@@ -28,6 +28,39 @@ function(swift_configure_lit_site_cfg source_path destination_path installed_nam
28
28
endif ()
29
29
endfunction ()
30
30
31
+ function (swift_generate_lit_swift_features_cfg output_path )
32
+ if (SWIFT_COMPILER_IS_MSVC_LIKE )
33
+ set (test_lit_swift_features_cmd
34
+ "${CMAKE_C_COMPILER} " "/P" "/EP" "/I" "${SWIFT_MAIN_INCLUDE_DIR} " "/TC"
35
+ "/Fi<<<OUTPUT_FILE>>>" )
36
+ else ()
37
+ set (test_lit_swift_features_cmd
38
+ "${CMAKE_C_COMPILER} " "-E" "-P" "-I${SWIFT_MAIN_INCLUDE_DIR} " "-x" "c" "-o"
39
+ "<<<OUTPUT_FILE>>>" )
40
+ endif ()
41
+
42
+ list (
43
+ TRANSFORM test_lit_swift_features_cmd
44
+ REPLACE "<<<OUTPUT_FILE>>>" "${output_path} " )
45
+ add_custom_command (
46
+ OUTPUT "${output_path} "
47
+ COMMAND
48
+ ${test_lit_swift_features_cmd}
49
+ "${CMAKE_CURRENT_SOURCE_DIR} /lit.swift-features.cfg.inc"
50
+ DEPENDS
51
+ "lit.swift-features.cfg.inc"
52
+ "${SWIFT_MAIN_INCLUDE_DIR} /swift/Basic/Features.def"
53
+ )
54
+
55
+ # Execute during generation once, so one can run Lit without rebuilding the
56
+ # test suite dependencies first.
57
+ execute_process (
58
+ COMMAND
59
+ ${test_lit_swift_features_cmd}
60
+ "${CMAKE_CURRENT_SOURCE_DIR} /lit.swift-features.cfg.inc"
61
+ )
62
+ endfunction ()
63
+
31
64
function (normalize_boolean_spelling var_name )
32
65
if (${var_name} )
33
66
set ("${var_name} " TRUE PARENT_SCOPE )
@@ -254,16 +287,6 @@ if(NOT "${COVERAGE_DB}" STREQUAL "")
254
287
COMMENT "Touching covering tests" )
255
288
endif ()
256
289
257
- if (SWIFT_COMPILER_IS_MSVC_LIKE )
258
- set (C_PREPROCESSOR_COMMAND
259
- "${CMAKE_C_COMPILER} " "/P" "/EP" "/I" "${SWIFT_MAIN_INCLUDE_DIR} " "/TC"
260
- "/Fi<<<OUTPUT_FILE>>>" )
261
- else ()
262
- set (C_PREPROCESSOR_COMMAND
263
- "${CMAKE_C_COMPILER} " "-E" "-P" "-I${SWIFT_MAIN_INCLUDE_DIR} " "-x" "c" "-o"
264
- "<<<OUTPUT_FILE>>>" )
265
- endif ()
266
-
267
290
foreach (SDK ${SWIFT_SDKS} )
268
291
foreach (ARCH ${SWIFT_SDK_${SDK}_ARCHITECTURES} )
269
292
# macCatalyst needs to run two sets of tests: one with the normal macosx target triple
@@ -315,33 +338,8 @@ foreach(SDK ${SWIFT_SDKS})
315
338
"${validation_test_bin_dir} /lit.site.cfg"
316
339
"validation-test${VARIANT_SUFFIX} .lit.site.cfg" )
317
340
318
- set (test_lit_swift_features_cmd ${C_PREPROCESSOR_COMMAND} )
319
- list (
320
- TRANSFORM test_lit_swift_features_cmd
321
- REPLACE "<<<OUTPUT_FILE>>>" "${test_bin_dir} /lit.swift-features.cfg" )
322
- add_custom_command (
323
- OUTPUT "${test_bin_dir} /lit.swift-features.cfg"
324
- COMMAND
325
- ${test_lit_swift_features_cmd}
326
- "${CMAKE_CURRENT_SOURCE_DIR} /lit.swift-features.cfg.inc"
327
- DEPENDS
328
- "lit.swift-features.cfg.inc"
329
- "${SWIFT_MAIN_INCLUDE_DIR} /swift/Basic/Features.def"
330
- )
331
-
332
- set (validation_test_lit_swift_features_cmd ${C_PREPROCESSOR_COMMAND} )
333
- list (
334
- TRANSFORM validation_test_lit_swift_features_cmd
335
- REPLACE "<<<OUTPUT_FILE>>>" "${validation_test_bin_dir} /lit.swift-features.cfg" )
336
- add_custom_command (
337
- OUTPUT "${validation_test_bin_dir} /lit.swift-features.cfg"
338
- COMMAND
339
- ${validation_test_lit_swift_features_cmd}
340
- "${CMAKE_CURRENT_SOURCE_DIR} /lit.swift-features.cfg.inc"
341
- DEPENDS
342
- "lit.swift-features.cfg.inc"
343
- "${SWIFT_MAIN_INCLUDE_DIR} /swift/Basic/Features.def"
344
- )
341
+ swift_generate_lit_swift_features_cfg ("${test_bin_dir} /lit.swift-features.cfg" )
342
+ swift_generate_lit_swift_features_cfg ("${validation_test_bin_dir} /lit.swift-features.cfg" )
345
343
add_custom_target (lit_swift_features_cfg_${VARIANT_SUFFIX}
346
344
DEPENDS
347
345
"${test_bin_dir} /lit.swift-features.cfg"
0 commit comments