mirror of
https://github.com/boostorg/contract.git
synced 2026-01-24 17:52:41 +00:00
225 lines
7.3 KiB
Plaintext
225 lines
7.3 KiB
Plaintext
|
|
import testing ;
|
|
import os ;
|
|
import feature ;
|
|
|
|
if ! [ os.environ BOOST_ROOT ] {
|
|
exit "Error: set BOOST_ROOT environment variable to Boost root directory" ;
|
|
}
|
|
local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
|
|
echo "Using Boost libraries from \"$(BOOST_ROOT)\" (see $BOOST_ROOT)" ;
|
|
use-project boost : $(BOOST_ROOT) ;
|
|
|
|
project
|
|
:
|
|
requirements
|
|
<toolset>gcc:<cxxflags>-std=c++11
|
|
<toolset>clang:<cxxflags>-std=c++11
|
|
|
|
<include>"./include"
|
|
|
|
<include>$(BOOST_ROOT)
|
|
<library-path>$(BOOST_ROOT)/stage/lib
|
|
<toolset>gcc:<library>/boost/system//boost_system
|
|
<toolset>clang:<library>/boost/system//boost_system
|
|
;
|
|
|
|
rule subdir-usage ( ) {
|
|
echo "
|
|
Usage: [time] bjam [-aq] [OPTION]... DIR[-CPP_FILE_NAME] [--clean] [; echo $?]
|
|
Build and run Boost.Contract tests and examples.
|
|
|
|
Options:
|
|
toolset=msvc,gcc,clang use different compilers
|
|
boost_contract-link=shared,static, compile Boost.Contract lib as shared,
|
|
header static, or header-only
|
|
boost_contract-no=all_on,entryinv, selectively turn off contract checking
|
|
pre,exitinv,post,
|
|
entryinv_pre,entryinv_exitinv,entryinv_post,pre_exitinv,
|
|
pre_post,exitinv_post,pre_exitinv_post,
|
|
entryinv_exitinv_post,entryinv_pre_post,
|
|
entryinv_pre_exitinv,entryinv_pre_exitinv_post
|
|
" ;
|
|
}
|
|
|
|
rule subdir-compile-fail ( subdir : cpp_fname : requirements * ) {
|
|
compile-fail $(subdir)/$(cpp_fname).cpp
|
|
:
|
|
<link>shared:<library>../build//boost_contract
|
|
<link>static:<library>../build//boost_contract
|
|
<include>$(subdir)
|
|
$(requirements)
|
|
:
|
|
$(subdir)-$(cpp_fname)
|
|
;
|
|
}
|
|
|
|
rule subdir-run ( subdir : cpp_fname : requirements * ) {
|
|
run $(subdir)/$(cpp_fname).cpp : :
|
|
:
|
|
<link>shared:<library>../build//boost_contract
|
|
<link>static:<library>../build//boost_contract
|
|
<include>$(subdir)
|
|
$(requirements)
|
|
:
|
|
$(subdir)-$(cpp_fname)
|
|
;
|
|
}
|
|
|
|
rule subdir-run-with-no ( subdir : cpp_fname : requirements * ) {
|
|
# Aliases explicitly built or implicitly when building all tests...
|
|
alias $(subdir)-$(cpp_fname)-no_entryinv : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>entryinv ;
|
|
alias $(subdir)-$(cpp_fname)-no_pre : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>pre ;
|
|
alias $(subdir)-$(cpp_fname)-no_exitinv : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>exitinv ;
|
|
alias $(subdir)-$(cpp_fname)-no_post : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>post ;
|
|
alias $(subdir)-$(cpp_fname)-no_entryinv_pre : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>entryinv_pre ;
|
|
alias $(subdir)-$(cpp_fname)-no_entryinv_exitinv : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>entryinv_exitinv ;
|
|
alias $(subdir)-$(cpp_fname)-no_entryinv_post : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>entryinv_post ;
|
|
alias $(subdir)-$(cpp_fname)-no_pre_exitinv : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>pre_exitinv ;
|
|
alias $(subdir)-$(cpp_fname)-no_pre_post : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>pre_post ;
|
|
alias $(subdir)-$(cpp_fname)-no_exitinv_post : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>exitinv_post ;
|
|
alias $(subdir)-$(cpp_fname)-no_pre_exitinv_post : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>pre_exitinv_post ;
|
|
alias $(subdir)-$(cpp_fname)-no_entryinv_exitinv_post
|
|
:
|
|
$(subdir)-$(cpp_fname)
|
|
:
|
|
<boost_contract-no>entryinv_exitinv_post
|
|
;
|
|
alias $(subdir)-$(cpp_fname)-no_entry_pre_post : $(subdir)-$(cpp_fname) :
|
|
<boost_contract-no>entryinv_pre_post ;
|
|
alias $(subdir)-$(cpp_fname)-no_entryinv_pre_exitinv
|
|
:
|
|
$(subdir)-$(cpp_fname)
|
|
:
|
|
<boost_contract-no>entryinv_pre_exitinv
|
|
;
|
|
alias $(subdir)-$(cpp_fname)-no_entryinv_pre_exitinv_post
|
|
:
|
|
$(subdir)-$(cpp_fname)
|
|
:
|
|
<boost_contract-no>entryinv_pre_exitinv_post
|
|
;
|
|
# ...otherwise only this is built when building just subdir.
|
|
subdir-run $(subdir) : $(cpp_fname) : $(requirements) ;
|
|
}
|
|
|
|
rule subdir-lib ( subdir : cpp_fname : requirements * ) {
|
|
lib $(subdir)-$(cpp_fname) : $(subdir)/$(cpp_fname).cpp
|
|
:
|
|
<link>shared:<library>../build//boost_contract
|
|
<link>static:<library>../build//boost_contract
|
|
<include>$(subdir)
|
|
$(requirements)
|
|
;
|
|
}
|
|
|
|
feature.feature boost_contract-link : shared static header :
|
|
composite propagated link-incompatible ;
|
|
feature.compose <boost_contract-link>shared : <link>shared ;
|
|
feature.compose <boost_contract-link>static : <link>static ;
|
|
feature.compose <boost_contract-link>header :
|
|
<define>BOOST_CONTRACT_HEADER_ONLY ;
|
|
|
|
feature.feature boost_contract-no
|
|
:
|
|
all_on entryinv pre exitinv post entryinv_pre entryinv_exitinv
|
|
entryinv_post pre_exitinv pre_post exitinv_post pre_exitinv_post
|
|
entryinv_exitinv_post entryinv_pre_post entryinv_pre_exitinv
|
|
entryinv_pre_exitinv_post
|
|
:
|
|
composite propagated link-incompatible
|
|
;
|
|
# 1 contract off.
|
|
feature.compose <boost_contract-no>entryinv
|
|
:
|
|
<define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
|
;
|
|
feature.compose <boost_contract-no>pre
|
|
:
|
|
<define>BOOST_CONTRACT_NO_PRECONDITIONS
|
|
;
|
|
feature.compose <boost_contract-no>exitinv
|
|
:
|
|
<define>BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
|
;
|
|
feature.compose <boost_contract-no>post
|
|
:
|
|
<define>BOOST_CONTRACT_NO_POSTCONDITIONS
|
|
;
|
|
# 2 contracts off.
|
|
feature.compose <boost_contract-no>entryinv_pre
|
|
:
|
|
<define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_PRECONDITIONS
|
|
;
|
|
feature.compose <boost_contract-no>entryinv_exitinv
|
|
:
|
|
<define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
|
;
|
|
feature.compose <boost_contract-no>entryinv_post
|
|
:
|
|
<define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_POSTCONDITIONS
|
|
;
|
|
feature.compose <boost_contract-no>pre_exitinv
|
|
:
|
|
<define>BOOST_CONTRACT_NO_PRECONDITIONS
|
|
<define>BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
|
;
|
|
feature.compose <boost_contract-no>pre_post
|
|
:
|
|
<define>BOOST_CONTRACT_NO_PRECONDITIONS
|
|
<define>BOOST_CONTRACT_NO_POSTCONDITIONS
|
|
;
|
|
feature.compose <boost_contract-no>exitinv_post
|
|
:
|
|
<define>BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_POSTCONDITIONS
|
|
;
|
|
# 3 contracts off.
|
|
feature.compose <boost_contract-no>pre_exitinv_post
|
|
:
|
|
<define>BOOST_CONTRACT_NO_PRECONDITIONS
|
|
<define>BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_POSTCONDITIONS
|
|
;
|
|
feature.compose <boost_contract-no>entryinv_exitinv_post
|
|
:
|
|
<define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_POSTCONDITIONS
|
|
;
|
|
feature.compose <boost_contract-no>entryinv_pre_post
|
|
:
|
|
<define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_PRECONDITIONS
|
|
<define>BOOST_CONTRACT_NO_POSTCONDITIONS
|
|
;
|
|
feature.compose <boost_contract-no>entryinv_pre_exitinv
|
|
:
|
|
<define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_PRECONDITIONS
|
|
<define>BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
|
;
|
|
# All 4 contracts oof.
|
|
feature.compose <boost_contract-no>entryinv_pre_exitinv_post
|
|
:
|
|
<define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_PRECONDITIONS
|
|
<define>BOOST_CONTRACT_NO_EXIT_INVARIANTS
|
|
<define>BOOST_CONTRACT_NO_POSTCONDITIONS
|
|
;
|
|
|