Skip to content

Commit 5170ec1

Browse files
committed
Merge bitcoin/bitcoin#32665: depends: Bump boost to 1.88.0 and use new CMake buildsystem
6c2538d depends: Bump boost to 1.88.0 and use new CMake buildsystem (Cory Fields) Pull request description: Originally #30434. This has a few advantages over the old method of simply copying headers: - Installs proper CMake files which can be picked up by our buildsystem - Only installs necessary headers, not all of Boost Pulls in upstreamed boostorg/test#445. ACKs for top commit: willcl-ark: tACK 6c2538d hebasto: re-ACK 6c2538d, only rebased since my previous [review](bitcoin/bitcoin#32665 (review)). Tree-SHA512: fc3fce77b21c8ea500370841f44f1cc87e0bb09cdde55f75d2f90853cb06a6f8c73ac6ca9ca3e91a879e9f95dd59aa40254c1b04e7a168c52fa1b31cc5b7f537
2 parents 8fafb81 + 6c2538d commit 5170ec1

File tree

2 files changed

+161
-6
lines changed

2 files changed

+161
-6
lines changed

depends/packages/boost.mk

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
package=boost
2-
$(package)_version=1.81.0
3-
$(package)_download_path=https://archives.boost.io/release/$($(package)_version)/source/
4-
$(package)_file_name=boost_$(subst .,_,$($(package)_version)).tar.gz
5-
$(package)_sha256_hash=205666dea9f6a7cfed87c7a6dfbeb52a2c1b9de55712c9c1a87735d7181452b6
2+
$(package)_version = 1.88.0
3+
$(package)_download_path = https://github.com/boostorg/boost/releases/download/boost-$($(package)_version)
4+
$(package)_file_name = boost-$($(package)_version)-cmake.tar.gz
5+
$(package)_sha256_hash = dcea50f40ba1ecfc448fdf886c0165cf3e525fef2c9e3e080b9804e8117b9694
6+
$(package)_patches = skip_compiled_targets.patch
7+
$(package)_build_subdir = build
8+
9+
define $(package)_set_vars
10+
$(package)_config_opts = -DBOOST_INCLUDE_LIBRARIES="multi_index;signals2;test"
11+
$(package)_config_opts += -DBOOST_TEST_HEADERS_ONLY=ON
12+
$(package)_config_opts += -DBOOST_ENABLE_MPI=OFF
13+
$(package)_config_opts += -DBOOST_ENABLE_PYTHON=OFF
14+
$(package)_config_opts += -DBOOST_INSTALL_LAYOUT=system
15+
$(package)_config_opts += -DBUILD_TESTING=OFF
16+
$(package)_config_opts += -DCMAKE_DISABLE_FIND_PACKAGE_ICU=ON
17+
endef
18+
19+
define $(package)_preprocess_cmds
20+
patch -p1 < $($(package)_patch_dir)/skip_compiled_targets.patch
21+
endef
22+
23+
define $(package)_config_cmds
24+
$($(package)_cmake) -S .. -B .
25+
endef
626

