summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <codeminister@publicstatic.de>2014-01-20 01:58:52 (GMT)
committerGregor Mi <codeminister@publicstatic.de>2014-01-20 01:58:52 (GMT)
commit277950c3e30420ab4eafe67b5d2b2042afb26307 (patch)
treeb8ea9abbb5c8bc691bf503a1f84f6f7d656eb169
parentfb399a31d4b9316922bf8fdf3b7da594ac860ffe (diff)
cmake works, but does not compile yet
-rw-r--r--CMakeLists.txt43
-rw-r--r--doc/CMakeLists.txt3
-rw-r--r--src/CMakeLists.txt25
-rw-r--r--src/KSaneImageSaver.h3
-rw-r--r--src/SaveLocation.h3
-rw-r--r--src/skanlite.h4
6 files changed, 60 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cfa3fa7..47fd4aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,13 +1,41 @@
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8.12)
project(skanlite)
-
-find_package(KDE4 REQUIRED)
-include(KDE4Defaults)
-include_directories (${KDE4_INCLUDES})
-
-find_package(KSane REQUIRED)
+# ECM setup (Extended Cmake Modules)
+find_package(ECM 0.0.9 REQUIRED NO_MODULE)
+# ECM setup2 and include find same cmake module (copied from /usr/share/kde4/apps/cmake/modules/FindSane.cmake)
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake-modules)
+
+include(FeatureSummary)
+include(ECMSetupVersion) # yiels ecm_setup_version
+include(ECMGenerateHeaders)
+include(CMakePackageConfigHelpers)
+include(CheckFunctionExists)
+include(KDEInstallDirs) # yields ${XDG_APPS_INSTALL_DIR}
+include(KDEFrameworkCompilerSettings)
+include(KDECMakeSettings)
+include(GenerateExportHeader)
+
+find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core Widgets)
+
+find_package(KF5 ${KF5_VERSION} REQUIRED
+ COMPONENTS # alias to find_package(KFGuiAddons ${KF5_VERSION} REQUIRED)
+ GuiAddons
+ DocTools # yields kdoctools_create_handbook
+ Sane # will find KF5Sane
+)
+
+set(KF5_VERSION "5.0.0")
+
+ecm_setup_version(
+ ${KF5_VERSION}
+ VARIABLE_PREFIX SKANLITE
+ VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/skanlite_version.h"
+ PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/src/version.h.cmake"
+)
+
+message(STATUS "KSANE_FOUND=${KSANE_FOUND}, KSANE_INCLUDE_DIR=${KSANE_INCLUDE_DIR}")
find_package(PNG REQUIRED)
set(SKANLITE_VERSION_MAJOR "1")
@@ -16,7 +44,6 @@ set(SKANLITE_VERSION_STRING "${SKANLITE_VERSION_MAJOR}.${SKANLITE_VERSION_MINOR}
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/version.h)
-
add_subdirectory(src)
add_subdirectory(doc)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index adce41e..7ce3faf 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,3 +1,2 @@
-########### install files ###############
#
-kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR skanlite)
+kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR skanlite)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e08dc83..1824429 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,14 +1,25 @@
-include_directories(${KSANE_INCLUDE_DIR})
-
set(skanlite_SRCS main.cpp skanlite.cpp ImageViewer.cpp KSaneImageSaver.cpp SaveLocation.cpp)
-kde4_add_ui_files(skanlite_SRCS settings.ui SaveLocation.ui)
+qt5_wrap_ui(skanlite_SRCS settings.ui SaveLocation.ui)
-kde4_add_app_icon(skanlite_SRCS "${KDE4_INSTALL_DIR}/share/icons/oxygen/*/devices/scanner.png")
+#kde4_add_app_icon(skanlite_SRCS "${KDE4_INSTALL_DIR}/share/icons/oxygen/*/devices/scanner.png")
-kde4_add_executable(skanlite ${skanlite_SRCS})
+add_executable(skanlite ${skanlite_SRCS})
-target_link_libraries(skanlite ${KDE4_KIO_LIBS} ${KSANE_LIBRARY} ${PNG_LIBRARY})
+target_link_libraries(skanlite
+ PUBLIC
+ Qt5::Core
+ PRIVATE
+ # KF5::CoreAddons
+ # Other private libs
+ KF5::Sane
+ KF5::I18n
+ KF5::PrintUtils
+ KF5::Wallet
+ KF5::WidgetsAddons
+ ${PNG_LIBRARY}
+)
install(TARGETS skanlite ${INSTALL_TARGETS_DEFAULT_ARGS})
-install( PROGRAMS skanlite.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
+message(STATUS "XDG_APPS_INSTALL_DIR=${XDG_APPS_INSTALL_DIR}")
+install(PROGRAMS skanlite.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
diff --git a/src/KSaneImageSaver.h b/src/KSaneImageSaver.h
index 53e4f96..658b257 100644
--- a/src/KSaneImageSaver.h
+++ b/src/KSaneImageSaver.h
@@ -3,6 +3,7 @@
* Description : Image saver class for libksane image data.
*
* Copyright (C) 2010-2012 by Kåre Särs <kare.sars@iki .fi>
+* Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -25,7 +26,7 @@
#ifndef KSaneImageSaver_h
#define KSaneImageSaver_h
-#include <libksane/ksane.h>
+#include "ksane.h"
#include <QThread>
diff --git a/src/SaveLocation.h b/src/SaveLocation.h
index 6043b4b..e6da055 100644
--- a/src/SaveLocation.h
+++ b/src/SaveLocation.h
@@ -3,6 +3,7 @@
* Description : Save location settings dialog.
*
* Copyright (C) 2008-2012 by Kåre Särs <kare.sars@iki .fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -27,8 +28,6 @@
#include "ui_SaveLocation.h"
-#include <KUrl>
-
#include <KDialog>
class SaveLocation : public KDialog, public Ui_SaveLocation
diff --git a/src/skanlite.h b/src/skanlite.h
index aae31cc..9ada13f 100644
--- a/src/skanlite.h
+++ b/src/skanlite.h
@@ -1,6 +1,7 @@
/* ============================================================
*
* Copyright (C) 2007-2012 by Kåre Särs <kare.sars@iki .fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -23,9 +24,10 @@
#ifndef Skanlite_h
#define Skanlite_h
-#include <libksane/ksane.h>
#include <QDir>
+#include <KSane/ksane.h>
+
#include "ui_settings.h"
#include "ImageViewer.h"