Files
swift-mirror/stdlib/public/Reflection/CMakeLists.txt
Erik Eckstein 3bd7f027f8 Runtime: use SmallVector instead of std::vector to avoid memory allocations in most cases.
This dramatically reduces the number of needed malloc calls.
Unfortunately I had to add the implementation of SmallVectorBase::grow_pod to the runtime, as we don't link LLVM. This is a bad hack, but better than re-inventing a new SmallVector implementation.

SR-10028
rdar://problem/48575729
2019-03-06 14:37:03 -08:00

56 lines
2.0 KiB
CMake

set(swiftReflection_SOURCES
MetadataSource.cpp
TypeLowering.cpp
TypeRef.cpp
TypeRefBuilder.cpp
"${SWIFT_SOURCE_DIR}/stdlib/public/runtime/LLVMSupport.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/Context.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/OldDemangler.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/Demangler.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/NodePrinter.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/ManglingUtils.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/Punycode.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/Remangler.cpp")
# When we're building with assertions, include the demangle node dumper to aid
# in debugging.
if (LLVM_ENABLE_ASSERTIONS)
list(APPEND swiftReflection_SOURCES
"${SWIFT_SOURCE_DIR}/lib/Demangling/NodeDumper.cpp")
endif(LLVM_ENABLE_ASSERTIONS)
if(SWIFT_BUILD_STDLIB)
add_swift_target_library(swiftReflection STATIC TARGET_LIBRARY
${swiftReflection_SOURCES}
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CXX_FLAGS} -DswiftCore_EXPORTS
LINK_FLAGS ${SWIFT_RUNTIME_LINK_FLAGS}
INSTALL_IN_COMPONENT dev)
endif()
# Build a specific version for the host with the host toolchain. This is going
# to be used by tools (e.g. lldb)
if(SWIFT_INCLUDE_TOOLS)
if(NOT SWIFT_BUILD_STDLIB)
add_custom_target(swiftReflection-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
endif()
if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
set(CURRENT_CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
set(CURRENT_CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER})
set(CMAKE_C_COMPILER ${HOST_CMAKE_C_COMPILER})
set(CMAKE_CXX_COMPILER ${HOST_CMAKE_CXX_COMPILER})
endif()
add_swift_host_library(swiftReflection STATIC
${swiftReflection_SOURCES})
target_compile_options(swiftReflection PRIVATE
${SWIFT_RUNTIME_CXX_FLAGS})
set_property(TARGET swiftReflection
APPEND_STRING PROPERTY LINK_FLAGS ${SWIFT_RUNTIME_LINK_FLAGS})
if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
set(CMAKE_C_COMPILER ${CURRENT_CMAKE_C_COMPILER})
set(CMAKE_CXX_COMPILER ${CURRENT_CMAKE_CXX_COMPILER})
endif()
endif()