Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2015-02-24 23:38:44 +0300
committerKenneth Heafield <github@kheafield.com>2015-02-24 23:38:44 +0300
commit2ee2f288122d9a927e66d7f0d4343c05f9e40d92 (patch)
tree2999d2527dbfaf86d072d988894e22c6277ffd8e /jam-files/sanity.jam
parent04d4f311dc65c20c074e774842e8a74982b7f857 (diff)
Another attempt at fixing linkage/macro definition
Diffstat (limited to 'jam-files/sanity.jam')
-rw-r--r--jam-files/sanity.jam37
1 files changed, 21 insertions, 16 deletions
diff --git a/jam-files/sanity.jam b/jam-files/sanity.jam
index 5bc790462..1133a6f3a 100644
--- a/jam-files/sanity.jam
+++ b/jam-files/sanity.jam
@@ -84,6 +84,7 @@ while $(argv) {
#Determine if a library can be compiled statically.
rule auto-shared ( name : additional * ) {
+
additional ?= "" ;
if $(shared-command-line) = "<link>shared" {
return "<link>shared" ;
@@ -131,21 +132,13 @@ if $(with-macports) {
#Convenience rule for boost libraries. Defines library boost_$(name).
rule boost-lib ( name macro : deps * ) {
- flags = $(L-boost-search)" -lboost_"$(name)"$(boost-lib-version)" ;
- local main ;
- if $(name) = "unit_test_framework" {
- main = "BOOST_AUTO_TEST_CASE(foo) {}" ;
- flags += " -DBOOST_TEST_MODULE=CompileTest $(I-boost-include) -include boost/test/unit_test.hpp" ;
- }
- local default-linkage ;
- if [ test_flags " -Wl,-Bstatic $(flags) -Wl,-Bdynamic " : $(main) ] {
- default-linkage = "<link>static" ;
- } else {
- default-linkage = "<link>shared" ;
- requirements += <define>BOOST_$(macro) ;
- }
- lib boost_$(name) : $(deps) : <link>static $(boost-search) <name>boost_$(name)$(boost-lib-version) : $(default-linkage) ;
- lib boost_$(name) : $(deps) : <link>shared $(boost-search) <name>boost_$(name)$(boost-lib-version) <define>BOOST_$(macro) : $(default-linkage) : <define>BOOST_$(macro) ;
+ lib boost_$(name)_static : $(deps) : $(boost-search) <name>boost_$(name)$(boost-lib-version) <link>static ;
+ lib boost_$(name)_shared : $(deps) : $(boost-search) <name>boost_$(name)$(boost-lib-version) <link>shared : : <define>BOOST_$(macro) ;
+
+ alias boost_$(name)_default : $(deps) : <link>static:<source>boost_$(name)_static <link>shared:<source>boost_$(name)_shared ;
+
+ alias boost_$(name)_static_works : $(deps) : [ check-target-builds empty_test_shared "Shared Boost" : <source>boost_$(name)_default : <source>boost_$(name)_static ] ;
+ alias boost_$(name) : $(deps) : [ check-target-builds empty_test_static "Static Boost" : <source>boost_$(name)_static_works : <source>boost_$(name)_shared ] ;
}
#Argument is e.g. 103600
@@ -168,13 +161,25 @@ rule boost ( min-version ) {
boost-lib-version = "" ;
}
+ #Crazy amount of testing to make sure that BOOST_TEST_DYN_LINK is defined properly.
+ lib boost_unit_test_framework_static_test : : $(boost-search) <name>boost_unit_test_framework$(boost-lib-version) <link>static ;
+ obj empty_test_static.o : jam-files/empty_test_main.cc boost_unit_test_framework_static_test ;
+ exe empty_test_static : empty_test_static.o boost_unit_test_framework_static_test ;
+
+ lib boost_unit_test_framework_shared_test : : $(boost-search) <name>boost_unit_test_framework$(boost-lib-version) <link>shared : : <define>BOOST_TEST_DYN_LINK ;
+ obj empty_test_shared.o : jam-files/empty_test_main.cc boost_unit_test_framework_shared_test ;
+ exe empty_test_shared : empty_test_shared.o boost_unit_test_framework_shared_test ;
+
+ explicit empty_test_static.o empty_test_static empty_test_shared.o empty_test_shared ;
+
+
#See tools/build/v2/contrib/boost.jam in a boost distribution for a table of macros to define.
boost-lib system SYSTEM_DYN_LINK ;
boost-lib thread THREAD_DYN_DLL : boost_system ;
boost-lib program_options PROGRAM_OPTIONS_DYN_LINK ;
- boost-lib unit_test_framework TEST_DYN_LINK ;
boost-lib iostreams IOSTREAMS_DYN_LINK ;
boost-lib filesystem FILE_SYSTEM_DYN_LINK ;
+ boost-lib unit_test_framework TEST_DYN_LINK ;
# if $(BOOST-VERSION) >= 104800 {
# boost-lib chrono CHRONO_DYN_LINK ;
# boost-lib timer TIMER_DYN_LINK : boost_chrono ;