mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
CMake: Enable finding the Swift -target flag in more cases
When the detected SDK for CMAKE_OSX_SYSROOT and friends has the same version as your current macOS system version, CMake helpfully doesn't set CMAKE_OSX_DEPLOYMENT_TARGET. Unfortunately, in this case, swiftc will default to macOS 10.4, which is absolutely ancient. Grab the target triple from the -print-target-info JSON when CMAKE_OSX_DEPLOYMENT_TARGET is not provided at configure time.
This commit is contained in:
parent
ee54f9ee95
commit
7ab1d117f1
Notes:
github-actions[bot]
2024-09-23 17:07:23 +00:00
Author: https://github.com/ADKaster
Commit: 7ab1d117f1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1477
2 changed files with 14 additions and 3 deletions
|
@ -25,7 +25,7 @@ endfunction()
|
||||||
# NOTE: This logic will eventually move to CMake
|
# NOTE: This logic will eventually move to CMake
|
||||||
function(_setup_swift_paths)
|
function(_setup_swift_paths)
|
||||||
# If we haven't set the swift library search paths, do that now
|
# If we haven't set the swift library search paths, do that now
|
||||||
if(NOT SWIFT_LIBRARY_SEARCH_PATHS OR NOT SWIFT_INCLUDE_PATHS)
|
if(NOT SWIFT_LIBRARY_SEARCH_PATHS OR NOT SWIFT_INCLUDE_PATHS OR (APPLE AND NOT SWIFT_TARGET_TRIPLE))
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(SDK_FLAGS "-sdk" "${CMAKE_OSX_SYSROOT}")
|
set(SDK_FLAGS "-sdk" "${CMAKE_OSX_SYSROOT}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -38,6 +38,17 @@ function(_setup_swift_paths)
|
||||||
OUTPUT_VARIABLE SWIFT_TARGET_INFO
|
OUTPUT_VARIABLE SWIFT_TARGET_INFO
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# FIXME: https://gitlab.kitware.com/cmake/cmake/-/issues/26174
|
||||||
|
if (APPLE)
|
||||||
|
if (CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||||
|
set(SWIFT_TARGET_TRIPLE "${CMAKE_SYSTEM_PROCESSOR}-apple-macosx${CMAKE_OSX_DEPLOYMENT_TARGET}" CACHE STRING "Swift target triple")
|
||||||
|
else()
|
||||||
|
string(JSON SWIFT_TARGET_TARGET GET ${SWIFT_TARGET_INFO} "target")
|
||||||
|
string(JSON SWIFT_TARGET_TARGET_TRIPLE GET ${SWIFT_TARGET_TARGET} "triple")
|
||||||
|
set(SWIFT_TARGET_TRIPLE ${SWIFT_TARGET_TARGET_TRIPLE} CACHE STRING "Swift target triple")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# extract search paths from swift driver response
|
# extract search paths from swift driver response
|
||||||
string(JSON SWIFT_TARGET_PATHS GET ${SWIFT_TARGET_INFO} "paths")
|
string(JSON SWIFT_TARGET_PATHS GET ${SWIFT_TARGET_INFO} "paths")
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/GenerateSwiftHeader.cmake)
|
||||||
|
|
||||||
# FIXME: https://gitlab.kitware.com/cmake/cmake/-/issues/26174
|
# FIXME: https://gitlab.kitware.com/cmake/cmake/-/issues/26174
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(CMAKE_Swift_COMPILER_TARGET "${CMAKE_SYSTEM_PROCESSOR}-apple-macosx${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
set(CMAKE_Swift_COMPILER_TARGET "${SWIFT_TARGET_TRIPLE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(VFS_OVERLAY_DIRECTORY "${CMAKE_BINARY_DIR}/vfs_overlays" CACHE PATH "Directory to put VFS overlays in")
|
set(VFS_OVERLAY_DIRECTORY "${CMAKE_BINARY_DIR}/vfs_overlays" CACHE PATH "Directory to put VFS overlays in")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue