File tree Expand file tree Collapse file tree 2 files changed +32
-6
lines changed Expand file tree Collapse file tree 2 files changed +32
-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 (_SwiftFlags -DCMAKE_Swift_FLAGS= "-use-ld=lld" )
18
+ else ()
19
+ set (_SwiftFlags )
20
+ endif ()
21
+ ExternalProject_Add (FoundationMacros
22
+ SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /FoundationMacros"
23
+ PREFIX "${CMAKE_BINARY_DIR} /_deps"
24
+ BINARY_DIR "macros"
25
+ CMAKE_ARGS
26
+ -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
27
+ ${_SwiftFlags}
28
+ INSTALL_COMMAND "" )
29
+ ExternalProject_Get_Property (FoundationMacros BINARY_DIR )
30
+ if (CMAKE_HOST_WIN32 )
31
+ set (_SwiftFoundation_PredicateMacro "${BINARY_DIR} /FoundationMacros.exe#PredicateMacro" )
32
+ set (_SwiftFoundation_ExpressionMacro "${BINARY_DIR} /FoundationMacros.exe#ExpressionMacro" )
33
+ else ()
34
+ set (_SwiftFoundation_PredicateMacro "${BINARY_DIR} /FoundationMacros#PredicateMacro" )
35
+ set (_SwiftFoundation_ExpressionMacro "${BINARY_DIR} /FoundationMacros#ExpressionMacro" )
20
36
endif ()
21
37
38
+ add_subdirectory (_FoundationCShims )
22
39
add_subdirectory (FoundationEssentials )
23
40
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