-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
70 lines (56 loc) · 2.11 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.9)
project(StickyLocking LANGUAGES NONE)
message(STATUS "Configuring StickyLocking for ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "")
# Git tag
set(BUILD_TOOLS_VERSION 1.2.0)
include(ExternalProject)
ExternalProject_Add(
build-tools
PREFIX build-tools
# DOWNLOAD_COMMAND ""
# SOURCE_DIR ../../build-tools
GIT_REPOSITORY https://github.com/tonystone/build-tools.git
GIT_TAG ${BUILD_TOOLS_VERSION}
UPDATE_COMMAND "" # Note: since there is no update step, installing the tools will only happen once even if you change the version. To force install, remove the external/build-tools directory.
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
EXCLUDE_FROM_ALL true
)
#
# Build tool paths.
#
set(BUILD_TOOLS_ROOT "${CMAKE_CURRENT_BINARY_DIR}/build-tools/build-tools")
set(BUILD_TOOLS_BIN "${BUILD_TOOLS_ROOT}/bin")
# Look for modules in the our root.
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
include(Gyb)
#
# Clean the package
#
add_custom_target(build-clean
COMMAND swift package clean
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
#
# Build xcode project Target
#
add_custom_target(xcode-project
DEPENDS build-tools generate-source generate-tests
COMMAND swift package generate-xcodeproj --xcconfig-overrides Package.xcconfig --enable-code-coverage
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
SOURCES Package.swift)
#
# Build xcode workspace Target which includes the playground
#
add_custom_target(xcode-workspace
DEPENDS build-tools xcode-project StickyLocking-Playground.playground
COMMAND "${BUILD_TOOLS_BIN}/xcworkspace_tool.rb" StickyLocking StickyLocking.xcodeproj StickyLocking-Playground.playground
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
add_custom_target(documentation
DEPENDS xcode-project generate-source
COMMAND jazzy --clean
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
add_subdirectory(Sources)
add_subdirectory(Tests)