8
8
9
9
# Macros must be built for the build machine, not the host.
10
10
include (ExternalProject)
11
+
11
12
if (NOT SwiftTesting_MACRO_MAKE_PROGRAM)
12
13
set (SwiftTesting_MACRO_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM} )
13
14
endif ()
14
15
if (NOT SwiftTesting_MACRO_Swift_COMPILER)
15
16
set (SwiftTesting_MACRO_Swift_COMPILER ${CMAKE_Swift_COMPILER} )
16
17
endif ()
18
+ if (NOT SwiftTesting_MACRO_Swift_FLAGS)
19
+ set (SwiftTesting_MACRO_Swift_FLAGS ${CMAKE_Swift_FLAGS} )
20
+ set (SwiftTesting_MACRO_SWIFT_FLAGS_RELEAE ${CMAKE_Swift_FLAGS_RELEAE} )
21
+ set (SwiftTesting_MACRO_SWIFT_FLAGS_RELWITHDEBINFO ${CMAKE_Swift_FLAGS_RELWITHDEBINFO} )
22
+ endif ()
17
23
if (NOT SwiftTesting_MACRO_AR)
18
24
set (SwiftTesting_MACRO_AR ${CMAKE_AR} )
19
25
endif ()
@@ -32,10 +38,11 @@ ExternalProject_Add(TestingMacros
32
38
PREFIX "tm"
33
39
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /TestingMacros"
34
40
CMAKE_ARGS
41
+ -DCMAKE_MAKE_PROGRAM=${SwiftTesting_MACRO_MAKE_PROGRAM}
35
42
-DCMAKE_Swift_COMPILER=${SwiftTesting_MACRO_Swift_COMPILER}
43
+ -DCMAKE_Swift_FLAGS=${SwiftTesting_MACRO_Swift_FLAGS}
36
44
-DCMAKE_AR=${SwiftTesting_MACRO_AR}
37
45
-DCMAKE_RANLIB=${SwiftTesting_MACRO_RANLIB}
38
- -DCMAKE_MAKE_PROGRAM=${SwiftTesting_MACRO_MAKE_PROGRAM}
39
46
-DSwiftTesting_BuildMacrosAsExecutables=${SwiftTesting_BuildMacrosAsExecutables}
40
47
-DSwiftSyntax_DIR=${SwiftSyntax_DIR}
41
48
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>)
@@ -52,14 +59,15 @@ if(NOT SwiftTesting_BuildMacrosAsExecutables)
52
59
# TestingMacros uses `ExternalProject` and we cannot directly query the
53
60
# properties of its targets here.
54
61
if ("${CMAKE_SYSTEM_NAME} " STREQUAL "Darwin" )
55
- set (SwiftTesting_TestingMacrosLibraryName "libTestingMacros.dylib" )
62
+ install (PROGRAMS "${INSTALL_DIR} /lib/libTestingMacros.dylib"
63
+ DESTINATION lib/swift/host/plugins/testing)
56
64
elseif ("${CMAKE_SYSTEM_NAME} " STREQUAL "Linux" )
57
- set (SwiftTesting_TestingMacrosLibraryName "libTestingMacros.so" )
65
+ install (PROGRAMS "${INSTALL_DIR} /lib/libTestingMacros.so"
66
+ DESTINATION lib/swift/host/plugins)
67
+ elseif ("${CMAKE_SYSTEM_NAME} " STREQUAL "Windows" )
68
+ # In Windows toolchain, TestingMacros.dll is installed from seprate CMake
69
+ # buikd, just for the macros.
58
70
else ()
59
71
message (FATAL_ERROR "Unable to determine the library name for TestingMacros based on system name: ${CMAKE_SYSTEM_NAME} " )
60
72
endif ()
61
-
62
- install (PROGRAMS "${INSTALL_DIR} /lib/${SwiftTesting_TestingMacrosLibraryName} "
63
- # TODO: Finalize the install path
64
- DESTINATION lib/swift/host/plugins)
65
73
endif ()
0 commit comments