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
|
|
|
|
|
2014-04-14 17:21:01 +00:00
|
|
|
SET(CMAKE_AUTOMOC ON)
|
|
|
|
SET(CMAKE_AUTOUIC ON)
|
2015-04-17 21:31:12 +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-04-17 21:31:11 +00:00
|
|
|
OPTION(NO_MARBLE "disable the marble widget" OFF)
|
2015-04-17 21:31:10 +00:00
|
|
|
OPTION(NO_TESTS "disable the tests" OFF)
|
|
|
|
OPTION(NO_DOCS "disable the docs" OFF)
|
2015-04-07 20:29:35 +00:00
|
|
|
|
2015-04-07 19:44:49 +00:00
|
|
|
SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules)
|
2015-03-26 20:50:28 +00:00
|
|
|
INCLUDE_DIRECTORIES( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} qt-ui qt-ui/profile)
|
|
|
|
|
|
|
|
# compiler specific settings
|
2014-04-14 17:21:01 +00:00
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
|
|
|
endif()
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# pkgconfig for required libraries
|
2014-04-14 17:21:01 +00:00
|
|
|
FIND_PACKAGE(PkgConfig)
|
2015-04-07 19:53:28 +00:00
|
|
|
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-17 21:31:12 +00:00
|
|
|
IF(LIBGIT2_FROM_PKGCONFIG)
|
2015-04-16 14:24:25 +00:00
|
|
|
pkg_config_library(LIBGIT2 libgit2 REQUIRED)
|
2015-04-17 21:31:12 +00:00
|
|
|
SET(LIBGIT2_LIBRARIES "")
|
2015-02-23 17:04:52 +00:00
|
|
|
ELSE()
|
2015-04-07 20:38:08 +00:00
|
|
|
FIND_PACKAGE(LIBGIT2 REQUIRED)
|
2015-04-08 03:49:21 +00:00
|
|
|
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDE_DIR})
|
2015-02-23 17:04:52 +00:00
|
|
|
ENDIF()
|
2014-04-14 17:21:01 +00:00
|
|
|
|
2015-04-17 21:31:12 +00:00
|
|
|
IF(LIBDC_FROM_PKGCONFIG)
|
|
|
|
pkg_config_library(LIBDC libdivecomputer REQUIRED)
|
|
|
|
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
|
|
|
|
|
|
|
|
IF(NOT NO_MARBLE)
|
|
|
|
FIND_PACKAGE(MARBLE QUIET)
|
|
|
|
IF(MARBLE_FOUND)
|
|
|
|
include_directories(${MARBLE_INCLUDE_DIR})
|
|
|
|
ELSE()
|
|
|
|
SET(NO_MARBLE ON)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
IF(NO_MARBLE)
|
|
|
|
message(STATUS marble NOT AVAIL)
|
|
|
|
ADD_DEFINITIONS(-DNO_MARBLE)
|
|
|
|
SET(MARBLE_LIBRARIES "")
|
|
|
|
ENDIF()
|
2015-03-26 20:50:28 +00:00
|
|
|
|
2015-04-07 23:13:27 +00:00
|
|
|
SET(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} -lusb-1.0)
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# handle out of tree build correctly
|
|
|
|
|
2014-04-14 17:21:01 +00:00
|
|
|
STRING(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${${PROJECT_NAME}_BINARY_DIR}" insource)
|
|
|
|
GET_FILENAME_COMPONENT(PARENTDIR ${${PROJECT_NAME}_SOURCE_DIR} PATH)
|
|
|
|
STRING(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${PARENTDIR}" insourcesubdir)
|
|
|
|
IF(NOT (insource OR insourcedir))
|
2015-04-17 21:31:11 +00:00
|
|
|
IF(NOT NO_MARBLE)
|
|
|
|
add_custom_target(link_marble_data ALL COMMAND rm -f marbledata && ln -s ${${PROJECT_NAME}_SOURCE_DIR}/marbledata ${${PROJECT_NAME}_BINARY_DIR}/marbledata)
|
|
|
|
ENDIF()
|
2014-04-14 17:21:01 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2015-02-02 15:52:35 +00:00
|
|
|
#configure Qt.
|
2015-03-26 20:50:28 +00:00
|
|
|
|
2015-04-09 18:06:47 +00:00
|
|
|
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network WebKitWidgets PrintSupport Svg Test LinguistTools)
|
2015-02-02 15:52:35 +00:00
|
|
|
SET(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::WebKitWidgets Qt5::PrintSupport Qt5::Svg)
|
|
|
|
SET(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
|
|
|
|
|
2014-04-14 17:21:01 +00:00
|
|
|
# Generate the ssrf-config.h every 'make'
|
2015-03-26 20:50:28 +00:00
|
|
|
|
2015-02-03 07:56:55 +00:00
|
|
|
FILE(WRITE ${CMAKE_BINARY_DIR}/version.h.in "
|
|
|
|
#define VERSION_STRING \"@VERSION_STRING@\"
|
|
|
|
#define GIT_VERSION_STRING \"@GIT_VERSION_STRING@\"
|
|
|
|
#define CANONICAL_VERSION_STRING \"@CANONICAL_VERSION_STRING@\"
|
|
|
|
")
|
|
|
|
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 ()
|
2015-04-01 18:40:00 +00:00
|
|
|
IF(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
|
|
|
|
SET(VER_OS win)
|
|
|
|
ENDIF ()
|
2015-02-03 07:56:55 +00:00
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND sh scripts/get-version \${VER_OS}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE VERSION_STRING
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND sh scripts/get-version linux
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_VERSION_STRING
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND sh scripts/get-version full
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE CANONICAL_VERSION_STRING
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
CONFIGURE_FILE(\${SRC} \${DST} @ONLY)
|
2015-04-01 18:40:00 +00:00
|
|
|
IF(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
|
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND cat ${CMAKE_SOURCE_DIR}/packaging/windows/subsurface.nsi.in
|
|
|
|
COMMAND sed -e \"s/VERSIONTOKEN/\${VERSION_STRING}/\"
|
|
|
|
COMMAND sed -e \"s/PRODVTOKEN/\${CANONICAL_VERSION_STRING}/\"
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/staging/subsurface.nsi
|
|
|
|
)
|
|
|
|
ENDIF()
|
2014-04-14 17:21:01 +00:00
|
|
|
")
|
|
|
|
ADD_CUSTOM_TARGET(version ALL COMMAND
|
|
|
|
${CMAKE_COMMAND} -D SRC=${CMAKE_BINARY_DIR}/version.h.in
|
|
|
|
-D DST=${CMAKE_BINARY_DIR}/ssrf-version.h
|
2015-04-01 18:40:00 +00:00
|
|
|
-D CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
2014-04-14 17:21:01 +00:00
|
|
|
-P ${CMAKE_BINARY_DIR}/version.cmake
|
|
|
|
)
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# set up the different target platforms
|
|
|
|
|
2015-03-26 19:24:46 +00:00
|
|
|
SET(PLATFORM_SRC unknown_platform.c)
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
2015-04-05 13:53:17 +00:00
|
|
|
set(SUBSURFACE_TARGET subsurface)
|
2015-03-26 19:24:46 +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-03-26 19:24:46 +00:00
|
|
|
ENDIF()
|
|
|
|
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
2015-04-05 13:53:17 +00:00
|
|
|
set(SUBSURFACE_TARGET Subsurface)
|
2015-03-26 19:24:46 +00:00
|
|
|
SET(PLATFORM_SRC macos.c)
|
2015-04-03 19:34:23 +00:00
|
|
|
FIND_LIBRARY(APP_SERVICES_LIBRARY ApplicationServices )
|
|
|
|
SET(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
|
2015-04-04 23:28:25 +00:00
|
|
|
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})
|
2015-03-26 19:24:46 +00:00
|
|
|
ENDIF()
|
|
|
|
IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
2015-04-05 13:53:17 +00:00
|
|
|
set(SUBSURFACE_TARGET subsurface)
|
2015-03-26 19:24:46 +00:00
|
|
|
SET(PLATFORM_SRC windows.c)
|
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32)
|
|
|
|
remove_definitions(-DUNICODE)
|
2015-04-03 17:32:05 +00:00
|
|
|
add_definitions(-mwindows)
|
2015-03-26 19:24:46 +00:00
|
|
|
ENDIF()
|
|
|
|
|
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-03-26 20:50:28 +00:00
|
|
|
|
2014-04-14 19:47:12 +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
|
2014-04-17 14:34:21 +00:00
|
|
|
#gettextfrommoc should be added because we are using it on the c-code.
|
|
|
|
gettextfromc.cpp
|
2014-04-17 15:21:39 +00:00
|
|
|
#dirk ported some core functionality to c++.
|
|
|
|
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-03-26 19:24:46 +00:00
|
|
|
${PLATFORM_SRC}
|
2014-04-14 17:21:01 +00:00
|
|
|
)
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# the interface, in C++
|
|
|
|
|
2014-04-14 19:47:12 +00:00
|
|
|
SET(SUBSURFACE_INTERFACE
|
|
|
|
qt-ui/updatemanager.cpp
|
|
|
|
qt-ui/about.cpp
|
|
|
|
qt-ui/completionmodels.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
|
|
|
|
qt-ui/models.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/printlayout.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
|
|
|
|
qt-ui/usermanual.cpp
|
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
|
2014-11-13 18:31:03 +00:00
|
|
|
qt-ui/filtermodels.cpp
|
2015-02-23 16:15:30 +00:00
|
|
|
qt-ui/undocommands.cpp
|
2014-04-14 19:47:12 +00:00
|
|
|
)
|
2014-04-14 17:21:01 +00:00
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# the profile widget
|
|
|
|
|
2014-04-14 19:47:12 +00:00
|
|
|
SET(SUBSURFACE_PROFILE_LIB_SRCS
|
|
|
|
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/diveplotdatamodel.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-03-26 20:50:28 +00:00
|
|
|
# the yearly statistics widget.
|
|
|
|
|
2014-08-25 17:52:45 +00:00
|
|
|
SET(SUBSURFACE_STATISTICS_LIB_SRCS
|
|
|
|
qt-ui/statistics/statisticswidget.cpp
|
|
|
|
qt-ui/statistics/yearstatistics.cpp
|
|
|
|
qt-ui/statistics/statisticsbar.cpp
|
|
|
|
qt-ui/statistics/monthstatistics.cpp
|
|
|
|
)
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# the main app.
|
|
|
|
|
2014-04-14 19:47:12 +00:00
|
|
|
SET(SUBSURFACE_APP
|
|
|
|
main.cpp
|
|
|
|
qt-gui.cpp
|
|
|
|
qthelper.cpp
|
|
|
|
)
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# create the libraries
|
|
|
|
|
2014-04-14 19:47:12 +00:00
|
|
|
FILE(GLOB SUBSURFACE_UI qt-ui/*.ui)
|
2015-02-24 08:11:03 +00:00
|
|
|
QT5_WRAP_UI(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
|
|
|
|
QT5_ADD_RESOURCES(SUBSURFACE_RESOURCES subsurface.qrc)
|
2014-04-14 17:21:01 +00:00
|
|
|
|
|
|
|
ADD_LIBRARY(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} )
|
2015-02-02 15:52:35 +00:00
|
|
|
TARGET_LINK_LIBRARIES(subsurface_corelib ${QT_LIBRARIES})
|
2014-04-14 17:21:01 +00:00
|
|
|
ADD_LIBRARY(subsurface_profile STATIC ${SUBSURFACE_PROFILE_LIB_SRCS})
|
2015-02-02 15:52:35 +00:00
|
|
|
TARGET_LINK_LIBRARIES(subsurface_profile ${QT_LIBRARIES})
|
2014-08-25 17:52:45 +00:00
|
|
|
ADD_LIBRARY(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS})
|
2015-02-02 15:52:35 +00:00
|
|
|
TARGET_LINK_LIBRARIES(subsurface_statistics ${QT_LIBRARIES})
|
2014-04-14 17:21:01 +00:00
|
|
|
ADD_LIBRARY(subsurface_generated_ui STATIC ${SUBSURFACE_UI_HDRS})
|
2015-02-24 08:11:03 +00:00
|
|
|
TARGET_LINK_LIBRARIES(subsurface_generated_ui ${QT_LIBRARIES})
|
2014-04-14 17:21:01 +00:00
|
|
|
ADD_LIBRARY(subsurface_interface STATIC ${SUBSURFACE_INTERFACE})
|
2015-02-02 15:52:35 +00:00
|
|
|
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")
|
|
|
|
SET(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lpthread)
|
|
|
|
endif()
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# create the executables
|
|
|
|
|
2015-04-05 13:53:17 +00:00
|
|
|
ADD_EXECUTABLE(${SUBSURFACE_TARGET} ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
|
|
|
target_link_libraries( ${SUBSURFACE_TARGET}
|
2014-04-14 17:21:01 +00:00
|
|
|
subsurface_generated_ui
|
|
|
|
subsurface_interface
|
|
|
|
subsurface_profile
|
2014-08-25 17:52:45 +00:00
|
|
|
subsurface_statistics
|
2014-04-14 17:21:01 +00:00
|
|
|
subsurface_corelib
|
|
|
|
${SUBSURFACE_LINK_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2014-08-25 17:52:45 +00:00
|
|
|
ADD_DEPENDENCIES(subsurface_statistics subsurface_generated_ui)
|
2014-04-14 17:21:01 +00:00
|
|
|
ADD_DEPENDENCIES(subsurface_profile subsurface_generated_ui)
|
|
|
|
ADD_DEPENDENCIES(subsurface_interface subsurface_generated_ui)
|
|
|
|
ADD_DEPENDENCIES(subsurface_generated_ui version)
|
2014-04-14 19:47:12 +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
|
|
|
|
IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/qt.conf
|
|
|
|
COMMAND echo \"[Paths]\" > ${CMAKE_BINARY_DIR}/qt.conf \; echo \"Prefix=.\" >> ${CMAKE_BINARY_DIR}/qt.conf
|
|
|
|
)
|
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
generate_qtconf
|
|
|
|
DEPENDS ${CMAKE_BINARY_DIR}/qt.conf
|
|
|
|
)
|
2015-04-05 13:53:17 +00:00
|
|
|
ADD_DEPENDENCIES(${SUBSURFACE_TARGET} generate_qtconf)
|
2015-03-31 21:03:02 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
# QTest based tests
|
|
|
|
|
2015-02-04 08:30:24 +00:00
|
|
|
MACRO(test NAME FILE)
|
2015-03-15 01:04:53 +00:00
|
|
|
ADD_EXECUTABLE(${NAME} tests/${FILE} ${SUBSURFACE_RESOURCES})
|
2015-03-25 21:48:02 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${NAME} subsurface_corelib ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES})
|
2015-02-04 08:30:24 +00:00
|
|
|
ADD_TEST(NAME ${NAME} COMMAND ${NAME})
|
|
|
|
ENDMACRO()
|
2014-04-17 14:34:21 +00:00
|
|
|
|
2015-02-04 08:30:24 +00:00
|
|
|
ENABLE_TESTING()
|
2015-03-10 21:27:14 +00:00
|
|
|
ADD_DEFINITIONS(-DSUBSURFACE_SOURCE="${CMAKE_SOURCE_DIR}")
|
|
|
|
ADD_DEFINITIONS(-g)
|
2015-04-17 21:31:10 +00:00
|
|
|
IF(NOT NO_TESTS)
|
|
|
|
test(TestUnitConversion testunitconversion.cpp)
|
|
|
|
test(TestProfile testprofile.cpp)
|
|
|
|
test(TestGpsCoords testgpscoords.cpp)
|
|
|
|
test(TestParse testparse.cpp)
|
|
|
|
ENDIF()
|
2015-03-30 19:50:52 +00:00
|
|
|
|
2015-04-17 21:31:10 +00:00
|
|
|
IF(NOT NO_DOCS)
|
|
|
|
ADD_CUSTOM_TARGET(documentation ALL mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ \\; make -C ${CMAKE_SOURCE_DIR}/Documentation OUT=${CMAKE_BINARY_DIR}/Documentation/ doc)
|
|
|
|
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})
|
|
|
|
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-03-30 19:50:52 +00:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
|
|
# # 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})
|
|
|
|
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-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...)
|
|
|
|
FILE(WRITE ${CMAKE_BINARY_DIR}/dlllist.cmake "
|
|
|
|
MESSAGE(STATUS \"processing dlllist.cmake\")
|
|
|
|
# figure out which command to use for objdump
|
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
|
|
|
|
OUTPUT_VARIABLE OBJDUMP
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
# figure out where we should search for libraries
|
|
|
|
EXECUTE_PROCESS(
|
|
|
|
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
|
|
|
|
)
|
|
|
|
# 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...
|
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND tail -1 CMakeFiles/subsurface.dir/link.txt
|
|
|
|
COMMAND cut -d\\ -f 2-
|
|
|
|
OUTPUT_VARIABLE LINKER_LINE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
# finally run our win-ldd.pl script against that to
|
|
|
|
# collect all the required dlls
|
|
|
|
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
|
|
|
|
)
|
|
|
|
# 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})
|
|
|
|
EXECUTE_PROCESS(COMMAND install \${DLL} \${STAGING})
|
|
|
|
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-01 20:36:38 +00:00
|
|
|
add_custom_target(fake_install
|
|
|
|
COMMAND "${CMAKE_COMMAND}" --build . --target install
|
2015-04-05 13:53:17 +00:00
|
|
|
DEPENDS ${SUBSURFACE_TARGET}
|
2015-04-03 17:05:05 +00:00
|
|
|
)
|
|
|
|
|
2015-04-01 20:36:38 +00:00
|
|
|
add_custom_target(installer
|
|
|
|
COMMAND ${MAKENSIS} ${WINDOWSSTAGING}/subsurface.nsi
|
|
|
|
DEPENDS fake_install
|
|
|
|
)
|
2015-03-30 19:50:52 +00:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
|
|
|
# # Android template directory
|
|
|
|
# SET(ANDROID_PACKAGE_SOURCE_DIR, ${CMAKE_BINARY_DIR}/android)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
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)
|
|
|
|
install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations)
|
2015-04-05 13:53:17 +00:00
|
|
|
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
|
2015-04-06 03:19:02 +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-06 03:19:02 +00:00
|
|
|
ENDIF()
|
2015-03-30 19:50:52 +00:00
|
|
|
ENDIF()
|