Skip to content

CMake compatibility with Swift build assumptions #267

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 1 commit into from
Jul 1, 2017

Conversation

dgrove-oss
Copy link
Contributor

All of the swift projects that depend on finding libdispatch.so
during their builds (swift, foundation, swiftpm) all expect it
to be in src/.libs/libdispatch.so (libtool convention). Temporarily
add a rule to copy the built library to where libtool would have
placed it to decouple using CMake for libdispatch from updating
all of the other dependent projects' build expectations.

All of the swift projects that depend on finding libdispatch.so
during their builds (swift, foundation, swiftpm) all expect it
to be in src/.libs/libdispatch.so (libtool convention). Temporarily
add a rule to copy the built library to where libtool would have
placed it to decouple using CMake for libdispatch from updating
all of the other dependent projects' build expectations.
@dgrove-oss
Copy link
Contributor Author

@das @compnerd -- staging for invoking libdispatch CMake from swift/utils/build-script. The changes to the other projects to avoid needing this are simple, but I don't want to try to coordinate across all of the repos. So we put in this crutch with the plan of updating the other projects soon after we cut-over to CMake for libdispatch and then getting rid of this.

@compnerd
Copy link
Member

@dgrove-oss yeah, I have a pr for that in the swift repo. Don't see a problem with trying to stage it with some hacks in the build system.

add_custom_command(TARGET dispatch POST_BUILD
COMMAND cmake -E make_directory .libs
COMMAND cmake -E copy $<TARGET_FILE:dispatch> .libs
COMMENT "Copying libdispatch to .libs")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this always run? Perhaps have a output to prevent that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for me it runs exactly when dispatch is built, which I think is what we want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the record, can't specify both a TARGET and an OUTPUT in a custom_command.

CMake Error at src/CMakeLists.txt:195 (add_custom_command):
add_custom_command Wrong syntax. A TARGET and OUTPUT can not both be
specified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I guess I was mixing up some other behaviour then. If it is only run once, then it is what we want.

@das
Copy link
Contributor

das commented Jul 1, 2017

lgtm, thanks!

@das das merged commit ce90d0c into swiftlang:master Jul 1, 2017
@dgrove-oss dgrove-oss deleted the cmake-copy-libdisaptch branch July 1, 2017 14:17
das added a commit that referenced this pull request Jul 31, 2017
CMake compatibility with Swift build assumptions

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
@das das removed the darwin pending label Aug 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants