-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
110 lines (96 loc) · 3.83 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.10)
include(CheckCXXCompilerFlag)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_program(CCACHE_PROGRAM ccache)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
if(CCACHE_PROGRAM)
message(STATUS "Using compiler cache")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
endif()
project(DYN_MATCH C CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_compile_options("-Wall" "-O3" "-DNDEBUG" "-Wno-maybe-uninitialized")
# if no build mode is specified build in release mode
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release")
endif()
# tweak compiler flags
CHECK_CXX_COMPILER_FLAG(-funroll-loops COMPILER_SUPPORTS_FUNROLL_LOOPS)
if(COMPILER_SUPPORTS_FUNROLL_LOOPS)
add_definitions(-funroll-loops)
endif()
CHECK_CXX_COMPILER_FLAG(-fno-stack-limit COMPILER_SUPPORTS_FNOSTACKLIMITS)
if(COMPILER_SUPPORTS_FNOSTACKLIMITS)
add_definitions(-fno-stack-limit)
endif()
CHECK_CXX_COMPILER_FLAG(-Wall COMPILER_SUPPORTS_WALL)
if(COMPILER_SUPPORTS_WALL)
add_definitions(-Wall)
endif()
CHECK_CXX_COMPILER_FLAG(-march=native COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
add_definitions(-march=native)
endif()
# check dependencies
#find_package(OpenMP)
#if(OpenMP_CXX_FOUND)
#message(STATUS "OpenMP support detected")
#add_definitions(${OpenMP_CXX_FLAGS})
#else()
#message(WARNING "OpenMP not available, activating workaround")
#add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
#set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_COMPILE_OPTIONS "")
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/misc)
#endif()
# 64 Bit option
option(64BITMODE "64 bit mode" OFF)
if(64BITMODE)
add_definitions("-DMODE64BITEDGES")
add_definitions("-DPOINTER64=1")
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/app)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/extern/argtable3-3.0.3)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/io)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/tools)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/algorithms)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/data_structure)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/extern/sparsehash/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/extern)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/extern/maxmatch_MV)
set(LIBMATCH_SOURCE_FILES
./lib/tools/quality_metrics.cpp
./lib/tools/random_functions.cpp
./lib/tools/timer.cpp
./lib/io/graph_io.cpp
./lib/data_structure/dyn_graph_access.cpp
./lib/data_structure/graph_access.cpp
./lib/algorithms/baswanaguptasen_dyn_matching.cpp
./lib/algorithms/blossom_dyn_matching.cpp
./lib/algorithms/blossom_dyn_matching_naive.cpp
./lib/algorithms/naive_dyn_matching.cpp
./lib/algorithms/static_blossom.cpp
./lib/algorithms/rw_dyn_matching.cpp
./lib/algorithms/dyn_matching.cpp
./lib/algorithms/neimansolomon_dyn_matching.cpp
extern/argtable3-3.0.3/argtable3.c)
add_library(libmatch OBJECT ${LIBMATCH_SOURCE_FILES})
set(LIBCONVERT_SOURCE_FILES
./lib/io/graph_io.cpp
./lib/data_structure/dyn_graph_access.cpp
./lib/data_structure/graph_access.cpp
./lib/tools/random_functions.cpp
extern/argtable3-3.0.3/argtable3.c)
add_library(libconvert OBJECT ${LIBCONVERT_SOURCE_FILES})
# generate targets for each binary
add_executable(dynmatch app/dyn_matching.cpp $<TARGET_OBJECTS:libmatch> )
target_link_libraries(dynmatch ${OpenMP_CXX_LIBRARIES})
install(TARGETS dynmatch DESTINATION bin)
add_executable(convert_metis_seq app/metis_to_sequence.cpp $<TARGET_OBJECTS:libconvert> )
install(TARGETS convert_metis_seq DESTINATION bin)