diff --git a/CMakeLists.txt b/CMakeLists.txt index b6eea00..bdc397c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,48 +1,80 @@ +cmake_minimum_required(VERSION 3.0.0) + project(kdevkernel) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(AUTOMOC ON) -find_package(KDE4 4.7.0 REQUIRED) -find_package(KDevPlatform 1.2.60 REQUIRED) +find_package(ECM REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(MIN_KDEV_VERSION "5.1.80") +set(MIN_QT_VER "5.5.0") +set(MIN_KF_VER "5.15.0") + +#Find what is the prefix of the KDevelop installation +set(KDevelop_Include_DIR "include/kdevelop") +find_path(KDevelop_PREFIX ${KDevelop_Include_DIR}) +set(KDevelop_Include_Full_DIR ${KDevelop_PREFIX}/${KDevelop_Include_DIR}) +message(STATUS "KDevelop headers : " ${KDevelop_Include_Full_DIR}) + +set(KDevPlatform_Include_DIR "include/kdevplatform") +set(KDevPlatform_Include_Full_DIR ${KDevelop_PREFIX}/${KDevPlatform_Include_DIR}) +message(STATUS "KDevPlatform headers : " ${KDevPlatform_Include_Full_DIR}) + +include(KDECompilerSettings NO_POLICY_SCOPE) +include(ECMAddTests) +include(KDEInstallDirs) +include(KDECMakeSettings) +include(FeatureSummary) + +find_package(Qt5 ${MIN_QT_VER} CONFIG REQUIRED Core Gui Widgets Test) +find_package(KF5 ${MIN_KF_VER} REQUIRED COMPONENTS ItemModels TextEditor) +find_package(KDevelop ${MIN_KDEV_VERSION} REQUIRED) +find_package(KDevPlatform ${MIN_KDEV_VERSION} REQUIRED CONFIG) include_directories( - ${KDE4_INCLUDES} - ${KDEVPLATFORM_INCLUDE_DIR} - ${KDEVPLATFORM_INCLUDE_DIR}/../kdevelop + ${KDevPlatform_Include_Full_DIR} + ${KDevelop_Include_Full_DIR} + ${KDevPlatform_DIR} + ${KDevelop_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} - ${CMAKE_PREFIX_PATH}/include/kdevelop ) set(kdevkernel_plugin_SRCS kdevkernelplugin.cpp ) -kde4_add_plugin(kdevkernel +kdevplatform_add_plugin(kdevkernel SOURCES ${kdevkernel_plugin_SRCS}) target_link_libraries(kdevkernel - ${KDEVPLATFORM_PROJECT_LIBRARIES} - ${KDEVPLATFORM_INTERFACES_LIBRARIES} - ${KDEVPLATFORM_UTIL_LIBRARIES} - ${KDEVPLATFORM_OUTPUTVIEW_LIBRARIES} + KDev::Interfaces + KDev::Project + KDev::OutputView + KDev::Util ) -set (kdevkernel_kcm_SRCS - kcm_kdevkernel.cpp - kdevkernelconfigwidget.cpp -) +#set (kdevkernel_kcm_SRCS +# kcm_kdevkernel.cpp +# kdevkernelconfigwidget.cpp +#) -kde4_add_ui_files(kdevkernel_kcm_SRCS kdevkernelconfigwidget.ui) -kde4_add_kcfg_files(kdevkernel_kcm_SRCS kcfg_kdevkernelconfig.kcfgc) -kde4_add_plugin(kcm_kdevkernel ${kdevkernel_kcm_SRCS}) -target_link_libraries(kcm_kdevkernel ${KDE4_KIO_LIBS} ${KDEVPLATFORM_INTERFACES_LIBRARIES} ${KDEVPLATFORM_LANGUAGE_LIBRARIES} ${KDEVPLATFORM_PROJECT_LIBRARIES} ${KDEVPLATFORM_UTIL_LIBRARIES}) +#ki18n_wrap_ui(kdevkernel_kcm_SRCS kdevkernelconfigwidget.ui) +#kconfig_add_kcfg_files(kdevkernel_kcm_SRCS kcfg_kdevkernelconfig.kcfgc) +#kdevplatform_add_plugin(kcm_kdevkernel SOURCES ${kdevkernel_kcm_SRCS}) +#target_link_libraries(kcm_kdevkernel KF5::KIOCore +# KDev::Interfaces +# KDev::Project +# KDev::Language +# KDev::Util +# ) -install( - TARGETS kdevkernel - kcm_kdevkernel - DESTINATION ${PLUGIN_INSTALL_DIR} -) +#install( +# TARGETS kdevkernel +# kcm_kdevkernel +# DESTINATION ${PLUGIN_INSTALL_DIR} +#) install( FILES kdevkernel.desktop @@ -51,3 +83,4 @@ install( ) add_subdirectory(icons) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) \ No newline at end of file diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index 1cc0772..81eaeab 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -1,2 +1 @@ -kde4_install_icons(${ICON_INSTALL_DIR}) - +#ecm_install_icons(${ICON_INSTALL_DIR}) \ No newline at end of file diff --git a/kcm_kdevkernel.h b/kcm_kdevkernel.h index b7dc545..4d486ae 100644 --- a/kcm_kdevkernel.h +++ b/kcm_kdevkernel.h @@ -18,12 +18,15 @@ #ifndef KCM_KDEVKERNEL_H #define KCM_KDEVKERNEL_H -#include +// Probably this got removed +//#include #include "kdevkernelplugin.h" +//#include class KDevKernelConfig; class KDevKernelKCModule : public ProjectKCModule +//class KDevKernelKCModule : public Pro { Q_OBJECT public: diff --git a/kdevkernelconfigwidget.cpp b/kdevkernelconfigwidget.cpp index 54aed9e..0d00bc1 100644 --- a/kdevkernelconfigwidget.cpp +++ b/kdevkernelconfigwidget.cpp @@ -26,6 +26,8 @@ #include #include #include +#include +#include KDevKernelConfigWidget::KDevKernelConfigWidget(QWidget *parent, const QString &projectRoot) : QWidget(parent), _projectRoot(projectRoot) { @@ -47,8 +49,10 @@ void KDevKernelConfigWidget::loadFrom(KConfig *config) KConfigGroup group(config->group(KERN_KGROUP)); // Fill in the arch values - KUrl pRoot(_projectRoot); - pRoot.adjustPath(KUrl::AddTrailingSlash); + //QUrl pRoot(_projectRoot); + QUrl pRoot(_projectRoot); + pRoot.adjustPath(QUrl::StripTrailingSlash ); + //QDir archDir(QUrl(pRoot, "arch").toLocalFile()); QDir archDir(KUrl(pRoot, "arch").toLocalFile()); archDir.setFilter(QDir::Dirs); foreach (const QString &archEntry, archDir.entryList()) { @@ -57,7 +61,7 @@ void KDevKernelConfigWidget::loadFrom(KConfig *config) } if (group.hasKey(KERN_BDIR)) { - buildDir->setUrl(group.readEntry(KERN_BDIR, KUrl())); + buildDir->setUrl(group.readEntry(KERN_BDIR, QUrl())); } else { buildDir->setStartDir(pRoot); } @@ -71,9 +75,9 @@ void KDevKernelConfigWidget::loadFrom(KConfig *config) } if (group.hasKey(KERN_CROSS)) { - crossCompiler->setUrl(KUrl(group.readEntry(KERN_CROSS, "") + "gcc")); + crossCompiler->setUrl(QUrl(group.readEntry(KERN_CROSS, "") + "gcc")); } else { - crossCompiler->setStartDir(KUrl("/usr/bin/")); + crossCompiler->setStartDir(QUrl("/usr/bin/")); } } @@ -102,9 +106,9 @@ void KDevKernelConfigWidget::saveTo(KConfig *config, KDevelop::IProject *project // Remove the .config file if configuration changed. This will trigger // the corresponding make rule from the plugin the next time we parse. if (defconfig->currentText() != group.readEntry(KERN_DEFCONFIG, "")) { - KUrl buildDir(group.readEntry(KERN_BDIR, _projectRoot)); - buildDir.adjustPath(KUrl::AddTrailingSlash); - QFile dotConfig(KUrl(buildDir, ".config").toLocalFile()); + QUrl buildDir(group.readEntry(KERN_BDIR, _projectRoot)); + buildDir.adjustPath(QUrl::AddTrailingSlash); + QFile dotConfig(QUrl(buildDir, ".config").toLocalFile()); if (dotConfig.exists()) dotConfig.remove(); } @@ -125,9 +129,9 @@ void KDevKernelConfigWidget::archChanged (const QString &arch) defconfig->clear(); // Fill in the configs values - KUrl pRoot(_projectRoot); - pRoot.adjustPath(KUrl::AddTrailingSlash); - QDir configDirs(KUrl(pRoot, QString("arch/%1/configs").arg(arch)).toLocalFile()); + QUrl pRoot(_projectRoot); + pRoot.adjustPath(QUrl::AddTrailingSlash); + QDir configDirs(QUrl(pRoot, QString("arch/%1/configs").arg(arch)).toLocalFile()); foreach (const QString &configFile, configDirs.entryList()) { if (configFile.startsWith('.')) continue; defconfig->addItem(configFile.left(configFile.size() - QString("_defconfig").size())); diff --git a/kdevkernelplugin.cpp b/kdevkernelplugin.cpp index e693f14..89404a2 100644 --- a/kdevkernelplugin.cpp +++ b/kdevkernelplugin.cpp @@ -49,7 +49,7 @@ K_EXPORT_PLUGIN(KernelProjectFactory( )) KDevKernelPlugin::KDevKernelPlugin(QObject *parent, const QVariantList &args) - : KDevelop::AbstractFileManagerPlugin(KernelProjectFactory::componentData(), parent) + : KDevelop::AbstractFileManagerPlugin( componentName(), parent) { Q_UNUSED(args); KDEV_USE_EXTENSION_INTERFACE(KDevelop::IBuildSystemManager) @@ -78,7 +78,7 @@ KDevelop::Path::List KDevKernelPlugin::includeDirectories(KDevelop::ProjectBaseI KUrl::List KDevKernelPlugin::includeDirectories(KDevelop::IProject *project) const { KUrl::List ret; - KUrl projectRoot = project->folder(); + KUrl projectRoot = project->sender(); KConfigGroup config(project->projectConfiguration()->group(KERN_KGROUP)); KUrl bDir(KUrl(config.readEntry(KERN_BDIR, projectRoot))); bDir.adjustPath(KUrl::AddTrailingSlash); diff --git a/kdevkernelplugin.h b/kdevkernelplugin.h index bc8f9a9..217d88e 100644 --- a/kdevkernelplugin.h +++ b/kdevkernelplugin.h @@ -21,12 +21,13 @@ #include #include #include -#include +#include #include #include #include #include #include +#include class KJob; class IMakeBuilder;