File tree Expand file tree Collapse file tree 10 files changed +77
-6
lines changed Expand file tree Collapse file tree 10 files changed +77
-6
lines changed Original file line number Diff line number Diff line change 4
4
/* .xcodeproj
5
5
xcuserdata /
6
6
.swiftpm
7
+ build
Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 3.15.1 )
2
+
3
+ project (SwiftTSC LANGUAGES C Swift )
4
+
5
+ set (SWIFT_VERSION 5 )
6
+ set (CMAKE_Swift_LANGUAGE_VERSION ${SWIFT_VERSION} )
7
+ if (CMAKE_VERSION VERSION_LESS 3.16 )
8
+ add_compile_options ($< $< COMPILE_LANGUAGE:Swift> :-swift-version$< SEMICOLON> ${SWIFT_VERSION} > )
9
+ endif ()
10
+
11
+ set (CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR} /swift )
12
+
13
+ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
14
+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
15
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /bin )
16
+
17
+ option (BUILD_SHARED_LIBS "Build shared libraryes by default" YES )
18
+
19
+ add_subdirectory (Sources )
20
+ add_subdirectory (cmake/modules )
Original file line number Diff line number Diff line change
1
+ add_subdirectory (TSCclibc )
2
+ add_subdirectory (TSCLibc )
3
+ add_subdirectory (TSCBasic )
4
+ add_subdirectory (TSCUtility )
Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ target_link_libraries(TSCBasic PUBLIC
55
55
set_target_properties (TSCBasic PROPERTIES
56
56
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY} )
57
57
58
+ set_property (GLOBAL APPEND PROPERTY TSC_EXPORTS TSCBasic )
59
+
58
60
install (TARGETS TSCBasic
59
61
ARCHIVE DESTINATION lib
60
62
LIBRARY DESTINATION lib
Original file line number Diff line number Diff line change 8
8
9
9
add_library (TSCLibc
10
10
libc.swift )
11
- target_compile_options (TSCLibc PRIVATE
12
- -autolink-force-load )
11
+
12
+ if (CMAKE_SYSTEM_NAME STREQUAL Windows )
13
+ target_compile_options (TSCLibc PRIVATE
14
+ -autolink-force-load )
15
+ endif ()
13
16
target_link_libraries (TSCLibc PUBLIC
14
- clibc )
17
+ TSCclibc )
15
18
# NOTE(compnerd) workaround for CMake not setting up include flags yet
16
19
set_target_properties (TSCLibc PROPERTIES
17
20
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY} )
18
21
22
+ set_property (GLOBAL APPEND PROPERTY TSC_EXPORTS TSCLibc )
23
+
19
24
install (TARGETS TSCLibc
20
25
ARCHIVE DESTINATION lib
21
26
LIBRARY DESTINATION lib
Original file line number Diff line number Diff line change @@ -34,3 +34,5 @@ target_link_libraries(TSCUtility PUBLIC
34
34
# NOTE(compnerd) workaround for CMake not setting up include flags yet
35
35
set_target_properties (TSCUtility PROPERTIES
36
36
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY} )
37
+
38
+ set_property (GLOBAL APPEND PROPERTY TSC_EXPORTS TSCUtility )
Original file line number Diff line number Diff line change 6
6
# See http://swift.org/LICENSE.txt for license information
7
7
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8
8
9
- add_library (clibc STATIC
9
+ add_library (TSCclibc STATIC
10
10
libc.c )
11
- target_include_directories (clibc PUBLIC
11
+ target_include_directories (TSCclibc PUBLIC
12
12
include )
13
13
14
14
if (NOT BUILD_SHARED_LIBS )
15
- install (TARGETS clibc
15
+ install (TARGETS TSCclibc
16
16
ARCHIVE DESTINATION lib )
17
17
endif ()
18
+
19
+ set_property (GLOBAL APPEND PROPERTY TSC_EXPORTS TSCclibc )
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -eu
4
+
5
+ __dir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
6
+
7
+ SRCROOT=" ` cd " ${__dir} /.." ; pwd` "
8
+ echo " SRCROOT is $SRCROOT "
9
+
10
+ BUILD_DIR=$SRCROOT /build
11
+ echo " BUILD_DIR is $BUILD_DIR "
12
+
13
+ mkdir -p $BUILD_DIR
14
+ cd $BUILD_DIR
15
+
16
+ CMAKE_Swift_FLAGS=" "
17
+ if (uname | grep -qi darwin); then
18
+ CMAKE_Swift_FLAGS=" -sdk $( xcrun --sdk macosx --show-sdk-path) "
19
+ fi
20
+
21
+ set -x
22
+ cmake \
23
+ -G Ninja \
24
+ -DCMAKE_BUILD_TYPE=Debug \
25
+ -DCMAKE_Swift_FLAGS=" $CMAKE_Swift_FLAGS " \
26
+ $SRCROOT
27
+
28
+ ninja
Original file line number Diff line number Diff line change
1
+ set (TSC_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR} /TSCExports.cmake )
2
+ configure_file (TSCConfig.cmake.in
3
+ ${CMAKE_CURRENT_BINARY_DIR} /TSCConfig.cmake )
4
+
5
+ get_property (TSC_EXPORTS GLOBAL PROPERTY TSC_EXPORTS )
6
+ export (TARGETS ${TSC_EXPORTS} FILE ${TSC_EXPORTS_FILE} )
Original file line number Diff line number Diff line change
1
+ include (@TSC_EXPORTS_FILE@ )
You can’t perform that action at this time.
0 commit comments