-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from apple/cmake
Setup proper CMake for TSC
- Loading branch information
Showing
10 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
/*.xcodeproj | ||
xcuserdata/ | ||
.swiftpm | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cmake_minimum_required(VERSION 3.15.1) | ||
|
||
project(SwiftTSC LANGUAGES C Swift) | ||
|
||
set(SWIFT_VERSION 5) | ||
set(CMAKE_Swift_LANGUAGE_VERSION ${SWIFT_VERSION}) | ||
if(CMAKE_VERSION VERSION_LESS 3.16) | ||
add_compile_options($<$<COMPILE_LANGUAGE:Swift>:-swift-version$<SEMICOLON>${SWIFT_VERSION}>) | ||
endif() | ||
|
||
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
option(BUILD_SHARED_LIBS "Build shared libraryes by default" YES) | ||
|
||
add_subdirectory(Sources) | ||
add_subdirectory(cmake/modules) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_subdirectory(TSCclibc) | ||
add_subdirectory(TSCLibc) | ||
add_subdirectory(TSCBasic) | ||
add_subdirectory(TSCUtility) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
||
SRCROOT="`cd "${__dir}/..";pwd`" | ||
echo "SRCROOT is $SRCROOT" | ||
|
||
BUILD_DIR=$SRCROOT/build | ||
echo "BUILD_DIR is $BUILD_DIR" | ||
|
||
mkdir -p $BUILD_DIR | ||
cd $BUILD_DIR | ||
|
||
CMAKE_Swift_FLAGS="" | ||
if (uname | grep -qi darwin); then | ||
CMAKE_Swift_FLAGS="-sdk $(xcrun --sdk macosx --show-sdk-path)" | ||
fi | ||
|
||
set -x | ||
cmake \ | ||
-G Ninja \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_Swift_FLAGS="$CMAKE_Swift_FLAGS" \ | ||
$SRCROOT | ||
|
||
ninja |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set(TSC_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/TSCExports.cmake) | ||
configure_file(TSCConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/TSCConfig.cmake) | ||
|
||
get_property(TSC_EXPORTS GLOBAL PROPERTY TSC_EXPORTS) | ||
export(TARGETS ${TSC_EXPORTS} FILE ${TSC_EXPORTS_FILE}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include(@TSC_EXPORTS_FILE@) |