forked from ot/succinct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
68 lines (55 loc) · 1.82 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
cmake_minimum_required(VERSION 2.6)
project(SUCCINCT)
configure_file(
${SUCCINCT_SOURCE_DIR}/succinct_config.hpp.in
${SUCCINCT_SOURCE_DIR}/succinct_config.hpp)
option(SUCCINCT_USE_LIBCXX
"Use libc++ with Clang instead of libstdc++ (must be same as that used to compile Boost)"
OFF)
option(SUCCINCT_USE_INTRINSICS
"Use a set of intrinsics available on all x86-64 architectures"
ON)
option(SUCCINCT_USE_POPCNT
"Use popcount intrinsic. Available on x86-64 since SSE4.2."
OFF)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (SUCCINCT_USE_LIBCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif ()
endif ()
if (SUCCINCT_USE_POPCNT)
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
endif ()
# XXX(ot): what to do for MSVC?
endif ()
# XXX(ot): enable this on all compilers
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-braces")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion")
endif ()
find_package(Boost 1.42.0 COMPONENTS
unit_test_framework iostreams system filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories (${Boost_LIBRARY_DIRS})
include_directories(${PROJECT_SOURCE_DIR})
set(SUCCINCT_SOURCES
rs_bit_vector.cpp
bp_vector.cpp
)
add_library(succinct STATIC ${SUCCINCT_SOURCES})
add_subdirectory(perftest)
# make and run tests only if library is compiled stand-alone
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
enable_testing()
file(GLOB SUCCINCT_TEST_SOURCES test_*.cpp)
foreach(TEST_SRC ${SUCCINCT_TEST_SOURCES})
get_filename_component (TEST_SRC_NAME ${TEST_SRC} NAME_WE)
add_executable(${TEST_SRC_NAME} ${TEST_SRC})
target_link_libraries(${TEST_SRC_NAME}
succinct
${Boost_LIBRARIES}
)
add_test(${TEST_SRC_NAME} ${TEST_SRC_NAME})
endforeach(TEST_SRC)
endif ()