forked from konnibe/LogbookKonni-1.2
-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
124 lines (101 loc) · 3.01 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
# ~~~
# Summary: Main plugin build script
# 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.
# -------- Cmake setup ---------
#
cmake_minimum_required(VERSION 3.12.0)
include(${CMAKE_SOURCE_DIR}/cmake/CmakeSetup.cmake NO_POLICY_SCOPE)
message(STATUS "Cmake version: ${CMAKE_VERSION}.")
# -------- Build setup --------
#
include(PluginOptions)
if (BUILD_TYPE)
message(STATUS "Building: ${BUILD_TYPE}")
else ()
message(STATUS "Configuring")
endif ()
# -------- Plugin setup ----------
#
include(Plugin.cmake)
# -------- Setup completed, build the plugin --------
#
project(${PKG_NAME} VERSION ${PKG_VERSION})
include(PluginCompiler)
add_library(${CMAKE_PROJECT_NAME} SHARED EXCLUDE_FROM_ALL ${SRC})
include_directories(BEFORE ${CMAKE_BINARY_DIR}/include)
add_subdirectory("opencpn-libs/${PKG_API_LIB}")
if (${PKG_NAME} MATCHES wx32)
target_link_libraries(${CMAKE_PROJECT_NAME} ocpn::api_wx32)
else ()
target_link_libraries(${CMAKE_PROJECT_NAME} ocpn::api)
endif ()
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})
if (COMMAND late_init)
late_init()
endif ()
# Configure the flatpak manifest
file(
GLOB manifest ${PROJECT_SOURCE_DIR}/flatpak/org.opencpn.OpenCPN.Plugin.*.yaml
)
include(ConfigureManifest)
configure_manifest(${manifest} _new_manifest)
# Set up targets. Targets sets up new targets with BUILD_TYPE set to
# 'flatpak', 'android' or 'tarball'. The initial call without BUILD_TYPE ends
# here.
#
include(Targets)
create_targets(${_new_manifest})
if ("${BUILD_TYPE}" STREQUAL "")
return ()
endif ()
if (NOT ${BUILD_TYPE} STREQUAL "flatpak")
# Build package as required (flatpak already dealt with).
#
if (APPLE)
include(MacosWxwidgets)
endif ()
include(PluginInstall)
if (QT_ANDROID)
include(AndroidLibs)
else ()
include(PluginLibs)
endif ()
include(PluginLocalization)
include_directories(BEFORE ${CMAKE_BINARY_DIR}/include)
if (COMMAND add_plugin_libraries)
add_plugin_libraries()
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@")
configure_file(
# The XML metadata file
${CMAKE_SOURCE_DIR}/plugin.xml.in
${CMAKE_BINARY_DIR}/${pkg_displayname}.xml.in
@ONLY
)