forked from pdinklag/tdc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
84 lines (70 loc) · 2.51 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
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
project(tdc)
# enable tests
enable_testing()
# include CMake modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules")
# extlib
set(TDC_EXTLIB_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extlib")
set(TDC_EXTLIB_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/extlib")
# compiler
set(GCC_MIN_VERSION "10.1")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_MIN_VERSION)
message(FATAL_ERROR "GCC version must be at least ${GCC_MIN_VERSION}!")
else()
message(STATUS "Using GCC version ${CMAKE_CXX_COMPILER_VERSION}")
endif()
endif()
# build flags
set(CXX_STANDARD c++20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=gnu++20 ${GCC_WARNINGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb")
# build type
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE not defined - defaulting to Debug.")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
message(STATUS "CMAKE_BUILD_TYPE is Release")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
message(STATUS "CMAKE_BUILD_TYPE is RelWithDebInfo")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
message(STATUS "CMAKE_BUILD_TYPE is Debug")
else()
message(FATAL_ERROR "Unsupported CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()
# data types
set(CHAR_T "unsigned char" CACHE STRING "The type to use for char_t")
message(STATUS "CHAR_T is ${CHAR_T}")
add_definitions(-DCHAR_T=${CHAR_T})
set(INDEX_T "uint64_t" CACHE STRING "The type to use for index_t")
message(STATUS "INDEX_T is ${INDEX_T}")
add_definitions(-DINDEX_T=${INDEX_T})
# init submodules
include(InitSubmodules)
# include extlibs
include_directories(${TDC_EXTLIB_SOURCE_DIR}/ips4o)
include_directories(${TDC_EXTLIB_SOURCE_DIR}/json/single_include)
add_subdirectory(${TDC_EXTLIB_SOURCE_DIR}/libdivsufsort)
include_directories(${TDC_EXTLIB_SOURCE_DIR}/robin-hood-hashing/src/include)
add_subdirectory(${TDC_EXTLIB_SOURCE_DIR}/tlx)
include_directories(${TDC_EXTLIB_SOURCE_DIR}/tlx)
# find optional packages
find_package(BZip2)
if(BZIP2_FOUND)
add_definitions(-DBZIP2_FOUND)
endif()
find_package(MPFR)
find_package(LEDA)
find_package(Plads)
find_package(Powercap)
find_package(STree)
# include
include_directories(${CMAKE_SOURCE_DIR}/include)
# subdirectories
add_subdirectory(benchmark)
add_subdirectory(docs)
add_subdirectory(examples)
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(tools)