-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
147 lines (113 loc) · 3.74 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# check cmake requirements
cmake_minimum_required(VERSION 3.0)
######################## begin of project
project(ReadFramework)
set(RDF_FRAMEWORK_VERSION 0.7)
add_definitions(-DRDF_FRAMEWORK_VERSION="${RDF_FRAMEWORK_VERSION}")
# Codecov
# if(CMAKE_COMPILER_IS_GNUCXX)
# include("cmake/CodeCoverage.cmake")
# setup_target_for_coverage(${PROJECT_NAME}_coverage ${RDF_BINARY_NAME} coverage)
# endif()
if(CMAKE_CL_64)
SET(RDF_ARCHITECTURE "x64")
else()
SET(RDF_ARCHITECTURE "x86")
endif()
if(DEFINED GLOBAL_READ_BUILD)
# set output path when building for READ
if(MSVC)
SET(CMAKE_LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<CONFIGURATION>)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<CONFIGURATION>)
else()
SET(CMAKE_LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/READ)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/READ)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/READ)
endif()
endif()
# include macros needed
include("cmake/Utils.cmake")
# different compile options
option(DISABLE_QT_DEBUG "Disable Qt Debug Messages" OFF)
# load paths from the user file if exists
if(EXISTS ${CMAKE_SOURCE_DIR}/CMakeUser.cmake)
include(${CMAKE_SOURCE_DIR}/CMakeUser.cmake)
endif()
RDF_CHECK_COMPILER()
if(CMAKE_COMPILER_IS_GNUCXX)
# Codecov
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wno-attributes -Wno-unknown-pragmas -pthread -g -O0 -fprofile-arcs -ftest-coverage")
endif()
# find Qt
RDF_FIND_QT()
# find OpenCV
option(WITH_XFEATURES2D "Compile with xfeatures2d" OFF)
RDF_FIND_OPENCV()
if (DISABLE_QT_DEBUG)
message (STATUS "disabling qt debug messages")
add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif()
if(MSVC)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Win.cmake)
elseif(UNIX)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Unix.cmake)
else()
message(STATUS "build system unkown ... fallback to unix")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Unix.cmake)
endif()
file(GLOB MAIN_SOURCES "src/*.cpp")
file(GLOB MAIN_HEADERS "src/*.h")
# unit tests
file(GLOB TEST_SOURCES "src/UnitTests/*.cpp")
file(GLOB TEST_HEADERS "src/UnitTests/*.h")
# loader
file(GLOB MODULE_SOURCES "src/Module/*.cpp")
file(GLOB MODULE_HEADERS "src/Module/*.h")
# core
file(GLOB CORE_SOURCES "src/Core/*.cpp")
file(GLOB CORE_HEADERS "src/Core/*.h")
# external headers
file(GLOB GC_SOURCES "src/3rdparty/graphcut/*.cpp")
file(GLOB GC_HEADERS "src/3rdparty/graphcut/*.h")
# external headers
file(GLOB LSD_SOURCES "src/3rdparty/lsd/*.cpp")
file(GLOB LSD_HEADERS "src/3rdparty/lsd/*.h")
# external headers
file(GLOB WV_SOURCES "src/3rdparty/word2vec/*.cpp")
file(GLOB WV_HEADERS "src/3rdparty/word2vec/*.h")
# external headers
file(GLOB MC_SOURCES "src/3rdparty/maxclique/*.cpp")
file(GLOB MC_HEADERS "src/3rdparty/maxclique/*.h")
# gather information for building
include_directories (
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty
${CMAKE_CURRENT_SOURCE_DIR}/src/Core
${CMAKE_CURRENT_SOURCE_DIR}/src/Module
)
set( RDF_RESOURCES
src/RDF.qrc
)
QT5_ADD_RESOURCES(NOMACS_RCC ${RDF_RESOURCES})
# TODO: uncomment if we ever need translations
# file(GLOB RDF_TRANSLATIONS "translations/*.ts")
# QT5_ADD_TRANSLATION(RDF_QM ${RDF_TRANSLATIONS})
if(UNIX)
# enable CTest
include(CTest)
enable_testing()
endif()
# create build targets
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/BuildTargets.cmake)
# Codecov
if(CMAKE_COMPILER_IS_GNUCXX)
include("cmake/CodeCoverage.cmake")
setup_target_for_coverage(${PROJECT_NAME}_coverage ${RDF_BINARY_NAME} coverage)
endif()
#debug for printing out all variables
# get_cmake_property(_variableNames VARIABLES)
# foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
# endforeach()