-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
190 lines (159 loc) · 4.54 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#
# CMAKELISTS.TXT
# --------------
#
# Build file for JASS, including all the tools
# Copyright (c) 2016 Andrew Trotman
#
# Released under the 2-clause BSD license (See:https://en.wikipedia.org/wiki/BSD_licenses)
#
# Current supported build targets include:
# make refresh_externals
# This will re-download any external tools that are used as part of JASS. This is usefule when,
# for example, some external tool has been updated. The initial use case was UnicodeData.txt the
# data file that describes all the Unicode characters - which is used for the isalpha() and similar
# methods.
project(JASS)
#
#CMake verison 3.2 is required to set CMAKE_CXX_STANDARD to C++14.
#
cmake_minimum_required (VERSION 3.8)
# set(CMAKE_VERBOSE_MAKEFILE on)
#
# default is release build, unless specified on the command line using FORCE_CMAKE_BUILD_TYPE
#
if (NOT FORCE_CMAKE_BUILD_TYPE)
# set(CMAKE_BUILD_TYPE Debug)
# set(CMAKE_CONFIGURATION_TYPES Debug)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CONFIGURATION_TYPES Release)
else()
set(CMAKE_BUILD_TYPE ${FORCE_CMAKE_BUILD_TYPE})
set(CMAKE_CONFIGURATION_TYPES ${FORCE_CMAKE_BUILD_TYPE})
endif()
unset(FORCE_CMAKE_BUILD_TYPE CACHE)
message("Build Type:" ${CMAKE_BUILD_TYPE})
# add_definitions(-DUSE_CRT_MALLOC)
# add_definitions("-g -flto")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g -flto")
#
# Add these lines for clang coverage build
#
# add_definitions("-fprofile-instr-generate -fcoverage-mapping")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
#
# These lines add an externally configured #define to the compile line
#
if (JASS_EXTERNAL_DEFINE)
message("Adding compile parameter:" ${JASS_EXTERNAL_DEFINE})
add_definitions(${JASS_EXTERNAL_DEFINE})
endif()
#
# Set the debug flags based on the compiler
# _GLIBCXX_USE_CXX11_ABI=1 is necessary for g++ to allow C++ stateful custom allocators in std::string
#
if(WIN32)
add_definitions("/W3 /wd4005 /wd4996 /wd4514 /wd4996 /wd4820 /nologo")
else()
add_definitions("-Wall -fPIC -D_GLIBCXX_USE_CXX11_ABI=1 -Wno-ignored-attributes -Wno-deprecated-declarations")
endif()
#
# Add AVX and BMI use.
#
if(WIN32)
#
# At present (December 2018) appveyor builds do not support AVX512
#
if($ENV{APPVEYOR})
add_definitions("-D__AVX2__=1")
else()
#
# At present (August 2019) this desktop doesn not support AVX512
#
if($ENV{PROCESSOR_IDENTIFIER} STREQUAL "Intel64 Family 6 Model 23 Stepping 6, GenuineIntel")
add_definitions("-D__AVX2__=1")
else()
add_definitions("-D__AVX512F__=1")
endif()
endif()
else()
add_definitions(-march=native -mbmi -mavx2)
endif()
#
# Compatibility with the FileSystem libraries for g++ prior to verison 9
#
if(UNIX AND NOT APPLE)
message("Adding stdc++fs library for early g++ compatibility")
link_libraries(stdc++fs)
endif()
#
# If we're in Debug mode then enble the DEBUG macro'
#
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DDEBUG)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Threads)
#
# Download any external dependencies and get the include paths set up
#
add_subdirectory(external)
include_directories(source ${ZSTD_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR_2})
#
# Build the toolset
#
add_subdirectory(tools)
#
# Build the JASS library
#
add_subdirectory(source)
#
# Build the documentation examples
#
add_subdirectory(examples)
#
# build the unit tests
#
add_executable(unittest tools/unittest.cpp)
target_link_libraries(unittest JASSlib ${ZLIB_STATIC_LIB} ${ZSTD_STATIC_LIB} ${CMAKE_THREAD_LIBS_INIT})
#
# build the indexer
#
add_executable(JASS_index tools/JASS_index.cpp)
target_link_libraries(JASS_index JASSlib ${ZLIB_STATIC_LIB} ${CMAKE_THREAD_LIBS_INIT})
#
# build the compiled_indexes stubs
#
add_subdirectory(compiled_index)
#
# build the anytime search engine (JASS v1 re-implemented)
#
add_subdirectory(anytime)
#
# build the experimental components
#
add_subdirectory(experimental)
#
# build the checksummer
#
add_executable(hash tools/hash.cpp)
target_link_libraries(hash JASSlib ${CMAKE_THREAD_LIBS_INIT})
#
# Build the documentation with Doxygen (but Apple's HeaderDoc also works)
#
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_SOURCE_DIR}/build/Doxyfile @ONLY)
add_custom_target(
docs ${DOXYGEN_EXECUTABLE}
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dox
VERBATIM
)
endif(DOXYGEN_FOUND)
#
# Do this to build for debugging:
#
#cmake -D FORCE_CMAKE_BUILD_TYPE=Debug ..
#