Skip to content

Commit 959664b

Browse files
compnerdktopley-apple
authored andcommitted
build: fix symlink creation
This adjusts the symlink creation so that it always occurs. This also allows us to ensure that we wire up the dependency for the swift module to the symlink creation. The CMake based build would fail without this when trying to build dispatch for SourceKit on Linux. Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
1 parent 8b6b4d5 commit 959664b

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

CMakeLists.txt

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,19 @@ if(leaks_EXECUTABLE)
201201
endif()
202202

203203
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
204-
add_custom_command(OUTPUT
205-
"${CMAKE_SOURCE_DIR}/dispatch/module.modulemap"
206-
"${CMAKE_SOURCE_DIR}/private/module.modulemap"
207-
COMMAND
208-
${CMAKE_COMMAND} -E create_symlink "${CMAKE_SOURCE_DIR}/darwin/module.modulemap" "${CMAKE_SOURCE_DIR}/dispatch/module.modulemap"
209-
COMMAND
210-
${CMAKE_COMMAND} -E create_symlink "${CMAKE_SOURCE_DIR}/darwin/module.modulemap" "${CMAKE_SOURCE_DIR}/private/module.modulemap")
204+
add_custom_target(module-map-symlinks
205+
ALL
206+
COMMAND
207+
${CMAKE_COMMAND} -E create_symlink "${CMAKE_SOURCE_DIR}/dispatch/darwin/module.modulemap" "${CMAKE_SOURCE_DIR}/dispatch/module.modulemap"
208+
COMMAND
209+
${CMAKE_COMMAND} -E create_symlink "${CMAKE_SOURCE_DIR}/private/darwin/module.modulemap" "${CMAKE_SOURCE_DIR}/private/module.modulemap")
211210
else()
212-
add_custom_command(OUTPUT
213-
"${CMAKE_SOURCE_DIR}/dispatch/module.modulemap"
214-
"${CMAKE_SOURCE_DIR}/private/module.modulemap"
215-
COMMAND
216-
${CMAKE_COMMAND} -E create_symlink "${CMAKE_SOURCE_DIR}/generic/module.modulemap" "${CMAKE_SOURCE_DIR}/dispatch/module.modulemap"
217-
COMMAND
218-
${CMAKE_COMMAND} -E create_symlink "${CMAKE_SOURCE_DIR}/generic/module.modulemap" "${CMAKE_SOURCE_DIR}/private/module.modulemap")
211+
add_custom_target(module-map-symlinks
212+
ALL
213+
COMMAND
214+
${CMAKE_COMMAND} -E create_symlink "${CMAKE_SOURCE_DIR}/dispatch/generic/module.modulemap" "${CMAKE_SOURCE_DIR}/dispatch/module.modulemap"
215+
COMMAND
216+
${CMAKE_COMMAND} -E create_symlink "${CMAKE_SOURCE_DIR}/private/generic/module.modulemap" "${CMAKE_SOURCE_DIR}/private/module.modulemap")
219217
endif()
220218
configure_file("${CMAKE_SOURCE_DIR}/cmake/config.h.in"
221219
"${CMAKE_BINARY_DIR}/config/config_ac.h")

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ if(CMAKE_SWIFT_COMPILER)
9999
SWIFT_FLAGS
100100
-I ${CMAKE_SOURCE_DIR}
101101
${swift_optimization_flags})
102+
add_dependencies(swiftDispatch
103+
module-map-symlinks)
102104
target_sources(dispatch
103105
PRIVATE
104106
swift/DispatchStubs.cc

0 commit comments

Comments
 (0)