This repository has been archived by the owner on May 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
151 lines (141 loc) · 2.8 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# 3.10 required for some of these compiler options
# such as CXX_STANDARD 17 for MSVC
cmake_minimum_required( VERSION 3.10 )
project( MapleTools VERSION 1.0.0 LANGUAGES C CXX )
### Verbosity
set( CMAKE_COLOR_MAKEFILE ON )
set( CMAKE_VERBOSE_MAKEFILE ON )
# Generate 'compile_commands.json' for clang_complete
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
## Threads
find_package( Threads REQUIRED )
## mio: Multiplatform memory mapped IO
add_subdirectory(
dependencies/mio
)
### Targets
## Maple 2 library
add_library(
Maple2
STATIC
source/Maple2/Keys.cpp
source/Maple2/Util.cpp
)
target_include_directories(
Maple2
PUBLIC
include
)
set_target_properties(
Maple2
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS ON
)
if(MSVC)
include(dependencies/DownloadProject/DownloadProject.cmake)
download_project(
PROJ cryptopp
GIT_REPOSITORY [email protected]:weidai11/cryptopp.git
GIT_TAG master
PREFIX cryptopp
)
# Copy files from cryptopp-cmake to the working sources dir
configure_file(
dependencies/cryptopp-cmake/CMakeLists.txt
${CMAKE_BINARY_DIR}/cryptopp/cryptopp-src/CMakeLists.txt COPYONLY
)
configure_file(
dependencies/cryptopp-cmake/cryptopp-config.cmake
${CMAKE_BINARY_DIR}/cryptopp/cryptopp-src/cryptopp-config.cmake COPYONLY
)
add_subdirectory(
${CMAKE_BINARY_DIR}/cryptopp/cryptopp-src ${CMAKE_BINARY_DIR}/cryptopp/cryptopp-build
)
# create includes
file(
GLOB cryptopp_HEADERS
"${CMAKE_BINARY_DIR}/cryptopp/cryptopp-src/*.h"
)
file(
COPY ${cryptopp_HEADERS}
DESTINATION ${CMAKE_BINARY_DIR}/cryptopp/include/cryptopp
)
target_include_directories(
Maple2
PRIVATE
${CMAKE_BINARY_DIR}/cryptopp/include/
)
target_link_libraries(
Maple2
PRIVATE
cryptopp-static
)
else()
target_link_libraries(
Maple2
PRIVATE
cryptopp
)
endif()
## Expands .m2h/.m2d files into folder and "flattens" the virtual file system
add_executable(
Expand
tools/Expand.cpp
)
set_target_properties(
Expand
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS ON
)
target_include_directories(
Expand
PRIVATE
dependencies/Clara/include
)
target_link_libraries(
Expand
PRIVATE
Maple2
mio
${CMAKE_THREAD_LIBS_INIT}
)
## Packs a folder into a .m2h/.m2d pair
add_executable(
Pack
tools/Pack.cpp
)
set_target_properties(
Pack
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS ON
)
target_link_libraries(
Pack
PRIVATE
Maple2
${CMAKE_THREAD_LIBS_INIT}
)
# Link filesystem libs for GCC/Clang
if( CMAKE_COMPILER_IS_GNUCXX )
target_link_libraries(
Maple2
PRIVATE
stdc++fs
)
target_link_libraries(
Pack
PRIVATE
stdc++fs
)
target_link_libraries(
Expand
PRIVATE
stdc++fs
)
endif()