727
define $(package)_stage_cmds
8-
mkdir -p $($(package)_staging_prefix_dir)/include && \
9-
cp -r boost $($(package)_staging_prefix_dir)/include
28+
$(MAKE) DESTDIR=$($(package)_staging_dir) install
1029
endef
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
cmake: Add `BOOST_TEST_HEADERS_ONLY` configuration variable
2+
3+
This change allows the build to be configured to install only the
4+
Boost.Test headers required for using the headers-only variant of the
5+
Unit Test Framework.
6+
7+
Upstream commit: 097e97820e654ead9c477b47443a545cef5d3b12
8+
9+
10+
--- a/libs/test/CMakeLists.txt
11+
+++ b/libs/test/CMakeLists.txt
12+
@@ -30,60 +30,70 @@ set(_boost_test_dependencies
13+
Boost::utility
14+
)
15+
16+
-# Compiled targets
17+
+option(BOOST_TEST_HEADERS_ONLY "Boost.Test: Only install headers" OFF)
18+
19+
-function(boost_test_add_library name)
20+
+set(_boost_test_libraries "")
21+
22+
- add_library(boost_${name} ${ARGN})
23+
- add_library(Boost::${name} ALIAS boost_${name})
24+
+if (NOT BOOST_TEST_HEADERS_ONLY)
25+
26+
- target_include_directories(boost_${name} PUBLIC include)
27+
- target_link_libraries(boost_${name} PUBLIC ${_boost_test_dependencies})
28+
+ # Compiled targets
29+
30+
- target_compile_definitions(boost_${name}
31+
- PUBLIC BOOST_TEST_NO_LIB
32+
- # Source files already define BOOST_TEST_SOURCE
33+
- # PRIVATE BOOST_TEST_SOURCE
34+
- )
35+
+ function(boost_test_add_library name)
36+
37+
- if(BUILD_SHARED_LIBS)
38+
- target_compile_definitions(boost_${name} PUBLIC BOOST_TEST_DYN_LINK)
39+
- else()
40+
- target_compile_definitions(boost_${name} PUBLIC BOOST_TEST_STATIC_LINK)
41+
- endif()
42+
+ add_library(boost_${name} ${ARGN})
43+
+ add_library(Boost::${name} ALIAS boost_${name})
44+
45+
-endfunction()
46+
+ target_include_directories(boost_${name} PUBLIC include)
47+
+ target_link_libraries(boost_${name} PUBLIC ${_boost_test_dependencies})
48+
49+
-boost_test_add_library(prg_exec_monitor
50+
- src/cpp_main.cpp
51+
- src/debug.cpp
52+
- src/execution_monitor.cpp
53+
-)
54+
+ target_compile_definitions(boost_${name}
55+
+ PUBLIC BOOST_TEST_NO_LIB
56+
+ # Source files already define BOOST_TEST_SOURCE
57+
+ # PRIVATE BOOST_TEST_SOURCE
58+
+ )
59+
60+
-set(SOURCES
61+
- src/compiler_log_formatter.cpp
62+
- src/debug.cpp
63+
- src/decorator.cpp
64+
- src/execution_monitor.cpp
65+
- src/framework.cpp
66+
- src/junit_log_formatter.cpp
67+
- src/plain_report_formatter.cpp
68+
- src/progress_monitor.cpp
69+
- src/results_collector.cpp
70+
- src/results_reporter.cpp
71+
- src/test_framework_init_observer.cpp
72+
- src/test_tools.cpp
73+
- src/test_tree.cpp
74+
- src/unit_test_log.cpp
75+
- src/unit_test_main.cpp
76+
- src/unit_test_monitor.cpp
77+
- src/unit_test_parameters.cpp
78+
- src/xml_log_formatter.cpp
79+
- src/xml_report_formatter.cpp
80+
-)
81+
+ if(BUILD_SHARED_LIBS)
82+
+ target_compile_definitions(boost_${name} PUBLIC BOOST_TEST_DYN_LINK)
83+
+ else()
84+
+ target_compile_definitions(boost_${name} PUBLIC BOOST_TEST_STATIC_LINK)
85+
+ endif()
86+
+
87+
+ endfunction()
88+
89+
-boost_test_add_library(test_exec_monitor STATIC ${SOURCES} src/test_main.cpp)
90+
-boost_test_add_library(unit_test_framework ${SOURCES})
91+
+ boost_test_add_library(prg_exec_monitor
92+
+ src/cpp_main.cpp
93+
+ src/debug.cpp
94+
+ src/execution_monitor.cpp
95+
+ )
96+
+
97+
+ set(SOURCES
98+
+ src/compiler_log_formatter.cpp
99+
+ src/debug.cpp
100+
+ src/decorator.cpp
101+
+ src/execution_monitor.cpp
102+
+ src/framework.cpp
103+
+ src/junit_log_formatter.cpp
104+
+ src/plain_report_formatter.cpp
105+
+ src/progress_monitor.cpp
106+
+ src/results_collector.cpp
107+
+ src/results_reporter.cpp
108+
+ src/test_framework_init_observer.cpp
109+
+ src/test_tools.cpp
110+
+ src/test_tree.cpp
111+
+ src/unit_test_log.cpp
112+
+ src/unit_test_main.cpp
113+
+ src/unit_test_monitor.cpp
114+
+ src/unit_test_parameters.cpp
115+
+ src/xml_log_formatter.cpp
116+
+ src/xml_report_formatter.cpp
117+
+ )
118+
+
119+
+ boost_test_add_library(test_exec_monitor STATIC ${SOURCES} src/test_main.cpp)
120+
+ boost_test_add_library(unit_test_framework ${SOURCES})
121+
+
122+
+ set(_boost_test_libraries boost_prg_exec_monitor boost_test_exec_monitor boost_unit_test_framework)
123+
+
124+
+endif()
125+
126+
# Header-only targets
127+
128+
@@ -107,7 +117,7 @@ if(BOOST_SUPERPROJECT_VERSION AND NOT CMAKE_VERSION VERSION_LESS 3.13)
129+
130+
boost_install(
131+
TARGETS
132+
- boost_prg_exec_monitor boost_test_exec_monitor boost_unit_test_framework
133+
+ ${_boost_test_libraries}
134+
boost_included_prg_exec_monitor boost_included_test_exec_monitor boost_included_unit_test_framework
135+
VERSION ${BOOST_SUPERPROJECT_VERSION}
136+
HEADER_DIRECTORY include

0 commit comments

Comments
 (0)