Skip to content
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

build: attempt to bundle files for the modules #243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
2 changes: 2 additions & 0 deletions Sources/SWBAndroidPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ target_link_libraries(SWBAndroidPlatform PUBLIC
SWBUtil)
target_sources(SWBAndroidPlatform PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/resource_bundle_accessor.swift")
SwiftBuild_Bundle(MODULE SWBAndroidPlatform FILES
Android.xcspec)
5 changes: 5 additions & 0 deletions Sources/SWBGenericUnixPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ target_link_libraries(SWBGenericUnixPlatform PUBLIC
SWBUtil)
target_sources(SWBGenericUnixPlatform PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/resource_bundle_accessor.swift")
SwiftBuild_Bundle(MODULE SWBGenericUnixPlatform FILES
Unix.xcspec
UnixCompile.xcspec
UnixLd.xcspec
UnixLibtool.xcspec)
4 changes: 4 additions & 0 deletions Sources/SWBQNXPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ target_link_libraries(SWBQNXPlatform PUBLIC
SWBUtil)
target_sources(SWBQNXPlatform PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/resource_bundle_accessor.swift")
SwiftBuild_Bundle(MODULE SWBQNXPlatform FILES
QNX.xcspec
QNXCompile.xcspec
QNXLibtool.xcspec)
5 changes: 5 additions & 0 deletions Sources/SWBWebAssemblyPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ target_link_libraries(SWBWebAssemblyPlatform PUBLIC
SWBUtil)
target_sources(SWBWebAssemblyPlatform PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/resource_bundle_accessor.swift")
SwiftBuild_Bundle(MODULE SWBWebAssemblyPlatform FILES
WasmCompile.xcspec
WasmLd.xcspec
WasmLibtool.xcspec
WebAssembly.xcspec)
5 changes: 5 additions & 0 deletions Sources/SWBWindowsPlatform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ target_link_libraries(SWBWindowsPlatform PUBLIC
SWBUtil)
target_sources(SWBWindowsPlatform PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/resource_bundle_accessor.swift")
SwiftBuild_Bundle(MODULE SWBWindowsPlatform FILES
Windows.xcspec
WindowsCompile.xcspec
WindowsLd.xcspec
WindowsLibtool.xcspec)