Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Runtimes/Core/cmake/modules/EmitSwiftInterface.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ function(emit_swift_interface target)
if(NOT module_name)
set(module_name ${target})
endif()
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule")
# Account for an existing swiftmodule file
# generated with the previous logic
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule"
AND NOT IS_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule")
message(STATUS "Removing regular file ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule to support nested swiftmodule generation")
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule")
endif()
target_compile_options(${target} PRIVATE
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-module-path ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule/${SwiftCore_MODULE_TRIPLE}.swiftmodule>")
if(SwiftCore_VARIANT_MODULE_TRIPLE)
Expand Down
8 changes: 7 additions & 1 deletion Runtimes/Overlay/cmake/modules/EmitSwiftInterface.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ function(emit_swift_interface target)
if(NOT module_name)
set(module_name ${target})
endif()
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule")
# Account for an existing swiftmodule file
# generated with the previous logic
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule"
AND NOT IS_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule")
message(STATUS "Removing regular file ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule to support nested swiftmodule generation")
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule")
endif()
target_compile_options(${target} PRIVATE
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-module-path ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule/${SwiftOverlay_MODULE_TRIPLE}.swiftmodule>")
if(SwiftOverlay_VARIANT_MODULE_TRIPLE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ function(emit_swift_interface target)
if(NOT module_name)
set(module_name ${target})
endif()
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule")
# Account for an existing swiftmodule file
# generated with the previous logic
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule"
AND NOT IS_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule")
message(STATUS "Removing regular file ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule to support nested swiftmodule generation")
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule")
endif()
target_compile_options(${target} PRIVATE
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-module-path ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule/${${PROJECT_NAME}_MODULE_TRIPLE}.swiftmodule>")
if(${PROJECT_NAME}_VARIANT_MODULE_TRIPLE)
Expand Down