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)
|
|
|
|
SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/marbledata)
|
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)
|
|
|
|
|
|
|
|
MACRO(pkg_config_library LIBNAME pcfile)
|
2015-02-24 07:49:08 +00:00
|
|
|
pkg_check_modules(${LIBNAME} REQUIRED ${pcfile})
|
2014-04-14 17:21:01 +00:00
|
|
|
include_directories(${${LIBNAME}_INCLUDE_DIRS})
|
|
|
|
link_directories(${${LIBNAME}_LIBRARY_DIRS})
|
|
|
|
add_definitions(${${LIBNAME}_CFLAGS_OTHER})
|
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${${LIBNAME}_LIBRARIES})
|
|
|
|
ENDMACRO()
|
|
|
|
|
|
|
|
pkg_config_library(LIBXML libxml-2.0)
|
|
|
|
pkg_config_library(LIBSQLITE3 sqlite3)
|
2015-03-26 20:50:28 +00:00
|
|
|
pkg_config_library(LIBXSLT libxslt)
|
|
|
|
pkg_config_library(LIBZIP libzip)
|
|
|
|
|
|
|
|
# more libraries with special handling in case we build them ourselves
|
|
|
|
|
2015-02-24 07:49:08 +00:00
|
|
|
if(NOT DEFINED LIBGIT2DEVEL)
|
2015-02-23 17:04:52 +00:00
|
|
|
pkg_config_library(LIBGIT2 libgit2)
|
|
|
|
ELSE()
|
|
|
|
include_directories(${LIBGIT2DEVEL}/include)
|
|
|
|
link_directories(${LIBGIT2DEVEL}/build)
|
2015-03-26 19:24:19 +00:00
|
|
|
if(NOT DEFINED LIBGIT2STATIC)
|
2015-03-25 21:31:42 +00:00
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lgit2 -lssl -lcrypto)
|
2015-02-23 17:04:52 +00:00
|
|
|
ELSE()
|
2015-03-25 21:31:42 +00:00
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} libgit2.a -lssl -lcrypto)
|
2015-02-23 17:04:52 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2014-04-14 17:21:01 +00:00
|
|
|
|
2014-04-14 19:48:12 +00:00
|
|
|
SET(LIBDCDEVEL "" CACHE STRING "libraries")
|
2015-03-25 21:31:42 +00:00
|
|
|
IF(DEFINED LIBDCDEVEL)
|
2014-04-14 19:48:12 +00:00
|
|
|
cmake_policy(SET CMP0015 OLD)
|
|
|
|
include_directories(${LIBDCDEVEL}/include )
|
|
|
|
link_directories(${LIBDCDEVEL}/src/.libs)
|
2015-03-26 19:24:19 +00:00
|
|
|
if(NOT DEFINED LIBDCSTATIC)
|
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -ldivecomputer -lusb-1.0)
|
2015-03-25 21:31:42 +00:00
|
|
|
ELSE()
|
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} libdivecomputer.a -lusb-1.0)
|
|
|
|
ENDIF()
|
|
|
|
ELSE()
|
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -ldivecomputer)
|
2014-04-14 19:48:12 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2015-03-26 20:50:28 +00:00
|
|
|
IF(NOT DEFINED LIBMARBLEDEVEL)
|
|
|
|
FIND_PACKAGE(Marble REQUIRED)
|
|
|
|
include_directories(${MARBLE_INCLUDE_DIR})
|
|
|
|
link_directories(${MARBLE_LIB_DIR})
|
|
|
|
ELSE()
|
|
|
|
include_directories(${LIBMARBLEDEVEL}/include)
|
|
|
|
link_directories(${LIBMARBLEDEVEL}/lib)
|
|
|
|
SET(MARBLE_LIBRARIES -L${LIBMARBLEDEVEL}/lib -lssrfmarblewidget)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# 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))
|
|
|
|
add_custom_target(link_marble_data ALL COMMAND rm -f marbledata && ln -s ${${PROJECT_NAME}_SOURCE_DIR}/marbledata ${${PROJECT_NAME}_BINARY_DIR}/marbledata)
|
|
|
|
ENDIF()
|
|
|
|
|
2015-02-02 15:52:35 +00:00
|
|
|
#configure Qt.
|
2015-03-26 20:50:28 +00:00
|
|
|
|
2015-02-02 15:52:35 +00:00
|
|
|
FIND_PACKAGE(Qt5Core REQUIRED)
|
|
|
|
FIND_PACKAGE(Qt5Concurrent REQUIRED)
|
|
|
|
FIND_PACKAGE(Qt5Widgets REQUIRED)
|
|
|
|
FIND_PACKAGE(Qt5Network REQUIRED)
|
|
|
|
FIND_PACKAGE(Qt5WebKitWidgets REQUIRED)
|
|
|
|
FIND_PACKAGE(Qt5PrintSupport REQUIRED)
|
|
|
|
FIND_PACKAGE(Qt5Svg REQUIRED)
|
|
|
|
FIND_PACKAGE(Qt5Test REQUIRED)
|
|
|
|
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")
|
|
|
|
SET(PLATFORM_SRC linux.c)
|
2015-03-30 23:06:56 +00:00
|
|
|
if(NOT DEFINED LRELEASE)
|
|
|
|
set(LRELEASE lrelease)
|
|
|
|
endif()
|
2015-03-26 19:24:46 +00:00
|
|
|
ENDIF()
|
|
|
|
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
SET(PLATFORM_SRC macos.c)
|
2015-03-26 19:52:48 +00:00
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -framework CoreServices)
|
2015-03-30 23:06:56 +00:00
|
|
|
if(NOT DEFINED LRELEASE)
|
|
|
|
set(LRELEASE lrelease)
|
|
|
|
endif()
|
2015-03-26 19:24:46 +00:00
|
|
|
ENDIF()
|
|
|
|
IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
|
|
SET(PLATFORM_SRC windows.c)
|
|
|
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32)
|
|
|
|
remove_definitions(-DUNICODE)
|
2015-03-30 23:06:56 +00:00
|
|
|
if(NOT DEFINED LRELEASE)
|
|
|
|
set(LRELEASE lrelease.exe)
|
|
|
|
endif()
|
2015-03-26 19:24:46 +00:00
|
|
|
ENDIF()
|
|
|
|
|
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
|
|
|
|
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-03-26 20:50:28 +00:00
|
|
|
# create the executables
|
|
|
|
|
2015-02-24 08:11:03 +00:00
|
|
|
ADD_EXECUTABLE(subsurface ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
2014-04-14 17:21:01 +00:00
|
|
|
target_link_libraries( subsurface
|
|
|
|
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
|
|
|
|
)
|
|
|
|
ADD_DEPENDENCIES(subsurface generate_qtconf)
|
|
|
|
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-02-04 08:30:24 +00:00
|
|
|
test(TestUnitConversion testunitconversion.cpp)
|
|
|
|
test(TestProfile testprofile.cpp)
|
|
|
|
test(TestGpsCoords testgpscoords.cpp)
|
2015-03-10 21:27:14 +00:00
|
|
|
test(TestParse testparse.cpp)
|
2015-03-30 19:50:52 +00:00
|
|
|
|
2015-03-30 21:43:15 +00:00
|
|
|
ADD_CUSTOM_TARGET(documentation ALL mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ \\; make -C ${CMAKE_SOURCE_DIR}/Documentation OUT=${CMAKE_BINARY_DIR}/Documentation/ doc)
|
|
|
|
|
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
|
|
|
)
|
|
|
|
|
|
|
|
set(TRANSLATION_SRC
|
|
|
|
translations/subsurface_source.ts
|
|
|
|
translations/subsurface_bg_BG.ts
|
|
|
|
translations/subsurface_cs.ts
|
|
|
|
translations/subsurface_da_DK.ts
|
|
|
|
translations/subsurface_de_CH.ts
|
|
|
|
translations/subsurface_de_DE.ts
|
|
|
|
translations/subsurface_en_GB.ts
|
|
|
|
translations/subsurface_es_ES.ts
|
|
|
|
translations/subsurface_et_EE.ts
|
|
|
|
translations/subsurface_fi_FI.ts
|
|
|
|
translations/subsurface_fr_FR.ts
|
|
|
|
translations/subsurface_it_IT.ts
|
|
|
|
translations/subsurface_lv_LV.ts
|
|
|
|
translations/subsurface_nb_NO.ts
|
|
|
|
translations/subsurface_nl_NL.ts
|
|
|
|
translations/subsurface_pl_PL.ts
|
|
|
|
translations/subsurface_pt_BR.ts
|
|
|
|
translations/subsurface_pt_PT.ts
|
|
|
|
translations/subsurface_ru_RU.ts
|
|
|
|
translations/subsurface_sk_SK.ts
|
|
|
|
translations/subsurface_sv_SE.ts
|
|
|
|
translations/subsurface_tr.ts
|
|
|
|
translations/subsurface_zh_TW.ts
|
|
|
|
)
|
|
|
|
|
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-03-30 19:50:52 +00:00
|
|
|
# disabled translations as they are below 50%:
|
|
|
|
# translations/subsurface_el_GR.ts \
|
|
|
|
# translations/subsurface_he.ts \
|
|
|
|
# translations/subsurface_hu.ts \
|
|
|
|
# translations/subsurface_ro_RO.ts \
|
|
|
|
|
|
|
|
# if we apply the REGEX to TRANSLATION_SRC then the list of files turns
|
|
|
|
# into a single string, so we assemble it file name by file name
|
|
|
|
foreach(TRANSLATION ${TRANSLATION_SRC})
|
|
|
|
string(REGEX REPLACE \\.ts .qm TRANSLATION_QM ${TRANSLATION})
|
2015-03-30 23:06:56 +00:00
|
|
|
string(REGEX REPLACE "/" "-" TRANSLATION_TARGET ${TRANSLATION_QM})
|
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/${TRANSLATION_QM}
|
|
|
|
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/translations \\; ${LRELEASE} ${CMAKE_SOURCE_DIR}/${TRANSLATION} -qm ${CMAKE_BINARY_DIR}/${TRANSLATION_QM}
|
|
|
|
DEPENDS ${TRANSLATION}
|
|
|
|
)
|
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
generate_translations_${TRANSLATION_TARGET}
|
|
|
|
DEPENDS ${CMAKE_BINARY_DIR}/${TRANSLATION_QM}
|
|
|
|
)
|
|
|
|
ADD_DEPENDENCIES(subsurface generate_translations_${TRANSLATION_TARGET})
|
|
|
|
set(TRANSLATIONS ${TRANSLATIONS} ${CMAKE_BINARY_DIR}/${TRANSLATION_QM})
|
2015-03-30 19:50:52 +00:00
|
|
|
endforeach()
|
|
|
|
|
2015-03-31 20:39:09 +00:00
|
|
|
foreach(QTTRANSLATION ${QTTRANSLATIONS_BASE})
|
|
|
|
set(QTTRANSLATIONS ${QTTRANSLATIONS} ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
|
|
|
|
endforeach()
|
|
|
|
|
2015-03-30 19:50:52 +00:00
|
|
|
# now for each platform the install instructions
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
# # OS X bundling rules
|
|
|
|
# # "make mac-deploy" deploys the external libs (Qt, libdivecomputer, libusb, etc.) into the bundle
|
|
|
|
# # "make install" installs the bundle to /Applications
|
|
|
|
# # "make mac-create-dmg" creates Subsurface.dmg
|
|
|
|
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})
|
|
|
|
install(TARGETS subsurface DESTINATION ${WINDOWSSTAGING})
|
|
|
|
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()
|
|
|
|
# stupid cmake doesn't allow a target to depend on the "install" target.
|
|
|
|
# How lame is that...
|
|
|
|
add_custom_target(fake_install
|
|
|
|
COMMAND "${CMAKE_COMMAND}" --build . --target install
|
|
|
|
DEPENDS subsurface)
|
|
|
|
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)
|
|
|
|
install(TARGETS subsurface DESTINATION bin)
|
|
|
|
ENDIF()
|