-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
111 lines (91 loc) · 3.18 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
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# Project declaration
project(xmm)
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()
# The version number.
set (xmm_VERSION_MAJOR 0)
set (xmm_VERSION_MINOR 1)
# Compiler Flags
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -DJSON_DEBUG -fPIC")
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
# Include JSON
include_directories(./dependencies/jsoncpp/include)
include_directories(./dependencies/jsoncpp/src)
# Declare library
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/core/common)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/core/distributions)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/core/model)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/core/trainingset)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/models/gmm)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/models/hmm)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/models/kmeans)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
add_definitions(-DUSE_PTHREAD)
file(
GLOB_RECURSE
xmm_source_files
src/*
)
file(
GLOB_RECURSE
jsoncpp_source_files
dependencies/jsoncpp/src/*
)
add_library(
xmm
STATIC
${xmm_source_files} ${jsoncpp_source_files}
)
# Declare Unit tests
set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/dependencies/catch)
# message(${LINK_DIRECTORIES})
file(
GLOB_RECURSE
xmm_test_files
test/*
)
add_executable(
tests
EXCLUDE_FROM_ALL
${xmm_test_files}
)
# linking configuration
target_link_libraries(
tests
xmm
)
set_target_properties(tests PROPERTIES OUTPUT_NAME xmm_testing)
add_custom_command(TARGET tests POST_BUILD COMMAND ${EXECUTABLE_OUTPUT_PATH}/xmm_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)
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")