-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Cmake] add toolchain and cache files for Darwin platforms #77958
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
Conversation
|
||
if(NOT CMAKE_OSX_SYSROOT) | ||
if(DEFINED ENV{SDKROOT}) | ||
set(sdk_name $ENV{SDKROOT}) |
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.
Why is this sdk_name
? The SDKROOT is the full path to the SDK right?
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.
not necessarily. macosx
and iphoneos
are valid values for the SDKROOT
. The xcrun
call below does the translation to the actual full path to the SDK.
set(sdk_name $ENV{SDKROOT}) | ||
else() | ||
message(FATAL_ERROR "SDKROOT environment variable not set") | ||
endif() |
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.
This might be easier to read as:
if(NOT DEFINED ENV{SDKROOT})
message(FATAL_ERROR "The 'SDKROOT' environment variable is not set")
endif()
execute_process(COMMAND "${XCRUN_EXECUTABLE}" --show-sdk-path -sdk $ENV{SDKROOT} ...)
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.
cleaned up the check
set(CMAKE_OSX_SYSROOT "${SDKROOT}" CACHE FILEPATH "") | ||
endif() | ||
|
||
if(NOT CMAKE_MAKE_PROGRAM) |
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.
What if ninja
is already in the path? This would skip over that I think.
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.
In this case, that should be fine. The ninja
that xcrun picks up here isn't special.
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.
Removed the check
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 agree with @compnerd's comment on cleaning up the SDKROOT
environment variable check.
We can probably drop the CMAKE_MAKE_PROGRAM
check from the toolchain. It's not really specific to a particular build in the same way that the compilers and linkers are. If it's not available on the PATH
, we can plumb that in through the scripts invoking CMake.
@swift-ci please smoke test |
@swift-ci please smoke test Linux |
@swift-ci please test Windows |
@swift-ci please smoke test Linux |
1 similar comment
@swift-ci please smoke test Linux |
Add the Toolchain and cache files for the various Darwin platforms