diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2019-05-12 22:20:56 +0200 |
---|---|---|
committer | Cristian Adam <cristian.adam@gmail.com> | 2019-05-17 13:33:28 +0000 |
commit | d855b84c5df923394ace3bb91dab379f7e0daa34 (patch) | |
tree | e184ccdf5724151465a1653f9fc308af43293de8 /src/libs/3rdparty/syntax-highlighting | |
parent | f872a95fddd2690bb6953a17e48935c1b12d83d9 (diff) |
Qt Creator CMake port
Based on Tobias Hunger's work from a few months ago.
The CMake configuration needs libclang and Qt paths specified as
CMAKE_PREFIX_PATH.
Auto tests are run with "ctest". At the moment the pass rate is 87%.
Change-Id: Iba98e39bf22077d52706dce6c85986be67a6eab0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/3rdparty/syntax-highlighting')
-rw-r--r-- | src/libs/3rdparty/syntax-highlighting/CMakeLists.txt | 166 | ||||
-rw-r--r-- | src/libs/3rdparty/syntax-highlighting/CMakeLists.txt.kde | 134 |
2 files changed, 169 insertions, 131 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt index 49923fb26e..e849815098 100644 --- a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt @@ -1,134 +1,38 @@ -cmake_minimum_required(VERSION 3.0) - -set(KF5_VERSION "5.52.0") -project(KSyntaxHighlighting VERSION ${KF5_VERSION}) - -find_package(ECM 5.51.0 REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) -if(POLICY CMP0063) - cmake_policy(SET CMP0063 NEW) -endif() - -include(FeatureSummary) -include(GenerateExportHeader) -include(ECMSetupVersion) -include(ECMGenerateHeaders) -include(ECMGeneratePriFile) -include(CMakePackageConfigHelpers) -include(ECMPoQmTools) -include(ECMQtDeclareLoggingCategory) -include(KDEInstallDirs) -include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) -include(KDECMakeSettings) -include(ECMMarkNonGuiExecutable) -include(ECMAddQch) - - -ecm_setup_version(PROJECT - VARIABLE_PREFIX SyntaxHighlighting - VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/ksyntaxhighlighting_version.h" - PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfigVersion.cmake" +add_qtc_library(KSyntaxHighlighting STATIC + PUBLIC_INCLUDES autogenerated/ autogenerated/src/lib src/lib + PUBLIC_DEFINES KSYNTAXHIGHLIGHTING_LIBRARY + DEPENDS Qt5::Network Qt5::Gui + SOURCES + autogenerated/src/lib/ksyntaxhighlighting_logging.cpp autogenerated/src/lib/ksyntaxhighlighting_logging.h + autogenerated/ksyntaxhighlighting_version.h + + data/themes/theme-data.qrc + + src/lib/abstracthighlighter.cpp src/lib/abstracthighlighter.h src/lib/abstracthighlighter_p.h + src/lib/context.cpp src/lib/context_p.h + src/lib/contextswitch.cpp src/lib/contextswitch_p.h + src/lib/definition.cpp src/lib/definition.h + src/lib/definitiondownloader.cpp src/lib/definitiondownloader.h + src/lib/definitionref_p.h + src/lib/definition_p.h + src/lib/foldingregion.cpp src/lib/foldingregion.h + src/lib/format.cpp src/lib/format.h src/lib/format_p.h + src/lib/htmlhighlighter.cpp src/lib/htmlhighlighter.h + src/lib/keywordlist.cpp src/lib/keywordlist_p.h + src/lib/ksyntaxhighlighting_export.h + src/lib/matchresult_p.h + src/lib/repository.cpp src/lib/repository.h src/lib/repository_p.h + src/lib/rule.cpp src/lib/rule_p.h + src/lib/state.cpp src/lib/state.h src/lib/state_p.h + src/lib/syntaxhighlighter.cpp src/lib/syntaxhighlighter.h + src/lib/textstyledata_p.h + src/lib/theme.cpp src/lib/theme.h + src/lib/themedata.cpp src/lib/themedata_p.h + src/lib/wildcardmatcher.cpp src/lib/wildcardmatcher_p.h + src/lib/xml_p.h ) -# -# Dependencies -# -set(REQUIRED_QT_VERSION 5.8.0) -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.") -set_package_properties(Qt5XmlPatterns PROPERTIES PURPOSE "Compile-time validation of syntax definition files.") - -find_package(Perl REQUIRED) -set_package_properties(Perl PROPERTIES PURPOSE "Auto-generate PHP syntax definition files.") - -# -# allow to install the "differently" licensed syntax xml files instead of putting them in a QRC and link them in -# -option(QRC_SYNTAX "Bundle the syntax definition files inside the library as resources" ON) -add_feature_info(SYNTAX_RESOURCE ${QRC_SYNTAX} "Bundle the syntax definition files inside the library as resources") - -# -# allow to turn of lookup for syntax files and themes via QStandardPaths -# -option(NO_STANDARD_PATHS "Skip lookup of syntax and theme definitions in QStandardPaths locations" OFF) -add_feature_info(FEATURE_NO_STANDARD_PATHS ${NO_STANDARD_PATHS} "Skip lookup of syntax and theme definitions in QStandardPaths locations") - -# -# API documentation -# -option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) -add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") - -# -# Translations -# -if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") - ecm_install_po_files_as_qm(po) -endif() - -# tell the framework if it shall use the syntax files from the resource -if (QRC_SYNTAX) - add_definitions(-DHAS_SYNTAX_RESOURCE) -endif() - -# skip standard paths? -if (NO_STANDARD_PATHS) - add_definitions(-DNO_STANDARD_PATHS) -endif() - -# -# Actually build the stuff -# -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_subdirectory(data) -add_subdirectory(src) -if(TARGET Qt5::Gui) - add_subdirectory(examples) -endif() - -# -# CMake package config file generation -# -set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5SyntaxHighlighting") - -if (BUILD_QCH) - ecm_install_qch_export( - TARGETS KF5SyntaxHighlighting_QCH - FILE KF5SyntaxHighlightingQchTargets.cmake - DESTINATION "${CMAKECONFIG_INSTALL_DIR}" - COMPONENT Devel - ) - set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5SyntaxHighlightingQchTargets.cmake\")") -endif() - -configure_package_config_file( - "${CMAKE_CURRENT_SOURCE_DIR}/KF5SyntaxHighlightingConfig.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfig.cmake" - INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}" +install( + DIRECTORY data/ + DESTINATION "${IDE_DATA_PATH}/generic-highlighter/" ) - -install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfigVersion.cmake" - DESTINATION "${CMAKECONFIG_INSTALL_DIR}" - COMPONENT Devel) - -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}" - COMPONENT Devel) -install(FILES org_kde_ksyntaxhighlighting.categories DESTINATION ${KDE_INSTALL_CONFDIR}) - -feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt.kde b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt.kde new file mode 100644 index 0000000000..49923fb26e --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt.kde @@ -0,0 +1,134 @@ +cmake_minimum_required(VERSION 3.0) + +set(KF5_VERSION "5.52.0") +project(KSyntaxHighlighting VERSION ${KF5_VERSION}) + +find_package(ECM 5.51.0 REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +if(POLICY CMP0063) + cmake_policy(SET CMP0063 NEW) +endif() + +include(FeatureSummary) +include(GenerateExportHeader) +include(ECMSetupVersion) +include(ECMGenerateHeaders) +include(ECMGeneratePriFile) +include(CMakePackageConfigHelpers) +include(ECMPoQmTools) +include(ECMQtDeclareLoggingCategory) +include(KDEInstallDirs) +include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) +include(KDECMakeSettings) +include(ECMMarkNonGuiExecutable) +include(ECMAddQch) + + +ecm_setup_version(PROJECT + VARIABLE_PREFIX SyntaxHighlighting + VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/ksyntaxhighlighting_version.h" + PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfigVersion.cmake" +) + +# +# Dependencies +# +set(REQUIRED_QT_VERSION 5.8.0) +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.") +set_package_properties(Qt5XmlPatterns PROPERTIES PURPOSE "Compile-time validation of syntax definition files.") + +find_package(Perl REQUIRED) +set_package_properties(Perl PROPERTIES PURPOSE "Auto-generate PHP syntax definition files.") + +# +# allow to install the "differently" licensed syntax xml files instead of putting them in a QRC and link them in +# +option(QRC_SYNTAX "Bundle the syntax definition files inside the library as resources" ON) +add_feature_info(SYNTAX_RESOURCE ${QRC_SYNTAX} "Bundle the syntax definition files inside the library as resources") + +# +# allow to turn of lookup for syntax files and themes via QStandardPaths +# +option(NO_STANDARD_PATHS "Skip lookup of syntax and theme definitions in QStandardPaths locations" OFF) +add_feature_info(FEATURE_NO_STANDARD_PATHS ${NO_STANDARD_PATHS} "Skip lookup of syntax and theme definitions in QStandardPaths locations") + +# +# API documentation +# +option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) +add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") + +# +# Translations +# +if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") + ecm_install_po_files_as_qm(po) +endif() + +# tell the framework if it shall use the syntax files from the resource +if (QRC_SYNTAX) + add_definitions(-DHAS_SYNTAX_RESOURCE) +endif() + +# skip standard paths? +if (NO_STANDARD_PATHS) + add_definitions(-DNO_STANDARD_PATHS) +endif() + +# +# Actually build the stuff +# +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_subdirectory(data) +add_subdirectory(src) +if(TARGET Qt5::Gui) + add_subdirectory(examples) +endif() + +# +# CMake package config file generation +# +set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5SyntaxHighlighting") + +if (BUILD_QCH) + ecm_install_qch_export( + TARGETS KF5SyntaxHighlighting_QCH + FILE KF5SyntaxHighlightingQchTargets.cmake + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + COMPONENT Devel + ) + set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5SyntaxHighlightingQchTargets.cmake\")") +endif() + +configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/KF5SyntaxHighlightingConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfig.cmake" + INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}" +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfigVersion.cmake" + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + COMPONENT Devel) + +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}" + COMPONENT Devel) +install(FILES org_kde_ksyntaxhighlighting.categories DESTINATION ${KDE_INSTALL_CONFDIR}) + +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) |