Add KSyntaxHighlighting recipe

Reviewers: cordlandwehr

Reviewed By: cordlandwehr

Differential Revision: https://phabricator.kde.org/D7104
This commit is contained in:
Volker Krause
2017-08-03 20:23:50 +02:00
parent 923d0f6d5c
commit 081b0f4982
4 changed files with 135 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
DESCRIPTION = "KSyntaxHighlighting"
HOMEPAGE = "https://api.kde.org/frameworks/syntax-highlighting/html/index.html"
LICENSE = "LGPL-2.1"
LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1"
PR = "r0"
DEPENDS = "qtbase ksyntaxhighlighting-native"
SRC_URI = " \
git://anongit.kde.org/syntax-highlighting;nobranch=1 \
file://0001-cross-compilation-support.patch \
file://0002-no-gui.patch \
"
S = "${WORKDIR}/git"
inherit cmake_kf5
inherit perlnative
EXTRA_OECMAKE_class-native += " -DKSYNTAXHIGHLIGHTING_USE_GUI=OFF"
EXTRA_OECMAKE_class-target += " -DKATEHIGHLIGHTINGINDEXER=${STAGING_DIR_NATIVE}/usr/bin/katehighlightingindexer"
sysroot_stage_all_append_class-native () {
mkdir -p ${SYSROOT_DESTDIR}/${bindir}
cp ${B}/src/indexer/katehighlightingindexer ${SYSROOT_DESTDIR}/${bindir}
}

View File

@@ -0,0 +1,35 @@
commit de7828ae46f6feb9a219e9b1444e1d7e32bd94ac
Author: Volker Krause <vkrause@kde.org>
Date: Thu Aug 3 19:47:59 2017 +0200
Add cross-compilation support for the highlighting indexer
Reviewers: #frameworks
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D7102
diff --git a/src/indexer/CMakeLists.txt b/src/indexer/CMakeLists.txt
index a2c7ef7..acb1647 100644
--- a/src/indexer/CMakeLists.txt
+++ b/src/indexer/CMakeLists.txt
@@ -1,7 +1,13 @@
-add_executable(katehighlightingindexer katehighlightingindexer.cpp)
-
-if(Qt5XmlPatterns_FOUND)
- target_link_libraries(katehighlightingindexer Qt5::XmlPatterns)
+if(CMAKE_CROSSCOMPILING AND KATEHIGHLIGHTINGINDEXER_EXECUTABLE)
+ # cross build, we need the indexer supplied externally
+ add_executable(katehighlightingindexer IMPORTED GLOBAL)
+ set_target_properties(katehighlightingindexer PROPERTIES IMPORTED_LOCATION ${KATEHIGHLIGHTINGINDEXER_EXECUTABLE})
else()
- target_link_libraries(katehighlightingindexer Qt5::Core)
+ # host build
+ add_executable(katehighlightingindexer katehighlightingindexer.cpp)
+ if(Qt5XmlPatterns_FOUND)
+ target_link_libraries(katehighlightingindexer Qt5::XmlPatterns)
+ else()
+ target_link_libraries(katehighlightingindexer Qt5::Core)
+ endif()
endif()

View File

@@ -0,0 +1,73 @@
commit 60ea773130332471311f4e5193eed77162cfee2b
Author: Volker Krause <vkrause@kde.org>
Date: Thu Aug 3 19:53:11 2017 +0200
Allow to build KSyntaxHighlighter without Qt5Gui
Summary:
This actually only builds the indexer, which is useful for
cross-compilation. With Yocto this avoids pulling in a full
graphics stack for the host build.
Reviewers: #frameworks
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D7103
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bd2130..b9c90d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,7 +34,11 @@ ecm_setup_version(PROJECT
# Dependencies
#
set(REQUIRED_QT_VERSION "5.6.0")
-find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Core Gui Network Test)
+find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Core Network Test)
+option(KSYNTAXHIGHLIGHTING_USE_GUI "Build components depending on Qt5Gui" ON)
+if(KSYNTAXHIGHLIGHTING_USE_GUI)
+ find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Gui)
+endif()
find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE QUIET OPTIONAL_COMPONENTS Widgets XmlPatterns)
set_package_properties(Qt5 PROPERTIES URL "http://qt-project.org/")
set_package_properties(Qt5Widgets PROPERTIES PURPOSE "Example application.")
@@ -63,8 +67,10 @@ endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(data)
add_subdirectory(src)
-add_subdirectory(examples)
-add_subdirectory(autotests)
+if(TARGET Qt5::Gui)
+ add_subdirectory(examples)
+ add_subdirectory(autotests)
+endif()
#
# CMake package config file generation
@@ -93,10 +99,12 @@ install(FILES
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel)
-install(EXPORT KF5SyntaxHighlightingTargets
+if(TARGET KF5SyntaxHighlighting)
+ install(EXPORT KF5SyntaxHighlightingTargets
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
FILE KF5SyntaxHighlightingTargets.cmake
NAMESPACE KF5::)
+endif()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ksyntaxhighlighting_version.h"
DESTINATION "${KDE_INSTALL_INCLUDEDIR_KF5}"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f9faade..b882025 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,3 +1,5 @@
add_subdirectory(indexer)
-add_subdirectory(lib)
-add_subdirectory(cli)
+if(TARGET Qt5::Gui)
+ add_subdirectory(lib)
+ add_subdirectory(cli)
+endif()

View File

@@ -0,0 +1,2 @@
require ${PN}.inc
SRCREV = "v${PV}"