-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
111 lines (91 loc) · 3.11 KB
/
Copy pathCMakeLists.txt
File metadata and controls
111 lines (91 loc) · 3.11 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
cmake_minimum_required(VERSION 3.26)
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
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS
"Debug"
"Release"
"MinSizeRel"
"RelWithDebInfo")
else()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
endif()
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/include/reelay/version.hpp" version_file)
string(REGEX MATCH "REELAY_VERSION_MAJOR ([0-9]*)" _ ${version_file})
set(version_major ${CMAKE_MATCH_1})
string(REGEX MATCH "REELAY_VERSION_MINOR ([0-9]*)" _ ${version_file})
set(version_minor ${CMAKE_MATCH_1})
string(REGEX MATCH "REELAY_VERSION_PATCH ([0-9]*)" _ ${version_file})
set(version_patch ${CMAKE_MATCH_1})
project(
"reelay"
LANGUAGES CXX
VERSION "${version_major}.${version_minor}.${version_patch}")
message(STATUS "Building Reelay version: ${PROJECT_VERSION}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS_COVERAGE "-O0 --coverage")
option(REELAY_INSTALL "Install Reelay" ON)
option(REELAY_BUILD_TESTS "Build the C++ unit tests" OFF)
option(REELAY_BUILD_APPS "Build Reelay Apps" OFF)
option(REELAY_BUILD_PYTHON_BINDINGS "Build Python bindings" OFF)
include(GNUInstallDirs)
include(FetchContent)
add_library(reelay INTERFACE)
add_library(reelay::reelay ALIAS reelay)
# Dependencies
find_package(Threads REQUIRED)
set(BOOST_INCLUDE_LIBRARIES icl)
set(BOOST_USE_STATIC_LIBS TRUE)
fetchcontent_declare(
Boost
URL https://github.com/boostorg/boost/releases/download/boost-1.89.0/boost-1.89.0-cmake.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP
TRUE
FIND_PACKAGE_ARGS
1.82.0
CONFIG)
fetchcontent_makeavailable(Boost)
set(CUDD_INSTALL
OFF
CACHE BOOL "" FORCE)
fetchcontent_declare(
cudd
GIT_REPOSITORY https://github.com/cuddorg/cudd.git
GIT_TAG 4.0.0
FIND_PACKAGE_ARGS 4.0.0 CONFIG)
fetchcontent_makeavailable(cudd)
# reelay-core
target_include_directories(
reelay INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(reelay INTERFACE $<BUILD_INTERFACE:Boost::icl>
$<BUILD_INTERFACE:cudd::cudd> Threads::Threads)
if(REELAY_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
if(REELAY_BUILD_APPS)
message(STATUS "Building Reelay apps...")
add_subdirectory(apps/rybinx)
add_subdirectory(apps/ryjson1)
endif()
if(REELAY_BUILD_PYTHON_BINDINGS)
add_subdirectory(src/pybind11)
endif()
if(REELAY_INSTALL)
include(cmake/install.cmake)
endif()
if(PROJECT_IS_TOP_LEVEL AND UNIX)
# Create symlink to compile_commands.json on the project directory
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/compile_commands.json
${CMAKE_SOURCE_DIR}/compile_commands.json)
endif()