two patches that goes on top of the last three ones:

1 - list of files insteaf of grepping to *.c
2 - specify the libdcdevel path


On Mon, Apr 14, 2014 at 2:35 PM, Tomaz Canabrava <tcanabr...@kde.org> wrote:

> Second try, with dirk's input on IRC.
>
>
> On Mon, Apr 14, 2014 at 1:46 PM, Tomaz Canabrava <tcanabr...@kde.org>wrote:
>
>>
>> So -
>> CMake has a testing framework called CTest that can generate html reports
>> and it's easy to integrate a new test on it. I created this in cmake *only*
>> because it was what I had used before, tried to learn the docs for qmake +
>> tests and it was a bit frustrating / hard to do.
>>
>>
>> what this does right now:
>> 1 - compiles subsurface in small libraries
>> ( core, ui, profile )
>> 2 - compiles tests that are linked to those libraries
>> 3 - run tests by running 'make test'
>>
>> make test will run
>> a few tests are failing, even using IS_FP_SAME, and the plan is to
>> increase the amount
>> of code tested to 100% over time ( we can also include the gcov tool to
>> get the percent of code that is tested. )
>>
>> Tomaz
>>
>>
>
From 25cee82af87832810033a3be44721c3dafefffde Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Mon, 14 Apr 2014 16:48:12 -0300
Subject: [PATCH 5/5] Add the option to specify the LIBDCDEVEL path.

Use cmake .. -DLIBDCDEVEL="../your/library" to specify
where the libdc is, or leave it blank if you have it
installed on the system. you can change the location later
by running ccmake.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 CMakeLists.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94de131..0d2d4d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,13 @@ pkg_config_library(LIBSQLITE3 sqlite3)
 pkg_config_library(LIBGIT2 libgit2)
 pkg_config_library(LIBXSLT libxslt)
 
+SET(LIBDCDEVEL "" CACHE STRING "libraries")
+IF(NOT (LIBDCDEVEL STREQUAL ""))
+	cmake_policy(SET CMP0015 OLD)
+	include_directories(${LIBDCDEVEL}/include )
+	link_directories(${LIBDCDEVEL}/lib)
+ENDIF()
+
 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)
-- 
1.9.2

From a48b7188c66d1b553bfad2c0ff5622213e1db0b9 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Mon, 14 Apr 2014 16:47:12 -0300
Subject: [PATCH 4/5] Use a list of files instead of filtering for *.c

While filtering for *.c / *.cpp is much smaller, it has the
disvantage of getting garbage on some computers as the devs
tends to create test files around.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 CMakeLists.txt | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 81 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35fc9ee..94de131 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 2.8)
 
 #options
 SET(SUBSURFACE_QT_VERSION "4")
+
 SET(CMAKE_AUTOMOC ON)
 SET(CMAKE_AUTOUIC ON)
 SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/marbledata)
@@ -68,21 +69,88 @@ ADD_CUSTOM_TARGET(version ALL COMMAND
 )
 
 # compile the core library, in C.
-FILE(GLOB SUBSURFACE_CORE_LIB_SRCS *.c)
-LIST(REMOVE_ITEM SUBSURFACE_CORE_LIB_SRCS
-	${CMAKE_CURRENT_SOURCE_DIR}/windows.c
-	${CMAKE_CURRENT_SOURCE_DIR}/macos.c
-	${CMAKE_CURRENT_SOURCE_DIR}/cochran.c
+SET(SUBSURFACE_CORE_LIB_SRCS
+	deco.c
+	device.c
+	dive.c
+	divelist.c
+	equipment.c
+	file.c
+	libdivecomputer.c
+	load-git.c
+	membuffer.c
+	parse-xml.c
+	planner.c
+	profile.c
+	worldmap-save.c
+	save-git.c
+	save-xml.c
+	sha1.c
+	statistics.c
+	strtod.c
+	subsurfacestartup.c
+	time.c
+	uemis.c
+	uemis-downloader.c
+	linux.c
 )
 
-FILE(GLOB SUBSURFACE_PROFILE_LIB_SRCS qt-ui/profile/*.cpp)
-FILE(GLOB SUBSURFACE_UI qt-ui/*.ui)
-FILE(GLOB SUBSURFACE_INTERFACE qt-ui/*.cpp)
-FILE(GLOB SUBSURFACE_APP *.cpp )
-IF(NOT (CMAKE_SYSTEM_NAME MATCHES Android))
-	LIST(REMOVE_ITEM SUBSURFACE_APP ${CMAKE_CURRENT_SOURCE_DIR}/android.cpp)
-ENDIF()
+#the interface, in C++
+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
+	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
+	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/exif.cpp
+	qt-ui/divelogimportdialog.cpp
+	qt-ui/tagwidget.cpp
+	qt-ui/groupedlineedit.cpp
+	qt-ui/usermanual.cpp
+)
 
+#the profile widget
+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
+)
+
+#the main app.
+SET(SUBSURFACE_APP
+	main.cpp
+	gettextfromc.cpp
+	qt-gui.cpp
+	qthelper.cpp
+)
+
+FILE(GLOB SUBSURFACE_UI qt-ui/*.ui)
 # to be replaced by QT_WRAP_UI on CMake 3.
 IF(${SUBSURFACE_QT_VERSION} MATCHES "4")
     QT4_WRAP_UI( SUBSURFACE_UI_HDRS ${SUBSURFACE_UI} )
@@ -112,6 +180,7 @@ target_link_libraries( subsurface
 ADD_DEPENDENCIES(subsurface_profile subsurface_generated_ui)
 ADD_DEPENDENCIES(subsurface_interface subsurface_generated_ui)
 ADD_DEPENDENCIES(subsurface_generated_ui version)
+ADD_DEPENDENCIES(subsurface_corelib version)
 
 ENABLE_TESTING()
 ADD_EXECUTABLE( TestUnitConversion tests/testunitconversion.cpp )
-- 
1.9.2

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to