File tree Expand file tree Collapse file tree 3 files changed +33
-6
lines changed Expand file tree Collapse file tree 3 files changed +33
-6
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ if(POLICY CMP0156)
19
19
cmake_policy (SET CMP0156 NEW)
20
20
endif ()
21
21
22
+ if (POLICY CMP0156)
23
+ cmake_policy (SET CMP0156 NEW)
24
+ endif ()
22
25
if (POLICY CMP0157)
23
26
# New Swift build model: improved incremental build performance and LSP support
24
27
cmake_policy (SET CMP0157 NEW)
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
+ if (POLICY CMP0157)
17
+ cmake_policy (SET CMP0157 NEW)
18
+ endif ()
19
+
20
+ project (FoundationMacros
21
+ LANGUAGES Swift)
22
+
15
23
# SwiftSyntax Dependency
16
- include (FetchContent)
17
24
find_package (SwiftSyntax)
18
25
if (NOT SwiftSyntax_FOUND)
26
+ include (FetchContent)
27
+
19
28
# If building at desk, check out and link against the SwiftSyntax repo's targets
20
29
FetchContent_Declare(SwiftSyntax
21
30
GIT_REPOSITORY https://github.com/swiftlang/swift-syntax.git
You can’t perform that action at this time.
0 commit comments