File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -42,3 +42,24 @@ add_dependencies(swiftClangImporter
42
42
${CLANG_TABLEGEN_TARGETS} )
43
43
44
44
set_swift_llvm_is_available (swiftClangImporter )
45
+
46
+ # Mark - copy "cxx-interop.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} /cxx-interop.h"
53
+ COMMAND "${CMAKE_COMMAND} " "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR} /cxx-interop.h" "${SWIFTINC_DIR} " )
54
+
55
+ add_custom_target ("copy_cxxInterop_support_header"
56
+ DEPENDS "${SWIFTINC_DIR} /cxx-interop.h"
57
+ COMMENT "Copying C++ interop support header to ${SWIFTINC_DIR} " )
58
+
59
+ swift_install_in_component (FILES "${CMAKE_CURRENT_SOURCE_DIR} /cxx-interop.h"
60
+ TARGET ${SWIFT_CLANG_RESOURCE_DIR_SYMLINK_INSTALL_TARGET}
61
+ DESTINATION "include/swift"
62
+ COMPONENT compiler )
63
+
64
+ add_dependencies (swiftClangImporter
65
+ "copy_cxxInterop_support_header" )
Original file line number Diff line number Diff line change
1
+ // ===--- cxx-interop.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_CXX_INTEROP_H
18
+ #define SWIFT_CLANGIMPORTER_CXX_INTEROP_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 REFERENCE (_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_CXX_INTEROP_H
You can’t perform that action at this time.
0 commit comments