# Copyright (C) 2008-2016 Lorenzo Caminiti # Distributed under the Boost Software License, Version 1.0 (see accompanying # file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). # See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html import build/boost_contract_no ; import testing ; import os ; import feature ; BOOST_ROOT = [ os.environ BOOST_ROOT ] ; if ! $(BOOST_ROOT) { exit "Error: set BOOST_ROOT environment variable to Boost root directory" ; } rule help_exit ( targets * : sources * : properties * ) { all_nos = "" ; sep = "" ; for local cond in [ boost_contract_no.conds ] { all_nos = "$(all_nos)$(sep)$(cond)" ; sep = "," ; } echo " Usage: bjam [OPTION]... DIR[-CPP_FILE_NAME] Build and run Boost.Contract tests and examples. Using Boost libraries from environment variable: $BOOST_ROOT = $(BOOST_ROOT) Options: boost_contract_link=shared, build Boost.Contract library as shared, static,header static, or header-only (shared by default) boost_contract_no=all_yes, contract checking off (all_yea by default) $(all_nos) Examples (on Linux-based bash): Build just \"test/public_function/body_throw.cpp\": [test]$ bjam public_function-body_throw Build all targets using MSVC, GCC, and CLang compilers: $ time bjam -q toolset=msvc,gcc,clang ; echo $? Build with all linkages on multiple compilers: $ time bjam -q toolset=msvc,gcc,clang boost_contract_link=static,header ; echo $? Build with all contract checking combinations on multiple compilers: $ time bjam -q toolset=msvc,gcc,clang boost_contract_no=$(all_nos) ; echo $? " ; exit ; } project : requirements gcc:-std=c++11 clang:-std=c++11 "./include" $(BOOST_ROOT) $(BOOST_ROOT)/stage/lib gcc:/boost/system//boost_system clang:/boost/system//boost_system ; use-project boost : $(BOOST_ROOT) ; rule subdir-compile-fail ( subdir : cpp_fname : requirements * ) { compile-fail $(subdir)/$(cpp_fname).cpp : shared:../build//boost_contract static:../build//boost_contract $(subdir) $(requirements) : $(subdir)-$(cpp_fname) ; } rule subdir-run ( subdir : cpp_fname : requirements * ) { run $(subdir)/$(cpp_fname).cpp : : : shared:../build//boost_contract static:../build//boost_contract $(subdir) $(requirements) : $(subdir)-$(cpp_fname) ; } rule subdir-lib ( subdir : cpp_fname : requirements * ) { lib $(subdir)-$(cpp_fname) : $(subdir)/$(cpp_fname).cpp : shared:../build//boost_contract static:../build//boost_contract $(subdir) $(requirements) ; } feature.feature boost_contract_link : shared static header : composite propagated link-incompatible ; feature.compose shared : shared ; feature.compose static : static ; feature.compose header : BOOST_CONTRACT_HEADER_ONLY ; feature.feature boost_contract_no : all_yes [ boost_contract_no.conds ] : composite propagated link-incompatible ; for local cond in [ boost_contract_no.conds ] { feature.compose $(cond) : [ boost_contract_no.defs_$(cond) ] ; }