-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
163 lines (135 loc) · 3.91 KB
/
CMakeLists.txt
File metadata and controls
163 lines (135 loc) · 3.91 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
cmake_minimum_required( VERSION 3.16 )
# PROJECT_VERSION_LONG : <V>.<V>.<V>+<N>+g<H> (Debian native compatible `git describe --tags`)
# PROJECT_VERSION : <V>.<V>.<V>.<N>
file( STRINGS "${CMAKE_SOURCE_DIR}/CHANGELOG" PROJECT_VERSION
LIMIT_COUNT 1
)
string( REGEX REPLACE
"^[^ ]+ \\((.*)\\)$" "\\1"
PROJECT_VERSION_LONG "${PROJECT_VERSION}"
)
string( REGEX REPLACE
"[\\+~-]" "."
PROJECT_VERSION "${PROJECT_VERSION}"
)
string( REGEX REPLACE
"^[^ ]+ \\(([0-9]+(\\.[0-9]+)?(\\.[0-9]+)?(\\.[0-9]+)?).*\\)$" "\\1"
PROJECT_VERSION "${PROJECT_VERSION}"
)
project( openemsh
LANGUAGES CXX
VERSION "${PROJECT_VERSION}"
DESCRIPTION "openEMS mesher"
HOMEPAGE_URL "https://github.com/Open-RFlab/openemsh"
)
message( STATUS "Version: ${PROJECT_VERSION}" )
set( OEMSH_BUGREPORT "https://github.com/Open-RFlab/openemsh/issues" )
set( OEMSH_FUNDING "https://liberapay.com/thomaslepoix" )
set( OEMSH_OEMS_MESHING "https://wiki.openems.de/index.php/FDTD_Mesh.html" )
file( READ "${CMAKE_SOURCE_DIR}/CHANGELOG" OEMSH_CHANGELOG )
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE "Release" )
endif()
message( STATUS "Build type: ${CMAKE_BUILD_TYPE}" )
option( CPM_DISABLE "Don't use CPM to retrieve dependencies" "$ENV{CPM_DISABLE}" )
option( OEMSH_PORTABILITY_TWEAKS "Enable some portability tweaks" OFF )
list( APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake"
)
if( NOT CPM_DISABLE )
message( STATUS "Downloading dependencies with CPM" )
include( CPM )
CPMAddPackage(
NAME cmake-utils
GITHUB_REPOSITORY conformism/cmake-utils
GIT_TAG main
DOWNLOAD_ONLY
)
set( CMakeUtils_DIR "${cmake-utils_SOURCE_DIR}" )
CPMAddPackage(
NAME pugixml
GITHUB_REPOSITORY zeux/pugixml
VERSION 1.15
OPTIONS
"BUILD_SHARED_LIBS ON"
)
set( pugixml_DIR "${pugixml_BINARY_DIR}" )
CPMAddPackage(
NAME CLI11
GITHUB_REPOSITORY CLIUtils/CLI11
VERSION 2.5.0
)
set( CLI11_DIR "${CLI11_BINARY_DIR}" )
CPMAddPackage(
NAME indicators
GITHUB_REPOSITORY p-ranav/indicators
GIT_TAG 3872f37
PATCHES "https://github.com/p-ranav/indicators/pull/130.patch"
)
set( indicators_DIR "${indicators_BINARY_DIR}" )
endif()
find_package( CMakeUtils QUIET )
if( CMakeUtils_FOUND )
message( STATUS "Found CMakeUtils: ${CMakeUtils_DIR}" )
else()
message( STATUS "Not found CMakeUtils: Only minimal build enabled" )
endif()
find_package( pugixml REQUIRED )
if( pugixml_FOUND )
message( STATUS "Found pugixml: ${pugixml_DIR} ${PUGIXML_VERSION}" )
endif()
find_package( CLI11 2.4.0 REQUIRED )
if( CLI11_FOUND )
message( STATUS "Found CLI11: ${CLI11_DIR} ${CLI11_VERSION}" )
endif()
# TODO match indicators and spdlog
# https://github.com/bkryza/clang-uml/blob/fc3fc12/src/common/generators/progress_indicator.cc
find_package( indicators REQUIRED )
if( indicators_FOUND )
message( STATUS "Found indicators: ${indicators_DIR} ${indicators_VERSION}" )
endif()
find_package( Qt6
COMPONENTS
Core REQUIRED
Gui REQUIRED
Widgets REQUIRED
)
if( Qt6_FOUND )
message( STATUS "Found Qt: ${Qt6_DIR} ${Qt6_VERSION}" )
endif()
find_program( D2 NAMES d2 )
if( D2 )
message( STATUS "Found D2: ${D2}" )
else()
message( STATUS "Not found D2: Some parts of doc disabled" )
endif()
find_program( PDF2SVG NAMES pdf2svg )
if( PDF2SVG )
message( STATUS "Found pdf2svg: ${PDF2SVG}" )
else()
message( STATUS "Not found pdf2svg: Some parts of doc disabled" )
endif()
if( CMakeUtils_FOUND )
set( CMAKE_UTILS * )
set( COVERAGE_GLOBAL_ONLY ON )
include( CMakeUtils )
endif()
include( ConfigureFileBuildTime )
include( GNUInstallDirs )
set( CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE
)
add_subdirectory( "${CMAKE_SOURCE_DIR}/src" )
add_subdirectory( "${CMAKE_SOURCE_DIR}/test" )
add_subdirectory( "${CMAKE_SOURCE_DIR}/icon" )
add_subdirectory( "${CMAKE_SOURCE_DIR}/pack" )
add_subdirectory( "${CMAKE_SOURCE_DIR}/doc" )
if( CMakeUtils_FOUND )
coverage_global()
endif()