File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -42,3 +42,23 @@ add_dependencies(swiftClangImporter
42
42
${CLANG_TABLEGEN_TARGETS} )
43
43
44
44
set_swift_llvm_is_available (swiftClangImporter )
45
+
46
+ # Mark - copy "swift-interop-support.h" into the local include directory and install it
47
+ # into the compiler toolchain.
48
+ set (SWIFTINC_DIR
49
+ "${CMAKE_BINARY_DIR} /${CMAKE_CFG_INTDIR} /include/swift" )
50
+
51
+ add_custom_command (
52
+ OUTPUT "${SWIFTINC_DIR} /swift-interop-support.h"
53
+ COMMAND "${CMAKE_COMMAND} " "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR} /swift-interop-support.h" "${SWIFTINC_DIR} " )
54
+
55
+ add_custom_target ("copy_cxxInterop_support_header"
56
+ DEPENDS "${SWIFTINC_DIR} /swift-interop-support.h"
57
+ COMMENT "Copying C++ interop support header to ${SWIFTINC_DIR} " )
58
+
59
+ swift_install_in_component (FILES "${CMAKE_CURRENT_SOURCE_DIR} /swift-interop-support.h"
60
+ DESTINATION "include/swift"
61
+ COMPONENT compiler )
62
+
63
+ add_dependencies (swiftClangImporter
64
+ "copy_cxxInterop_support_header" )
Original file line number Diff line number Diff line change
1
+ // ===--- swift-interop-support.h - C++ and Swift Interop --------*- C++ -*-===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ // ===----------------------------------------------------------------------===//
12
+ //
13
+ // This file provides common utilities and annotations that are useful for C++
14
+ // codebases that interoperate with Swift.
15
+ //
16
+ // ===----------------------------------------------------------------------===//
17
+ #ifndef SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H
18
+ #define SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H
19
+
20
+ #define SELF_CONTAINED __attribute__ ((swift_attr(" import_owned" )))
21
+ #define SAFE_TO_IMPORT __attribute__ ((swift_attr(" import_unsafe" )))
22
+
23
+ #define _CXX_INTEROP_STRINGIFY (_x ) #_x
24
+ #define SWIFT_REFERENCE_TYPE (_retain, _release ) \
25
+ __attribute__ ((swift_attr(" import_reference" ))) \
26
+ __attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(retain:_retain)))) \
27
+ __attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(release:_release))))
28
+
29
+ #define SWIFT_NAME (_name ) __attribute__((swift_name(#_name)))
30
+
31
+ #endif // SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H
You can’t perform that action at this time.
0 commit comments