@@ -130,7 +130,14 @@ if (runtime_cxxmodules)
130
130
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0.15000309)
131
131
set (custom_modulemaps ${custom_modulemaps} std_darwin.MacOSX14.2.sdk.modulemap)
132
132
else ()
133
- set (custom_modulemaps ${custom_modulemaps} std_darwin.modulemap)
133
+ set (GENERATED_MODULEMAP ${CMAKE_BINARY_DIR} /std_darwin.modulemap)
134
+
135
+ add_custom_command (
136
+ OUTPUT ${GENERATED_MODULEMAP}
137
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR} /cmake/scripts/std_modulemap_darwin_fix.py ${GENERATED_MODULEMAP}
138
+ DEPENDS ${CMAKE_SOURCE_DIR} /cmake/scripts/std_modulemap_darwin_fix.py
139
+ COMMENT "Generating wrapped std modulemap for macOS SDK"
140
+ )
134
141
endif ()
135
142
endif ()
136
143
@@ -151,6 +158,12 @@ if (runtime_cxxmodules)
151
158
endif ()
152
159
endif (runtime_cxxmodules)
153
160
161
+ if (GENERATED_MODULEMAP)
162
+ list (APPEND copy_commands COMMAND ${CMAKE_COMMAND} -E copy ${GENERATED_MODULEMAP} ${CMAKE_BINARY_DIR} /etc/cling/std_darwin.modulemap)
163
+ list (APPEND files_to_copy ${GENERATED_MODULEMAP} )
164
+ install (FILES ${CMAKE_BINARY_DIR} /etc/cling/std_darwin.modulemap DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} /cling)
165
+ endif ()
166
+
154
167
foreach (file ${custom_modulemaps}
155
168
Interpreter/DynamicExprInfo.h
156
169
Interpreter/DynamicLookupRuntimeUniverse.h
@@ -204,6 +217,10 @@ else()
204
217
COMMENT "Copying LLVM resource and header files" )
205
218
endif ()
206
219
add_custom_target (LLVMRES DEPENDS ${stamp_file} CLING)
220
+ if (GENERATED_MODULEMAP)
221
+ add_custom_target (generate_std_modulemap DEPENDS ${GENERATED_MODULEMAP} )
222
+ add_dependencies (LLVMRES generate_std_modulemap)
223
+ endif ()
207
224
# CLING is a shorthand for CLING_LIBRARIES and some other clang-specific
208
225
# dependencies which ensure the correct order of building. Then the cling header
209
226
# files (such as RuntimeUniverse.h) are moved to a semi-private place in ROOT
0 commit comments