2015-03-26 20:50:28 +00:00
# cmake based build of Subsurface
2016-03-16 07:57:41 +00:00
# Uncomment his to see all commands cmake actually executes
# set(CMAKE_VERBOSE_MAKEFILE ON)
2019-03-10 09:59:23 +00:00
cmake_minimum_required(VERSION 3.1)
2019-03-19 16:14:31 +00:00
project(Subsurface)
2014-04-14 19:47:12 +00:00
2019-03-03 20:59:42 +00:00
# don't process generated files - this is new in 3.10
if (POLICY CMP0071)
2017-12-24 21:33:06 +00:00
cmake_policy(SET CMP0071 OLD)
endif()
2017-12-24 19:34:43 +00:00
2019-10-14 23:08:22 +00:00
# support Packagename_ROOT environment variable
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) # CMake 3.12
endif ()
2015-03-26 20:50:28 +00:00
# global settings
2018-02-13 13:38:51 +00:00
set(CMAKE_MODULE_PATH
${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules
${CMAKE_MODULE_PATH}
)
2015-04-18 12:22:11 +00:00
set(CMAKE_AUTOMOC ON)
2018-02-13 13:38:51 +00:00
include(MacroOutOfSourceBuild)
2015-11-17 19:08:42 +00:00
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
2017-10-07 23:36:49 +00:00
"We don't support building in source, please create a build folder elsewhere and remember to run git clean -xdf to remove temporary files created by CMake."
2015-11-17 19:08:42 +00:00
)
2015-11-09 20:57:47 +00:00
2019-09-23 21:49:25 +00:00
#Option for profiling
option(SUBSURFACE_PROFILING_BUILD "enable profiling of Subsurface binary" OFF)
2015-11-17 21:16:51 +00:00
#Options regarding usage of pkgconfig
2015-04-18 12:22:11 +00:00
option(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF)
option(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
2015-11-17 18:48:17 +00:00
2015-11-17 21:16:51 +00:00
#Library Handling
option(FORCE_LIBSSH "force linking with libssh to workaround libgit2 bug" ON)
2017-01-16 23:56:56 +00:00
option(LIBGIT2_DYNAMIC "search for libgit2.so before libgit2.a" OFF)
2015-11-17 21:16:51 +00:00
#Options regarding disabling parts of subsurface.
2015-04-18 12:22:11 +00:00
option(NO_DOCS "disable the docs" OFF)
2015-09-01 16:49:57 +00:00
option(NO_PRINTING "disable the printing support" OFF)
2015-07-01 15:08:33 +00:00
option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
2015-11-17 21:16:51 +00:00
#Options regarding enabling parts of subsurface
2015-07-20 16:35:00 +00:00
option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" ON)
2015-08-20 22:19:45 +00:00
option(FTDISUPPORT "enable support for libftdi based serial" OFF)
2015-11-17 21:16:51 +00:00
# Options regarding What should we build on subsurface
option(MAKE_TESTS "Make the tests" ON)
2020-11-14 03:04:17 +00:00
SET(SUBSURFACE_TARGET_EXECUTABLE "DesktopExecutable" CACHE STRING "The type of application, DesktopExecutable, MobileExecutable, or DownloaderExecutable")
LIST(APPEND SUBSURFACE_ACCEPTED_EXECUTABLES "DesktopExecutable" "MobileExecutable" "DownloaderExecutable")
2015-12-16 17:09:32 +00:00
SET_PROPERTY(CACHE SUBSURFACE_TARGET_EXECUTABLE PROPERTY STRINGS ${SUBSURFACE_ACCEPTED_EXECUTABLES})
2015-11-23 14:34:14 +00:00
2015-11-23 14:13:24 +00:00
#verify if Platform is correct and warn on wxit with example.
2015-12-16 16:30:56 +00:00
list (FIND SUBSURFACE_ACCEPTED_EXECUTABLES ${SUBSURFACE_TARGET_EXECUTABLE} _index)
2019-03-03 21:19:32 +00:00
if (_index EQUAL -1)
2015-11-23 14:13:24 +00:00
message(FATAL_ERROR "Requested platform not supported, please use one of the following:
2015-12-16 16:30:56 +00:00
${SUBSURFACE_ACCEPTED_EXECUTABLES}
2015-11-23 14:13:24 +00:00
2015-12-16 16:30:56 +00:00
inputted value was: ${SUBSURFACE_TARGET_EXECUTABLE}
2015-11-23 14:13:24 +00:00
2015-12-16 17:48:20 +00:00
Example: -DSUBSURFACE_TARGET_EXECUTABLE=DesktopExecutable")
2015-12-01 19:46:59 +00:00
endif()
2017-02-24 06:52:07 +00:00
# SUBSURFACE_SOURCE may be used in subdirectories (tests)
set(SUBSURFACE_SOURCE ${CMAKE_SOURCE_DIR})
add_definitions(-DSUBSURFACE_SOURCE="${SUBSURFACE_SOURCE}")
2015-09-02 23:52:34 +00:00
2019-03-10 09:59:23 +00:00
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
2020-10-17 22:08:38 +00:00
set(CMAKE_CXX_STANDARD 17)
2019-03-10 09:59:23 +00:00
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
2015-11-17 19:21:42 +00:00
#
# TODO: This Compilation part should go on the Target specific CMake.
#
2019-03-03 21:19:32 +00:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
2018-10-28 18:10:09 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
2019-03-03 21:19:32 +00:00
if ((CMAKE_SYSTEM_NAME MATCHES "Darwin") AND
((CMAKE_SYSTEM_VERSION MATCHES "11.4.") OR
(CMAKE_OSX_DEPLOYMENT_TARGET MATCHES "10.7") OR
(CMAKE_OSX_DEPLOYMENT_TARGET MATCHES "10.8")))
2019-03-10 09:59:23 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
2017-01-01 05:17:02 +00:00
endif()
2019-03-03 21:19:32 +00:00
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
2019-03-10 09:59:23 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
2019-03-03 21:19:32 +00:00
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2017-03-09 16:07:30 +00:00
# Warn about possible float conversion errors
# Use NOT VERSION_LESS since VERSION_GREATER_EQUAL is not available
# in currently used cmake version.
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion")
2017-03-23 01:13:49 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfloat-conversion")
2017-03-09 16:07:30 +00:00
endif()
2019-03-03 21:19:32 +00:00
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
2019-03-10 09:59:23 +00:00
# using Intel C++
2019-03-03 21:19:32 +00:00
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
2015-11-09 00:33:19 +00:00
# using Visual Studio C++
2014-04-14 17:21:01 +00:00
endif()
2019-09-23 21:49:25 +00:00
# set up profiling
if (SUBSURFACE_PROFILING_BUILD)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
endif()
2017-12-17 03:36:32 +00:00
# every compiler understands -Wall
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
2018-04-28 19:28:22 +00:00
# by detault optimize with -O2 even for debug builds
set (GCC_OPTIMIZATION_FLAGS "-O2" CACHE STRING "GCC optimization flags")
message (STATUS "GCC optimization flags: " ${GCC_OPTIMIZATION_FLAGS})
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${GCC_OPTIMIZATION_FLAGS}")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${GCC_OPTIMIZATION_FLAGS}")
2017-12-18 07:50:12 +00:00
2015-03-26 20:50:28 +00:00
# pkgconfig for required libraries
2015-04-18 12:22:11 +00:00
find_package(PkgConfig)
2018-02-13 13:38:51 +00:00
include(pkgconfig_helper)
2015-11-17 19:21:42 +00:00
# The 'HandleFindXXX' are special libraries that subsurface needs
# to find and configure in a few different ways because of a few
# developers that prefer pkg-config over CMake, so we try to make
# everyone happy. It also sets some variables for each library, so
# if you think a module miss anything, take a look on the specific
# module file.
2018-02-13 13:38:51 +00:00
include(HandleFindGit2)
include(HandleFindLibDiveComputer)
2019-03-03 21:19:32 +00:00
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
2018-02-13 13:38:51 +00:00
include(HandleUserManual)
2015-12-30 17:55:24 +00:00
endif()
2018-02-13 13:38:51 +00:00
include(HandleFtdiSupport)
include(HandleVersionGeneration)
include(RunOnBuildDir)
include(cmake_variables_helper)
2015-11-17 20:23:32 +00:00
2017-10-23 15:48:43 +00:00
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
include_directories(${CMAKE_OSX_SYSROOT}/usr/include/libxml2)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lxml2 -lxslt -lsqlite3)
else()
pkg_config_library(LIBXML libxml-2.0 REQUIRED)
pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED)
pkg_config_library(LIBXSLT libxslt REQUIRED)
endif()
2015-04-10 19:08:26 +00:00
pkg_config_library(LIBZIP libzip REQUIRED)
2020-04-24 22:19:04 +00:00
if(NOT ANDROID)
2020-09-19 21:16:08 +00:00
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
pkg_config_library(BLUEZ bluez REQUIRED)
endif()
2020-04-24 22:19:04 +00:00
pkg_config_library(LIBUSB libusb-1.0 QUIET)
2020-10-27 22:51:46 +00:00
pkg_config_library(LIBMTP libmtp QUIET)
2020-04-24 22:19:04 +00:00
endif()
2015-03-26 20:50:28 +00:00
2015-11-17 21:22:02 +00:00
include_directories(.
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/desktop-widgets
)
2015-11-23 14:19:38 +00:00
# Project Target specific configuration should go here,
# if the configuration is too big or would disrupt the normal code flux,
# move it somewhere else (another file) and include it.
2019-03-03 21:19:32 +00:00
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
2015-12-17 19:08:21 +00:00
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(SUBSURFACE_TARGET Subsurface)
else()
set(SUBSURFACE_TARGET subsurface)
endif()
2017-07-14 21:52:29 +00:00
list(APPEND QT_EXTRA_COMPONENTS QuickWidgets)
2016-01-07 16:38:16 +00:00
remove_definitions(-DSUBSURFACE_MOBILE)
2020-10-11 14:27:28 +00:00
if(NO_PRINTING)
message(STATUS "building without printing support")
add_definitions(-DNO_PRINTING)
else()
2020-10-07 19:37:22 +00:00
LIST(APPEND QT_EXTRA_COMPONENTS PrintSupport)
# Because Qt5WebKitWidgets isn't a part of the "regular" Qt5, we can't get it the normal way
find_package(Qt5WebKitWidgets REQUIRED)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} Qt5::WebKitWidgets)
endif()
2019-03-03 21:19:32 +00:00
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
2015-12-17 19:08:21 +00:00
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(SUBSURFACE_TARGET Subsurface-mobile)
else()
set(SUBSURFACE_TARGET subsurface-mobile)
endif()
2017-04-01 07:35:26 +00:00
list(APPEND QT_EXTRA_COMPONENTS QuickControls2)
2020-11-15 23:19:40 +00:00
list(APPEND QT_EXTRA_COMPONENTS QuickWidgets)
2015-12-17 19:08:21 +00:00
add_definitions(-DSUBSURFACE_MOBILE)
2019-11-23 10:24:26 +00:00
# add definition to seperate mobile for devices and for desktop
add_definitions(-DSUBSURFACE_MOBILE_DESKTOP)
2017-12-05 19:47:34 +00:00
message(STATUS "Building Subsurface-mobile requires BT support")
set(BTSUPPORT ON)
2020-11-14 03:04:17 +00:00
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
2020-11-15 21:12:21 +00:00
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(SUBSURFACE_TARGET Subsurface-downloader)
else()
set(SUBSURFACE_TARGET subsurface-downloader)
endif()
2020-11-14 03:04:17 +00:00
set(BTSUPPORT ON)
add_definitions(-DSUBSURFACE_DOWNLOADER)
message(STATUS "building the embedded Subsurface-downloader app")
2015-12-16 16:50:41 +00:00
endif()
if(ANDROID)
set(NO_PRINTING ON)
2020-04-22 03:34:44 +00:00
set(NO_USERMANUAL ON)
2020-04-24 22:19:04 +00:00
set(MAKE_TESTS OFF)
2015-12-16 16:50:41 +00:00
list(APPEND QT_EXTRA_COMPONENTS AndroidExtras)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -llog)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
2020-11-24 18:52:05 +00:00
# add pthread to the end of the library list on Linux
# this is only needed on Ubuntu
# but shouldn't hurt on other Linux versions
# in some builds we appear to be missing libz for some strange reason...
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lz -lpthread)
# Test for ARM processor (Raspberry Pi) and add libGLESv2 if found
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv6l")
message (STATUS "Found ARM processor. Adding libGLESv2")
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lGLESv2)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
2015-12-16 16:33:52 +00:00
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
2020-11-24 18:52:05 +00:00
execute_process(
COMMAND sh scripts/get-version linux
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE SSRF_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_library(APP_SERVICES_LIBRARY ApplicationServices)
find_library(HID_LIB HidApi)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${HID_LIB})
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
2019-03-03 21:19:32 +00:00
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
2015-12-16 22:34:33 +00:00
set(MACOSX_BUNDLE_INFO_STRING "Subsurface-mobile")
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface-mobile")
else()
set(MACOSX_BUNDLE_INFO_STRING "Subsurface")
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface")
endif()
2015-12-17 16:28:43 +00:00
set(MACOSX_BUNDLE_ICON_FILE Subsurface.icns)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.subsurface-divelog")
2020-11-24 18:52:05 +00:00
set(MACOSX_BUNDLE_BUNDLE_VERSION "${SSRF_VERSION_STRING}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${SSRF_VERSION_STRING}")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${SSRF_VERSION_STRING}")
set(MACOSX_BUNDLE_COPYRIGHT "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, Berthold Stoeger and others")
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE})
2015-12-16 16:33:52 +00:00
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
2020-11-24 18:52:05 +00:00
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32 -lws2_32)
remove_definitions(-DUNICODE)
add_definitions(-mwindows -D_WIN32)
2015-07-01 15:08:36 +00:00
endif()
2015-11-23 14:13:24 +00:00
2015-10-26 13:05:27 +00:00
if(BTSUPPORT)
2019-10-14 17:54:54 +00:00
set(BLESUPPORT ON)
2015-11-20 13:49:56 +00:00
list(APPEND QT_EXTRA_COMPONENTS Bluetooth)
2019-10-14 17:54:54 +00:00
add_definitions(-DBT_SUPPORT)
add_definitions(-DBLE_SUPPORT)
2015-10-26 13:05:27 +00:00
endif()
2015-11-20 13:49:56 +00:00
2018-11-13 07:47:47 +00:00
if(ANDROID)
# when building for Android, the toolchain file requires all cmake modules
# to be inside the CMAKE_FIND_ROOT_PATH - which prevents cmake from finding
# our Qt installation. This is ugly, but it works.
set(CMAKE_FIND_ROOT_PATH "/;${CMAKE_FIND_ROOT_PATH}")
endif()
2021-01-08 20:53:27 +00:00
set(QT_FIND_COMPONENTS Core Concurrent Widgets Network Svg Positioning Quick Location ${QT_EXTRA_COMPONENTS})
2019-10-14 17:57:28 +00:00
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
find_package(Qt5 5.9.1 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
2020-11-14 03:04:17 +00:00
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
2019-11-14 12:29:35 +00:00
# Kirigami 5.62 and newer require at least Qt 5.12
2020-04-24 22:19:04 +00:00
if(ANDROID)
find_package(Qt5 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools)
else()
find_package(Qt5 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
endif()
2020-11-14 03:04:17 +00:00
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
# let's pick a version that's not ancient
2020-11-16 12:22:41 +00:00
find_package(Qt5 5.11 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS})
2020-11-14 03:04:17 +00:00
set(MAKE_TESTS OFF)
2019-10-14 17:57:28 +00:00
endif()
2019-03-07 21:27:22 +00:00
foreach(_QT_COMPONENT ${QT_FIND_COMPONENTS})
list(APPEND QT_LIBRARIES Qt5::${_QT_COMPONENT})
endforeach()
2020-04-24 22:19:04 +00:00
if(NOT ANDROID)
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test Qt5::QuickTest)
endif()
2015-02-02 15:52:35 +00:00
2015-11-23 14:13:24 +00:00
#set up the subsurface_link_libraries variable
2020-10-27 22:51:46 +00:00
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
2020-11-14 03:04:17 +00:00
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
statistics: convert chart to QQuickItem
It turns out that the wrong base class was used for the chart.
QQuickWidget can only be used on desktop, not in a mobile UI.
Therefore, turn this into a QQuickItem and move the container
QQuickWidget into desktop-only code.
Currently, this code is insane: The chart is rendered onto a
QGraphicsScene (as it was before), which is then rendered into
a QImage, which is transformed into a QSGTexture, which is then
projected onto the device. This is performed on every mouse
move event, since these events in general change the position
of the info-box.
The plan is to slowly convert elements such as the info-box into
QQuickItems. Browsing the QtQuick documentation, this will
not be much fun.
Also note that the rendering currently tears, flickers and has
antialiasing artifacts, most likely owing to integer (QImage)
to floating point (QGraphicsScene, QQuickItem) conversion
problems. The data flow is
QGraphicsScene (float) -> QImage (int) -> QQuickItem (float).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-07 13:38:37 +00:00
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc map-widget/qml/map-widget.qrc desktop-widgets/qml/statsview2.qrc)
2020-11-14 03:04:17 +00:00
endif()
2015-09-17 22:24:26 +00:00
2019-03-17 03:17:07 +00:00
# hack to build successfully on LGTM
if(DEFINED ENV{LGTM_SRC})
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lgssapi_krb5 -lhttp_parser)
endif()
2015-04-09 18:50:06 +00:00
# include translations
2020-11-14 03:04:17 +00:00
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
2015-04-09 18:50:06 +00:00
add_subdirectory(translations)
2020-11-14 03:04:17 +00:00
endif()
2016-04-05 05:02:03 +00:00
add_subdirectory(core)
2015-09-03 18:25:01 +00:00
add_subdirectory(qt-models)
2019-11-13 14:08:40 +00:00
add_subdirectory(commands)
2020-11-14 03:04:17 +00:00
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
2015-09-03 18:56:37 +00:00
add_subdirectory(profile-widget)
2019-12-22 13:10:29 +00:00
add_subdirectory(map-widget)
2019-12-22 15:44:35 +00:00
add_subdirectory(mobile-widgets)
2021-01-01 00:37:56 +00:00
add_subdirectory(stats)
2020-11-14 03:04:17 +00:00
endif()
2019-12-14 21:15:12 +00:00
add_subdirectory(backend-shared)
2015-11-05 23:06:10 +00:00
2019-03-03 21:19:32 +00:00
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
2015-11-05 23:06:10 +00:00
add_subdirectory(desktop-widgets)
endif()
2014-04-14 17:21:01 +00:00
2015-03-26 20:50:28 +00:00
# create the executables
2019-03-03 21:19:32 +00:00
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
2020-11-23 17:34:02 +00:00
# set up Kirigami using KDE ECM
# that's available as kde-extra-cmake-modules on Homebrew, on all Linux flavors
# Android and iOS are built via qmake, Windows build of Subsurface-mobile isn't supported
2020-11-25 04:15:45 +00:00
find_package(ECM REQUIRED CONFIG PATHS ${CMAKE_CURRENT_SOURCE_DIR}/mobile-widgets/3rdparty/ECM)
2020-11-23 17:34:02 +00:00
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
set(BREEZEICONS_DIR mobile-widgets/3rdparty/breeze-icons/)
SET(QML_IMPORT_PATH ${QML_IMPORT_PATH} ${CMAKE_SOURCE_DIR}/mobile-widgets/3rdparty/kirigami/src ${CMAKE_SOURCE_DIR}/mobile-widgets/qml)
add_subdirectory(mobile-widgets/3rdparty)
include_directories(${CMAKE_SOURCE_DIR}/mobile-widgets/3rdparty/kirigami/src)
include(${CMAKE_SOURCE_DIR}/mobile-widgets/3rdparty/kirigami/KF5Kirigami2Macros.cmake)
2015-09-03 17:49:59 +00:00
set(MOBILE_SRC
2015-11-06 21:44:13 +00:00
subsurface-mobile-main.cpp
2018-07-11 09:34:33 +00:00
subsurface-helper.cpp
2015-09-03 17:49:59 +00:00
)
2016-04-05 05:02:03 +00:00
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc)
2020-11-25 03:49:27 +00:00
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/icons.qrc)
2020-11-25 22:10:48 +00:00
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/kirigami/src/scenegraph/shaders/shaders.qrc)
2020-11-23 17:34:02 +00:00
# the following is split across two commands since in cmake 3.12 this would result
# in a non-sensical "no sources given to target" error if done all as one set of
# arguments to the add_executable() call
add_executable(${SUBSURFACE_TARGET} ${SUBSURFACE_PKG} ${SUBSURFACE_RESOURCES})
target_sources(${SUBSURFACE_TARGET} PUBLIC ${MOBILE_SRC} ${MOBILE_RESOURCES})
2015-05-27 12:33:23 +00:00
target_link_libraries(
2015-11-05 23:06:10 +00:00
${SUBSURFACE_TARGET}
2019-12-22 15:44:35 +00:00
subsurface_mobile
2015-11-05 23:06:10 +00:00
subsurface_profile
2019-12-22 13:10:29 +00:00
subsurface_mapwidget
2019-12-14 20:56:31 +00:00
subsurface_backend_shared
2018-01-09 15:30:03 +00:00
subsurface_models_mobile
2020-03-02 16:41:00 +00:00
subsurface_commands
2015-11-05 23:06:10 +00:00
subsurface_corelib
2021-01-01 00:37:56 +00:00
subsurface_stats
2020-11-23 17:34:02 +00:00
kirigamiplugin
2015-11-23 14:34:14 +00:00
${SUBSURFACE_LINK_LIBRARIES}
)
2019-03-03 21:19:32 +00:00
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
2015-11-05 23:06:10 +00:00
set(SUBSURFACE_APP
subsurface-desktop-main.cpp
2018-07-11 09:34:33 +00:00
subsurface-helper.cpp
2015-11-05 23:06:10 +00:00
)
source_group("Subsurface App" FILES ${SUBSURFACE_APP})
2020-11-24 18:52:05 +00:00
if(ANDROID)
add_library(${SUBSURFACE_TARGET} SHARED ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
else()
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
endif()
2015-11-05 23:06:10 +00:00
target_link_libraries(
${SUBSURFACE_TARGET}
2015-05-27 12:33:23 +00:00
subsurface_generated_ui
subsurface_interface
subsurface_profile
subsurface_statistics
2019-12-22 13:10:29 +00:00
subsurface_mapwidget
2019-12-14 20:56:31 +00:00
subsurface_backend_shared
2018-01-09 15:30:03 +00:00
subsurface_models_desktop
2020-03-02 16:41:00 +00:00
subsurface_commands
2015-05-27 12:33:23 +00:00
subsurface_corelib
2021-01-01 21:43:21 +00:00
subsurface_stats
2015-11-05 23:06:10 +00:00
${SUBSURFACE_LINK_LIBRARIES}
)
2017-10-20 21:22:57 +00:00
add_dependencies(subsurface_desktop_preferences subsurface_generated_ui)
2015-11-05 23:06:10 +00:00
add_dependencies(subsurface_statistics subsurface_generated_ui)
add_dependencies(subsurface_interface subsurface_generated_ui)
add_dependencies(subsurface_profile subsurface_generated_ui)
2018-01-09 15:30:03 +00:00
add_dependencies(subsurface_models_desktop subsurface_generated_ui)
2015-11-05 23:06:10 +00:00
add_dependencies(subsurface_generated_ui version)
2020-11-14 03:04:17 +00:00
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
set(DOWNLOADER_APP
subsurface-downloader-main.cpp
2020-11-23 01:31:05 +00:00
cli-downloader.cpp
2020-11-14 03:04:17 +00:00
)
source_group("Downloader App" FILES ${DOWNLOADER_APP})
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${DOWNLOADER_APP} ${SUBSURFACE_RESOURCES})
target_link_libraries(
${SUBSURFACE_TARGET}
2020-11-15 03:21:16 +00:00
subsurface_backend_shared
subsurface_models_downloader
subsurface_commands
2020-11-14 03:04:17 +00:00
subsurface_corelib
${SUBSURFACE_LINK_LIBRARIES}
)
2015-05-27 12:33:23 +00:00
endif()
2014-04-14 17:21:01 +00:00
2015-04-18 12:22:11 +00:00
add_dependencies(subsurface_corelib version)
2014-04-14 17:21:01 +00:00
2015-03-31 21:03:02 +00:00
# add platform specific actions
2015-04-18 12:22:11 +00:00
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
2019-03-03 21:57:10 +00:00
file(WRITE ${CMAKE_BINARY_DIR}/qt.conf "[Paths]
Prefix=.
")
2015-04-18 12:22:11 +00:00
endif()
2015-03-31 21:03:02 +00:00
2015-06-16 13:58:22 +00:00
# build an automated html exporter
2015-09-02 23:52:34 +00:00
add_executable(export-html EXCLUDE_FROM_ALL export-html.cpp ${SUBSURFACE_RESOURCES})
2015-06-16 13:58:22 +00:00
target_link_libraries(export-html subsurface_corelib ${SUBSURFACE_LINK_LIBRARIES})
2015-03-30 19:50:52 +00:00
# install Subsurface
# first some variables with files that need installing
set(DOCFILES
2017-11-04 17:05:35 +00:00
README.md
2015-03-30 19:50:52 +00:00
ReleaseNotes/ReleaseNotes.txt
2015-03-30 21:43:15 +00:00
SupportedDivecomputers.txt
${CMAKE_BINARY_DIR}/Documentation/user-manual.html
${CMAKE_BINARY_DIR}/Documentation/user-manual_es.html
${CMAKE_BINARY_DIR}/Documentation/user-manual_fr.html
${CMAKE_BINARY_DIR}/Documentation/user-manual_ru.html
2015-03-30 19:50:52 +00:00
)
2017-02-03 18:57:57 +00:00
# add all the translations that we may need
2015-12-16 22:24:47 +00:00
FILE(STRINGS "subsurface_enabled_translations" QTTRANSLATIONS_BASE)
2015-03-31 20:39:09 +00:00
2015-04-10 19:10:07 +00:00
if(NOT DEFINED QT_TRANSLATION_DIR OR QT_TRANSLATION_DIR STREQUAL "")
2015-04-04 23:21:32 +00:00
set(QT_TRANSLATION_DIR ${Qt5Core_DIR}/../../../translations)
endif()
2015-04-04 20:12:20 +00:00
set(QTTRANSLATIONS "")
2015-03-31 20:39:09 +00:00
foreach(QTTRANSLATION ${QTTRANSLATIONS_BASE})
2019-03-03 21:19:32 +00:00
if (QTTRANSLATION AND EXISTS ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
set(QTTRANSLATIONS ${QTTRANSLATIONS} ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
2015-04-04 20:12:20 +00:00
endif()
2015-03-31 20:39:09 +00:00
endforeach()
2015-03-30 19:50:52 +00:00
# now for each platform the install instructions
2015-12-16 22:25:38 +00:00
if(ANDROID)
2015-04-18 12:22:09 +00:00
# Android template directory
2015-07-08 22:42:12 +00:00
include(${QT_ANDROID_CMAKE})
2017-05-28 01:54:03 +00:00
if((DEFINED ENV{KEYSTORE}) AND (DEFINED ENV{KEYSTORE_PASSWORD}))
add_qt_android_apk(${SUBSURFACE_TARGET}.apk ${SUBSURFACE_TARGET}
PACKAGE_SOURCES ${CMAKE_BINARY_DIR}/android-mobile DEPENDS ${ANDROID_NATIVE_LIBSSL} ${ANDROID_NATIVE_LIBCRYPT}
KEYSTORE $ENV{KEYSTORE} Subsurface-mobile KEYSTORE_PASSWORD $ENV{KEYSTORE_PASSWORD}
)
message(STATUS "KEYSTORE=$ENV{KEYSTORE} KEYSTORE_PASSWORD=$ENV{KEYSTORE_PASSWORD}")
else()
add_qt_android_apk(${SUBSURFACE_TARGET}.apk ${SUBSURFACE_TARGET}
PACKAGE_SOURCES ${CMAKE_BINARY_DIR}/android-mobile DEPENDS ${ANDROID_NATIVE_LIBSSL} ${ANDROID_NATIVE_LIBCRYPT}
)
message(STATUS "no KEYSTORE")
endif()
2015-12-16 22:25:38 +00:00
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
2015-12-17 19:09:23 +00:00
set(APP_BUNDLE_DIR "${SUBSURFACE_TARGET}.app")
2020-10-13 23:23:37 +00:00
# macdeployqt simplifies a lot of this process, but still doesn't get everything right
# - it misses a couple of resources and frameworks
# - it seems to always deploy the SQL plugins (even though they aren't needed)
set(MACDEPLOY_ARGS "-qmldir=${APP_BUNDLE_DIR}/Contents/Resources/qml -appstore-compliant -verbose=0 -executable=${APP_BUNDLE_DIR}/Contents/MacOS/${SUBSURFACE_TARGET} -always-overwrite -libpath=${CMAKE_SOURCE_DIR}/../install-root/lib")
2015-12-16 22:34:33 +00:00
set(RESOURCEDIR ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources)
set(PLUGINDIR ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns)
2015-12-16 22:27:27 +00:00
install(DIRECTORY Documentation/images DESTINATION ${RESOURCEDIR}/share/Documentation)
install(FILES ${DOCFILES} DESTINATION ${RESOURCEDIR}/share/Documentation)
install(DIRECTORY theme DESTINATION ${RESOURCEDIR})
install(DIRECTORY printing_templates DESTINATION ${RESOURCEDIR})
install(FILES ${TRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
install(FILES ${QTTRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR})
2017-07-29 00:19:01 +00:00
install(CODE "execute_process(COMMAND mkdir -p ${RESOURCEDIR}/qml)")
2017-09-02 11:39:37 +00:00
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
2018-07-07 00:20:53 +00:00
install(CODE "execute_process(COMMAND cp ${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
2015-12-16 22:27:27 +00:00
# this is a hack - but I don't know how else to find the macdeployqt program if it's not in the PATH
string(REPLACE moc macdeployqt MACDEPLOYQT ${QT_MOC_EXECUTABLE})
2019-12-10 10:06:00 +00:00
install(CODE "execute_process(COMMAND ${MACDEPLOYQT} ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})")
2020-10-13 23:23:37 +00:00
# the next hack is here to delete the sqlite plugin that get's installed even though it isn't needed
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns/sqldrivers)")
2015-12-16 22:34:33 +00:00
# and another hack to get the QML Components in the right place
2020-10-13 23:23:37 +00:00
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick.2,QtLocation,QtPositioning})")
2017-07-29 00:19:01 +00:00
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtLocation ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
2018-07-07 00:23:54 +00:00
if(NOT Qt5Core_VERSION VERSION_LESS 5.11.0)
# and with Qt 5.11 we need another library that isn't copied by macdeployqt
2020-10-13 23:23:37 +00:00
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtPositioningQuick.framework)")
2018-07-07 00:23:54 +00:00
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/lib/QtPositioningQuick.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
endif()
2020-09-13 00:34:33 +00:00
if(NOT Qt5Core_VERSION VERSION_LESS 5.14.0)
# and with Qt 5.14 we need another library that isn't always copied by macdeployqt
2020-10-13 23:23:37 +00:00
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtQmlWorkerScript.framework)")
2020-09-13 00:34:33 +00:00
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/lib/QtQmlWorkerScript.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
endif()
2019-03-03 21:19:32 +00:00
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
2018-05-19 21:13:35 +00:00
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtGraphicalEffects ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQml ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
endif()
2015-12-16 22:25:38 +00:00
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
2017-11-14 14:13:42 +00:00
if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
if(NOT DEFINED OBJCOPY)
2020-10-28 17:55:02 +00:00
set(OBJCOPY x86_64-w64-mingw32.shared-objcopy)
2017-11-14 14:13:42 +00:00
endif()
2017-11-15 20:17:37 +00:00
find_program(OBJCOPY_FOUND ${OBJCOPY})
if (OBJCOPY_FOUND)
message(STATUS "Build type is 'RelWithDebInfo'. Creating debug symbols in a separate file.")
add_custom_command(TARGET ${SUBSURFACE_TARGET} POST_BUILD
COMMAND ${OBJCOPY} --only-keep-debug ${SUBSURFACE_TARGET}.exe ${SUBSURFACE_TARGET}.exe.debug
COMMAND ${OBJCOPY} --strip-debug --strip-unneeded ${SUBSURFACE_TARGET}.exe
COMMAND ${OBJCOPY} --add-gnu-debuglink=${SUBSURFACE_TARGET}.exe.debug ${SUBSURFACE_TARGET}.exe
)
endif()
2017-11-14 14:13:42 +00:00
endif()
2015-12-16 22:27:27 +00:00
# Windows bundling rules
# We don't have a helpful tool like macdeployqt for Windows, so we hardcode
# which libs we need.
# "make install", copies everything into a staging area
# "make installer", uses makensis to create an installer executable
set(WINDOWSSTAGING ${CMAKE_BINARY_DIR}/staging)
install(DIRECTORY Documentation/images DESTINATION ${WINDOWSSTAGING}/Documentation)
install(FILES ${DOCFILES} DESTINATION ${WINDOWSSTAGING}/Documentation)
install(DIRECTORY theme DESTINATION ${WINDOWSSTAGING})
install(DIRECTORY printing_templates DESTINATION ${WINDOWSSTAGING})
install(FILES ${TRANSLATIONS} DESTINATION ${WINDOWSSTAGING}/translations)
install(FILES ${QTTRANSLATIONS} DESTINATION ${WINDOWSSTAGING}/translations)
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt ${CMAKE_SOURCE_DIR}/packaging/windows/subsurface.ico DESTINATION ${WINDOWSSTAGING})
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION ${WINDOWSSTAGING})
install(FILES ${CMAKE_BINARY_DIR}/qt.conf DESTINATION ${WINDOWSSTAGING})
2018-11-14 08:20:18 +00:00
if(NOT Qt5Core_VERSION VERSION_LESS 5.11.0)
# hack to work around the fact that we don't process the dependencies of plugins
# as of Qt 5.11 this additional DLL is needed and it's only referenced in the qml DLLs
install(FILES ${_qt5Core_install_prefix}/bin/Qt5PositioningQuick.dll DESTINATION ${WINDOWSSTAGING})
endif()
2015-12-16 22:27:27 +00:00
if(NOT DEFINED MAKENSIS)
set(MAKENSIS makensis)
endif()
2015-11-23 14:48:35 +00:00
2015-12-16 22:27:27 +00:00
# the script we created above is now added as a command to run at
# install time - so this ensures that subsurface.exe has been
# built before this is run
2017-02-24 06:52:07 +00:00
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DSUBSURFACE_TARGET=${SUBSURFACE_TARGET} -DSUBSURFACE_SOURCE=${SUBSURFACE_SOURCE} -DSTAGING=${WINDOWSSTAGING} -P ${CMAKE_SOURCE_DIR}/cmake/Modules/dlllist.cmake)")
2015-03-30 19:50:52 +00:00
2015-12-16 22:27:27 +00:00
# create the subsurface-x.y.z.exe installer - this needs to depend
# on the install target but cmake doesn't allow that, so we depend
# on the fake target instead
add_custom_target(
fake_install
COMMAND "${CMAKE_COMMAND}" --build . --target install
DEPENDS ${SUBSURFACE_TARGET}
)
add_custom_target(
installer
COMMAND ${MAKENSIS} ${WINDOWSSTAGING}/subsurface.nsi
DEPENDS fake_install
)
2015-12-16 22:25:38 +00:00
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
2017-09-02 11:39:37 +00:00
# the syntax is odd, but this searches for libqtgeoservices_googlemaps.so
# in the filesystem below our install-root
# different Linux flavors put the plugin in different directories
file(GLOB_RECURSE GOOGLEMAPS ${CMAKE_SOURCE_DIR}/../install-root/libqtgeoservices_googlemaps.so)
2019-03-03 21:19:32 +00:00
if (NOT GOOGLEMAPS)
2017-09-02 11:39:37 +00:00
message(STATUS "Cannot find libqtgeoservices_googlemaps.so")
2017-08-25 16:02:15 +00:00
else()
2017-09-02 11:39:37 +00:00
add_custom_target(link_googlemaps_plugin ALL COMMAND
rm -rf ${CMAKE_BINARY_DIR}/geoservices &&
mkdir -p ${CMAKE_BINARY_DIR}/geoservices &&
ln -sf ${GOOGLEMAPS} ${CMAKE_BINARY_DIR}/geoservices)
2017-07-29 00:18:09 +00:00
endif()
2015-12-16 22:27:27 +00:00
install(FILES subsurface.debug DESTINATION bin)
install(FILES subsurface.desktop DESTINATION share/applications)
2018-09-03 20:04:50 +00:00
install(CODE "execute_process(COMMAND sh ${CMAKE_SOURCE_DIR}/scripts/add-version-to-appdata.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})")
2018-07-09 00:50:58 +00:00
install(FILES appdata/subsurface.appdata.xml DESTINATION share/metainfo)
2015-12-16 22:27:27 +00:00
install(FILES icons/subsurface-icon.svg DESTINATION share/icons/hicolor/scalable/apps)
install(DIRECTORY Documentation/images DESTINATION share/subsurface/Documentation)
install(FILES ${DOCFILES} DESTINATION share/subsurface/Documentation)
install(DIRECTORY theme DESTINATION share/subsurface)
install(DIRECTORY printing_templates DESTINATION share/subsurface)
install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations)
2020-11-24 18:52:05 +00:00
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
2015-04-18 12:22:11 +00:00
endif()
2015-09-03 20:10:50 +00:00
if (MAKE_TESTS)
2019-04-03 18:39:31 +00:00
enable_testing()
2015-09-03 20:10:50 +00:00
add_subdirectory(tests)
endif()
2016-09-23 00:12:49 +00:00
# useful for debugging CMake issues
2017-02-25 15:27:43 +00:00
# print_all_variables()