-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswift-build-system.patch
72 lines (72 loc) · 3.11 KB
/
swift-build-system.patch
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
67
68
69
70
71
72
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 8046ea79966..cd4fa6e673b 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -17,3 +17,54 @@ configure_file(
SwiftConfig.cmake.in
${swift_cmake_builddir}/SwiftConfig.cmake
@ONLY)
+
+# Generate install-tree CMake files
+set(SWIFT_CONFIG_CODE "
+# Compute the installation prefix from this SwiftConfig.cmake file location.
+get_filename_component(SWIFT_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
+# Construct the proper number of get_filename_component(... PATH)
+# calls to compute the installation prefix.
+string(REGEX REPLACE "/" ";" _count "${SWIFT_INSTALL_PACKAGE_DIR}")
+foreach(p ${_count})
+ set(SWIFT_CONFIG_CODE "${SWIFT_CONFIG_CODE}
+get_filename_component(SWIFT_INSTALL_PREFIX \"\${SWIFT_INSTALL_PREFIX}\" PATH)")
+endforeach(p)
+set(SWIFT_INCLUDE_DIRS "\${SWIFT_INSTALL_PREFIX}/include")
+set(SWIFT_LIBRARY_DIRS "\${SWIFT_INSTALL_PREFIX}/lib")
+set(SWIFT_CMAKE_DIR "\${SWIFT_INSTALL_PREFIX}/${SWIFT_INSTALL_PACKAGE_DIR}")
+set(SWIFT_BINARY_DIR "\${SWIFT_INSTALL_PREFIX}")
+
+set(SWIFT_EXPORTS_FILE "\${SWIFT_CMAKE_DIR}/SwiftExports.cmake")
+set(SWIFT_CONFIG_EXPORTS ${SWIFT_EXPORTS})
+
+install(TARGETS ${SWIFT_CONFIG_EXPORTS}
+ DESTINATION .
+ EXPORT SwiftExports
+ COMPONENT dev)
+
+include(CMakePackageConfigHelpers)
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/SwiftConfig.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/SwiftConfig.cmake"
+ INSTALL_DESTINATION ${SWIFT_INSTALL_PACKAGE_DIR}/cmake/swift)
+
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/SwiftConfig.cmake
+ DESTINATION ${SWIFT_INSTALL_PACKAGE_DIR})
+
+install(EXPORT SwiftExports DESTINATION ${SWIFT_INSTALL_PACKAGE_DIR})
+
+# installing each header individually to preserve the directory structure
+macro(install_headers directory ext)
+ file(GLOB_RECURSE headers RELATIVE ${directory} ${directory}/*.${ext})
+ foreach(header ${headers})
+ get_filename_component(dir ${header} DIRECTORY)
+ install(FILES ${directory}/${header} DESTINATION ${SWIFT_INCLUDE_DIRS}/${dir})
+ endforeach()
+endmacro()
+install_headers(${SWIFT_INCLUDE_DIR} h)
+install_headers(${SWIFT_MAIN_INCLUDE_DIR} h)
+install_headers(${SWIFT_INCLUDE_DIR} def)
+install_headers(${SWIFT_MAIN_INCLUDE_DIR} def)
+
+install(DIRECTORY ${CMAKE_SOURCE_DIR}/stdlib/public/SwiftShims DESTINATION stdlib/public)
+
diff --git a/cmake/modules/SwiftComponents.cmake b/cmake/modules/SwiftComponents.cmake
index 4d77e374deb..88b6645a811 100644
--- a/cmake/modules/SwiftComponents.cmake
+++ b/cmake/modules/SwiftComponents.cmake
@@ -76,7 +76,7 @@ set(_SWIFT_DEFINED_COMPONENTS
# for the following exceptions.
set(_SWIFT_DEFAULT_COMPONENTS "${_SWIFT_DEFINED_COMPONENTS}")
# 'dev' takes up a lot of disk space and isn't part of a normal toolchain.
-list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "dev")
+#list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "dev")
# These clang header options conflict with 'clang-builtin-headers'.
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "clang-resource-dir-symlink")
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "clang-builtin-headers-in-clang-resource-dir")