forked from compnerd/swift-win32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (53 loc) · 2.31 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
#[[
Copyright © 2019 Saleem Abdulrasool <[email protected]>
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
#]]
cmake_minimum_required(VERSION 3.16.0)
project(SwiftWin32
LANGUAGES C Swift)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
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)
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
find_package(dispatch CONFIG QUIET)
find_package(Foundation CONFIG QUIET)
find_package(Git REQUIRED)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMODULE_UPDATE_RESULT)
if(NOT GIT_SUBMODULE_UPDATE_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMODULE_UPDATE_RESULT}, please checkout submodules")
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Packages/Cassowary"
OUTPUT_VARIABLE CASSOWARY_GIT_REVISION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Packages/SwiftCOM"
OUTPUT_VARIABLE SWIFT_COM_GIT_REVISION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Packages/swift-log"
OUTPUT_VARIABLE SWIFT_LOG_GIT_REVISION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Packages/swift-collections"
OUTPUT_VARIABLE COLLECTIONS_GIT_REVISION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
include(SwiftSupport)
add_subdirectory(Packages/swift-collections)
add_subdirectory(Sources)
add_subdirectory(Examples)
message("-- Building with sub-modules:")
message("-- Cassowary rG${CASSOWARY_GIT_REVISION}")
message("-- Swift/COM rG${SWIFT_COM_GIT_REVISION}")
message("-- swift-log rG${SWIFT_LOG_GIT_REVISION}")
message("-- Collections rG${COLLECTIONS_GIT_REVISION}")
export(TARGETS SwiftCOM SwiftWin32
FILE SwiftWin32Config.cmake)