-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
143 lines (124 loc) · 3.91 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
cmake_minimum_required(VERSION 3.5)
if(${CMAKE_VERSION} VERSION_LESS "3.12")
project(
Bliss
VERSION 0.77
LANGUAGES CXX C
DESCRIPTION "A Tool for Computing Automorphism Groups and Canonical Labelings of Graphs. http://www.tcs.hut.fi/Software/bliss/."
)
else()
project(
Bliss
VERSION 0.77
LANGUAGES CXX C
DESCRIPTION "A Tool for Computing Automorphism Groups and Canonical Labelings of Graphs"
HOMEPAGE_URL "http://www.tcs.hut.fi/Software/bliss/"
)
endif()
option(USE_GMP "Use GNU Multiple Precision Arithmetic library" OFF)
set(
BLISS_SOURCE_FILES
src/abstractgraph.cc
src/bliss_C.cc
src/defs.cc
src/digraph.cc
src/graph.cc
src/orbit.cc
src/partition.cc
src/uintseqhash.cc
src/utils.cc
)
# In MSVC, the executable and libraries should go to the top directory
if(MSVC)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
endif(MSVC)
# Add the shared library
add_library(libbliss ${BLISS_SOURCE_FILES})
set_target_properties(libbliss PROPERTIES OUTPUT_NAME bliss )
add_library(Bliss::libbliss ALIAS libbliss)
target_include_directories(
libbliss
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
set_target_properties(libbliss PROPERTIES
# All code ending in a shared library should be made PIC
POSITION_INDEPENDENT_CODE ON
# Compiling with hidden visibility
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)
add_executable(bliss src/bliss.cc)
add_executable(Bliss::bliss ALIAS bliss)
target_link_libraries(bliss PRIVATE libbliss)
if(USE_GMP)
target_link_libraries(bliss ${GMP_LIBRARIES})
endif(USE_GMP)
set_target_properties(libbliss bliss PROPERTIES COMPILE_OPTIONS "")
# specify the C++ standard
set_target_properties(libbliss bliss
PROPERTIES CXX_STANDARD 11
CXX_STANDARD_REQUIRED True)
if (MSVC)
# /permissive- for standard C++ with "and" and "or" logical operators
target_compile_options(libbliss PUBLIC /permissive-)
target_compile_options(bliss PUBLIC /permissive-)
else()
# Warnings, optimization, no assertions
target_compile_options(libbliss PRIVATE -O3 -DNDEBUG) #-Wextra -Werror ### disable as part of scip build
target_compile_options(bliss PRIVATE -O3 -DNDEBUG) #-Wextra -Werror ### disable as part of scip build
endif()
if(USE_GMP)
find_path(GMP_INCLUDE_DIR NAMES gmp.h)
find_library(GMP_LIBRARIES NAMES gmp libgmp mpir REQUIRED)
if (MSVC)
target_compile_options(libbliss PUBLIC /DBLISS_USE_GMP /I${GMP_INCLUDE_DIR})
target_compile_options(bliss PUBLIC /DBLISS_USE_GMP /I${GMP_INCLUDE_DIR})
else()
target_compile_options(libbliss PUBLIC -DBLISS_USE_GMP -I${GMP_INCLUDE_DIR})
target_compile_options(bliss PUBLIC -DBLISS_USE_GMP -I${GMP_INCLUDE_DIR})
endif()
endif(USE_GMP)
# Set the default build type to the given value if no build type was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to Release as none was specified")
set(
CMAKE_BUILD_TYPE Release
CACHE STRING "Choose the type of build" FORCE
)
# Set the possible values of build type for cmake-gui, ccmake
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo"
)
endif()
install(
TARGETS libbliss bliss
EXPORT Bliss
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(${CMAKE_VERSION} VERSION_LESS "3.14")
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/bliss"
DESTINATION include
COMPONENT lib
)
else()
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/bliss"
TYPE INCLUDE
COMPONENT lib
)
endif()
install(EXPORT Bliss
DESTINATION lib/cmake/Bliss
NAMESPACE Bliss::
FILE BlissConfig.cmake
)