mirror of
https://github.com/boostorg/contract.git
synced 2026-01-24 17:52:41 +00:00
111 lines
3.6 KiB
Plaintext
111 lines
3.6 KiB
Plaintext
|
|
# Copyright (C) 2008-2017 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
|
|
<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
|
|
;
|
|
use-project boost : $(BOOST_ROOT) ;
|
|
|
|
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-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
|
|
<define>BOOST_CONTRACT_STATIC_LINK
|
|
;
|
|
feature.compose <boost_contract_link>header :
|
|
<define>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 <boost_contract_no>$(cond) :
|
|
[ boost_contract_no.defs_$(cond) ] ;
|
|
}
|
|
|