-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
112 lines (96 loc) · 2.82 KB
/
Copy pathCMakeLists.txt
File metadata and controls
112 lines (96 loc) · 2.82 KB
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
cmake_minimum_required(VERSION 3.10)
project(greedy-hps-moco)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set the build type to Release by default
if(NOT CMAKE_BUILD_TYPE)
# set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)
endif()
# Print the build type
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# Warning flags
set(HYPER_GRASP_CXX_WARN_FLAGS "")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND HYPER_GRASP_CXX_WARN_FLAGS
-Wall
-Wextra
-Wpedantic
# -pedantic-errors
# -Wold-style-cast
# -Wundef
# -Wredundant-decls
# -Wcast-qual
# -Wmissing-include-dirs
# -Wdisabled-optimization
# -Wconversion
# -Wdouble-promotion
# -Wshadow
# -Wnull-dereference
)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
list(APPEND HYPER_GRASP_CXX_WARN_FLAGS
-Wvector-operation-performance
-Wduplicated-cond
)
endif()
else()
message(WARNING "Unknown compiler (not GNU, Clang, or MSVC), not setting any warning flags.")
set(HYPER_GRASP_CXX_WARN_FLAGS "")
endif()
# Find dependencies
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
# Include FetchContent module
include(FetchContent)
find_package(CLI11 QUIET)
if (NOT CLI11_FOUND)
include(FetchContent)
FetchContent_Declare(
cli11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11
GIT_TAG v2.4.2
)
FetchContent_MakeAvailable(cli11)
endif()
find_package(OpenMP QUIET)
if (NOT OpenMP_CXX_FOUND)
message(WARNING "OpenMP not found. Building without OpenMP support.")
endif()
find_package(mooutils QUIET)
# If mooutils not found fallback to github
if (NOT mooutils_FOUND)
include(FetchContent)
FetchContent_Declare(
mooutils
GIT_REPOSITORY https://github.com/adbjesus/mooutils.git
GIT_TAG main
)
FetchContent_MakeAvailable(mooutils)
add_library(mooutils::mooutils ALIAS mooutils)
endif()
# Add include directories
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/instances)
include_directories(${CMAKE_SOURCE_DIR}/solver)
include_directories(${CMAKE_SOURCE_DIR}/hps)
include_directories(${CMAKE_SOURCE_DIR}/others)
include_directories(${CMAKE_SOURCE_DIR}/mokp)
# Add the executable and specify the source files
add_executable(greedy-hps-moco
${CMAKE_SOURCE_DIR}/apps/main.cpp
# Add other source files if necessary
)
# Link the executable with the libraries
target_link_libraries(greedy-hps-moco
PRIVATE
mooutils::mooutils
CLI11::CLI11
OpenMP::OpenMP_CXX
)
# Set compile options
target_compile_options(greedy-hps-moco PRIVATE ${MOBKP_CXX_WARN_FLAGS})
# Set the output name of the executable
set_target_properties(greedy-hps-moco PROPERTIES OUTPUT_NAME greedy-hps-moco)
# Install the target
install(TARGETS greedy-hps-moco)