@@ -17,6 +17,60 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
17
17
ADD_CUSTOM_BUILTIN_RESOURCES (boostBuiltinResourceData BOOST_RESOURCES_TO_EMBED "${_BOOST_PREPROCESSOR_BR_BUNDLE_SEARCH_DIRECTORY_} " "boost" "boost::builtin" "${_BOOST_PREPROCESSOR_BR_OUTPUT_DIRECTORY_HEADER_} " "${_BOOST_PREPROCESSOR_BR_OUTPUT_DIRECTORY_HEADER_} " "STATIC" "INTERNAL" )
18
18
endif ()
19
19
20
- set (BOOST_INCLUDE_LIBRARIES wave )
20
+ get_filename_component (NBL_BOOST_WAVE_DEP_FILE "${CMAKE_CURRENT_SOURCE_DIR} /dep/wave.cmake" ABSOLUTE )
21
+
22
+ if (NOT EXISTS "${NBL_BOOST_WAVE_DEP_FILE} " )
23
+ message (FATAL_ERROR "Internal error, generate NBL_BOOST_WAVE_DEP_FILE by enabling NBL_BOOST_GENERATE_DEP_LIST!" )
24
+ endif ()
25
+
21
26
set (BOOST_STAGEDIR "${CMAKE_CURRENT_BINARY_DIR} /boost/superproject/stage" )
22
- add_subdirectory (superproject superproject EXCLUDE_FROM_ALL )
27
+ include ("${NBL_BOOST_WAVE_DEP_FILE} " )
28
+
29
+ foreach (BOOST_LIB IN LISTS NBL_BOOST_LIBS )
30
+ add_subdirectory (superproject/libs/${BOOST_LIB} EXCLUDE_FROM_ALL )
31
+ endforeach ()
32
+
33
+ add_subdirectory (superproject/libs/wave EXCLUDE_FROM_ALL )
34
+
35
+ # Boost uses it's own tool for generating dependency list for targets, therefore we
36
+ # can make sure manually added dependnecy subdirectories for a library are valid
37
+ # https://www.boost.org/doc/libs/1_83_0/tools/boostdep/doc/html/index.html#boostdep.introduction.building_boostdep
38
+
39
+ if (NBL_BOOST_GENERATE_DEP_LIST ) # internal, for Nabla devs
40
+ if (WIN32 )
41
+ set (NBL_BOOSTDEP_EXE "boostdep.exe" )
42
+ else ()
43
+ set (NBL_BOOSTDEP_EXE "boostdep" )
44
+ endif ()
45
+
46
+ set (NBL_BOOSTDEP_EXE_FILEPATH "${CMAKE_CURRENT_BINARY_DIR} /superproject/tools/boostdep/bin/${NBL_BOOSTDEP_EXE} " )
47
+
48
+ if (NOT EXISTS "${NBL_BOOSTDEP_EXE_FILEPATH} " )
49
+ macro (NBL_BOOST_EXECUTE )
50
+ execute_process (COMMAND ${ARGV}
51
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /superproject"
52
+ )
53
+ endmacro ()
54
+
55
+ NBL_BOOST_EXECUTE (cmd /C bootstrap.bat )
56
+ NBL_BOOST_EXECUTE (cmd /C b2.exe tools/boostdep/build )
57
+ NBL_BOOST_EXECUTE ("${CMAKE_COMMAND} " -E copy "./dist/bin/${NBL_BOOSTDEP_EXE} " "${NBL_BOOSTDEP_EXE_FILEPATH} " )
58
+ NBL_BOOST_EXECUTE (git clean -fdx )
59
+ NBL_BOOST_EXECUTE (git reset --hard )
60
+ endif ()
61
+
62
+ execute_process (COMMAND "${NBL_BOOSTDEP_EXE_FILEPATH} " --boost-root "${CMAKE_CURRENT_SOURCE_DIR} /superproject" --brief wave
63
+ OUTPUT_VARIABLE NBL_OUTPUT_VAR
64
+ )
65
+
66
+ file (WRITE "${NBL_BOOST_WAVE_DEP_FILE} " "${NBL_OUTPUT_VAR} " )
67
+
68
+ file (STRINGS "${NBL_BOOST_WAVE_DEP_FILE} " NBL_BOOST_LIBS )
69
+ set (NBL_BOOST_LIBS ${NBL_BOOST_LIBS} )
70
+ list (POP_FRONT NBL_BOOST_LIBS )
71
+ list (FILTER NBL_BOOST_LIBS EXCLUDE REGEX "#" )
72
+ list (FILTER NBL_BOOST_LIBS EXCLUDE REGEX "(unknown)" )
73
+ string (REPLACE "~" "/" NBL_BOOST_LIBS "${NBL_BOOST_LIBS} " )
74
+
75
+ file (WRITE "${NBL_BOOST_WAVE_DEP_FILE} " "set(NBL_BOOST_LIBS ${NBL_BOOST_LIBS} )" )
76
+ endif ()
0 commit comments