-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
112 lines (94 loc) · 3.66 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
# --------------------------------------------------------------------------- #
# CMake Preamble
# --------------------------------------------------------------------------- #
cmake_minimum_required(VERSION 3.10.0)
project(bwtzip-openmp)
#set(CMAKE_VERBOSE_MAKEFILE ON)
# C++ Standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
# Enable warnings
if (MSVC)
add_compile_options(/W4)
else ()
add_compile_options(-Werror -Wall -Wextra -Wpedantic)
endif ()
# OpenMP dependency
find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif ()
# Enable unit testing support
include(CTest)
enable_testing()
include_directories(BEFORE
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/external)
# --------------------------------------------------------------------------- #
# bwtzip - Unmodified serial version
# --------------------------------------------------------------------------- #
set(COMMON_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/bwtzip_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/bwtzip_suffixtree.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/bwtzip_mtf.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/bwtzip_zle.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/bwtzip_arith.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/bwtzip_file.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/clock.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/wclock.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/log.cc)
# bwtzip executable
set(BWTZIP_SRC
${COMMON_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/src/bwtzip.cc)
add_executable(bwtzip
${BWTZIP_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/src/main_bwtzip.cc)
# bwtunzip executable
set(BWTUNZIP_SRC
${COMMON_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/src/bwtunzip.cc)
add_executable(bwtunzip
${BWTUNZIP_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/src/main_bwtunzip.cc)
# --------------------------------------------------------------------------- #
# pbwtzip - OpenMP parallel version
# --------------------------------------------------------------------------- #
# pbwtzip executable
set(PBWTZIP_SRC
${COMMON_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/src/pbwtzip.cc)
add_executable(pbwtzip
${PBWTZIP_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/src/main_pbwtzip.cc)
# pbwtzip2 executable
set(PBWTZIP2_SRC
${COMMON_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/src/pbwtzip2.cc)
add_executable(pbwtzip2
${PBWTZIP2_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/src/main_pbwtzip2.cc)
# --------------------------------------------------------------------------- #
# Tests
# --------------------------------------------------------------------------- #
# Prepare "Catch" library for other executables
set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/catch)
add_library(Catch INTERFACE)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
set(TEST_SOURCES
${COMMON_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/src/pbwtzip.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/pbwtzip2.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/bwtunzip.cc
${CMAKE_CURRENT_SOURCE_DIR}/test/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/test_pbwtzip.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/test_pbwtzip2.cpp)
add_executable(tests ${TEST_SOURCES})
target_link_libraries(tests
PUBLIC
Catch)
add_test(NAME tests COMMAND tests)