-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathCMakeLists.txt
72 lines (60 loc) · 2.9 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
cmake_minimum_required(VERSION 2.6.0)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
include(AppendCompilerFlags)
include(CheckSSE4_2)
## Project information ##
project(sdsl CXX C)
set(PROJECT_VEDOR "Simon Gog")
set(PROJECT_CONTACT "[email protected]")
set(PROJECT_URL "https://github.com/simongog/sdsl")
set(PROJECT_DESCRIPTION "SDSL: Succinct Data Structure Library")
set(CMAKE_BUILD_TYPE "Release")
## Project options ##
option(USE_LIBDIVSUFSORT "Use the libdivsufsort library of Yuta Mori to construct suffix arrays" ON)
if(USE_LIBDIVSUFSORT)
find_package(divsufsort)
find_package(divsufsort64)
else()
set( divsufsort_FOUND 0 )
set( divsufsort64_FOUND 0 )
endif()
if(NOT divsufsort_FOUND)
set( divsufsort_INCLUDE_DIRS "." )
message("WARNING: libdivsufsort is not installed! ")
message(" The build in default algorithm ")
message(" will use much more time and space")
message(" then libdivsufsort!")
endif()
if(NOT divsufsort64_FOUND)
set( divsufsort64_INCLUDE_DIRS "." )
message("WARNING: libdivsufsort64 is not installed! ")
message(" The build in default algorithm ")
message(" will use much more time and space")
message(" then libdivsufsort64!")
endif()
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" PROJECT_VERSION_FULL)
string(REGEX REPLACE "[\n\r]" "" PROJECT_VERSION_FULL "${PROJECT_VERSION_FULL}")
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+$" "\\1" PROJECT_VERSION_MAJOR "${PROJECT_VERSION_FULL}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+$" "\\1" PROJECT_VERSION_MINOR "${PROJECT_VERSION_FULL}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)$" "\\1" PROJECT_VERSION_PATCH "${PROJECT_VERSION_FULL}")
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
math(EXPR LIBRARY_VERSION_MAJOR "1 + ${PROJECT_VERSION_MAJOR}")
set(LIBRARY_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(LIBRARY_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(LIBRARY_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}")
set(LIBRARY_VERSION_FULL "${LIBRARY_VERSION}.${LIBRARY_VERSION_PATCH}")
#append_cxx_compiler_flags("-W -ffast-math -Wall -O9 -funroll-loops -DNDEBUG -DWRITE_R_OUTPUT -DMEM_INFO" "GCC" CMAKE_CXX_FLAGS)
#append_cxx_compiler_flags("-ffast-math -Wall -pedantic -enable-long-long -Weffc++ -O9 -funroll-loops -DNDEBUG -DWRITE_R_OUTPUT -DMEM_INFO" "GCC" CMAKE_CXX_FLAGS)
append_cxx_compiler_flags("-ffast-math -Wall -O9 -funroll-loops -DNDEBUG" "GCC" CMAKE_CXX_FLAGS)
if( BUILTIN_POPCNT )
append_cxx_compiler_flags("-msse4.2" "GCC" CMAKE_CXX_FLAGS)
message("CPU seems to support fast popcount.\n")
message("Flag -msse4.2 added to compile options.\n")
endif()
#append_cxx_compiler_flags("-Wall -ffast-math -Wall -g -DNDEBUG" "GCC" CMAKE_CXX_FLAGS)
add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(test)
add_subdirectory(examples)
message("Options")
message("USE_LIBDIVSUFSORT = ${USE_LIBDIVSUFSORT}")