-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
CMakeLists.txt
97 lines (75 loc) · 3.29 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
cmake_minimum_required(VERSION 3.20)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake-d/cmake-d)
project(Provision D)
option(build_anisetteserver "Build Anisette server" ON)
option(build_mkcassette "Build mkcassette" OFF)
option(use_native_plist "Want dlang plist" OFF)
option(link_libplist_dynamic "Load libplist at runtime" OFF)
include(cmake/dependencies.cmake)
set(PROVISION_SOURCE_DIR "lib/")
file(GLOB_RECURSE PROVISION_D_SOURCES "${PROVISION_SOURCE_DIR}*.d")
find_package(PkgConfig REQUIRED)
add_library(provision STATIC ${PROVISION_D_SOURCES})
target_include_directories(provision PUBLIC ${PROVISION_SOURCE_DIR})
if (link_libplist_dynamic)
target_compile_versions(provision PUBLIC LibPlist)
include(UseDub)
FetchContent_Declare(
plist_proj
GIT_REPOSITORY https://github.com/Dadoum/libplist-d
GIT_TAG d494cf3fe79a2bb20583173c0c8cf85ef33b719e
PATCH_COMMAND ${DUB_DIRECTORY}/CMakeTmp/DubToCMake -c dynamic -s plist-d
)
FetchContent_MakeAvailable(plist_proj)
add_library(plist ALIAS plist-d)
else()
if(NOT CMAKE_CROSSCOMPILING)
pkg_check_modules(plist IMPORTED_TARGET libplist-2.0)
if (NOT plist_FOUND)
pkg_check_modules(plist IMPORTED_TARGET libplist)
endif()
endif()
if (plist_FOUND AND NOT use_native_plist)
message("Using libplist. ")
target_compile_versions(provision PUBLIC LibPlist)
include(UseDub)
FetchContent_Declare(
plist_proj
GIT_REPOSITORY https://github.com/Dadoum/libplist-d
GIT_TAG 30d152e88767611e10048b25777ecb5f9075f87c
PATCH_COMMAND ${DUB_DIRECTORY}/CMakeTmp/DubToCMake -c static -s plist-d
)
FetchContent_MakeAvailable(plist_proj)
add_library(plist INTERFACE)
target_link_libraries(plist INTERFACE PkgConfig::plist plist-d)
else()
message(WARNING "Using fallback Property list parser. ")
include(UseDub)
FetchContent_Declare(
plist_proj
GIT_REPOSITORY https://github.com/hatf0/plist
PATCH_COMMAND ${DUB_DIRECTORY}/CMakeTmp/DubToCMake -s plist
)
FetchContent_MakeAvailable(plist_proj)
endif()
endif()
target_link_libraries(provision PUBLIC plist slf4d requests)
set(RETRIEVE_HEADERS_SOURCE_DIR "retrieve_headers/")
file(GLOB_RECURSE RETRIEVE_HEADERS_D_SOURCES "${RETRIEVE_HEADERS_SOURCE_DIR}*.d")
add_executable(retrieve_headers ${RETRIEVE_HEADERS_D_SOURCES})
target_include_directories(retrieve_headers PUBLIC ${RETRIEVE_HEADERS_SOURCE_DIR})
target_link_libraries(retrieve_headers provision)
if(build_anisetteserver)
set(ANISETTE_SERVER_SOURCE_DIR "anisette_server/")
file(GLOB_RECURSE ANISETTE_SERVER_D_SOURCES "${ANISETTE_SERVER_SOURCE_DIR}*.d")
add_executable(anisette_server ${ANISETTE_SERVER_D_SOURCES})
target_include_directories(anisette_server PUBLIC ${ANISETTE_SERVER_SOURCE_DIR})
target_link_libraries(anisette_server provision handy-httpd)
endif()
if(build_mkcassette)
set(MKCASSETTE_SOURCE_DIR "mkcassette/")
file(GLOB_RECURSE MKCASSETTE_D_SOURCES "${MKCASSETTE_SOURCE_DIR}*.d")
add_executable(mkcassette ${MKCASSETTE_D_SOURCES})
target_include_directories(mkcassette PUBLIC ${MKCASSETTE_SOURCE_DIR})
target_link_libraries(mkcassette provision)
endif()