Skip to content

Commit 86a8d57

Browse files
authored
Merge pull request #34655 from nkcsgexi/install-feature-json
CMake: generate SupportedFeatures.json while building and install it into toolchain
2 parents b0577b0 + 5598a60 commit 86a8d57

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tools/driver/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ target_link_libraries(swift-frontend
1313
swiftSymbolGraphGen
1414
LLVMBitstreamReader)
1515

16+
# Generate and install supported feature JSON file to the toolchain.
17+
if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
18+
set(DUMMY_SWIFT_INPUT "${SWIFT_RUNTIME_OUTPUT_INTDIR}/dummyInput.swift")
19+
set(INT_FEATURE_FILE "${SWIFT_RUNTIME_OUTPUT_INTDIR}/SupportedFeatures.json")
20+
add_custom_command(TARGET swift-frontend POST_BUILD
21+
COMMAND "${CMAKE_COMMAND}" "-E" "touch" "${DUMMY_SWIFT_INPUT}"
22+
COMMAND "${SWIFT_RUNTIME_OUTPUT_INTDIR}/swift-frontend"
23+
"-emit-supported-features" "-o"
24+
"${INT_FEATURE_FILE}"
25+
"${DUMMY_SWIFT_INPUT}")
26+
swift_install_in_component(FILES "${INT_FEATURE_FILE}"
27+
DESTINATION "bin"
28+
COMPONENT compiler)
29+
endif()
30+
1631
swift_create_post_build_symlink(swift-frontend
1732
SOURCE "swift-frontend${CMAKE_EXECUTABLE_SUFFIX}"
1833
DESTINATION "swift${CMAKE_EXECUTABLE_SUFFIX}"

0 commit comments

Comments
 (0)