-
Notifications
You must be signed in to change notification settings - Fork 90
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
base: main
Are you sure you want to change the base?
Conversation
This adds a helper to bundle files into the resource directory for the module.
@swift-ci test |
Sources/CMakeLists.txt
Outdated
${CMAKE_COMMAND} -E copy_if_different ${BundleXCSpecs_FILES} "${CMAKE_CURRENT_BINARY_DIR}/SwiftBuild_${BundleXCSpecs_MODULE}.resources/") | ||
|
||
file(CONFIGURE | ||
OUTPUT resource_bundle_accessor.swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the absolute path with the conversion is important. Otherwise, the output location is not very well defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you referring to the native path conversion for the path used in the generated code, or the use of a relative path when setting the output for file(CONFIGURE? I restored the former, the latter I thought was ok to remain relative since it's documented to be relative to CMAKE_CURRENT_BINARY_DIR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is documented to be relative to that, and I originally tried to use the relative path but ended up running into some issues. Furthermore, now that it is extracted into a helper, you no longer have a good idea of where CMAKE_CURRENT_BINARY_DIR
is pointing to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, that makes sense to me, thanks. Updated the patch to use an absolute path here and avoid use of CMAKE_CURRENT_BINARY_DIR in general
f4c62b0
to
ea9d19b
Compare
- Handle all the remaining xcspecs - centralize resource accessor generation alongside the bundling
ea9d19b
to
fce47fd
Compare
@swift-ci test |
COMMAND | ||
${CMAKE_COMMAND} -E copy_if_different ${BundleXCSpecs_FILES} "${CMAKE_BINARY_DIR}/share/pm/SwiftBuild_${BundleXCSpecs_MODULE}.resources/") | ||
|
||
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/share/pm/SwiftBuild_${BundleXCSpecs_MODULE}.resources" _SWIFT_BUILD_RESOURCE_BUNDLE_BUILD_PATH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can use $<TARGET_PROEPRTY:${BundleXCSpecs_MODULE},BINARY_DIR>
to get the module's binary dir rather than placing this at the top-level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gave this a try but I was unable to use a generator expression in the output path when creating the resource accessor
Builds on a rebased #243 by @compnerd