-
Notifications
You must be signed in to change notification settings - Fork 102
[CMake] Fix build with SwiftTesting_BuildMacrosAsExecutables option set #645
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
There were two issues: - typo -load-plugin-exectuable -> -load-plugin-executable - The executable target for TestingMacros was not installed Resolves swiftlang#644
6e9deec
to
0923343
Compare
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.
Good on the executable fix.
I'm not sure where the expected location is for the macros though. We have a funny tendency of sticking everything under <prefix>/lib/swift
. I could also see a strong argument for libexec
since these aren't really executables that someone would invoke directly.
CC @bnbarham or @rintaro, do you know where we're sticking executable macros these days?
When building the toolchain, the macro product goes somewhere… so I'd expect to put it in the same place. :) |
It looks to me like when @rintaro added the install rules in #581 , the intention was for executables to be installed into I also don't know what the toolchain does for the macros regarding libs vs executables though, that's on y'all :). |
So for the toolchain builds, the macros are built entirely separately. They're kind of awkward when dealing with cross-compiling as well since they need to build for the I've personally been using I'm also going to ping @compnerd, @rintaro, and @al45tair for thoughts since I think it makes more sense to install the macros to |
Yes, my pull request adding it via FetchContent is here: LadybirdBrowser/ladybird#1202 Note that I did run into two separate issues with that (beyond the typo). The first is that the Testing target would not build unless the TestingMacros target was installed, as I am not including SwiftSyntax into my project (yet) and swift-testing builds the TestingMacros target itself as an executable if it can't be find_package'd. That's fixed in this PR by adding the install() rule. The second is that the Testing target didn't actually include any interface properties that instruct CMake to use the macro plugin, so I had to add my own target property to it before exposing it to my CMake build for consumers to use, like so:
So if using this project via FetchContent is a goal, adding that automagically would be nice :).
In light of that second issue, I'm not sure if I'm holding it wrong, or if you did some other magic to pick up the plugin when linking against Testing 🤔 . As a side note, I did make two additional changes in my .patch file when pulling swift-testing in via FetchContent:
|
So for comparison's sake, we already have: if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(SwiftTesting_MACRO_PATH "${SwiftTesting_MACRO_INSTALL_PREFIX}/bin/TestingMacros.exe")
else()
set(SwiftTesting_MACRO_PATH "${SwiftTesting_MACRO_INSTALL_PREFIX}/bin/TestingMacros")
endif() So… as long as we're consistent with the rest of our CMake script, I'm happy with the proposed changes. If @etcwilde is happy with them, we can run CI and then merge this change. |
I don't have strong opinion on where to install macro plugin executables, this is just an install from
|
Okay, as long as we can come back and align things a little better with the filesystem hierarchy standard on Linux/Unix later, I'm fine with this as-is to get things unblocked.
I think I agree with switching it to |
@swift-ci test |
@ADKaster You are free to merge this PR once all CI jobs complete. I recommend a squash-and-merge. |
@grynspan as I'm not a member of swiftlang or granted write access on this repository specifically, I'm gonna have to ask that someone else push the merge button |
I'm never sure who can see the green button! Sorry! |
Agreed, they should really live in |
I'm not sure about that, FHS dictates that |
This is for executable macros, not the library macros. |
My understanding is that the macros we're talking about here are executables, which is what |
Ah, the plugins built as executables definitely belong in |
That makes sense to me. |
Resolve the issues with an out-of-toolchain build from the command line with ninja
Motivation:
Fixes #644
Modifications:
There were two issues:
- typo -load-plugin-exectuable -> -load-plugin-executable
- The executable target for TestingMacros was not installed
Result:
A build from the command line with cmake -GNinja -Bbuild will successfully complete if SwiftSyntax is not find_package-able
Checklist: