File tree 2 files changed +36
-6
lines changed
2 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 12
12
##
13
13
##===----------------------------------------------------------------------===##
14
14
15
- add_subdirectory (_FoundationCShims)
16
-
17
- # Disable the macro build on Windows until we can correctly build it for the host architecture
18
- if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
19
- add_subdirectory (FoundationMacros)
15
+ include (ExternalProject)
16
+ if (CMAKE_HOST_WIN32 )
17
+ set (_FoundationMacrosSwiftFlags -DCMAKE_Swift_FLAGS="-use-ld=lld" )
18
+ endif ()
19
+ ExternalProject_Add(FoundationMacros
20
+ SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /FoundationMacros"
21
+ PREFIX "${CMAKE_BINARY_DIR} /_deps"
22
+ BINARY_DIR "macros"
23
+ CMAKE_ARGS
24
+ -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
25
+ ${_FoundationMacrosSwiftFlags}
26
+ INSTALL_COMMAND "" )
27
+ ExternalProject_Get_Property(FoundationMacros BINARY_DIR)
28
+ if (CMAKE_HOST_WIN32 )
29
+ set (_SwiftFoundation_PredicateMacro "${BINARY_DIR} /FoundationMacros.exe#PredicateMacro" )
30
+ set (_SwiftFoundation_ExpressionMacro "${BINARY_DIR} /FoundationMacros.exe#ExpressionMacro" )
31
+ else ()
32
+ set (_SwiftFoundation_PredicateMacro "${BINARY_DIR} /FoundationMacros#PredicateMacro" )
33
+ set (_SwiftFoundation_ExpressionMacro "${BINARY_DIR} /FoundationMacros#ExpressionMacro" )
20
34
endif ()
21
35
36
+ add_subdirectory (_FoundationCShims)
22
37
add_subdirectory (FoundationEssentials)
23
38
add_subdirectory (FoundationInternationalization)
Original file line number Diff line number Diff line change 12
12
##
13
13
##===----------------------------------------------------------------------===##
14
14
15
+ cmake_minimum_required (VERSION 3.22)
16
+
17
+ if (POLICY CMP0156)
18
+ # Deduplicate linked libraries where appropriate
19
+ cmake_policy (SET CMP0156 NEW)
20
+ endif ()
21
+ if (POLICY CMP0157)
22
+ # New Swift build model: improved incremental build performance and LSP support
23
+ cmake_policy (SET CMP0157 NEW)
24
+ endif ()
25
+
26
+ project (FoundationMacros
27
+ LANGUAGES Swift)
28
+
15
29
# SwiftSyntax Dependency
16
- include (FetchContent)
17
30
find_package (SwiftSyntax)
18
31
if (NOT SwiftSyntax_FOUND)
32
+ include (FetchContent)
33
+
19
34
# If building at desk, check out and link against the SwiftSyntax repo's targets
20
35
FetchContent_Declare(SwiftSyntax
21
36
GIT_REPOSITORY https://github.com/swiftlang/swift-syntax.git
You can’t perform that action at this time.
0 commit comments