# (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears # in all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. # # Boost.Python build and test Jamfile # # To run all tests quietly: jam test # To run all tests with verbose output: jam -sPYTHON_TEST_ARGS=-v test # # Declares the following targets: # 1. libboost_python.dll/.so, a dynamic library to be linked with all # Boost.Python modules # # 2. pairs of test targets of the form .test and .run # .test runs the test when it is out-of-date, and the "test" # pseudotarget depends on it. .run runs # a test unconditionally, and can be used to force a test to run.. Each # test target builds one or more Boost.Python modules and runs a Python # script to test them. The test names are: # # from ../test # # comprehensive - a comprehensive test of Boost.Python features # # from ../example: # abstract - # getting_started1 - # getting_started2 - # simple_vector - # do_it_yourself_convts - # pickle1 - # pickle2 - # pickle3 - # # dvect1 - # dvect2 - # ivect1 - # ivect2 - # noncopyable - # # subproject-specific environment/command-line variables: # # PYTHON - How to invoke the Python interpreter. Defaults to "python" # # PYTHON_ROOT - Windows only: where Python is installed. Defaults to "c:/tools/python" # # PYTHON_VERSION - Version of Python. Defaults to "2.1" on Windows, "1.5" on Unix # # PYTHON_TEST_ARGS - specifies arguments to be passed to test scripts on # the command line. "-v" can be useful if you want to # see the output of successful tests. # # PYTHON_VECT_ITERATIONS - specifies the number of test iterations to use for # the dvect and ivect tests above. # declare the location of this subproject relative to the root subproject libs/python/build ; # bring in the rules for python SEARCH on python.jam = $(BOOST_BUILD_PATH) ; include python.jam ; local PYTHON_PROPERTIES = $(PYTHON_PROPERTIES) BOOST_PYTHON_DYNAMIC_LIB ; ####################### rule bpl-test ( test-name : sources + ) { boost-python-test $(test-name) : $(sources) boost_python ; } ####################### # # Declare the boost python static link library # # Base names of the source files for libboost_python local CPP_SOURCES = types classes conversions extension_class functions init_function module_builder objects cross_module errors ; lib boost_python_static : ../src/$(CPP_SOURCES).cpp # requirements : $(BOOST_PYTHON_INCLUDES) true BOOST_PYTHON_STATIC_LIB=1 $(PYTHON_PROPERTIES) ; dll boost_python # $(SUFDLL[1]) : ../src/$(CPP_SOURCES).cpp # requirements : $(BOOST_PYTHON_INCLUDES) true dynamic BOOST_PYTHON_HAS_DLL_RUNTIME=1 $(PYTHON_PROPERTIES) ; ############# comprehensive module and test ########### bpl-test boost_python_test : ../test/comprehensive.cpp ; boost-python-runtest comprehensive : ../test/comprehensive.py boost_python_test boost_python ; ############# simple tests from ../example ############ rule boost-python-example-runtest ( name ) { bpl-test $(name) : ../example/$(name).cpp ; boost-python-runtest $(name) : ../example/test_$(name).py $(name) ; } boost-python-example-runtest abstract ; boost-python-example-runtest getting_started1 ; boost-python-example-runtest getting_started2 ; boost-python-example-runtest simple_vector ; boost-python-example-runtest do_it_yourself_convts ; boost-python-example-runtest pickle1 ; boost-python-example-runtest pickle2 ; boost-python-example-runtest pickle3 ; bpl-test ivect : ../example/ivect.cpp ; bpl-test dvect : ../example/dvect.cpp ; bpl-test noncopyable_export : ../example/noncopyable_export.cpp ; bpl-test noncopyable_import : ../example/noncopyable_import.cpp ; ############## cross-module tests from ../example ########## # A simple rule to build a test which depends on multiple modules in the PYTHONPATH rule boost-python-multi-example-runtest ( test-name : modules + ) { boost-python-runtest $(test-name) : ../example/tst_$(test-name).py $(modules) boost_python : : : $(PYTHON_VECT_ITERATIONS) ; } PYTHON_VECT_ITERATIONS ?= 10 ; boost-python-multi-example-runtest dvect1 : ivect dvect ; boost-python-multi-example-runtest dvect2 : ivect dvect ; boost-python-multi-example-runtest ivect1 : ivect dvect ; boost-python-multi-example-runtest ivect2 : ivect dvect ; boost-python-multi-example-runtest noncopyable : noncopyable_import noncopyable_export ;