File tree Expand file tree Collapse file tree 6 files changed +109
-28
lines changed Expand file tree Collapse file tree 6 files changed +109
-28
lines changed Original file line number Diff line number Diff line change @@ -7,16 +7,22 @@ cmake_minimum_required(VERSION 3.5...3.16)
7
7
8
8
project (boost_ci VERSION "${BOOST_SUPERPROJECT_VERSION} " LANGUAGES CXX)
9
9
10
- add_library (boost_boost_ci INTERFACE )
10
+ add_library (boost_boost_ci src/boost_ci.cpp )
11
11
add_library (Boost::boost_ci ALIAS boost_boost_ci)
12
12
13
- target_include_directories (boost_boost_ci INTERFACE include )
13
+ target_include_directories (boost_boost_ci PUBLIC include )
14
14
15
15
target_link_libraries (boost_boost_ci
16
- INTERFACE
16
+ PUBLIC
17
17
Boost::config
18
+ PRIVATE
19
+ Boost::atomic
18
20
)
19
21
22
+ if (BUILD_SHARED_LIBS )
23
+ target_compile_definitions (boost_boost_ci PUBLIC BOOST_BOOST_CI_DYN_LINK)
24
+ endif ()
25
+
20
26
if (BUILD_TESTING)
21
27
add_subdirectory (test )
22
28
endif ()
Original file line number Diff line number Diff line change
1
+ # Boost CI Test Build Jamfile
2
+
3
+ # Copyright (c) 2022 Alexander Grund
4
+ #
5
+ # Distributed under the Boost Software License, Version 1.0.
6
+ # (See accompanying file LICENSE or www.boost.org/LICENSE_1_0.txt)
7
+
8
+ import configure ;
9
+
10
+ local requirements =
11
+ <link>shared:<define>BOOST_BOOST_CI_DYN_LINK=1
12
+ <library>/boost/atomic//boost_atomic
13
+ ;
14
+
15
+ project boost/ci
16
+ : source-location ../src
17
+ : requirements $(requirements)
18
+ : usage-requirements $(requirements)
19
+ ;
20
+
21
+ lib boost_ci
22
+ : boost_ci.cpp
23
+ ;
24
+
25
+ boost-install boost_ci ;
Original file line number Diff line number Diff line change 11
11
#include < memory>
12
12
#endif
13
13
14
+ // This define is usually set in boost/<libname>/config.hpp
15
+ #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_BOOST_CI_DYN_LINK)
16
+ #ifdef BOOST_BOOST_CI_SOURCE
17
+ #define BOOST_BOOST_CI_DECL BOOST_SYMBOL_EXPORT
18
+ #else
19
+ #define BOOST_BOOST_CI_DECL BOOST_SYMBOL_IMPORT
20
+ #endif
21
+ #else
22
+ #define BOOST_BOOST_CI_DECL
23
+ #endif
24
+
14
25
namespace boost
15
26
{
16
27
namespace boost_ci
@@ -21,25 +32,7 @@ namespace boost
21
32
#define MSVC_VALUE false
22
33
#endif
23
34
24
- // Some function to test
25
- BOOST_NOINLINE int get_answer (const bool isMsvc = MSVC_VALUE)
26
- {
27
- int answer;
28
- // Specifically crafted condition to check for coverage from MSVC and non MSVC builds
29
- if (isMsvc)
30
- {
31
- answer = 21 ;
32
- } else
33
- {
34
- answer = 42 ;
35
- }
36
- #ifdef BOOST_NO_CXX11_SMART_PTR
37
- return answer;
38
- #else
39
- // Just use some stdlib feature combined with a Boost.Config feature as demonstration
40
- auto ptr = std::unique_ptr<int >(new int (answer));
41
- return *ptr;
42
- #endif
43
- }
35
+ // Some function to test. Returns 41 for true, 42 otherwise
36
+ BOOST_BOOST_CI_DECL int get_answer (bool isMsvc = MSVC_VALUE);
44
37
}
45
38
}
Original file line number Diff line number Diff line change
1
+ //
2
+ // Copyright (c) 2022 Alexander Grund
3
+ //
4
+ // Use, modification and distribution is subject to the Boost Software License,
5
+ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6
+ // http://www.boost.org/LICENSE_1_0.txt)
7
+
8
+ #define BOOST_BOOST_CI_SOURCE
9
+
10
+ #include < boost/boost-ci/boost_ci.hpp>
11
+ // Just some dependency on another Boost library
12
+ #include < boost/atomic/atomic.hpp>
13
+
14
+ namespace boost
15
+ {
16
+ namespace boost_ci
17
+ {
18
+ // Some function to test
19
+ int get_answer (const bool isMsvc)
20
+ {
21
+ boost::atomic_int answer;
22
+ // Specifically crafted condition to check for coverage from MSVC and non MSVC builds
23
+ if (isMsvc)
24
+ {
25
+ answer = 21 ;
26
+ } else
27
+ {
28
+ answer = 42 ;
29
+ }
30
+ #ifdef BOOST_NO_CXX11_SMART_PTR
31
+ return answer;
32
+ #else
33
+ // Just use some stdlib feature combined with a Boost.Config feature as demonstration
34
+ auto ptr = std::unique_ptr<int >(new int (answer));
35
+ return *ptr;
36
+ #endif
37
+ }
38
+ }
39
+ }
Original file line number Diff line number Diff line change 8
8
import os ;
9
9
import testing ;
10
10
11
- project boost/ci/test
12
- : requirements
13
- <include>.
11
+ project : requirements
12
+ <library>/boost/ci//boost_ci
14
13
;
15
14
16
15
local B2_ADDRESS_MODEL = [ os.environ B2_ADDRESS_MODEL ] ;
Original file line number Diff line number Diff line change @@ -11,8 +11,27 @@ project(cmake_subdir_test LANGUAGES CXX)
11
11
if (BOOST_CI_INSTALL_TEST)
12
12
find_package (boost_boost_ci REQUIRED)
13
13
else ()
14
- add_subdirectory (../.. boostorg/ci)
15
- add_subdirectory (../../../config boostorg/config)
14
+ add_subdirectory (../.. boostorg/boost-ci)
15
+
16
+ set (deps
17
+ # Primary dependencies
18
+ atomic
19
+ config
20
+ core
21
+ # Secondary dependencies
22
+ align
23
+ assert
24
+ predef
25
+ preprocessor
26
+ static_assert
27
+ throw_exception
28
+ type_traits
29
+ winapi
30
+ )
31
+
32
+ foreach (dep IN LISTS deps)
33
+ add_subdirectory (../../../${dep} boostorg/${dep} )
34
+ endforeach ()
16
35
endif ()
17
36
18
37
add_executable (main main.cpp)
You can’t perform that action at this time.
0 commit comments