Files
swift-mirror/stdlib/public/RuntimeModule/CMakeLists.txt
Alastair Houghton c9c5dc0de1 [Backtracing] Add platform and architecture information.
It's useful to capture the platform and platform version with the image map.
Also, display both the platform and architecture information when generating
a crash log.

rdar://124913332
2025-01-27 15:44:28 +00:00

119 lines
3.1 KiB
CMake

#===--- CMakeLists.txt - Runtime module ------------------------------------===#
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2023 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#
#===------------------------------------------------------------------------===#
#
# The Runtime module isn't the runtime itself; that lives in libswiftCore;
# rather, it's a high level Swift interface to things
set(swift_runtime_link_libraries
swiftCore
swift_Concurrency
)
set(concurrency)
if(SWIFT_BUILD_STDLIB AND SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY)
set(concurrency _Concurrency)
endif()
set(RUNTIME_SOURCES
Address.swift
Backtrace.swift
Backtrace+Codable.swift
BacktraceFormatter.swift
Base64.swift
ByteSwapping.swift
CachingMemoryReader.swift
CompactBacktrace.swift
CompactImageMap.swift
Compression.swift
Context.swift
CoreSymbolication.swift
Dwarf.swift
EightByteBuffer.swift
Elf.swift
ElfImageCache.swift
FramePointerUnwinder.swift
Image.swift
ImageMap.swift
ImageMap+Darwin.swift
ImageMap+Linux.swift
ImageSource.swift
Libc.swift
LimitSequence.swift
MemoryReader.swift
OSReleaseScanner.swift
ProcMapsScanner.swift
Registers.swift
Runtime.swift
RichFrame.swift
SymbolicatedBacktrace.swift
Utils.swift
Win32Extras.cpp
get-cpu-context.${SWIFT_ASM_EXT}
)
set(RUNTIME_COMPILE_FLAGS
"-cxx-interoperability-mode=default"
"-Xfrontend;-experimental-spi-only-imports"
"-Xcc;-I${SWIFT_SOURCE_DIR}/include"
"-Xcc;-I${CMAKE_BINARY_DIR}/include"
"-Xcc;-I${SWIFT_STDLIB_SOURCE_DIR}/public/RuntimeModule/modules"
"-disable-upcoming-feature;MemberImportVisibility")
###TODO: Add these when we add static linking support
#
#list(APPEND RUNTIME_COMPILE_FLAGS
# "-Xcc;-I${SWIFT_PATH_TO_ZLIB_SOURCE}"
# "-Xcc;-I${SWIFT_PATH_TO_ZSTD_SOURCE}/lib"
# "-Xcc;-I${SWIFT_PATH_TO_LIBLZMA_SOURCE}/src/liblzma/api")
if(SWIFT_ASM_AVAILABLE)
list(APPEND RUNTIME_SOURCES get-cpu-context.${SWIFT_ASM_EXT})
list(APPEND RUNTIME_COMPILE_FLAGS "-DSWIFT_ASM_AVAILABLE")
else()
message(warning "Assembly language not available on this platform; backtracing will fail.")
endif()
set(LLVM_OPTIONAL_SOURCES
get-cpu-context.S
get-cpu-context.asm
)
add_swift_target_library(swiftRuntime ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
${RUNTIME_SOURCES}
SWIFT_MODULE_DEPENDS ${concurrency}
SWIFT_MODULE_DEPENDS_ANDROID Android
SWIFT_MODULE_DEPENDS_LINUX Glibc
SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
SWIFT_MODULE_DEPENDS_OPENBSD Glibc
SWIFT_MODULE_DEPENDS_CYGWIN Glibc
SWIFT_MODULE_DEPENDS_HAIKU Glibc
SWIFT_MODULE_DEPENDS_WINDOWS CRT
PRIVATE_LINK_LIBRARIES ${swift_runtime_link_libraries}
SWIFT_COMPILE_FLAGS
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
${RUNTIME_COMPILE_FLAGS}
-parse-stdlib
LINK_FLAGS
${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}
INSTALL_IN_COMPONENT stdlib
MACCATALYST_BUILD_FLAVOR "zippered"
TARGET_SDKS OSX LINUX LINUX_STATIC
)