mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Move all core-functionality to subsurface-core
And adapt a new CMakeLists.txt file for it. On the way I've also found out that we where double-compilling a few files. I've also set the subsurface-core as a include_path but that was just to reduce the noise on this commit, since I plan to remove it from the include path to make it obligatory to specify something like include "subsurface-core/dive.h" for the header files. Since the app is growing quite a bit we ended up having a few different files with almost same name that did similar things, I want to kill that (for instance Dive.h, dive.h, PrintDive.h and such). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a079821423
commit
4c0156e3d5
105 changed files with 102 additions and 78 deletions
|
@ -23,6 +23,12 @@ option(FBSUPPORT "allow posting to Facebook" ON)
|
|||
option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" ON)
|
||||
option(FTDISUPPORT "enable support for libftdi based serial" OFF)
|
||||
|
||||
add_definitions(-DSUBSURFACE_SOURCE="${CMAKE_SOURCE_DIR}")
|
||||
|
||||
if(BTSUPPORT)
|
||||
add_definitions(-DBT_SUPPORT)
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_MODULE_PATH}
|
||||
${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules
|
||||
|
@ -34,6 +40,7 @@ include_directories(.
|
|||
qt-ui
|
||||
qt-models
|
||||
qt-ui/profile
|
||||
subsurface-core/
|
||||
)
|
||||
|
||||
# get the version string -- this is only used for Mac Bundle at this point
|
||||
|
@ -268,19 +275,16 @@ add_custom_target(
|
|||
set(PLATFORM_SRC unknown_platform.c)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(SUBSURFACE_TARGET subsurface)
|
||||
set(PLATFORM_SRC linux.c)
|
||||
# in some builds we appear to be missing libz for some strange reason...
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lz)
|
||||
endif()
|
||||
if(ANDROID)
|
||||
set(PLATFORM_SRC android.cpp)
|
||||
set(SUBSURFACE_TARGET subsurface)
|
||||
# To allow us to debug log to logcat
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -llog)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(SUBSURFACE_TARGET Subsurface)
|
||||
set(PLATFORM_SRC macos.c)
|
||||
find_library(APP_SERVICES_LIBRARY ApplicationServices)
|
||||
find_library(HID_LIB HidApi)
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${HID_LIB})
|
||||
|
@ -299,7 +303,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(SUBSURFACE_TARGET subsurface)
|
||||
set(PLATFORM_SRC windows.c)
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32 -lws2_32)
|
||||
remove_definitions(-DUNICODE)
|
||||
add_definitions(-mwindows -D_WIN32)
|
||||
|
@ -307,68 +310,7 @@ endif()
|
|||
|
||||
# include translations
|
||||
add_subdirectory(translations)
|
||||
|
||||
if(BTSUPPORT)
|
||||
add_definitions(-DBT_SUPPORT)
|
||||
set(BT_SRC_FILES qt-ui/btdeviceselectiondialog.cpp)
|
||||
set(BT_CORE_SRC_FILES qtserialbluetooth.cpp)
|
||||
endif()
|
||||
|
||||
# compile the core library, in C.
|
||||
set(SUBSURFACE_CORE_LIB_SRCS
|
||||
cochran.c
|
||||
datatrak.c
|
||||
deco.c
|
||||
device.c
|
||||
dive.c
|
||||
divesite.c
|
||||
divesite.cpp # some new stuff that is not c code but belongs to divesite.
|
||||
divelist.c
|
||||
equipment.c
|
||||
file.c
|
||||
git-access.c
|
||||
libdivecomputer.c
|
||||
liquivision.c
|
||||
load-git.c
|
||||
membuffer.c
|
||||
ostctools.c
|
||||
parse-xml.c
|
||||
planner.c
|
||||
profile.c
|
||||
gaspressures.c
|
||||
worldmap-save.c
|
||||
save-git.c
|
||||
save-xml.c
|
||||
save-html.c
|
||||
sha1.c
|
||||
statistics.c
|
||||
strtod.c
|
||||
subsurfacestartup.c
|
||||
time.c
|
||||
uemis.c
|
||||
uemis-downloader.c
|
||||
version.c
|
||||
# gettextfrommoc should be added because we are using it on the c-code.
|
||||
gettextfromc.cpp
|
||||
# dirk ported some core functionality to c++.
|
||||
qthelper.cpp
|
||||
divecomputer.cpp
|
||||
exif.cpp
|
||||
subsurfacesysinfo.cpp
|
||||
devicedetails.cpp
|
||||
configuredivecomputer.cpp
|
||||
configuredivecomputerthreads.cpp
|
||||
divesitehelpers.cpp
|
||||
taxonomy.c
|
||||
checkcloudconnection.cpp
|
||||
windowtitleupdate.cpp
|
||||
divelogexportlogic.cpp
|
||||
qt-init.cpp
|
||||
${BT_CORE_SRC_FILES}
|
||||
${SERIAL_FTDI}
|
||||
${PLATFORM_SRC}
|
||||
)
|
||||
source_group("Subsurface Core" FILES ${SUBSURFACE_CORE_LIB_SRCS})
|
||||
add_subdirectory(subsurface-core)
|
||||
|
||||
if(FBSUPPORT)
|
||||
add_definitions(-DFBSUPPORT)
|
||||
|
@ -406,12 +348,9 @@ source_group("Subsurface Models" FILES ${SUBSURFACE_MODELS})
|
|||
set(SUBSURFACE_APP
|
||||
main.cpp
|
||||
qt-gui.cpp
|
||||
qthelper.cpp
|
||||
)
|
||||
source_group("Subsurface App" FILES ${SUBSURFACE_APP})
|
||||
|
||||
add_library(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} )
|
||||
target_link_libraries(subsurface_corelib ${QT_LIBRARIES})
|
||||
add_library(subsurface_models STATIC ${SUBSURFACE_MODELS_LIB_SRCS})
|
||||
target_link_libraries(subsurface_models ${QT_LIBRARIES})
|
||||
|
||||
|
@ -483,7 +422,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|||
endif()
|
||||
|
||||
# build an automated html exporter
|
||||
add_executable(export-html EXCLUDE_FROM_ALL export-html.cpp qt-init.cpp qthelper.cpp ${SUBSURFACE_RESOURCES})
|
||||
add_executable(export-html EXCLUDE_FROM_ALL export-html.cpp ${SUBSURFACE_RESOURCES})
|
||||
target_link_libraries(export-html subsurface_corelib ${SUBSURFACE_LINK_LIBRARIES})
|
||||
|
||||
# QTest based tests
|
||||
|
@ -495,7 +434,7 @@ macro(TEST NAME FILE)
|
|||
set_tests_properties(${NAME}_run PROPERTIES DEPENDS ${NAME}_build)
|
||||
endmacro()
|
||||
|
||||
add_definitions(-DSUBSURFACE_SOURCE="${CMAKE_SOURCE_DIR}")
|
||||
|
||||
add_definitions(-g)
|
||||
if(NOT NO_TESTS)
|
||||
enable_testing()
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
|
||||
#include "metrics.h"
|
||||
|
||||
#include "../dive.h"
|
||||
#include "../divelist.h"
|
||||
#include "../divecomputer.h"
|
||||
#include "subsurface-core/dive.h"
|
||||
#include "subsurface-core/divelist.h"
|
||||
#include "subsurface-core/divecomputer.h"
|
||||
#include "cleanertablemodel.h"
|
||||
#include "treemodel.h"
|
||||
|
||||
|
|
|
@ -4,6 +4,10 @@ qt5_wrap_ui(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
|
|||
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc)
|
||||
source_group("Subsurface Interface Files" FILES ${SUBSURFACE_UI})
|
||||
|
||||
if(BTSUPPORT)
|
||||
set(BT_SRC_FILES btdeviceselectiondialog.cpp)
|
||||
endif()
|
||||
|
||||
# the interface, in C++
|
||||
set(SUBSURFACE_INTERFACE
|
||||
updatemanager.cpp
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <QDialog>
|
||||
#include <QStringListModel>
|
||||
#include "ui_configuredivecomputerdialog.h"
|
||||
#include "../libdivecomputer.h"
|
||||
#include "subsurface-core/libdivecomputer.h"
|
||||
#include "configuredivecomputer.h"
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QNetworkAccessManager>
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include <QAbstractTableModel>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "../dive.h"
|
||||
#include "../divelist.h"
|
||||
#include "subsurface-core/dive.h"
|
||||
#include "subsurface-core/divelist.h"
|
||||
|
||||
namespace Ui {
|
||||
class DiveLogImportDialog;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef GRAPHICSVIEW_COMMON_H
|
||||
#define GRAPHICSVIEW_COMMON_H
|
||||
|
||||
#include "../color.h"
|
||||
#include "subsurface-core/color.h"
|
||||
#include <QMap>
|
||||
#include <QVector>
|
||||
#include <QColor>
|
||||
|
|
81
subsurface-core/CMakeLists.txt
Normal file
81
subsurface-core/CMakeLists.txt
Normal file
|
@ -0,0 +1,81 @@
|
|||
set(PLATFORM_SRC unknown_platform.c)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(PLATFORM_SRC linux.c)
|
||||
elseif(ANDROID)
|
||||
set(PLATFORM_SRC android.cpp)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(PLATFORM_SRC macos.c)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(PLATFORM_SRC windows.c)
|
||||
endif()
|
||||
|
||||
if(FTDISUPPORT)
|
||||
set(SERIAL_FTDI serial_ftdi.c)
|
||||
endif()
|
||||
|
||||
if(BTSUPPORT)
|
||||
add_definitions(-DBT_SUPPORT)
|
||||
set(BT_SRC_FILES qt-ui/btdeviceselectiondialog.cpp)
|
||||
set(BT_CORE_SRC_FILES qtserialbluetooth.cpp)
|
||||
endif()
|
||||
|
||||
# compile the core library, in C.
|
||||
set(SUBSURFACE_CORE_LIB_SRCS
|
||||
cochran.c
|
||||
datatrak.c
|
||||
deco.c
|
||||
device.c
|
||||
dive.c
|
||||
divesite.c
|
||||
divesite.cpp
|
||||
divelist.c
|
||||
equipment.c
|
||||
file.c
|
||||
git-access.c
|
||||
libdivecomputer.c
|
||||
liquivision.c
|
||||
load-git.c
|
||||
membuffer.c
|
||||
ostctools.c
|
||||
parse-xml.c
|
||||
planner.c
|
||||
profile.c
|
||||
gaspressures.c
|
||||
worldmap-save.c
|
||||
save-git.c
|
||||
save-xml.c
|
||||
save-html.c
|
||||
sha1.c
|
||||
statistics.c
|
||||
strtod.c
|
||||
subsurfacestartup.c
|
||||
time.c
|
||||
uemis.c
|
||||
uemis-downloader.c
|
||||
version.c
|
||||
# gettextfrommoc should be added because we are using it on the c-code.
|
||||
gettextfromc.cpp
|
||||
# dirk ported some core functionality to c++.
|
||||
qthelper.cpp
|
||||
divecomputer.cpp
|
||||
exif.cpp
|
||||
subsurfacesysinfo.cpp
|
||||
devicedetails.cpp
|
||||
configuredivecomputer.cpp
|
||||
configuredivecomputerthreads.cpp
|
||||
divesitehelpers.cpp
|
||||
taxonomy.c
|
||||
checkcloudconnection.cpp
|
||||
windowtitleupdate.cpp
|
||||
divelogexportlogic.cpp
|
||||
qt-init.cpp
|
||||
qtserialbluetooth.cpp
|
||||
${SERIAL_FTDI}
|
||||
${PLATFORM_SRC}
|
||||
${BT_CORE_SRC_FILES}
|
||||
)
|
||||
source_group("Subsurface Core" FILES ${SUBSURFACE_CORE_LIB_SRCS})
|
||||
|
||||
add_library(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} )
|
||||
target_link_libraries(subsurface_corelib ${QT_LIBRARIES})
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue