-
Notifications
You must be signed in to change notification settings - Fork 91
/
CMakeLists.txt
109 lines (86 loc) · 2.65 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
cmake_minimum_required(VERSION 3.2)
# Name
project(Medusa)
# Version
set(VERSION_MAJOR 0)
set(VERSION_MINOR 5)
set(VERSION_PATCH 4)
# Variables
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(MEDUSA_MODULES_TO_BUILD "all"
CACHE STRING "Semicolon-separated list of modules to build, or \"all\"")
list(REMOVE_DUPLICATES MEDUSA_MODULES_TO_BUILD)
list(SORT MEDUSA_MODULES_TO_BUILD)
if ("${MEDUSA_MODULES_TO_BUILD}" MATCHES "all")
message("Compile all modules")
else()
foreach (medusa_module ${MEDUSA_MODULES_TO_BUILD})
# TODO(wisk): check if the module if correct
message("Compile module ${medusa_module}")
endforeach()
endif()
set(MEDUSA_EXECUTABLE_PATH ".")
set(MEDUSA_LIBRARY_PATH lib)
set(MEDUSA_MODULE_PATH lib/medusa)
set(MEDUSA_RESOURCE_PATH share/medusa)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Options
## Tools
option(MEDUSA_BUILD_TOOLS
"Build Medusa tools"
TRUE)
## Tests
option(MEDUSA_BUILD_TESTS
"Build Medusa tests"
TRUE)
if (MEDUSA_BUILD_TESTS)
enable_testing()
endif()
# Features
## C++
set(CMAKE_CXX_STANDARD 11)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-fabi-version=9 HAVE_ABI_VERSION)
if (HAVE_ABI_VERSION)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=9")
endif()
# TODO(wisk): set default visiblity as hidden on ELF
## CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
## if (HAVE_VISIBILITY_HIDDEN)
## set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
## endif()
## CHECK_CXX_COMPILER_FLAG(-fvisibility-inlines-hidden HAVE_VISIBILITY_INLINES_HIDDEN)
## if (HAVE_VISIBILITY_INLINES_HIDDEN)
## set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
## endif()
# src: ogdf cmake
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_definitions(
"/DNOMINMAX"
"/D_CRT_SECURE_NO_WARNINGS"
"/D_SCL_SECURE_NO_WARNINGS"
"/wd4251" "/wd4503"
"/Zm256")
endif()
# Sources
add_subdirectory(src)
# Packaging
add_subdirectory(package)
find_package(Doxygen)
if (DOXYGEN_FOUND)
message("Doxygen found, I'll generate documentations for you")
set(DOCROOT "${CMAKE_SOURCE_DIR}/doc/api")
configure_file("${DOCROOT}/Doxyfile.in" "${DOCROOT}/Doxyfile" @ONLY)
set(DOC_TARGET_NAME "doc")
if (MSVC_IDE)
set(DOC_TARGET_NAME "DOCUMENTATION")
endif()
add_custom_target(${DOC_TARGET_NAME}
${DOXYGEN_EXECUTABLE} ${DOCROOT}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with doxygen" VERBATIM
)
endif()