Skip to content

Commit cb394f6

Browse files
committed
build: allow building tools and stdlib separately
This restores the ability to build the standard library and the tools in two separate build invocations. This is required to cross-compile the standard library on various targets without building complete toolchains.
1 parent d51c92f commit cb394f6

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

stdlib/public/Reflection/CMakeLists.txt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,25 @@ if(SWIFT_BUILD_STDLIB)
2525
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CXX_FLAGS}
2626
LINK_FLAGS ${SWIFT_RUNTIME_LINK_FLAGS}
2727
INSTALL_IN_COMPONENT dev)
28-
else()
29-
add_custom_target(swiftReflection-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
3028
endif()
3129

3230
# Build a specific version for the host with the host toolchain. This is going
3331
# to be used by tools (e.g. lldb)
32+
if(SWIFT_INCLUDE_TOOLS)
33+
if(NOT SWIFT_BUILD_STDLIB)
34+
add_custom_target(swiftReflection-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
35+
endif()
3436

35-
if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
36-
set(CMAKE_C_COMPILER ${HOST_CMAKE_C_COMPILER})
37-
set(CMAKE_CXX_COMPILER ${HOST_CMAKE_CXX_COMPILER})
38-
endif()
37+
if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
38+
set(CMAKE_C_COMPILER ${HOST_CMAKE_C_COMPILER})
39+
set(CMAKE_CXX_COMPILER ${HOST_CMAKE_CXX_COMPILER})
40+
endif()
3941

40-
add_swift_host_library(swiftReflection STATIC
41-
${swiftReflection_SOURCES})
42-
target_compile_options(swiftReflection PRIVATE
43-
${SWIFT_RUNTIME_CXX_FLAGS})
44-
set_property(TARGET swiftReflection
45-
APPEND_STRING PROPERTY LINK_FLAGS ${SWIFT_RUNTIME_LINK_FLAGS})
42+
add_swift_host_library(swiftReflection STATIC
43+
${swiftReflection_SOURCES})
44+
target_compile_options(swiftReflection PRIVATE
45+
${SWIFT_RUNTIME_CXX_FLAGS})
46+
set_property(TARGET swiftReflection
47+
APPEND_STRING PROPERTY LINK_FLAGS ${SWIFT_RUNTIME_LINK_FLAGS})
48+
endif()
4649

0 commit comments

Comments
 (0)