• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2#          Copyright Andrey Semashev 2007 - 2015.
3# Distributed under the Boost Software License, Version 1.0.
4#    (See accompanying file LICENSE_1_0.txt or copy at
5#          http://www.boost.org/LICENSE_1_0.txt)
6#
7# The file was adapted from libs/tr2/test/Jamfile.v2 by John Maddock.
8
9import testing ;
10import path ;
11import regex ;
12import os ;
13import ../build/log-platform-config ;
14
15project
16    : requirements
17        <conditional>@log-platform-config.set-platform-defines
18
19        <include>common
20
21        # Disable warnings about using 'insecure' standard C functions
22        <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
23        <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
24        <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
25        <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
26        <toolset>intel-win:<define>_SCL_SECURE_NO_WARNINGS
27        <toolset>intel-win:<define>_SCL_SECURE_NO_DEPRECATE
28        <toolset>intel-win:<define>_CRT_SECURE_NO_WARNINGS
29        <toolset>intel-win:<define>_CRT_SECURE_NO_DEPRECATE
30
31        <toolset>msvc:<cxxflags>/bigobj
32        <toolset>msvc:<cxxflags>/wd4503 # decorated name length exceeded, name was truncated
33        <toolset>msvc:<cxxflags>/wd4456 # declaration of 'A' hides previous local declaration
34        <toolset>msvc:<cxxflags>/wd4459 # declaration of 'A' hides global declaration
35        <toolset>msvc:<cxxflags>/wd4003 # not enough actual parameters for macro 'X' - caused by BOOST_PP_IS_EMPTY and BOOST_PP_IS_BEGIN_PARENS which are used by Fusion
36        <toolset>msvc:<cxxflags>/wd4355 # 'this' : used in base member initializer list
37
38        # Disable Intel warnings:
39        # warning #177: function "X" was declared but never referenced
40        # warning #780: using-declaration ignored -- it refers to the current namespace
41        # warning #2196: routine is both "inline" and "noinline"
42        # remark #1782: #pragma once is obsolete. Use #ifndef guard instead.
43        # remark #193: zero used for undefined preprocessing identifier "X"
44        # remark #304: access control not specified ("public" by default)
45        # remark #981: operands are evaluated in unspecified order
46        # remark #1418: external function definition with no prior declaration
47        # Mostly comes from Boost.Phoenix: warning #411: class "X" defines no constructor to initialize the following: reference member "Y"...
48        # warning #734: "X" (declared at line N of "file.hpp"), required for copy that was eliminated, is inaccessible
49        # warning #279: controlling expression is constant
50        <toolset>intel-win:<cxxflags>"/Qwd177,780,2196,1782,193,304,981,1418,411,734,279"
51        <toolset>intel-linux:<cxxflags>"-wd177,780,2196,1782,193,304,981,1418,411,734,279"
52        <toolset>intel-darwin:<cxxflags>"-wd177,780,2196,1782,193,304,981,1418,411,734,279"
53
54        <toolset>darwin:<cxxflags>-ftemplate-depth-1024
55        <toolset>gcc:<cxxflags>-ftemplate-depth-1024
56
57        <toolset>gcc:<cxxflags>-fno-strict-aliasing  # avoids strict aliasing violations in other Boost components
58
59        # Boost.Interprocess does not compile on Cygwin: https://github.com/boostorg/interprocess/issues/76
60        <target-os>cygwin:<define>BOOST_LOG_WITHOUT_IPC
61
62        <library>/boost/log//boost_log
63        <library>/boost/log//boost_log_setup
64        <library>/boost/regex//boost_regex
65        <library>/boost/filesystem//boost_filesystem
66        <library>/boost/test//boost_unit_test_framework
67        <threading>single:<define>BOOST_LOG_NO_THREADS
68        <threading>multi:<library>/boost/thread//boost_thread
69    : default-build
70        # Testers typically don't specify threading environment and the library can be built and tested for single and multi. I'm more interested in multi though.
71        <threading>multi
72#        <link>static
73    ;
74
75# this rule enumerates through all the sources and invokes
76# the run rule for each source, the result is a list of all
77# the run rules, which we can pass on to the test_suite rule:
78rule test_all
79{
80    local all_rules ;
81    local file ;
82
83    if ! [ os.environ BOOST_LOG_TEST_WITHOUT_SELF_CONTAINED_HEADER_TESTS ]
84    {
85        local headers_path = [ path.make $(BOOST_ROOT)/libs/log/include/boost/log ] ;
86        for file in [ path.glob-tree $(headers_path) : *.hpp : detail ]
87        {
88            local rel_file = [ path.relative-to $(headers_path) $(file) ] ;
89            # Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end.
90            #       All '/' are replaced with '-' because apparently test scripts have a problem with test names containing slashes.
91            local test_name = [ regex.replace ~hdr/$(rel_file) "/" "-" ] ;
92            #ECHO $(rel_file) ;
93            all_rules += [ compile compile/self_contained_header.cpp : <define>"BOOST_LOG_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(test_name) ] ;
94        }
95    }
96
97    for file in [ glob compile/*.cpp ]
98    {
99        if [ path.basename $(file) ] != "self_contained_header.cpp"
100        {
101            all_rules += [ compile $(file) ] ;
102        }
103    }
104    for file in [ glob compile_fail/*.cpp ]
105    {
106        all_rules += [ compile-fail $(file) ] ;
107    }
108    for file in [ glob run/*.cpp ]
109    {
110        all_rules += [ run $(file) ] ;
111    }
112
113    if ! [ os.environ BOOST_LOG_TEST_WITHOUT_EXAMPLES ]
114    {
115        all_rules += [ build-project ../example ] ;
116    }
117
118    #ECHO All rules: $(all_rules) ;
119    return $(all_rules) ;
120}
121
122test-suite log : [ test_all ] ;
123