-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
263 lines (218 loc) · 7.07 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# ~~~
# Author: bdcat <Dave Register>
# Copyright:
# License: GPLv2+
# ~~~
# -------- Cmake setup ---------
#
cmake_minimum_required(VERSION 3.12.0)
cmake_policy(SET CMP0042 NEW)
if (POLICY CMP0072)
cmake_policy(SET CMP0072 NEW)
endif ()
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif ()
# Locations where cmake looks for cmake modules.
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/build ${CMAKE_SOURCE_DIR}/cmake)
if (WIN32)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/buildwin)
endif ()
message(STATUS "Cmake version: ${CMAKE_VERSION}.")
set(CMAKE_VERBOSE_MAKEFILE ON)
# -------- Build setup (mostly in PluginCompiler) --------
#
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
message(STATUS "Building: ${BUILD_TYPE}")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(
-Wno-inconsistent-missing-override
-Wno-potentially-evaluated-expression
)
endif ()
# -------- Options ----------
set(OCPN_TEST_REPO
"david-register/ocpn-plugins-unstable"
CACHE STRING "Default repository for untagged builds"
)
set(OCPN_BETA_REPO
"david-register/ocpn-plugins-unstable"
CACHE STRING
"Default repository for tagged builds matching 'beta'"
)
set(OCPN_RELEASE_REPO
"david-register/ocpn-plugins-stable"
CACHE STRING
"Default repository for tagged builds not matching 'beta'"
)
set(OCPN_TARGET_TUPLE "" CACHE STRING
"Target spec: \"platform;version;arch\""
)
string(TOLOWER "${OCPN_TARGET_TUPLE}" _lc_target)
if ("${_lc_target}" MATCHES "android*")
set(QT_ANDROID ON)
set(OCPN_USE_BUNDLED_WXCURL OFF)
# Until we have a proper toolchain file:
set(CMAKE_CROSSCOMPILING ON)
else ()
set(QT_ANDROID OFF)
add_definitions(-D__OCPN_USE_CURL__)
endif ()
# ------- Plugin setup --------
#
include("VERSION.cmake")
project(oesenc_pi VERSION ${OCPN_VERSION})
set(PKG_PRERELEASE "") # Empty, or a tag like 'beta'
set(DISPLAY_NAME oesenc) # Dialogs, installer artifacts, ...
set(PLUGIN_API_NAME oeSENC) # As of GetCommonName() in plugin API
set(CPACK_PACKAGE_CONTACT "Dave Register")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"OpenCPN support for encrypted OCPN Vector Charts "
)
set(CPACK_PACKAGE_DESCRIPTION [=[
OCPN Vector Charts licensed and sourced from chart providers like
Hydrographic Offices.
While the charts are not officially approved official ENC charts they
are based on the same data -- the legal conditions are described in the
EULA. The charts has world-wide coverage and provides a cost-effective
way to access the national chart databases. Charts are encrypted and
can only be used after purchasing decryption keys from o-charts.org.
]=])
set(PKG_AUTHOR "Dave register")
set(CPACK_PACKAGE_HOMEPAGE_URL https://github.com/bdbcat/oesenc_pi)
set(PKG_INFO_URL https://opencpn.org/OpenCPN/plugins/oesenc.html)
set(SRC
src/oesenc_pi.h
src/oesenc_pi.cpp
src/eSENCChart.cpp
src/eSENCChart.h
src/InstallDirs.cpp
src/InstallDirs.h
src/Osenc.cpp
src/Osenc.h
src/mygeom.h
src/mygeom63.cpp
src/TexFont.cpp
src/TexFont.h
src/s52plib.cpp
src/s57RegistrarMgr.cpp
src/chartsymbols.cpp
src/s52cnsy.cpp
src/viewport.cpp
src/s52utils.cpp
src/bbox.cpp
src/OCPNRegion.cpp
src/LLRegion.cpp
src/cutil.cpp
src/razdsparser.cpp
src/pi_DepthFont.cpp
src/ochartShop.cpp
src/ochartShop.h
libs/gdal/src/s57classregistrar.cpp
)
# -------- Setup completed, build the plugin --------
#
add_library(${CMAKE_PROJECT_NAME} SHARED ${SRC})
add_subdirectory("libs/api-16")
target_link_libraries(${CMAKE_PROJECT_NAME} ocpn::api)
set(VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(PACKAGE_NAME ${CMAKE_PROJECT_NAME})
# Create the minimim ocpn version id string like ov50
string(REGEX REPLACE "\([0-9]\)\.\([0-9]\).*" "ov\\1\\2"
OCPN_MIN_VERSION ${API_OCPN_MIN_VERSION})
# Set up targets. Targets sets up a recursive call with BUILD_TYPE set to
# 'flatpak', 'pkg' or 'tarball'. The initial call without BUILD_TYPE ends
# here.
#
include(Targets)
create_targets(
${PROJECT_SOURCE_DIR}/flatpak/org.opencpn.OpenCPN.Plugin.oesenc.yaml
)
if ("${BUILD_TYPE}" STREQUAL "")
return ()
endif ()
if (NOT ${BUILD_TYPE} STREQUAL "flatpak")
# Build package as required (flatpak already dealt with).
#
include(PluginCompiler)
include(PluginLocalization)
include(PluginInstall)
include(PluginPackage)
if (QT_ANDROID)
include(libs/AndroidLibs.cmake)
else ()
include(PluginLibs)
endif ()
include_directories(BEFORE ${CMAKE_BINARY_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/libs/gdal/src)
add_subdirectory("libs/cpl")
target_link_libraries(${PACKAGE_NAME} ocpn::cpl)
add_subdirectory("libs/dsa")
target_link_libraries(${PACKAGE_NAME} ocpn::dsa)
add_subdirectory("libs/wxJSON")
target_link_libraries(${PACKAGE_NAME} ocpn::wxjson)
add_subdirectory("libs/iso8211")
target_link_libraries(${PACKAGE_NAME} ocpn::iso8211)
add_subdirectory("libs/tinyxml")
target_link_libraries(${PACKAGE_NAME} ocpn::tinyxml)
add_subdirectory("libs/libglu")
target_link_libraries(${PACKAGE_NAME} ocpn::glu)
if( ("${plugin_target}" STREQUAL "mingw") OR ("${plugin_target}" STREQUAL "msvc") )
option(OCPN_USE_BUNDLED_WXCURL "Use wxCurl libraries" ON)
message(STATUS "Building bundled wxCurl libraries")
else( ("${plugin_target}" STREQUAL "mingw") OR ("${plugin_target}" STREQUAL "msvc") )
message(STATUS "Using system wxCurl libraries")
INCLUDE_DIRECTORIES("libs/wxcurl/src")
endif( ("${plugin_target}" STREQUAL "mingw") OR ("${plugin_target}" STREQUAL "msvc") )
if (NOT QT_ANDROID)
if(OCPN_USE_BUNDLED_WXCURL)
add_subdirectory("libs/wxcurl")
target_link_libraries(${PACKAGE_NAME} ocpn::wxcurl)
endif(OCPN_USE_BUNDLED_WXCURL)
endif ()
add_subdirectory("libs/oeserverd")
if (ARCH STREQUAL "armhf")
add_compile_definitions(OCPN_ARMHF)
endif ()
if (APPLE)
# Copy some items needed by the .img package
execute_process(
COMMAND cp -R ${CMAKE_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}
)
execute_process(
COMMAND cp -a ${CMAKE_SOURCE_DIR}/data/rrc_eula_ChartSetsForOpenCPN.txt
${CMAKE_SOURCE_DIR}/buildosx/InstallOSX/SGLockInstall.scptd
${CMAKE_SOURCE_DIR}/buildosx/InstallOSX/sgli
${CMAKE_BINARY_DIR}
)
endif ()
endif ()
configure_file(
${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/include//config.h
@ONLY
)
configure_file(
# The cloudsmith upload script
${CMAKE_SOURCE_DIR}/ci/upload.sh.in ${CMAKE_BINARY_DIR}/upload.sh
@ONLY
)
configure_file(
# The cloudsmith upload script, windows bat file.
${CMAKE_SOURCE_DIR}/ci/upload.bat.in ${CMAKE_BINARY_DIR}/upload.bat
@ONLY
)
set(checksum "@checksum@")
message(STATUS "CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
configure_file(
# The XML metadata file
${CMAKE_SOURCE_DIR}/plugin.xml.in
${CMAKE_BINARY_DIR}/${pkg_displayname}.xml.in
@ONLY
)