@@ -44,7 +44,7 @@ set(NBL_BOOST_TARGETS
44
44
PARENT_SCOPE )
45
45
46
46
# Boost uses it's own tool for generating dependency list for targets, therefore we
47
- # can make sure manually added dependnecy subdirectories for a library are valid
47
+ # can make sure manually added dependency subdirectories for a library are valid
48
48
# https://www.boost.org/doc/libs/1_83_0/tools/boostdep/doc/html/index.html#boostdep.introduction.building_boostdep
49
49
50
50
if (NBL_BOOST_GENERATE_DEP_LIST ) # internal, for Nabla devs
@@ -83,5 +83,29 @@ if(NBL_BOOST_GENERATE_DEP_LIST) # internal, for Nabla devs
83
83
list (FILTER NBL_BOOST_LIBS EXCLUDE REGEX "(unknown)" )
84
84
string (REPLACE "~" "/" NBL_BOOST_LIBS "${NBL_BOOST_LIBS} " )
85
85
86
+ # we override boost's .gitmodules to pick only those modules we really use (reported by boost's dep executable)
87
+ # boost hosts now like 200 repositories, some of them are really big however atm we reference around 60
88
+ set (BOOST_SUBMODULE_TEMPLATE
89
+ [=[
90
+
91
+ [submodule "@NAME@"]
92
+ path = libs/@NAME@
93
+
94
+ fetchRecurseSubmodules = on-demand
95
+ branch = .
96
+ ]=]
97
+ )
98
+
99
+ unset (BOOST_GITMODULES )
100
+ foreach (NAME ${NBL_BOOST_LIBS} )
101
+ string (REPLACE "/" "_" FLATTEN_NAME "${NAME} " )
102
+ string (CONFIGURE "${BOOST_SUBMODULE_TEMPLATE} " TEMPLATE )
103
+ string (APPEND BOOST_GITMODULES "${TEMPLATE} " )
104
+ endforeach ()
105
+
106
+ # NOTE: this you commit to version control
86
107
file (WRITE "${NBL_BOOST_WAVE_DEP_FILE} " "set(NBL_BOOST_LIBS ${NBL_BOOST_LIBS} )" )
108
+
109
+ # and this one too + you update boost submodule pointer with the update!
110
+ file (WRITE "${CMAKE_CURRENT_SOURCE_DIR} /superproject/.gitmodules" "${BOOST_GITMODULES} " )
87
111
endif ()
0 commit comments