summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-09-02 20:52:34 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-30 10:36:48 -0700
commit4c0156e3d51b389db8eccc3fa3da4b8f248f9b13 (patch)
tree966868d29150fdba13a5a56fb4305bc432ec7a72 /CMakeLists.txt
parenta0798214231c652ac6142228f5ddfc4b65c921f8 (diff)
downloadsubsurface-4c0156e3d51b389db8eccc3fa3da4b8f248f9b13.tar.gz
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>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt81
1 files changed, 10 insertions, 71 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba6544210..0a14db6de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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()