Skip to content

[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

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

justice-adams-apple
Copy link
Contributor

Add the Toolchain and cache files for the various Darwin platforms


if(NOT CMAKE_OSX_SYSROOT)
if(DEFINED ENV{SDKROOT})
set(sdk_name $ENV{SDKROOT})
Copy link
Member

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?

Copy link
Member

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()
Copy link
Member

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} ...)

Copy link
Contributor Author

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)
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the check

Copy link
Member

@etcwilde etcwilde left a 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.

@justice-adams-apple
Copy link
Contributor Author

@swift-ci please smoke test

@etcwilde
Copy link
Member

etcwilde commented Dec 5, 2024

@swift-ci please smoke test Linux

@etcwilde
Copy link
Member

etcwilde commented Dec 5, 2024

@swift-ci please test Windows

@etcwilde
Copy link
Member

etcwilde commented Dec 6, 2024

@swift-ci please smoke test Linux

1 similar comment
@justice-adams-apple
Copy link
Contributor Author

@swift-ci please smoke test Linux

@justice-adams-apple justice-adams-apple merged commit acb2a44 into main Dec 10, 2024
3 checks passed
@justice-adams-apple justice-adams-apple deleted the jadams/add-toolchain-files branch December 10, 2024 16:34
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