mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-24 16:40:21 +00:00
CMake: Check for Swift-aware C++ compiler more robustly
Instead of looking for "AppleClang", we can just check whether the CMAKE_CXX_COMPILER understands swift_attr and swift_name.
This commit is contained in:
parent
f638f84185
commit
e467b38d3d
1 changed files with 9 additions and 8 deletions
|
@ -1,16 +1,17 @@
|
||||||
enable_language(Swift)
|
enable_language(Swift)
|
||||||
|
|
||||||
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 6.0)
|
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 6.0)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR "Swift 6.0 or newer is required to parse C++ headers in C++23 mode")
|
||||||
"Swift 6.0 or newer is required to parse C++ headers in C++23 mode"
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# FIXME: How to verify this on non-Apple?
|
# Check for a Swift-aware clang
|
||||||
if (APPLE AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
include(CheckCXXSourceCompiles)
|
||||||
message(FATAL_ERROR
|
check_cxx_source_compiles([=[
|
||||||
"Swift files must use Clang that was bundled with swiftc"
|
struct __attribute__((swift_name("CxxS"))) __attribute__((swift_attr("~Copyable"))) S { int& x; };
|
||||||
)
|
int main() {}
|
||||||
|
]=] CXX_COMPILER_SUPPORTS_SWIFT_ATTRS)
|
||||||
|
if (NOT CXX_COMPILER_SUPPORTS_SWIFT_ATTRS)
|
||||||
|
message(FATAL_ERROR "A Swift-aware C++ compiler is required to build with Swift interop enabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/InitializeSwift.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/InitializeSwift.cmake)
|
||||||
|
|
Loading…
Reference in a new issue