Skip to content

Include xcspec resources in the CMake build #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
build: attempt to bundle files for the modules
This adds a helper to bundle files into the resource directory for the
module.
  • Loading branch information
compnerd authored and owenv committed May 5, 2025
commit ef21a84e7315ed46c3e0133a7b288d12bac74117
15 changes: 15 additions & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ See http://swift.org/LICENSE.txt for license information
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
]]

include(CMakeParseArguments)
function(SwiftBuild_Bundle)
set(Options)
set(OneValueArguments MODULE)
set(MultiValueArguments FILES)
cmake_parse_arguments(PARSE_ARGV 0 BundleXCSpecs
"${Options}" "${OneValueArguments}" "${MultiValueArguments}")

add_custom_command(TARGET ${BundleXCSpecs_MODULE} POST_BUILD
COMMAND
${CMAKE_COMMAND} -E make_directory "$<TARGET_PROPERTY:${BundleXCSpecs_MODULE},LOCATION>/SwiftBuild_${BundleXCSpecs_MODULE}.resources"
COMMAND
${CMAKE_COMMAND} -E copy_if_different ${BundleXCSpecs_FILES} "$<TARGET_PROPERTY:${BundleXCSpecs_MODULE},LOCATION>/SwiftBuild_${BundleXCSpecs_MODULE}.resources/")
endfunction()

add_subdirectory(SWBCSupport)
add_subdirectory(SWBCLibc)
add_subdirectory(SWBLibc)
Expand Down
3 changes: 3 additions & 0 deletions Sources/SWBAndroidPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBAndroidPlatform)

install(TARGETS SWBAndroidPlatform
ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}")

SwiftBuild_Bundle(MODULE SWBAndroidPlatform FILES
Android.xcspec)
6 changes: 6 additions & 0 deletions Sources/SWBGenericUnixPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBGenericUnixPlatform)

install(TARGETS SWBGenericUnixPlatform
ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}")

SwiftBuild_Bundle(MODULE SWBGenericUnixPlatform FILES
Unix.xcspec
UnixCompile.xcspec
UnixLd.xcspec
UnixLibtool.xcspec)
5 changes: 5 additions & 0 deletions Sources/SWBQNXPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBQNXPlatform)

install(TARGETS SWBQNXPlatform
ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}")

SwiftBuild_Bundle(MODULE SWBQNXPlatform FILES
QNX.xcspec
QNXCompile.xcspec
QNXLibtool.xcspec)
6 changes: 6 additions & 0 deletions Sources/SWBWebAssemblyPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBWebAssemblyPlatform)

install(TARGETS SWBWebAssemblyPlatform
ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}")

SwiftBuild_Bundle(MODULE SWBWebAssemblyPlatform FILES
WasmCompile.xcspec
WasmLd.xcspec
WasmLibtool.xcspec
WebAssembly.xcspec)
6 changes: 6 additions & 0 deletions Sources/SWBWindowsPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBWindowsPlatform)

install(TARGETS SWBWindowsPlatform
ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}")

SwiftBuild_Bundle(MODULE SWBWindowsPlatform FILES
Windows.xcspec
WindowsCompile.xcspec
WindowsLd.xcspec
WindowsLibtool.xcspec)