forked from swiftlang/swift-foundation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (51 loc) · 2.2 KB
/
Copy pathCMakeLists.txt
File metadata and controls
59 lines (51 loc) · 2.2 KB
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
##===----------------------------------------------------------------------===##
##
## This source file is part of the Swift open source project
##
## Copyright (c) 2024 Apple Inc. and the Swift project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.md for the list of Swift project authors
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##
# SwiftSyntax Dependency
include(FetchContent)
find_package(SwiftSyntax)
if(NOT SwiftSyntax_FOUND)
# If building at desk, check out and link against the SwiftSyntax repo's targets
FetchContent_Declare(SwiftSyntax
GIT_REPOSITORY https://github.com/swiftlang/swift-syntax.git
GIT_TAG 4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c) # 600.0.0-prerelease-2024-06-12
FetchContent_MakeAvailable(SwiftSyntax)
endif()
add_library(FoundationMacros SHARED
FoundationMacros.swift
PredicateMacro.swift)
target_compile_definitions(FoundationMacros PRIVATE FOUNDATION_MACROS_LIBRARY)
set_target_properties(FoundationMacros
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/lib
)
target_link_libraries(FoundationMacros PUBLIC
SwiftSyntax::SwiftSyntax
SwiftSyntax::SwiftSyntaxMacros
SwiftSyntax::SwiftDiagnostics
SwiftSyntax::SwiftSyntaxBuilder
)
set_target_properties(FoundationMacros PROPERTIES
INSTALL_RPATH "$ORIGIN"
INSTALL_REMOVE_ENVIRONMENT_RPATH ON)
target_compile_options(FoundationMacros PRIVATE -parse-as-library)
target_compile_options(FoundationMacros PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend AccessLevelOnImport>"
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend StrictConcurrency>"
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-upcoming-feature -Xfrontend InferSendableFromCaptures>")
install(TARGETS FoundationMacros
ARCHIVE DESTINATION lib/swift/host/plugins
LIBRARY DESTINATION lib/swift/host/plugins
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})