-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
93 lines (68 loc) · 3.26 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
cmake_minimum_required(VERSION 3.1)
# set the project name and version
project(D4 VERSION 0.1)
add_custom_target(clean-cmake-files
COMMAND ${CMAKE_COMMAND} -P clean-all.cmake
)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_BUILD_TYPE Release)
# specify the C++ standard
set(CMAKE_CXX_STANDARD_REQUIRED 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# source/include files
file(GLOB_RECURSE SOURCES ./src/**.cpp)
file(GLOB_RECURSE INCLUDES ./src/**.hpp)
set(SRCS ${SOURCES})
set(HEADERS ${INCLUDES})
set(Boost_USE_STATIC_LIBS ON)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/3rdParty/glucose-3.0/)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/3rdParty/kahypar/)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/3rdParty/bipe/)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
if (NOT DEFINED BUILD_MODE)
set(BUILD_MODE 1)
endif()
set(libList ${CMAKE_SOURCE_DIR}/3rdParty/kahypar/build/lib/libkahypar.a ${Boost_LIBRARIES} ${CMAKE_SOURCE_DIR}/3rdParty/bipe/build/libbipe.a ${CMAKE_SOURCE_DIR}/3rdParty/bipe/3rdParty/glucose-3.0/core/libglucose.a ${CMAKE_SOURCE_DIR}/3rdParty/patoh/libpatoh.a ${CMAKE_SOURCE_DIR}/3rdParty/glucose-3.0/core/lib_glucose.a)
set(wnoOption -Wno-strict-aliasing -Wno-class-memaccess -Wno-format -Wno-misleading-indentation -Wno-literal-suffix -Wno-sign-compare -Wno-parentheses)
# build.
if(${BUILD_MODE} EQUAL 1)
message("Library debug D4")
add_library(d4 ${SRCS} ${HEADERS})
target_compile_options(d4 PUBLIC -DNOMAIN -std=c++20 -Wall -g -O2 ${wnoOption} -U NDEBUG)
target_link_libraries (d4 -lz -O2 -U NDEBUG -lgmpxx -lgmp ${libList})
target_include_directories (d4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
install (TARGETS d4 DESTINATION lib)
install(FILES ${HEADER} DESTINATION include/${CMAKE_PROJECT_NAME}-debug)
elseif(${BUILD_MODE} EQUAL 2)
message("Library static")
add_library(d4 ${SRCS} ${HEADERS})
target_compile_options(d4 PUBLIC -DNOMAIN -std=c++20 -Wall -O3 ${wnoOption} -D NDEBUG -static)
target_link_libraries (d4 -lz -O3 -lgmpxx -lgmp ${libList} -static)
target_include_directories (d4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
install (TARGETS d4 DESTINATION lib)
install(FILES ${HEADER} DESTINATION include/${CMAKE_PROJECT_NAME}-static)
elseif(${BUILD_MODE} EQUAL 3)
message("Library profil")
add_library(d4 ${SRCS} ${HEADERS})
target_compile_options(d4 PUBLIC -DNOMAIN -std=c++20 -Wall -pg -O3 ${wnoOption} -D NDEBUG)
target_link_libraries (d4 -lz -O3 -pg -lgmpxx -lgmp ${libList})
target_include_directories (d4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
install (TARGETS d4 DESTINATION lib)
install(FILES ${HEADER} DESTINATION include/${CMAKE_PROJECT_NAME}-profil)
else()
message("Library standard")
add_library(d4 ${SRCS} ${HEADERS})
target_compile_options(d4 PUBLIC -DNOMAIN -std=c++20 -Wall -O3 ${wnoOption} -D NDEBUG)
target_link_libraries (d4 -lz -O3 -lgmpxx -lgmp ${libList})
target_include_directories (d4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
install (TARGETS d4 DESTINATION lib)
install(FILES ${HEADER} DESTINATION include/${CMAKE_PROJECT_NAME}-standard)
endif()
file(GLOB cmake_generated ${CMAKE_SOURCE_DIR}/src/*~)
foreach(file ${cmake_generated})
if (EXISTS ${file})
file(REMOVE_RECURSE ${file})
endif()
endforeach(file)