Commit graph

69 commits

Author SHA1 Message Date
Tomaz Canabrava
6f93590705 Add FindLibdivecomputer.cmake
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:27:39 -07:00
Tomaz Canabrava
46990f4ac8 Simplify libgit handling on main CMakeLists.txt
We will use the OPTIONS variable to decide to find the
.a or the .so, so there's no need to do checks here.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:09:35 -07:00
Tomaz Canabrava
5a9931f438 Add build options
- add an option to toogle between libgit2 from package vs built from source
- add two options that will be used in the future: use static/dynamic lib

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:08:55 -07:00
Tomaz Canabrava
2e05dbb791 No need to specify Marble dir anymore
We are already looking for the default directory.
*if* cmake doesn't find Marble automatically, the user needs
to specify -DMARBLE_INCLUDE_DIR and -DMARBLE_LIBRARIES

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:07:33 -07:00
Tomaz Canabrava
057231701e Move the pkg_config_library macro to its own file
The pkg_config_library macro is a helper macro and was generating noise
on the main CMakeLists.txt file, so I moved it to another file.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:07:07 -07:00
Tomaz Canabrava
e56580229b FindMarble moved to cmake/Modules
This is the correct way to deal with CMake Modules (or at least, the
default way). All our custom CMakeFiles will be here.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:06:54 -07:00
Tomaz Canabrava
85fbd1737c Simplify finding Qt
Qt5 Supports Components, which means that we can list the
components we need to find, instead of specifying one for
each line.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:06:44 -07:00
Dirk Hohndel
143ecbf7a2 cmake: second attempt to install our ssrfmarble lib
Sorry for the noise.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-05 21:10:40 -07:00
Dirk Hohndel
f8a01ee309 cmake: on Linux install our special marble library
If we build our own library, make sure it gets installed as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-05 20:19:02 -07:00
Dirk Hohndel
5722d5f0dc cmake: add libz to end of linker line on Linux
While I don't need this when building on Fedora 20, OBS builds for
openSUSE appear to fail without this. Strange.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-05 17:41:35 -07:00
Dirk Hohndel
f07ba421d1 cmake: the application name should be capitalized on Mac
We want Subsurface.app but subsurface and subsurface.exe

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-05 06:53:17 -07:00
Dirk Hohndel
ce3a169cf9 cmake: try to get the dependency on the .qm files right
This is still not something I'm 100% sure I got right. But at least now it
correctly rebuilds the .qm files...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 21:59:51 -07:00
Dirk Hohndel
e8955e5916 cmake: use the correct macdeployqt command name
Oops, that was silly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 16:30:46 -07:00
Dirk Hohndel
115268c8fd cmake: correctly create a Mac bundle
Don't try to install the TARGET into the Subsurface.app or we get a neat
infinite recursion. As a bundle cmake does all these things automagically.
Right now the version is hard coded which is ugly but since it's determined in
a separate cmake file it seemed non-obvious how to do this right...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 16:29:01 -07:00
Dirk Hohndel
072422075e cmake: try to pick a useful default for the location of Qt translations
Not sure if this will work for most installations - it does work for mine.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 16:21:32 -07:00
Dirk Hohndel
b79c01ab7c cmake: don't always create .qm files
The cmake keywords still confuse me at times.
A custom target is always recreated. How silly. But the correct (I think)
implementation is actually easier...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 16:19:45 -07:00
Dirk Hohndel
41c5b95ee1 cmake: Mac install into Subsurface.app
I guess I should add the code to move that app to /Applications but I never use
it this way... not sure how many people really install from source on a Mac,
anyway.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 13:13:46 -07:00
Dirk Hohndel
09032a2761 cmake: make sure we have no emptry Qt translation names
When building on a Mac for some reason I was getting an empty translation file
name (and therefore and entry that was the whole directory and not a
translation file. This is a bit clumsy but it fixes the problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 13:12:20 -07:00
Dirk Hohndel
af9fb32fcd cmake: add ostctools.c
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 11:05:40 -07:00
Dirk Hohndel
acaedee159 cmake: make Windows binary a GUI app
This way we don't get the annoying terminal window

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-03 12:36:30 -07:00
Dirk Hohndel
3dac769c33 cmake: correctly link against CoreServices
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-03 12:34:23 -07:00
Dirk Hohndel
6a466d0cfb cmake: build working Windows installer including all the DLLs
Figure out the DLLs we need to include in the installer before building
the installer executable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-03 10:05:05 -07:00
Dirk Hohndel
297ddf666d cmake: add installer target for creating Windows installer
Silly cmake doesn't allow a target to depend on the install target. This
ugly hack appears to be the recommended workaround :-(

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-01 14:44:21 -07:00
Dirk Hohndel
70527ac83a cmake: setup .nsi file when cross building for Windows
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-01 13:36:20 -07:00
Dirk Hohndel
1b0d0687f8 cmake: first stab at installing cross built Windows files into staging
From there it can then be assembled as an installer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-31 14:07:09 -07:00
Dirk Hohndel
1e03edf60d cmake: remove debug output that snuck into an earlier commit
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-31 13:42:03 -07:00
Dirk Hohndel
d9a6acf4be cmake: add Qt translation files
Not doing anything with them, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-31 13:39:09 -07:00
Dirk Hohndel
499aeaf645 cmake: create translations and correctly install them
The previous attempt to install them was completely bogus as it only
worked when the source directory had previously used for an in-source
build using qmake.

Oops.

With this change we now create the translations in the build directory and
install them from there.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-30 16:06:56 -07:00
Dirk Hohndel
eecf40c121 cmake: fix Documentation build and install
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-30 14:43:15 -07:00
Dirk Hohndel
e2a0a51b29 cmake: implement "make install" for Linux
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-30 12:50:52 -07:00
Dirk Hohndel
f956d6291f cmake: make CMakeLists.txt more readable
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-26 13:50:28 -07:00
Dirk Hohndel
3378894291 cmake: add CoreServices framework for Mac
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-26 12:52:48 -07:00
Dirk Hohndel
c41b1dc688 cmake: add support to compile for Windows and Mac
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-26 12:25:26 -07:00
Dirk Hohndel
0a4444930e cmake: use DEFINED instead of comparing to ""
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-26 12:24:19 -07:00
Dirk Hohndel
4309ab4a16 cmake: setup marble link directory correctly
This way the necessary rpath settings are created

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-25 15:02:21 -07:00
Dirk Hohndel
405e52fef9 cmake: handle libzip like the other libraries
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-25 14:48:02 -07:00
Dirk Hohndel
24a1ab461b cmake cleanup
- don't reference .so files, reference libraries
- handle libdivecomputer just like the other libraries
- add the ability to link libdivecomputer statically

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-25 14:31:42 -07:00
Dirk Hohndel
b47d8d5992 Some simple test for file parsing
With no V2 question shown
- parsing fails when a V2 file is loaded
- parsing succeeds when a V3 file is loaded
- import of CSV file succeeds

With V2 question shown
- parsing succeeds when a V2 file is loaded

Finally compare the output of reading in the various files with reference
output included in the sources.

My guess is that this test might be a bit fragile, but hey, it's a start.

(reminder: the tests only get built when using cmake)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14 18:15:08 -07:00
Dirk Hohndel
bf9460e55e Add Subsurface resources to tests
This way we can use the resources from within the tests, for example to
load XSLT files.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14 18:08:26 -07:00
Dirk Hohndel
d5f6b104a2 Add notificationwidget to cmake build
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:25:57 -07:00
Salvador Cuñat
44b55bd1a2 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>
2015-03-10 10:03:08 -07:00
Patrick Valsecchi
d15641a6fa Cmake build now contains icons
Fixed the icon problem Dirk found.

We really should choose between qmake and cmake. I wouldn't care about
cmake if qmake was building the UTs...

From 8eeea28a523fd6ef588d81b82ab904d4512b3d7a Mon Sep 17 00:00:00 2001
From: Patrick Valsecchi <patrick@thus.ch>
Date: Tue, 24 Feb 2015 09:06:37 +0100
Subject: [PATCH 3/3] Cmake build now contains icons

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-24 11:41:39 +01:00
Patrick Valsecchi
e64501574b Fixed cmake build.
Non parallel build was broken because qthelper.cpp was depending
indirectly on a QT generated file and no cmake dependency was enforcing
the file to be generated before. I've removed the not needed #include
that was introducing this dependency.

In cmake, {FOO STREQUAL ""} is TRUE only if FOO is defined and
empty. Fixed a couple of bad usages.

Made the required libraries actually required in cmake.

From ef5ab90f258c5754d3022a023c28050cbafed3d5 Mon Sep 17 00:00:00 2001
From: Patrick Valsecchi <patrick@thus.ch>
Date: Tue, 24 Feb 2015 08:38:49 +0100
Subject: [PATCH 1/2] Fixed cmake build.

Non parallel build was broken because qthelper.cpp was depending
indirectly on a QT generated file and no cmake dependency was enforcing
the file to be generated before. I've removed the not needed #include
that was introducing this dependency.

In cmake, {FOO STREQUAL ""} is TRUE only if FOO is defined and
empty. Fixed a couple of bad usages.

Made the required libraries actually required in cmake.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-24 11:40:54 +01:00
Dirk Hohndel
62999c866f Add LIBGITDEVEL support to CMakeLists.txt
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-23 09:31:08 -08:00
Dirk Hohndel
cd545e1075 Add new files to CMakeLists.txt
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-23 09:30:56 -08:00
Dirk Hohndel
cae00d9858 Add LIBMARBLEDEVEL support to cmake
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-23 09:17:20 -08:00
Linus Torvalds
e287590e4b Start splitting out git repo helper routines
This doesn't actually change any code, but it moves the 'is_git_repo()'
function that is used by both loading and saving into a new git-access.c
file.

This is where I'll start doing remote repo syncing too. Knock wood.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 06:03:19 -08:00
Patrick Valsecchi
bd9a443793 More tolerant when parsing GPS coordinates.
Refactored the parsing logic to make it more solid (no more guessing) and
more flexible (support more formats).
Added a test for checking that.
Fixed a few warnings.

[Dirk Hohndel: some changes to coding style]

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-04 10:51:27 -08:00
Patrick Valsecchi
6e5b0ee6db Fix ssrf-version.h generation by cmake.
My previous cmake patch was relying on ssrf-version.h to be generated
correctly by qmake, in the source directory. This one fixes the generation
of this file in the build directory.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-03 07:17:18 -08:00
Patrick Valsecchi
7e0ff8c1e4 Fixed CMakeLists.txt to work with Qt5
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-02 08:00:49 -08:00