-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
117 lines (98 loc) · 3.32 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
cmake_minimum_required (VERSION 2.6)
# Project declaration
project(wavelet)
# The version number.
set (wavelet_VERSION_MAJOR 0)
set (wavelet_VERSION_MINOR 1)
# Compiler Flags
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -DDEBUG")
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
# C++11 Support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
# Look for Boost
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
# Look for armadillo
find_package(Armadillo)
if(ARMADILLO_FOUND)
include_directories(${ARMADILLO_INCLUDE_DIRS})
add_definitions(-DUSE_ARMA)
else(ARMADILLO_FOUND)
message(WARNING "Armadillo not found. Deactivating Offline Computation Functions.")
endif(ARMADILLO_FOUND)
# Declare library
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
file(
GLOB_RECURSE
wavelet_source_files
src/*
)
add_library(
wavelet
STATIC
${wavelet_source_files}
)
# linking configuration
if(ARMADILLO_FOUND)
target_link_libraries(
wavelet
${ARMADILLO_LIBRARIES}
)
endif(ARMADILLO_FOUND)
# Declare Unit tests
set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/dependencies/catch)
file(
GLOB_RECURSE
wavelet_test_files
test/*
)
add_executable(
tests
EXCLUDE_FROM_ALL
${wavelet_test_files}
)
# linking configuration
target_link_libraries(
tests
wavelet
)
set_target_properties(tests PROPERTIES OUTPUT_NAME wavelet_testing)
add_custom_command(TARGET tests POST_BUILD COMMAND ${EXECUTABLE_OUTPUT_PATH}/wavelet_testing)
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
find_program(DOTPATH dot)
if(${DOTPATH} STREQUAL "DOTPATH-NOTFOUND")
set(HAS_DOT "")
else(${DOTPATH} STREQUAL "DOTPATH-NOTFOUND")
set(HAS_DOT "-dot")
endif(${DOTPATH} STREQUAL "DOTPATH-NOTFOUND")
if(DOXYGEN_FOUND)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile${HAS_DOT}
DEPENDS ${tracking_source_files}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/
COMMENT "Generating API documentation with Doxygen" VERBATIM)
add_custom_target(docapi
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile-API
DEPENDS ${tracking_source_files}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/
COMMENT "Generating API documentation with Doxygen" VERBATIM)
else(DOXYGEN_FOUND)
message(STATUS "Doxygen not found, doc will not be included in the Makefile")
endif(DOXYGEN_FOUND)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/doc/html")