forked from nohal/dashboardsk_pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.cmake
155 lines (132 loc) · 5.34 KB
/
Plugin.cmake
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
# ~~~
# Summary: Local, non-generic plugin setup
# Copyright (c) 2020-2021 Mike Rossiter
# License: GPLv3+
# ~~~
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
# -------- Options ----------
set(OCPN_TEST_REPO
"nohal/opencpn-plugins"
CACHE STRING "Default repository for untagged builds")
set(OCPN_BETA_REPO
"nohal/dashboardsk_pi-beta"
CACHE STRING "Default repository for tagged builds matching 'beta'")
set(OCPN_RELEASE_REPO
"nohal/dashboardsk_pi-stable"
CACHE STRING "Default repository for tagged builds not matching 'beta'")
#
# ------- Plugin setup --------
#
set(PKG_NAME DashboardSK_pi)
set(PKG_VERSION "0.3.0")
set(PKG_PRERELEASE "beta") # Empty, or a tag like 'beta'
set(DISPLAY_NAME DashboardSK) # Dialogs, installer artifacts, ...
set(PLUGIN_API_NAME DashboardSK) # As of GetCommonName() in plugin API
set(PKG_SUMMARY "DashboardSK plugin for OpenCPN")
set(PKG_DESCRIPTION
[=[
DashboardSK plugin for OpenCPN
]=])
set(PKG_AUTHOR "Pavel Kalian")
set(PKG_IS_OPEN_SOURCE "yes")
set(PKG_HOMEPAGE https://github.com/nohal/dashboardsk_pi)
set(PKG_INFO_URL https://opencpn.org/OpenCPN/plugins/dashboardSK.html)
option(WITH_TESTS "Whether or not to build the tests" OFF)
option(SANITIZE "What sanitizers to use" "")
if(NOT "${SANITIZE}" STREQUAL "OFF" AND NOT "${SANITIZE}" STREQUAL "")
add_compile_options(-fsanitize=${SANITIZE} -fno-omit-frame-pointer)
add_link_options(-fsanitize=${SANITIZE} -fno-omit-frame-pointer)
endif()
add_definitions(-DDASHBOARDSK_USE_SVG)
add_definitions(-DocpnUSE_GL)
include_directories(${CMAKE_SOURCE_DIR}/include)
set(HDR_DASHBOARD
${CMAKE_SOURCE_DIR}/include/dashboardsk.h
${CMAKE_SOURCE_DIR}/include/dashboard.h
${CMAKE_SOURCE_DIR}/include/instrument.h
${CMAKE_SOURCE_DIR}/include/simplenumberinstrument.h
${CMAKE_SOURCE_DIR}/include/simplegaugeinstrument.h
${CMAKE_SOURCE_DIR}/include/simpletextinstrument.h
${CMAKE_SOURCE_DIR}/include/simplepositioninstrument.h
${CMAKE_SOURCE_DIR}/include/simplehistograminstrument.h
${CMAKE_SOURCE_DIR}/include/zone.h
${CMAKE_SOURCE_DIR}/include/displayscale.h
${CMAKE_SOURCE_DIR}/include/pager.h)
set(SRC_DASHBOARD
${CMAKE_SOURCE_DIR}/src/dashboardsk.cpp
${CMAKE_SOURCE_DIR}/src/dashboard.cpp
${CMAKE_SOURCE_DIR}/src/instrument.cpp
${CMAKE_SOURCE_DIR}/src/simplenumberinstrument.cpp
${CMAKE_SOURCE_DIR}/src/simplegaugeinstrument.cpp
${CMAKE_SOURCE_DIR}/src/simpletextinstrument.cpp
${CMAKE_SOURCE_DIR}/src/simplepositioninstrument.cpp
${CMAKE_SOURCE_DIR}/src/simplehistograminstrument.cpp
${CMAKE_SOURCE_DIR}/src/pager.cpp)
set(SRC_GUI_DESKTOP ${CMAKE_SOURCE_DIR}/src/dashboardskgui.cpp
${CMAKE_SOURCE_DIR}/src/dashboardskguiimpl.cpp)
set(SRC_GUI_ANDROID ${CMAKE_SOURCE_DIR}/src/dashboardskguiandroid.cpp
${CMAKE_SOURCE_DIR}/src/dashboardskguiimpl.cpp)
if(QT_ANDROID)
set(SRC_GUI ${SRC_GUI_ANDROID})
else()
set(SRC_GUI ${SRC_GUI_DESKTOP})
endif()
set(SRC ${SRC_DASHBOARD} ${SRC_GUI} ${CMAKE_SOURCE_DIR}/src/dashboardsk_pi.cpp)
set(PKG_API_LIB api-18) # A dir in opencpn-libs/ e. g., api-17 or api-16
macro(late_init)
# Perform initialization after the PACKAGE_NAME library, compilers and
# ocpn::api is available.
# Fix OpenGL deprecated warnings in Xcode
target_compile_definitions(${PACKAGE_NAME} PRIVATE GL_SILENCE_DEPRECATION)
# Prepare doxygen config
configure_file(${CMAKE_SOURCE_DIR}/doc/Doxyfile.in
${CMAKE_BINARY_DIR}/Doxyfile)
configure_file(${CMAKE_SOURCE_DIR}/doc/header.html.in
${CMAKE_BINARY_DIR}/header.html)
# Prepare asciidoxy
configure_file(${CMAKE_SOURCE_DIR}/doc/api.adoc.in
${CMAKE_BINARY_DIR}/api.adoc @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/doc/packages.toml
${CMAKE_BINARY_DIR}/packages.toml)
configure_file(${CMAKE_SOURCE_DIR}/doc/contents.toml
${CMAKE_BINARY_DIR}/contents.toml)
endmacro()
macro(add_plugin_libraries)
# Add libraries required by this plugin
if(WIN32)
add_subdirectory("${CMAKE_SOURCE_DIR}/opencpn-libs/WindowsHeaders")
target_link_libraries(${PACKAGE_NAME} windows::headers)
# add_subdirectory("${CMAKE_SOURCE_DIR}/opencpn-libs/glu")
# target_link_libraries(${PACKAGE_NAME} ocpn::glu_static)
endif()
if(LINUX)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GIOMM giomm-2.4)
if(GIOMM_FOUND)
include_directories(${GIOMM_INCLUDE_DIRS})
target_link_libraries(${PACKAGE_NAME} ${GIOMM_LIBRARIES})
add_definitions(-DDASHBOARDSK_USE_GIOMM)
endif()
endif()
add_subdirectory("${CMAKE_SOURCE_DIR}/opencpn-libs/plugin_dc")
target_link_libraries(${PACKAGE_NAME} ocpn::plugin-dc)
add_subdirectory("opencpn-libs/wxJSON")
target_link_libraries(${PACKAGE_NAME} ocpn::wxjson)
if(${WITH_TESTS})
include(CTest)
add_subdirectory("${CMAKE_SOURCE_DIR}/tests")
add_dependencies(${CMAKE_PROJECT_NAME} tests)
endif()
endmacro()
add_custom_target(
doxygen-docs
COMMAND doxygen
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_target(
asciidoxy-docs
COMMAND asciidoxy -D apidocs --spec-file packages.toml api.adoc
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS doxygen-docs)