-
Notifications
You must be signed in to change notification settings - Fork 294
/
CMakeLists.txt
66 lines (58 loc) · 2.53 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#[[
This source file is part of the Swift Collections Open Source Project
Copyright (c) 2021 - 2024 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
#]]
if(COLLECTIONS_SINGLE_MODULE)
if (COLLECTIONS_FOUNDATION_TOOLCHAIN_MODULE)
set(COLLECTIONS_MODULE_NAME _FoundationCollections)
set(COLLECTIONS_MODULE_TYPE STATIC)
else()
set(COLLECTIONS_MODULE_NAME Collections)
set(COLLECTIONS_MODULE_TYPE)
endif()
add_library(${COLLECTIONS_MODULE_NAME} ${COLLECTIONS_MODULE_TYPE})
if(COLLECTIONS_FOUNDATION_TOOLCHAIN_MODULE)
target_compile_options(${COLLECTIONS_MODULE_NAME} PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -allowable-client -Xfrontend FoundationEssentials>")
endif()
target_compile_definitions(${COLLECTIONS_MODULE_NAME} PRIVATE COLLECTIONS_SINGLE_MODULE)
set_target_properties(${COLLECTIONS_MODULE_NAME} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
if(COLLECTIONS_FOUNDATION_TOOLCHAIN_MODULE)
get_swift_host_os(swift_os)
if(BUILD_SHARED_LIBS)
# Install only the swift module and not the library
set(swift swift)
else()
# Install both the swift module and the binary
set(swift swift_static)
install(TARGETS ${COLLECTIONS_MODULE_NAME}
ARCHIVE DESTINATION lib/swift_static/${swift_os}
LIBRARY DESTINATION lib/swift_static/${swift_os}
RUNTIME DESTINATION bin)
endif()
get_swift_host_arch(swift_arch)
install(FILES $<TARGET_PROPERTY:${COLLECTIONS_MODULE_NAME},Swift_MODULE_DIRECTORY>/${COLLECTIONS_MODULE_NAME}.swiftdoc
DESTINATION lib/${swift}/${swift_os}/${COLLECTIONS_MODULE_NAME}.swiftmodule
RENAME ${swift_arch}.swiftdoc)
install(FILES $<TARGET_PROPERTY:${COLLECTIONS_MODULE_NAME},Swift_MODULE_DIRECTORY>/${COLLECTIONS_MODULE_NAME}.swiftmodule
DESTINATION lib/${swift}/${swift_os}/${COLLECTIONS_MODULE_NAME}.swiftmodule
RENAME ${swift_arch}.swiftmodule)
else()
_install_target(${COLLECTIONS_MODULE_NAME})
endif()
set_property(GLOBAL APPEND PROPERTY SWIFT_COLLECTIONS_EXPORTS ${COLLECTIONS_MODULE_NAME})
else()
add_subdirectory(Collections)
endif()
if(NOT COLLECTIONS_FOUNDATION_TOOLCHAIN_MODULE)
add_subdirectory(BitCollections)
add_subdirectory(DequeModule)
add_subdirectory(HashTreeCollections)
add_subdirectory(HeapModule)
endif()
add_subdirectory(OrderedCollections)
add_subdirectory(RopeModule)
add_subdirectory(InternalCollectionsUtilities)