diff --git a/CMakeLists.txt b/CMakeLists.txt index 27011890f4..cac414e27e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,173 +1,183 @@ cmake_minimum_required(VERSION 3.0) project(KDevelop) # KDevelop version set(KDEVELOP_VERSION_MAJOR 5) set(KDEVELOP_VERSION_MINOR 1) set(KDEVELOP_VERSION_PATCH 40) set( KDEVELOP_VERSION "${KDEVELOP_VERSION_MAJOR}.${KDEVELOP_VERSION_MINOR}.${KDEVELOP_VERSION_PATCH}" ) +set(KDevPlatform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/kdevplatform) +set(KDevPlatform_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/kdevplatform) + # plugin versions listed in the .desktop files set(KDEV_PLUGIN_VERSION 29) # we need some parts of the ECM CMake helpers find_package (ECM 5.14.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${KDevelop_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) include(KDECompilerSettings NO_POLICY_SCOPE) # needs to be first, as set policies influence following macros include(ECMOptionalAddSubdirectory) include(ECMInstallIcons) include(ECMAddAppIcon) include(ECMSetupVersion) include(ECMAddTests) include(ECMMarkNonGuiExecutable) include(ECMGenerateHeaders) include(ECMQtDeclareLoggingCategory) include(GenerateExportHeader) include(CMakePackageConfigHelpers) include(FeatureSummary) include(WriteBasicConfigVersionFile) include(CheckFunctionExists) include(KDEInstallDirs) include(KDECMakeSettings) set(QT_MIN_VERSION "5.5.0") find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Widgets Concurrent Quick QuickWidgets) if(BUILD_TESTING) find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED) endif() set(KF5_DEP_VERSION "5.15.0") # we need KCrash::initialize find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS Config Declarative DocTools IconThemes I18n ItemModels ItemViews JobWidgets KCMUtils KIO NewStuff NotifyConfig Parts Service TextEditor ThreadWeaver XmlGui WindowSystem Crash GuiAddons Archive Notifications ) find_package(KF5SysGuard CONFIG) set_package_properties(KF5SysGuard PROPERTIES PURPOSE "Framework for process listing. Required for the 'Attach to Process' feature" ) find_package(KDevelop-PG-Qt 1.90.90 CONFIG) set_package_properties(KDevelop-PG-Qt PROPERTIES PURPOSE "KDevelop parser generator library. Required for the QMake Builder/Manager plugin." ) find_package(SharedMimeInfo REQUIRED) add_definitions( -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050400 -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS ) function(add_compile_flag_if_supported _flag) unset(_have_flag CACHE) string(REGEX REPLACE "[-=]" "_" _varname ${_flag}) string(TOUPPER ${_varname} _varname) set(_varname "HAVE${_varname}") check_cxx_compiler_flag("${_flag}" "${_varname}") if (${${_varname}}) add_compile_options(${_flag}) endif() endfunction() # Turn off missing-field-initializers warning for GCC to avoid noise from false positives with empty {} # See discussion: http://mail.kde.org/pipermail/kdevelop-devel/2014-February/046910.html add_compile_flag_if_supported(-Wno-missing-field-initializers) add_compile_flag_if_supported(-Werror=undefined-bool-conversion) add_compile_flag_if_supported(-Werror=tautological-undefined-compare) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_flag_if_supported(-Wdocumentation) # This warning is triggered by every call to qCDebug() add_compile_flag_if_supported(-Wno-gnu-zero-variadic-macro-arguments) endif() if (CMAKE_COMPILER_CXX_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_flag_if_supported(-pedantic) endif() -include_directories(${KDevelop_SOURCE_DIR} ${KDevelop_BINARY_DIR}) +include_directories( + ${KDevPlatform_SOURCE_DIR} + ${KDevPlatform_SOURCE_DIR}/plugins + ${KDevPlatform_BINARY_DIR} + + ${KDevelop_SOURCE_DIR} + ${KDevelop_BINARY_DIR} +) string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug" OR CMAKE_BUILD_TYPE_TOLOWER STREQUAL "") set(COMPILER_OPTIMIZATIONS_DISABLED TRUE) else() set(COMPILER_OPTIMIZATIONS_DISABLED FALSE) endif() # create config.h configure_file (config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) add_subdirectory(kdevplatform) add_subdirectory(pics) add_subdirectory(app) add_subdirectory(analyzers) add_subdirectory(formatters) add_subdirectory(languages) add_subdirectory(projectbuilders) add_subdirectory(projectmanagers) add_subdirectory(debuggers) add_subdirectory(app_templates) add_subdirectory(documentation) add_subdirectory(kdeintegration) add_subdirectory(utils) add_subdirectory(file_templates) add_subdirectory(providers) add_subdirectory(runtimes) add_subdirectory(shortcuts) add_subdirectory(doc) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KDevelop") configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KDevelopConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) ecm_setup_version(${KDEVELOP_VERSION_MAJOR}.${KDEVELOP_VERSION_MINOR}.${KDEVELOP_VERSION_PATCH} VARIABLE_PREFIX KDEVELOP VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdevelop_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfigVersion.cmake" SOVERSION ${KDEVELOP_LIB_SOVERSION} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kdevelop_version.h" DESTINATION "${KDE_INSTALL_INCLUDEDIR}/kdevelop") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" ) install(EXPORT KDevelopTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" NAMESPACE KDev:: FILE KDevelopTargets.cmake) # kdebugsettings file install(FILES kdevelop.categories DESTINATION ${KDE_INSTALL_CONFDIR}) # CTestCustom.cmake has to be in the CTEST_BINARY_DIR. # in the KDE build system, this is the same as CMAKE_BINARY_DIR. configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake) install(FILES org.kde.kdevelop.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/kdevplatform/CMakeLists.txt b/kdevplatform/CMakeLists.txt index a3bc0e0135..ecb8bd7d79 100644 --- a/kdevplatform/CMakeLists.txt +++ b/kdevplatform/CMakeLists.txt @@ -1,96 +1,92 @@ # kdevplatform version set(KDEVPLATFORM_VERSION_MAJOR 5) set(KDEVPLATFORM_VERSION_MINOR 1) set(KDEVPLATFORM_VERSION_PATCH 40) set(KDEVPLATFORM_VERSION "${KDEVPLATFORM_VERSION_MAJOR}.${KDEVPLATFORM_VERSION_MINOR}.${KDEVPLATFORM_VERSION_PATCH}") # Increase this to reset incompatible item-repositories set(KDEV_ITEMREPOSITORY_VERSION 87) # library version / SO version set(KDEVPLATFORM_LIB_SOVERSION 10) -set(KDevPlatform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(KDevPlatform_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_MODULE_PATH ${KDevPlatform_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) include(KDevPlatformMacros) find_package(Grantlee5 CONFIG) set_package_properties(Grantlee5 PROPERTIES PURPOSE "Grantlee templating library, needed for file templates" URL "http://www.grantlee.org/" TYPE RECOMMENDED) set(Boost_ADDITIONAL_VERSIONS 1.39.0 1.39) find_package(Boost 1.35.0) set_package_properties(Boost PROPERTIES PURPOSE "Boost libraries for enabling the classbrowser" URL "http://www.boost.org" TYPE REQUIRED) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config-kdevplatform.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdevplatform.h ) -include_directories(${KDevPlatform_SOURCE_DIR} ${KDevPlatform_BINARY_DIR}) - string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug" OR CMAKE_BUILD_TYPE_TOLOWER STREQUAL "") set(COMPILER_OPTIMIZATIONS_DISABLED TRUE) else() set(COMPILER_OPTIMIZATIONS_DISABLED FALSE) endif() add_subdirectory(sublime) add_subdirectory(interfaces) add_subdirectory(project) add_subdirectory(language) add_subdirectory(shell) add_subdirectory(util) add_subdirectory(outputview) add_subdirectory(vcs) add_subdirectory(pics) add_subdirectory(debugger) add_subdirectory(documentation) add_subdirectory(serialization) add_subdirectory(template) if(BUILD_TESTING) add_subdirectory(tests) endif() add_subdirectory(plugins) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KDevPlatform") configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KDevPlatformConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KDevPlatformConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) ecm_setup_version(${KDEVPLATFORM_VERSION_MAJOR}.${KDEVPLATFORM_VERSION_MINOR}.${KDEVPLATFORM_VERSION_PATCH} VARIABLE_PREFIX KDEVPLATFORM VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdevplatform_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDevPlatformConfigVersion.cmake" SOVERSION ${KDEVPLATFORM_LIB_SOVERSION}) install( FILES "${KDevPlatform_BINARY_DIR}/kdevplatform_version.h" "${KDevPlatform_BINARY_DIR}/config-kdevplatform.h" DESTINATION "${KDE_INSTALL_INCLUDEDIR}/kdevplatform" ) install( FILES "${KDevPlatform_BINARY_DIR}/KDevPlatformConfig.cmake" "${KDevPlatform_BINARY_DIR}/KDevPlatformConfigVersion.cmake" cmake/modules/KDevPlatformMacros.cmake DESTINATION "${CMAKECONFIG_INSTALL_DIR}" ) install( EXPORT KDevPlatformTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" NAMESPACE KDev:: FILE KDevPlatformTargets.cmake ) # kdebugsettings file install( FILES kdevplatform.categories DESTINATION ${KDE_INSTALL_CONFDIR} ) # CTestCustom.cmake has to be in the CTEST_BINARY_DIR. # in the KDE build system, this is the same as CMAKE_BINARY_DIR. configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake) diff --git a/kdevplatform/cmake/modules/KDevPlatformMacros.cmake b/kdevplatform/cmake/modules/KDevPlatformMacros.cmake index 7fec0a7b6c..5b692cb19d 100644 --- a/kdevplatform/cmake/modules/KDevPlatformMacros.cmake +++ b/kdevplatform/cmake/modules/KDevPlatformMacros.cmake @@ -1,174 +1,167 @@ # # KDevelop Platform Macros # # The following macros are defined here: # # KDEVPLATFORM_ADD_APP_TEMPLATES( template1 ... templateN ) # Use this to get packaged template archives for the given app templates. # Parameters should be the directories containing the templates. # KDEVPLATFORM_ADD_FILE_TEMPLATES( template1 ... templateN ) # Use this to get packaged template archives for the given file templates. # Parameters should be the directories containing the templates. # # Copyright 2007 Andreas Pakulat # Redistribution and use is allowed according to the terms of the BSD license. include(CMakeParseArguments) # creates a template archive from the given directory macro(kdevplatform_create_template_archive _templateName) get_filename_component(_tmp_file ${_templateName} ABSOLUTE) get_filename_component(_baseName ${_tmp_file} NAME_WE) set(_template ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.tar.bz2) file(GLOB _files "${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*") set(_deps) foreach(_file ${_files}) get_filename_component(_fileName ${_file} NAME) string(COMPARE NOTEQUAL ${_fileName} .kdev_ignore _v1) string(REGEX MATCH "\\.svn" _v2 ${_fileName} ) if(WIN32) string(REGEX MATCH "_svn" _v3 ${_fileName} ) else() set(_v3 FALSE) endif() if ( _v1 AND NOT _v2 AND NOT _v3 ) set(_deps ${_deps} ${_file}) endif ( _v1 AND NOT _v2 AND NOT _v3 ) endforeach(_file) list(SORT _deps) add_custom_target(${_baseName} ALL DEPENDS ${_template}) if(WIN32) add_custom_command(OUTPUT ${_template} COMMAND ${CMAKE_COMMAND} -E tar ARGS cfvz ${_template} -- ${_deps} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} DEPENDS ${_deps} ) else() if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") add_custom_command(OUTPUT ${_template} COMMAND tar ARGS -c -C ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} --exclude .kdev_ignore --exclude .svn --numeric-owner -j -f ${_template} . DEPENDS ${_deps} ) else() add_custom_command(OUTPUT ${_template} COMMAND tar ARGS -c -C ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} --exclude .kdev_ignore --exclude .svn --mode=go=rX,u+rw,a-s --owner=root --group=root --numeric-owner -j -f ${_template} . DEPENDS ${_deps} ) endif() endif() endmacro(kdevplatform_create_template_archive _templateName) # package and install the given directory as a template archive macro(kdevplatform_add_template _installDirectory _templateName) kdevplatform_create_template_archive(${_templateName}) get_filename_component(_tmp_file ${_templateName} ABSOLUTE) get_filename_component(_baseName ${_tmp_file} NAME_WE) set(_template ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.tar.bz2) install( FILES ${_template} DESTINATION ${_installDirectory}) GET_DIRECTORY_PROPERTY(_tmp_DIR_PROPS ADDITIONAL_MAKE_CLEAN_FILES ) list(APPEND _tmp_DIR_PROPS ${_template}) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${_tmp_DIR_PROPS}") endmacro(kdevplatform_add_template _installDirectory _templateName) macro(kdevplatform_add_app_templates _templateNames) foreach(_templateName ${ARGV}) kdevplatform_add_template(${KDE_INSTALL_DATADIR}/kdevappwizard/templates ${_templateName}) endforeach(_templateName ${ARGV}) endmacro(kdevplatform_add_app_templates _templateNames) macro(kdevplatform_add_file_templates _templateNames) foreach(_templateName ${ARGV}) kdevplatform_add_template(${KDE_INSTALL_DATADIR}/kdevfiletemplates/templates ${_templateName}) endforeach(_templateName ${ARGV}) endmacro(kdevplatform_add_file_templates _templateNames) function(kdevplatform_add_library target) set(options) set(oneValueArgs) set(multiValueArgs SOURCES) cmake_parse_arguments(KDEV_ADD_LIBRARY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) string(REPLACE "KDevPlatform" "" shortTargetName ${target}) if (${shortTargetName} STREQUAL ${target}) message(FATAL_ERROR "Target passed to kdevplatform_add_library needs to start with \"KDevPlatform\", was \"${target}\"") endif() string(TOLOWER ${shortTargetName} shortTargetNameToLower) add_library(${target} ${KDEV_ADD_LIBRARY_SOURCES}) add_library(KDev::${shortTargetName} ALIAS ${target}) generate_export_header(${target} EXPORT_FILE_NAME ${shortTargetNameToLower}export.h) - target_include_directories(${target} - INTERFACE "$" - "$" "$" - "$" # useful for the "something.export.h" includes - ) - #some plugins install interfaces such as execute/iexecuteplugin.h - target_include_directories(${target} INTERFACE - "$" "$" ) + target_include_directories(${target} INTERFACE "$") set_target_properties(${target} PROPERTIES VERSION ${KDEVPLATFORM_VERSION} SOVERSION ${KDEVPLATFORM_LIB_SOVERSION} EXPORT_NAME ${shortTargetName} ) install(TARGETS ${target} EXPORT KDevPlatformTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${shortTargetNameToLower}export.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/${shortTargetNameToLower} COMPONENT Devel) endfunction() function(kdevplatform_add_plugin plugin) set(options SKIP_INSTALL) set(oneValueArgs JSON) set(multiValueArgs SOURCES) cmake_parse_arguments(KDEV_ADD_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) get_filename_component(json "${KDEV_ADD_PLUGIN_JSON}" REALPATH) list(LENGTH KDEV_ADD_PLUGIN_SOURCES src_count) if (NOT ${src_count} GREATER 0) message(FATAL_ERROR "kdevplatform_add_plugin() called without passing any source files. Please use the SOURCES parameter.") endif() # ensure we recompile the corresponding object files when the json file changes set(dependent_sources ) foreach(source ${KDEV_ADD_PLUGIN_SOURCES}) get_filename_component(source "${source}" REALPATH) if(EXISTS "${source}") file(STRINGS "${source}" match REGEX "K_PLUGIN_FACTORY_WITH_JSON") if(match) list(APPEND dependent_sources "${source}") endif() endif() endforeach() if(NOT dependent_sources) # fallback to all sources - better safe than sorry... set(dependent_sources ${KDEV_ADD_PLUGIN_SOURCES}) endif() set_property(SOURCE ${dependent_sources} APPEND PROPERTY OBJECT_DEPENDS ${json}) add_library(${plugin} MODULE ${KDEV_ADD_PLUGIN_SOURCES}) set_property(TARGET ${plugin} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS ${json}) if (NOT KDEV_ADD_PLUGIN_SKIP_INSTALL) install(TARGETS ${plugin} DESTINATION ${KDE_INSTALL_PLUGINDIR}/kdevplatform/${KDEV_PLUGIN_VERSION}) endif() endfunction()