2015-03-26 20:50:28 +00:00
|
|
|
# cmake based build of Subsurface
|
|
|
|
|
2014-04-14 17:21:01 +00:00
|
|
|
project(Subsurface)
|
2015-02-02 15:52:35 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.11)
|
2014-04-14 19:47:12 +00:00
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# global settings
|
|
|
|
|
2015-04-18 12:22:11 +00:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
option(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF)
|
|
|
|
option(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
|
2015-05-26 10:51:49 +00:00
|
|
|
option(LIBGRANTLEE_FROM_PKGCONFIG "use pkg-config to retrieve grantlee" OFF)
|
2015-04-18 12:22:11 +00:00
|
|
|
option(NO_MARBLE "disable the marble widget" OFF)
|
|
|
|
option(NO_TESTS "disable the tests" OFF)
|
|
|
|
option(NO_DOCS "disable the docs" OFF)
|
2015-05-29 19:31:15 +00:00
|
|
|
option(NO_PRINTING "disable the printing support" ON)
|
2015-07-01 15:08:33 +00:00
|
|
|
option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
|
2015-05-28 16:13:51 +00:00
|
|
|
option(USE_LIBGIT23_API "allow building with libgit2 master" OFF)
|
2015-06-21 12:56:36 +00:00
|
|
|
option(SUBSURFACE_MOBILE "build the QtQuick version for mobile device" OFF)
|
2015-04-07 20:29:35 +00:00
|
|
|
|
2015-06-04 03:10:40 +00:00
|
|
|
set(CMAKE_MODULE_PATH
|
|
|
|
${CMAKE_MODULE_PATH}
|
|
|
|
${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules
|
|
|
|
${${PROJECT_NAME}_SOURCE_SIR}/../install-root/lib/cmake/libssh2
|
|
|
|
)
|
|
|
|
|
2015-05-28 17:40:07 +00:00
|
|
|
include_directories(.
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
qt-ui
|
|
|
|
qt-models
|
|
|
|
qt-ui/profile
|
|
|
|
)
|
2015-03-26 20:50:28 +00:00
|
|
|
|
|
|
|
# compiler specific settings
|
2014-04-14 17:21:01 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
2015-04-18 12:22:11 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
2014-04-14 17:21:01 +00:00
|
|
|
endif()
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# pkgconfig for required libraries
|
2015-04-18 12:22:11 +00:00
|
|
|
find_package(PkgConfig)
|
|
|
|
include(cmake/Modules/pkgconfig_helper.cmake)
|
2014-04-14 17:21:01 +00:00
|
|
|
|
2015-04-10 19:08:26 +00:00
|
|
|
pkg_config_library(LIBXML libxml-2.0 REQUIRED)
|
|
|
|
pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED)
|
|
|
|
pkg_config_library(LIBXSLT libxslt REQUIRED)
|
|
|
|
pkg_config_library(LIBZIP libzip REQUIRED)
|
|
|
|
pkg_config_library(LIBUSB libusb-1.0 QUIET)
|
2015-03-26 20:50:28 +00:00
|
|
|
|
|
|
|
# more libraries with special handling in case we build them ourselves
|
2015-04-18 12:22:11 +00:00
|
|
|
if(LIBGIT2_FROM_PKGCONFIG)
|
2015-04-16 14:24:25 +00:00
|
|
|
pkg_config_library(LIBGIT2 libgit2 REQUIRED)
|
2015-04-18 12:22:11 +00:00
|
|
|
set(LIBGIT2_LIBRARIES "")
|
2015-05-28 16:13:51 +00:00
|
|
|
if(USE_LIBGIT23_API)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBGIT23_API")
|
2015-06-01 16:58:09 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LIBGIT23_API")
|
2015-05-28 16:13:51 +00:00
|
|
|
pkg_config_library(LIBSSH2 libssh2 REQUIRED)
|
|
|
|
set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} ${LIBSSH2_LIBRARIES})
|
|
|
|
endif()
|
2015-04-18 12:22:11 +00:00
|
|
|
else()
|
|
|
|
find_package(LIBGIT2 REQUIRED)
|
|
|
|
include_directories(${LIBGIT2_INCLUDE_DIR})
|
2015-05-28 16:13:51 +00:00
|
|
|
if(USE_LIBGIT23_API)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBGIT23_API")
|
2015-06-01 16:58:09 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LIBGIT23_API")
|
2015-06-29 19:33:33 +00:00
|
|
|
find_package(Libssh2 QUIET CONFIG)
|
2015-06-29 20:14:06 +00:00
|
|
|
if ("${LIBSSH2_VERSION}" STRGREATER "1.6.1")
|
2015-06-28 16:57:52 +00:00
|
|
|
set(LIBSSH2_LIBRARIES Libssh2::libssh2)
|
|
|
|
endif()
|
2015-06-09 23:55:27 +00:00
|
|
|
if(!LIBSSH2_FOUND OR "${LIBSSH2_FOUND}" STREQUAL "")
|
2015-06-04 04:59:39 +00:00
|
|
|
pkg_config_library(LIBSSH2 libssh2 REQUIRED)
|
|
|
|
endif()
|
2015-06-12 13:04:37 +00:00
|
|
|
find_package(libcurl QUIET)
|
|
|
|
if(!LIBCURL_FOUND OR "${LIBCURL_FOUND}" STREQUAL "")
|
|
|
|
pkg_config_library(LIBCURL libcurl REQUIRED)
|
|
|
|
endif()
|
|
|
|
set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} ${LIBSSH2_LIBRARIES} ${LIBCURL_LIBRARIES})
|
2015-05-28 16:13:51 +00:00
|
|
|
endif()
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
2014-04-14 17:21:01 +00:00
|
|
|
|
2015-04-18 12:22:11 +00:00
|
|
|
if(LIBDC_FROM_PKGCONFIG)
|
2015-04-17 21:31:12 +00:00
|
|
|
pkg_config_library(LIBDC libdivecomputer REQUIRED)
|
2015-04-18 12:22:11 +00:00
|
|
|
set(LIBDIVECOMPUTER_LIBRARIES "")
|
|
|
|
else()
|
|
|
|
find_package(Libdivecomputer REQUIRED)
|
|
|
|
include_directories(${LIBDIVECOMPUTER_INCLUDE_DIR})
|
|
|
|
endif()
|
2015-04-07 23:13:27 +00:00
|
|
|
|
2015-04-17 21:31:11 +00:00
|
|
|
# optional marble
|
2015-04-18 12:22:11 +00:00
|
|
|
if(NOT NO_MARBLE)
|
2015-04-22 01:19:16 +00:00
|
|
|
find_package(Marble QUIET)
|
2015-04-18 12:22:11 +00:00
|
|
|
if(MARBLE_FOUND)
|
2015-04-17 21:31:11 +00:00
|
|
|
include_directories(${MARBLE_INCLUDE_DIR})
|
2015-04-18 12:22:11 +00:00
|
|
|
else()
|
|
|
|
set(NO_MARBLE ON)
|
|
|
|
endif()
|
|
|
|
endif()
|
2015-04-17 21:31:11 +00:00
|
|
|
|
2015-04-18 12:22:11 +00:00
|
|
|
if(NO_MARBLE)
|
2015-04-18 12:22:12 +00:00
|
|
|
message(STATUS "building without marble widget support")
|
2015-04-18 12:22:11 +00:00
|
|
|
add_definitions(-DNO_MARBLE)
|
|
|
|
set(MARBLE_LIBRARIES "")
|
|
|
|
endif()
|
2015-03-26 20:50:28 +00:00
|
|
|
|
2015-04-21 15:15:40 +00:00
|
|
|
# setup Grantlee
|
|
|
|
|
2015-06-05 01:43:26 +00:00
|
|
|
if(NO_PRINTING)
|
|
|
|
message(STATUS "building without printing support")
|
|
|
|
add_definitions(-DNO_PRINTING)
|
|
|
|
set(GRANTLEE_LIBRARIES "")
|
|
|
|
else()
|
2015-05-26 10:51:49 +00:00
|
|
|
if(LIBGRANTLEE_FROM_PKGCONFIG)
|
|
|
|
pkg_config_library(GRANTLEE libgrantlee REQUIRED)
|
|
|
|
set(GRANTLEE_LIBRARIES "")
|
|
|
|
else()
|
|
|
|
find_package(Grantlee5)
|
|
|
|
set(GRANTLEE_LIBRARIES Grantlee5::Templates)
|
|
|
|
endif()
|
2015-05-29 19:31:15 +00:00
|
|
|
set(SUBSURFACE_PRINTING_SRCS
|
|
|
|
printer.cpp
|
|
|
|
templatelayout.cpp
|
|
|
|
)
|
2015-07-01 15:08:35 +00:00
|
|
|
set(PRINTING_PKG PrintSupport)
|
|
|
|
set(PRINTING_LIB Qt5::PrintSupport)
|
2015-05-29 19:31:15 +00:00
|
|
|
endif()
|
|
|
|
|
2015-07-01 15:08:33 +00:00
|
|
|
if(NO_USERMANUAL)
|
|
|
|
message(STATUS "building without usermanual")
|
|
|
|
add_definitions(-DNO_USERMANUAL)
|
|
|
|
else()
|
|
|
|
set(USERMANUAL qt-ui/usermanual.cpp)
|
|
|
|
set(WEBKIT_PKG WebKitWidgets)
|
|
|
|
set(WEBKIT_LIB Qt5::WebKitWidgets)
|
|
|
|
endif()
|
|
|
|
|
2015-04-21 15:15:40 +00:00
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${GRANTLEE_LIBRARIES} -lusb-1.0)
|
2015-04-07 23:13:27 +00:00
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# handle out of tree build correctly
|
2015-04-18 12:22:11 +00:00
|
|
|
string(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${${PROJECT_NAME}_BINARY_DIR}" insource)
|
2015-06-20 13:06:32 +00:00
|
|
|
if (insource)
|
|
|
|
message(STATUS "building in Subsurface source tree - we recommend out of tree builds")
|
|
|
|
else()
|
2015-06-21 12:48:10 +00:00
|
|
|
message(STATUS "out of source build from source in ${${PROJECT_NAME}_SOURCE_DIR}")
|
2015-06-20 13:06:32 +00:00
|
|
|
endif()
|
2015-04-18 12:22:11 +00:00
|
|
|
get_filename_component(PARENTDIR ${${PROJECT_NAME}_SOURCE_DIR} PATH)
|
|
|
|
string(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${PARENTDIR}" insourcesubdir)
|
|
|
|
if(NOT (insource OR insourcedir))
|
|
|
|
if(NOT NO_MARBLE)
|
2015-04-17 21:31:11 +00:00
|
|
|
add_custom_target(link_marble_data ALL COMMAND rm -f marbledata && ln -s ${${PROJECT_NAME}_SOURCE_DIR}/marbledata ${${PROJECT_NAME}_BINARY_DIR}/marbledata)
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2014-04-14 17:21:01 +00:00
|
|
|
|
2015-04-18 12:22:09 +00:00
|
|
|
# configure Qt.
|
2015-05-27 12:33:23 +00:00
|
|
|
if(SUBSURFACE_MOBILE)
|
2015-07-01 15:08:34 +00:00
|
|
|
set(QT_QUICK_PKG Quick)
|
|
|
|
set(QT_QUICK_LIB Qt5::Quick)
|
2015-05-27 12:33:23 +00:00
|
|
|
endif()
|
2015-07-01 15:08:35 +00:00
|
|
|
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG})
|
|
|
|
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_PKG})
|
2015-04-18 12:22:11 +00:00
|
|
|
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
|
2015-02-02 15:52:35 +00:00
|
|
|
|
2014-04-14 17:21:01 +00:00
|
|
|
# Generate the ssrf-config.h every 'make'
|
2015-04-18 12:22:11 +00:00
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/version.h.in
|
2015-04-18 12:22:10 +00:00
|
|
|
"#define VERSION_STRING \"@VERSION_STRING@\"
|
|
|
|
#define GIT_VERSION_STRING \"@GIT_VERSION_STRING@\"
|
|
|
|
#define CANONICAL_VERSION_STRING \"@CANONICAL_VERSION_STRING@\"
|
2015-02-03 07:56:55 +00:00
|
|
|
")
|
2015-04-18 12:22:09 +00:00
|
|
|
|
2015-04-18 12:22:11 +00:00
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/version.cmake "
|
|
|
|
if(\${APPLE})
|
|
|
|
set(VER_OS darwin)
|
|
|
|
elseif(\${WIN32})
|
|
|
|
set(VER_OS win)
|
|
|
|
else()
|
|
|
|
set(VER_OS linux)
|
|
|
|
endif()
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
|
|
|
|
set(VER_OS win)
|
|
|
|
endif()
|
|
|
|
execute_process(
|
2015-04-18 12:22:09 +00:00
|
|
|
COMMAND sh scripts/get-version \${VER_OS}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE VERSION_STRING
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
2015-04-18 12:22:11 +00:00
|
|
|
execute_process(
|
2015-04-18 12:22:09 +00:00
|
|
|
COMMAND sh scripts/get-version linux
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_VERSION_STRING
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
2015-04-18 12:22:11 +00:00
|
|
|
execute_process(
|
2015-04-18 12:22:09 +00:00
|
|
|
COMMAND sh scripts/get-version full
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE CANONICAL_VERSION_STRING
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
2015-04-18 12:22:11 +00:00
|
|
|
configure_file(\${SRC} \${DST} @ONLY)
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
|
|
|
|
execute_process(
|
2015-04-18 12:22:09 +00:00
|
|
|
COMMAND cat ${CMAKE_SOURCE_DIR}/packaging/windows/subsurface.nsi.in
|
2015-04-24 14:18:11 +00:00
|
|
|
COMMAND sed -e \"s/VERSIONTOKEN/\${GIT_VERSION_STRING}/\"
|
2015-04-18 12:22:09 +00:00
|
|
|
COMMAND sed -e \"s/PRODVTOKEN/\${CANONICAL_VERSION_STRING}/\"
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/staging/subsurface.nsi
|
|
|
|
)
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
2014-04-14 17:21:01 +00:00
|
|
|
")
|
2015-04-18 12:22:09 +00:00
|
|
|
|
2015-04-18 12:22:11 +00:00
|
|
|
add_custom_target(
|
2015-04-18 12:22:09 +00:00
|
|
|
version ALL COMMAND ${CMAKE_COMMAND} ${CMAKE_COMMAND}
|
|
|
|
-D SRC=${CMAKE_BINARY_DIR}/version.h.in
|
|
|
|
-D DST=${CMAKE_BINARY_DIR}/ssrf-version.h
|
|
|
|
-D CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
|
|
|
-P ${CMAKE_BINARY_DIR}/version.cmake
|
2014-04-14 17:21:01 +00:00
|
|
|
)
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# set up the different target platforms
|
2015-04-18 12:22:11 +00:00
|
|
|
set(PLATFORM_SRC unknown_platform.c)
|
2015-03-26 19:24:46 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
2015-05-02 02:17:22 +00:00
|
|
|
set(FBSUPPORT 1)
|
2015-04-05 13:53:17 +00:00
|
|
|
set(SUBSURFACE_TARGET subsurface)
|
2015-04-18 12:22:11 +00:00
|
|
|
set(PLATFORM_SRC linux.c)
|
2015-04-06 00:41:35 +00:00
|
|
|
# in some builds we appear to be missing libz for some strange reason...
|
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lz)
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
2015-05-02 02:17:22 +00:00
|
|
|
set(FBSUPPORT 1)
|
2015-04-05 13:53:17 +00:00
|
|
|
set(SUBSURFACE_TARGET Subsurface)
|
2015-04-18 12:22:11 +00:00
|
|
|
set(PLATFORM_SRC macos.c)
|
|
|
|
find_library(APP_SERVICES_LIBRARY ApplicationServices)
|
|
|
|
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
|
|
|
|
set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
|
|
|
|
set(MACOSX_BUNDLE_INFO_STRING "Subsurface")
|
|
|
|
set(MACOSX_BUNDLE_ICON_FILE Subsurface.icns)
|
|
|
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.subsurface-divelog")
|
|
|
|
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface")
|
|
|
|
set(MACOSX_BUNDLE_BUNDLE_VERSION "4.4.1")
|
|
|
|
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "4.4.1")
|
|
|
|
set(MACOSX_BUNDLE_LONG_VERSION_STRING "4.4.1")
|
|
|
|
set(MACOSX_BUNDLE_COPYRIGHT "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, and others")
|
|
|
|
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
|
|
|
set(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE})
|
|
|
|
endif()
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
2015-05-02 02:17:22 +00:00
|
|
|
set(FBSUPPORT 1)
|
2015-04-05 13:53:17 +00:00
|
|
|
set(SUBSURFACE_TARGET subsurface)
|
2015-04-18 12:22:11 +00:00
|
|
|
set(PLATFORM_SRC windows.c)
|
2015-03-26 19:24:46 +00:00
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32)
|
|
|
|
remove_definitions(-DUNICODE)
|
2015-04-03 17:32:05 +00:00
|
|
|
add_definitions(-mwindows)
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
2015-03-26 19:24:46 +00:00
|
|
|
|
2015-04-09 18:50:06 +00:00
|
|
|
# include translations
|
|
|
|
add_subdirectory(translations)
|
|
|
|
|
2014-04-14 17:21:01 +00:00
|
|
|
# compile the core library, in C.
|
2015-04-18 12:22:11 +00:00
|
|
|
set(SUBSURFACE_CORE_LIB_SRCS
|
2014-10-18 01:03:37 +00:00
|
|
|
cochran.c
|
Import Datatrak/WLog files
Sequentially parses a file, expected to be a Datatrak/WLog divelog, and
converts the dive info into Subsurface's dive structure.
As my first DC, back in 90s, was an Aladin Air X, the obvious choice of log
software was DTrak (Win version). After using it for some time we moved to WLog
(shareware software more user friendly than Dtrak, printing capable, and still
better, it runs under wine, which, as linux user, was definitive for me). Then,
some years later, my last Aladin died and I moved to an OSTC, forcing me to
look for a software that support this DC.
I found JDivelog which was capable of import Dtrak logs and used it for some
time until discovered Subsurface existence and devoted to it.
The fact was that importing Dtrak dives in JDivelog and then re-importing them
in Subsurface caused a significant data loss (mainly in the profile events and
alarms) and weird location of some other info in the dive notes (mostly tag
items in the original Dtrak software). This situation can't actually be solved
with tools like divelogs.de which causes similar if no greater data loss.
Although this won't be a core feature for Subsurface, I expect it can be useful
for some other divers as has been for me.
Comments and issues:
Datatrak/Wlog files include a lot of diving data which are not directly
supported in Subsurface, in these cases we choose mostly to use "tags".
The lack of some important info in Datatrak archives (e.g. tank's initial
pressure) forces us to do some arbitrary assumptions (e.g. initial pressure =
200 bar).
There might be archives coming directly from old DOS days, as first versions
of Datatrak run on that OS; they were coded CP437 or CP850, while dive logs
coming from Win versions seems to be coded CP1252. Finally, Wlog seems to use a
mixed confusing style. Program directly converts some of the old encoded chars
to iso8859 but is expected there be some issues with non alphabetic chars, e.g.
"ª".
There are two text fields: "Other activities" and "Dive notes", both limited to
256 char size. We have merged them in Subsurface's "Dive Notes" although the
first one could be "tagged", but we're unsure that the user had filled it in
a tag friendly way.
WLog adds some information to the dive and lets the user to write more than
256 chars notes. This is achieved, while keeping compatibility with DTrak
divelogs, by adding a complementary file named equally as the .log file and
with .add extension where all this info is stored. We have, still, not worked
with this complementary files.
This work is based on the paper referenced in butracker #194 which has some
errors (e.g. beginning of log and beginning of dive are changed) and a lot of
bytes of unknown meaning. Example.log shows, at least, one more byte than those
referred in the paper for the O2 Aladin computer, this could be a byte referred
to the use of SCR but the lack of an OC dive with O2 computer makes impossible
for us to compare.
The only way we have figured out to distinguish a priori between SCR and non
SCR dives with O2 computers is that the dives are tagged with a "rebreather"
tag. Obviously this is not a very trusty way of doing things. In SCR dives,
the O2% in mix means, probably, the maximum O2% in the circuit, not the O2%
of the EAN mix in the tanks, which would be unknown in this case.
The list of DCs related in bug #194 paper seems incomplete, we have added
one or two from WLog and discarded those which are known to exist but whose
model is unknown, grouping them under the imaginative name of "unknown". The
list can easily be increased in the future if we ever know the models
identifiers.
BTW, in Example.log, 0x00 identifier is used for some DC dives and from my own
divelogs is inferred that 0x00 is used for manually entered dives, this could
easily be an error in Example.log coming from a preproduction DC model.
Example.log which is shipped in datatrak package is included in dives
directory for testing pourposes.
[Dirk Hohndel: some small cleanups, merged with latest master, support
divesites, remove the pointless memset() before free() calls
add to cmake build]
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-05 18:38:27 +00:00
|
|
|
datatrak.c
|
2014-04-14 19:47:12 +00:00
|
|
|
deco.c
|
|
|
|
device.c
|
|
|
|
dive.c
|
2015-02-23 16:15:30 +00:00
|
|
|
divesite.c
|
2014-04-14 19:47:12 +00:00
|
|
|
divelist.c
|
|
|
|
equipment.c
|
|
|
|
file.c
|
2015-01-23 03:40:01 +00:00
|
|
|
git-access.c
|
2014-04-14 19:47:12 +00:00
|
|
|
libdivecomputer.c
|
2014-11-07 16:30:44 +00:00
|
|
|
liquivision.c
|
2014-04-14 19:47:12 +00:00
|
|
|
load-git.c
|
|
|
|
membuffer.c
|
2015-04-04 18:05:40 +00:00
|
|
|
ostctools.c
|
2014-04-14 19:47:12 +00:00
|
|
|
parse-xml.c
|
|
|
|
planner.c
|
|
|
|
profile.c
|
2014-08-27 12:43:54 +00:00
|
|
|
gaspressures.c
|
2014-04-14 19:47:12 +00:00
|
|
|
worldmap-save.c
|
|
|
|
save-git.c
|
|
|
|
save-xml.c
|
2014-05-30 02:42:15 +00:00
|
|
|
save-html.c
|
2014-04-14 19:47:12 +00:00
|
|
|
sha1.c
|
|
|
|
statistics.c
|
|
|
|
strtod.c
|
|
|
|
subsurfacestartup.c
|
|
|
|
time.c
|
|
|
|
uemis.c
|
|
|
|
uemis-downloader.c
|
2015-02-23 16:15:30 +00:00
|
|
|
version.c
|
2015-04-18 12:22:09 +00:00
|
|
|
# gettextfrommoc should be added because we are using it on the c-code.
|
2014-04-17 14:34:21 +00:00
|
|
|
gettextfromc.cpp
|
2015-04-18 12:22:09 +00:00
|
|
|
# dirk ported some core functionality to c++.
|
2014-04-17 15:21:39 +00:00
|
|
|
qthelper.cpp
|
2014-05-12 16:53:26 +00:00
|
|
|
divecomputer.cpp
|
2014-06-02 21:28:02 +00:00
|
|
|
exif.cpp
|
2014-06-19 15:21:16 +00:00
|
|
|
subsurfacesysinfo.cpp
|
2014-08-22 21:28:55 +00:00
|
|
|
devicedetails.cpp
|
|
|
|
configuredivecomputer.cpp
|
|
|
|
configuredivecomputerthreads.cpp
|
2015-03-10 21:27:14 +00:00
|
|
|
divesitehelpers.cpp
|
2015-06-16 13:08:31 +00:00
|
|
|
checkcloudconnection.cpp
|
2015-06-16 13:04:34 +00:00
|
|
|
windowtitleupdate.cpp
|
2015-06-16 13:34:40 +00:00
|
|
|
divelogexportlogic.cpp
|
2015-06-16 13:52:06 +00:00
|
|
|
qt-init.cpp
|
2015-03-26 19:24:46 +00:00
|
|
|
${PLATFORM_SRC}
|
2014-04-14 17:21:01 +00:00
|
|
|
)
|
2015-05-25 16:34:15 +00:00
|
|
|
source_group("Subsurface Core" FILES ${SUBSURFACE_CORE_LIB_SRCS})
|
2014-04-14 17:21:01 +00:00
|
|
|
|
2015-05-02 02:17:22 +00:00
|
|
|
if(FBSUPPORT)
|
|
|
|
add_definitions(-DFBSUPPORT)
|
|
|
|
set(SOCIALNETWORKS qt-ui/socialnetworks.cpp)
|
|
|
|
endif()
|
2015-03-26 20:50:28 +00:00
|
|
|
|
2015-05-28 17:40:07 +00:00
|
|
|
# the data models that will interface
|
|
|
|
# with the views.
|
|
|
|
set(SUBSURFACE_MODELS_LIB_SRCS
|
2015-05-28 18:00:58 +00:00
|
|
|
qt-models/cleanertablemodel.cpp
|
2015-05-28 19:23:49 +00:00
|
|
|
qt-models/cylindermodel.cpp
|
|
|
|
qt-models/diveplannermodel.cpp
|
2015-05-28 17:40:07 +00:00
|
|
|
qt-models/models.cpp
|
|
|
|
qt-models/filtermodels.cpp
|
2015-05-28 19:39:15 +00:00
|
|
|
qt-models/tankinfomodel.cpp
|
2015-05-28 19:52:13 +00:00
|
|
|
qt-models/weigthsysteminfomodel.cpp
|
2015-05-28 20:17:09 +00:00
|
|
|
qt-models/weightmodel.cpp
|
2015-05-28 20:51:07 +00:00
|
|
|
qt-models/divecomputermodel.cpp
|
2015-05-28 21:02:06 +00:00
|
|
|
qt-models/treemodel.cpp
|
2015-05-29 16:53:07 +00:00
|
|
|
qt-models/tableprintmodel.cpp
|
2015-05-28 21:12:11 +00:00
|
|
|
qt-models/yearlystatisticsmodel.cpp
|
2015-05-28 21:33:51 +00:00
|
|
|
qt-models/divetripmodel.cpp
|
2015-05-28 20:29:58 +00:00
|
|
|
qt-models/divecomputerextradatamodel.cpp
|
2015-05-28 17:40:07 +00:00
|
|
|
qt-models/completionmodels.cpp
|
2015-05-29 16:59:16 +00:00
|
|
|
qt-models/profileprintmodel.cpp
|
2015-05-29 17:42:57 +00:00
|
|
|
qt-models/divepicturemodel.cpp
|
2015-05-30 00:19:44 +00:00
|
|
|
qt-models/diveplotdatamodel.cpp
|
|
|
|
qt-models/divelocationmodel.cpp
|
2015-05-28 17:40:07 +00:00
|
|
|
)
|
|
|
|
source_group("Subsurface Models" FILES ${SUBSURFACE_MODELS})
|
|
|
|
|
2015-05-25 16:34:15 +00:00
|
|
|
# the interface, in C++
|
2015-04-18 12:22:11 +00:00
|
|
|
set(SUBSURFACE_INTERFACE
|
2014-04-14 19:47:12 +00:00
|
|
|
qt-ui/updatemanager.cpp
|
|
|
|
qt-ui/about.cpp
|
|
|
|
qt-ui/divecomputermanagementdialog.cpp
|
|
|
|
qt-ui/divelistview.cpp
|
|
|
|
qt-ui/diveplanner.cpp
|
2014-10-28 19:40:33 +00:00
|
|
|
qt-ui/diveshareexportdialog.cpp
|
2014-04-14 19:47:12 +00:00
|
|
|
qt-ui/downloadfromdivecomputer.cpp
|
|
|
|
qt-ui/globe.cpp
|
|
|
|
qt-ui/graphicsview-common.cpp
|
|
|
|
qt-ui/kmessagewidget.cpp
|
|
|
|
qt-ui/maintab.cpp
|
|
|
|
qt-ui/mainwindow.cpp
|
|
|
|
qt-ui/modeldelegates.cpp
|
2014-10-28 19:40:33 +00:00
|
|
|
qt-ui/metrics.cpp
|
2015-03-10 17:25:57 +00:00
|
|
|
qt-ui/notificationwidget.cpp
|
2014-04-14 19:47:12 +00:00
|
|
|
qt-ui/preferences.cpp
|
|
|
|
qt-ui/printdialog.cpp
|
|
|
|
qt-ui/printoptions.cpp
|
|
|
|
qt-ui/simplewidgets.cpp
|
|
|
|
qt-ui/starwidget.cpp
|
|
|
|
qt-ui/subsurfacewebservices.cpp
|
|
|
|
qt-ui/tableview.cpp
|
|
|
|
qt-ui/divelogimportdialog.cpp
|
|
|
|
qt-ui/tagwidget.cpp
|
|
|
|
qt-ui/groupedlineedit.cpp
|
2015-07-01 15:08:33 +00:00
|
|
|
${USERMANUAL}
|
2014-05-21 14:24:22 +00:00
|
|
|
qt-ui/divelogexportdialog.cpp
|
2014-05-30 17:38:27 +00:00
|
|
|
qt-ui/divepicturewidget.cpp
|
2014-06-19 15:21:16 +00:00
|
|
|
qt-ui/usersurvey.cpp
|
2014-08-22 21:28:55 +00:00
|
|
|
qt-ui/configuredivecomputerdialog.cpp
|
2015-02-23 16:15:30 +00:00
|
|
|
qt-ui/undocommands.cpp
|
2015-05-17 19:13:41 +00:00
|
|
|
qt-ui/locationinformation.cpp
|
2015-05-17 21:33:43 +00:00
|
|
|
qt-ui/qtwaitingspinner.cpp
|
2015-06-21 18:52:43 +00:00
|
|
|
${SUBSURFACE_PRINTING_SRCS}
|
2015-05-02 02:17:22 +00:00
|
|
|
${SOCIALNETWORKS}
|
2014-04-14 19:47:12 +00:00
|
|
|
)
|
2015-05-25 16:34:15 +00:00
|
|
|
source_group("Subsurface Interface" FILES ${SUBSURFACE_INTERFACE})
|
2014-04-14 17:21:01 +00:00
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# the profile widget
|
2015-04-18 12:22:11 +00:00
|
|
|
set(SUBSURFACE_PROFILE_LIB_SRCS
|
2014-04-14 19:47:12 +00:00
|
|
|
qt-ui/profile/profilewidget2.cpp
|
|
|
|
qt-ui/profile/diverectitem.cpp
|
|
|
|
qt-ui/profile/divepixmapitem.cpp
|
|
|
|
qt-ui/profile/divelineitem.cpp
|
|
|
|
qt-ui/profile/divetextitem.cpp
|
|
|
|
qt-ui/profile/animationfunctions.cpp
|
|
|
|
qt-ui/profile/divecartesianaxis.cpp
|
|
|
|
qt-ui/profile/diveprofileitem.cpp
|
|
|
|
qt-ui/profile/diveeventitem.cpp
|
|
|
|
qt-ui/profile/divetooltipitem.cpp
|
|
|
|
qt-ui/profile/ruleritem.cpp
|
2014-08-22 21:28:55 +00:00
|
|
|
qt-ui/profile/tankitem.cpp
|
2014-04-14 19:47:12 +00:00
|
|
|
)
|
2015-05-25 16:34:15 +00:00
|
|
|
source_group("Subsurface Profile" FILES ${SUBSURFACE_PROFILE_LIB_SRCS})
|
2014-04-14 19:47:12 +00:00
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# the yearly statistics widget.
|
2015-04-18 12:22:11 +00:00
|
|
|
set(SUBSURFACE_STATISTICS_LIB_SRCS
|
2014-08-25 17:52:45 +00:00
|
|
|
qt-ui/statistics/statisticswidget.cpp
|
|
|
|
qt-ui/statistics/yearstatistics.cpp
|
|
|
|
qt-ui/statistics/statisticsbar.cpp
|
|
|
|
qt-ui/statistics/monthstatistics.cpp
|
|
|
|
)
|
2015-05-25 16:34:15 +00:00
|
|
|
source_group("Subsurface Statistics" FILES ${SUBSURFACE_STATISTICS_LIB_SRCS})
|
2014-08-25 17:52:45 +00:00
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# the main app.
|
2015-04-18 12:22:11 +00:00
|
|
|
set(SUBSURFACE_APP
|
2014-04-14 19:47:12 +00:00
|
|
|
main.cpp
|
|
|
|
qt-gui.cpp
|
|
|
|
qthelper.cpp
|
|
|
|
)
|
2015-05-25 16:34:15 +00:00
|
|
|
source_group("Subsurface App" FILES ${SUBSURFACE_APP})
|
2014-04-14 19:47:12 +00:00
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# create the libraries
|
2015-04-18 12:22:11 +00:00
|
|
|
file(GLOB SUBSURFACE_UI qt-ui/*.ui)
|
|
|
|
qt5_wrap_ui(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
|
|
|
|
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc)
|
2015-05-25 16:34:15 +00:00
|
|
|
source_group("Subsurface Interface Files" FILES ${SUBSURFACE_UI})
|
2015-04-18 12:22:11 +00:00
|
|
|
|
|
|
|
add_library(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} )
|
|
|
|
target_link_libraries(subsurface_corelib ${QT_LIBRARIES})
|
2015-05-28 17:40:07 +00:00
|
|
|
add_library(subsurface_models STATIC ${SUBSURFACE_MODELS_LIB_SRCS})
|
|
|
|
target_link_libraries(subsurface_models ${QT_LIBRARIES})
|
2015-04-18 12:22:11 +00:00
|
|
|
add_library(subsurface_profile STATIC ${SUBSURFACE_PROFILE_LIB_SRCS})
|
|
|
|
target_link_libraries(subsurface_profile ${QT_LIBRARIES})
|
|
|
|
add_library(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS})
|
|
|
|
target_link_libraries(subsurface_statistics ${QT_LIBRARIES})
|
|
|
|
add_library(subsurface_generated_ui STATIC ${SUBSURFACE_UI_HDRS})
|
|
|
|
target_link_libraries(subsurface_generated_ui ${QT_LIBRARIES})
|
|
|
|
add_library(subsurface_interface STATIC ${SUBSURFACE_INTERFACE})
|
|
|
|
target_link_libraries(subsurface_interface ${QT_LIBRARIES} ${MARBLE_LIBRARIES})
|
2014-04-14 17:21:01 +00:00
|
|
|
|
2015-04-16 14:22:09 +00:00
|
|
|
# add pthread to the end of the library list on Linux
|
|
|
|
# this is only needed on Ubuntu (why do these idiots break everything?)
|
|
|
|
# but shouldn't hurt on other Linux versions
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
2015-04-18 12:22:11 +00:00
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lpthread)
|
2015-04-16 14:22:09 +00:00
|
|
|
endif()
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# create the executables
|
2015-05-27 12:33:23 +00:00
|
|
|
if(SUBSURFACE_MOBILE)
|
2015-06-09 19:20:44 +00:00
|
|
|
set(MOBILE_SRC qt-mobile/qmlmanager.cpp qt-models/divelistmodel.cpp)
|
2015-05-27 12:33:23 +00:00
|
|
|
add_definitions(-DSUBSURFACE_MOBILE)
|
|
|
|
qt5_add_resources(MOBILE_RESOURCES qt-mobile/mobile-resources.qrc)
|
2015-06-04 10:31:03 +00:00
|
|
|
add_executable(subsurface-mobile ${MOBILE_SRC} ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
|
2015-05-27 12:33:23 +00:00
|
|
|
target_link_libraries(
|
|
|
|
subsurface-mobile
|
|
|
|
subsurface_generated_ui
|
|
|
|
subsurface_interface
|
|
|
|
subsurface_profile
|
|
|
|
subsurface_statistics
|
|
|
|
subsurface_models
|
|
|
|
subsurface_corelib
|
|
|
|
${SUBSURFACE_LINK_LIBRARIES})
|
|
|
|
else()
|
|
|
|
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
|
|
|
target_link_libraries(
|
|
|
|
${SUBSURFACE_TARGET}
|
|
|
|
subsurface_generated_ui
|
|
|
|
subsurface_interface
|
|
|
|
subsurface_profile
|
|
|
|
subsurface_statistics
|
|
|
|
subsurface_models
|
|
|
|
subsurface_corelib
|
|
|
|
${SUBSURFACE_LINK_LIBRARIES}
|
2014-04-14 17:21:01 +00:00
|
|
|
)
|
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_statistics subsurface_generated_ui)
|
|
|
|
add_dependencies(subsurface_profile subsurface_generated_ui)
|
|
|
|
add_dependencies(subsurface_interface subsurface_generated_ui)
|
|
|
|
add_dependencies(subsurface_generated_ui version)
|
|
|
|
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")
|
|
|
|
add_custom_command(
|
2015-03-31 21:03:02 +00:00
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/qt.conf
|
|
|
|
COMMAND echo \"[Paths]\" > ${CMAKE_BINARY_DIR}/qt.conf \; echo \"Prefix=.\" >> ${CMAKE_BINARY_DIR}/qt.conf
|
2015-04-18 12:22:14 +00:00
|
|
|
)
|
2015-04-18 12:22:11 +00:00
|
|
|
add_custom_target(
|
2015-03-31 21:03:02 +00:00
|
|
|
generate_qtconf
|
|
|
|
DEPENDS ${CMAKE_BINARY_DIR}/qt.conf
|
2015-04-18 12:22:14 +00:00
|
|
|
)
|
2015-04-18 12:22:11 +00:00
|
|
|
add_dependencies(${SUBSURFACE_TARGET} generate_qtconf)
|
|
|
|
endif()
|
2015-03-31 21:03:02 +00:00
|
|
|
|
2015-06-16 13:58:22 +00:00
|
|
|
# build an automated html exporter
|
|
|
|
add_executable(export-html EXCLUDE_FROM_ALL export-html.cpp qt-init.cpp qthelper.cpp ${SUBSURFACE_RESOURCES})
|
|
|
|
target_link_libraries(export-html subsurface_corelib ${SUBSURFACE_LINK_LIBRARIES})
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# QTest based tests
|
2015-04-18 12:22:13 +00:00
|
|
|
macro(TEST NAME FILE)
|
2015-04-24 18:23:50 +00:00
|
|
|
add_executable(${NAME} EXCLUDE_FROM_ALL tests/${FILE} ${SUBSURFACE_RESOURCES})
|
2015-04-18 12:22:11 +00:00
|
|
|
target_link_libraries(${NAME} subsurface_corelib ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES})
|
2015-04-24 18:23:50 +00:00
|
|
|
add_test(NAME ${NAME}_build COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${NAME})
|
|
|
|
add_test(NAME ${NAME}_run COMMAND ${NAME})
|
|
|
|
set_tests_properties(${NAME}_run PROPERTIES DEPENDS ${NAME}_build)
|
2015-04-18 12:22:11 +00:00
|
|
|
endmacro()
|
2014-04-17 14:34:21 +00:00
|
|
|
|
2015-04-18 12:22:11 +00:00
|
|
|
add_definitions(-DSUBSURFACE_SOURCE="${CMAKE_SOURCE_DIR}")
|
|
|
|
add_definitions(-g)
|
|
|
|
if(NOT NO_TESTS)
|
2015-04-24 18:23:50 +00:00
|
|
|
enable_testing()
|
2015-04-18 12:22:13 +00:00
|
|
|
TEST(TestUnitConversion testunitconversion.cpp)
|
|
|
|
TEST(TestProfile testprofile.cpp)
|
|
|
|
TEST(TestGpsCoords testgpscoords.cpp)
|
|
|
|
TEST(TestParse testparse.cpp)
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
2015-03-30 19:50:52 +00:00
|
|
|
|
2015-06-20 04:33:29 +00:00
|
|
|
# install a few things so that one can run Subsurface from the build
|
|
|
|
# directory
|
2015-06-20 13:06:32 +00:00
|
|
|
if(NOT insource)
|
|
|
|
add_custom_target(themeLink ALL
|
|
|
|
COMMAND
|
|
|
|
rm -f ${CMAKE_BINARY_DIR}/theme &&
|
|
|
|
ln -s ${CMAKE_SOURCE_DIR}/theme ${CMAKE_BINARY_DIR}/theme
|
|
|
|
)
|
|
|
|
if(NOT NO_PRINTING)
|
|
|
|
add_custom_target(printing_templatesLink ALL
|
|
|
|
COMMAND
|
|
|
|
rm -f ${CMAKE_BINARY_DIR}/printing_templates &&
|
|
|
|
ln -s ${CMAKE_SOURCE_DIR}/printing_templates ${CMAKE_BINARY_DIR}/printing_templates
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(NOT NO_DOCS)
|
|
|
|
add_custom_target(
|
|
|
|
documentationLink ALL
|
|
|
|
COMMAND
|
|
|
|
mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ &&
|
2015-06-20 13:46:49 +00:00
|
|
|
rm -rf ${CMAKE_BINARY_DIR}/Documentation/images &&
|
2015-06-20 13:06:32 +00:00
|
|
|
ln -s ${CMAKE_SOURCE_DIR}/Documentation/images ${CMAKE_BINARY_DIR}/Documentation/images
|
|
|
|
)
|
|
|
|
endif()
|
2015-06-27 22:28:27 +00:00
|
|
|
else()
|
|
|
|
if(NOT NO_DOCS)
|
|
|
|
add_custom_target(
|
|
|
|
documentationLink ALL
|
|
|
|
)
|
|
|
|
endif()
|
2015-06-20 04:33:29 +00:00
|
|
|
endif()
|
2015-04-18 12:22:11 +00:00
|
|
|
if(NOT NO_DOCS)
|
2015-04-24 18:02:45 +00:00
|
|
|
add_custom_target(
|
|
|
|
documentation ALL
|
2015-06-27 22:28:27 +00:00
|
|
|
COMMAND
|
2015-04-24 18:02:45 +00:00
|
|
|
make -C ${CMAKE_SOURCE_DIR}/Documentation OUT=${CMAKE_BINARY_DIR}/Documentation/ doc
|
2015-06-27 22:28:27 +00:00
|
|
|
DEPENDS documentationLink
|
2015-04-24 18:02:45 +00:00
|
|
|
)
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
2015-03-30 21:43:15 +00:00
|
|
|
|
2015-03-30 19:50:52 +00:00
|
|
|
# install Subsurface
|
|
|
|
# first some variables with files that need installing
|
|
|
|
set(DOCFILES
|
|
|
|
README
|
|
|
|
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
|
|
|
)
|
|
|
|
|
2015-03-31 20:39:09 +00:00
|
|
|
set(QTTRANSLATIONS_BASE
|
|
|
|
qt_da.qm
|
|
|
|
qt_de.qm
|
|
|
|
qt_es.qm
|
|
|
|
qt_fr.qm
|
|
|
|
qt_he.qm
|
|
|
|
qt_hu.qm
|
|
|
|
qt_pl.qm
|
|
|
|
qt_pt.qm
|
|
|
|
qt_ru.qm
|
|
|
|
qt_sk.qm
|
|
|
|
qt_sv.qm
|
|
|
|
qt_zh_TW.qm
|
|
|
|
)
|
|
|
|
|
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})
|
2015-04-04 20:12:20 +00:00
|
|
|
if(NOT ${QTTRANSLATION} STREQUAL "")
|
|
|
|
set(QTTRANSLATIONS ${QTTRANSLATIONS} ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
|
|
|
|
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
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
2015-04-04 20:13:46 +00:00
|
|
|
set(RESOURCEDIR ${CMAKE_BINARY_DIR}/Subsurface.app/Contents/Resources)
|
|
|
|
install(DIRECTORY marbledata/maps DESTINATION ${RESOURCEDIR}/data)
|
|
|
|
install(DIRECTORY marbledata/bitmaps DESTINATION ${RESOURCEDIR}/data)
|
|
|
|
install(DIRECTORY Documentation/images DESTINATION ${RESOURCEDIR}/share/Documentation)
|
|
|
|
install(FILES ${DOCFILES} DESTINATION ${RESOURCEDIR}/share/Documentation)
|
|
|
|
install(DIRECTORY theme DESTINATION ${RESOURCEDIR})
|
2015-04-21 15:15:40 +00:00
|
|
|
install(DIRECTORY printing_templates DESTINATION ${RESOURCEDIR})
|
2015-04-04 20:13:46 +00:00
|
|
|
install(FILES ${TRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
|
|
|
|
install(FILES ${QTTRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
|
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR})
|
2015-04-10 20:15:19 +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})
|
|
|
|
install(CODE "execute_process(COMMAND ${MACDEPLOYQT} Subsurface.app)")
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
2015-03-30 19:50:52 +00:00
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
2015-04-18 12:22:09 +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
|
2015-03-31 21:03:02 +00:00
|
|
|
set(WINDOWSSTAGING ${CMAKE_BINARY_DIR}/staging)
|
|
|
|
install(DIRECTORY marbledata/maps DESTINATION ${WINDOWSSTAGING}/data)
|
|
|
|
install(DIRECTORY marbledata/bitmaps DESTINATION ${WINDOWSSTAGING}/data)
|
|
|
|
install(DIRECTORY Documentation/images DESTINATION ${WINDOWSSTAGING}/Documentation)
|
|
|
|
install(FILES ${DOCFILES} DESTINATION ${WINDOWSSTAGING}/Documentation)
|
|
|
|
install(DIRECTORY theme DESTINATION ${WINDOWSSTAGING})
|
2015-04-21 15:15:40 +00:00
|
|
|
install(DIRECTORY printing_templates DESTINATION ${WINDOWSSTAGING})
|
2015-03-31 21:03:02 +00:00
|
|
|
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})
|
2015-04-05 13:53:17 +00:00
|
|
|
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION ${WINDOWSSTAGING})
|
2015-03-31 21:03:02 +00:00
|
|
|
install(FILES ${CMAKE_BINARY_DIR}/qt.conf DESTINATION ${WINDOWSSTAGING})
|
2015-06-20 05:24:18 +00:00
|
|
|
install(DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/grantlee DESTINATION ${WINDOWSSTAGING})
|
2015-04-01 20:36:38 +00:00
|
|
|
if(NOT DEFINED MAKENSIS)
|
|
|
|
set(MAKENSIS makensis)
|
|
|
|
endif()
|
2015-04-03 17:05:05 +00:00
|
|
|
|
|
|
|
# next figure out the DLLs we need to include in the installer
|
|
|
|
# since this needs to run at install time we create a new cmake
|
|
|
|
# script that then gets executed at install time with install(CODE...)
|
2015-04-18 12:22:11 +00:00
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/dlllist.cmake "
|
|
|
|
message(STATUS \"processing dlllist.cmake\")
|
2015-04-03 17:05:05 +00:00
|
|
|
# figure out which command to use for objdump
|
2015-04-18 12:22:11 +00:00
|
|
|
execute_process(
|
2015-04-03 17:05:05 +00:00
|
|
|
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
|
|
|
|
OUTPUT_VARIABLE OBJDUMP
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2015-04-18 12:22:14 +00:00
|
|
|
)
|
2015-04-03 17:05:05 +00:00
|
|
|
# figure out where we should search for libraries
|
2015-04-18 12:22:11 +00:00
|
|
|
execute_process(
|
2015-04-03 17:05:05 +00:00
|
|
|
COMMAND ${CMAKE_C_COMPILER} -print-search-dirs
|
|
|
|
COMMAND sed -nE \"/^libraries: =/{s///;s,/lib/?\\\(:|\\\$\\\$\\\),/bin\\\\1,g;p;q;}\"
|
|
|
|
OUTPUT_VARIABLE ADDPATH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2015-04-18 12:22:14 +00:00
|
|
|
)
|
2015-04-03 17:05:05 +00:00
|
|
|
# since cmake doesn't appear to give us a variable with
|
|
|
|
# all libraries we link against, grab the link.txt script
|
|
|
|
# instead and drop the command name from it (before the
|
|
|
|
# first space) -- this will fail if the full path for the
|
|
|
|
# linker used contains a space...
|
2015-04-18 12:22:11 +00:00
|
|
|
execute_process(
|
2015-04-03 17:05:05 +00:00
|
|
|
COMMAND tail -1 CMakeFiles/subsurface.dir/link.txt
|
2015-04-28 20:40:18 +00:00
|
|
|
COMMAND cut -d\\ -f 2-
|
2015-04-03 17:05:05 +00:00
|
|
|
OUTPUT_VARIABLE LINKER_LINE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2015-04-18 12:22:14 +00:00
|
|
|
)
|
2015-04-03 17:05:05 +00:00
|
|
|
# finally run our win-ldd.pl script against that to
|
|
|
|
# collect all the required dlls
|
2015-04-18 12:22:11 +00:00
|
|
|
execute_process(
|
2015-04-05 13:53:17 +00:00
|
|
|
COMMAND sh -c \"OBJDUMP=\${OBJDUMP}-objdump PATH=$ENV{PATH}:\${ADDPATH} perl ${CMAKE_SOURCE_DIR}/scripts/win-ldd.pl ${SUBSURFACE_TARGET}.exe \${LINKER_LINE}\"
|
2015-04-03 17:05:05 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
|
|
OUTPUT_VARIABLE DLLS
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2015-04-18 12:22:14 +00:00
|
|
|
)
|
2015-04-03 17:05:05 +00:00
|
|
|
# replace newlines with semicolons so this is a cmake list
|
|
|
|
string(REPLACE \"\\n\" \";\" DLLLIST \${DLLS})
|
|
|
|
# executing 'install' as a command seems hacky, but you
|
|
|
|
# can't use the install() cmake function in a script
|
|
|
|
foreach(DLL \${DLLLIST})
|
2015-04-18 12:22:11 +00:00
|
|
|
execute_process(COMMAND install \${DLL} \${STAGING})
|
2015-04-03 17:05:05 +00:00
|
|
|
endforeach()
|
|
|
|
")
|
|
|
|
# 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
|
|
|
|
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -DSTAGING=${WINDOWSSTAGING} -P ${CMAKE_BINARY_DIR}/dlllist.cmake)")
|
|
|
|
|
|
|
|
# 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
|
2015-04-18 12:22:14 +00:00
|
|
|
add_custom_target(
|
|
|
|
fake_install
|
2015-04-01 20:36:38 +00:00
|
|
|
COMMAND "${CMAKE_COMMAND}" --build . --target install
|
2015-04-05 13:53:17 +00:00
|
|
|
DEPENDS ${SUBSURFACE_TARGET}
|
2015-04-18 12:22:14 +00:00
|
|
|
)
|
2015-04-03 17:05:05 +00:00
|
|
|
|
2015-04-18 12:22:14 +00:00
|
|
|
add_custom_target(
|
|
|
|
installer
|
2015-04-01 20:36:38 +00:00
|
|
|
COMMAND ${MAKENSIS} ${WINDOWSSTAGING}/subsurface.nsi
|
|
|
|
DEPENDS fake_install
|
2015-04-18 12:22:14 +00:00
|
|
|
)
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
2015-03-30 19:50:52 +00:00
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
2015-04-18 12:22:09 +00:00
|
|
|
# Android template directory
|
2015-04-18 12:22:11 +00:00
|
|
|
set(ANDROID_PACKAGE_SOURCE_DIR, ${CMAKE_BINARY_DIR}/android)
|
|
|
|
endif()
|
2015-03-30 19:50:52 +00:00
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
install(DIRECTORY marbledata/maps DESTINATION share/subsurface/data)
|
|
|
|
install(DIRECTORY marbledata/bitmaps DESTINATION share/subsurface/data)
|
|
|
|
install(FILES subsurface.desktop DESTINATION share/applications)
|
|
|
|
install(FILES 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)
|
2015-04-21 15:15:40 +00:00
|
|
|
install(DIRECTORY printing_templates DESTINATION share/subsurface)
|
2015-03-30 19:50:52 +00:00
|
|
|
install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations)
|
2015-05-27 12:33:23 +00:00
|
|
|
if(SUBSURFACE_MOBILE)
|
|
|
|
install(TARGETS subsurface-mobile DESTINATION bin)
|
|
|
|
else()
|
|
|
|
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
|
|
|
|
endif()
|
2015-04-18 12:22:11 +00:00
|
|
|
if(DEFINED LIBMARBLEDEVEL)
|
2015-04-06 04:10:40 +00:00
|
|
|
install(
|
|
|
|
CODE "file(GLOB SSRFMARBLE_SHLIBS \"${LIBMARBLEDEVEL}/lib/libssrfmarblewidget.so*\")"
|
|
|
|
CODE "file(INSTALL \${SSRFMARBLE_SHLIBS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)"
|
2015-04-18 12:22:14 +00:00
|
|
|
)
|
2015-04-18 12:22:11 +00:00
|
|
|
endif()
|
|
|
|
endif()
|