Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Port to kdevelop5 #22

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 58 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -51,3 +83,4 @@ install(
)

add_subdirectory(icons)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
3 changes: 1 addition & 2 deletions icons/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
kde4_install_icons(${ICON_INSTALL_DIR})

#ecm_install_icons(${ICON_INSTALL_DIR})
5 changes: 4 additions & 1 deletion kcm_kdevkernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@
#ifndef KCM_KDEVKERNEL_H
#define KCM_KDEVKERNEL_H

#include <project/projectkcmodule.h>
// Probably this got removed
//#include <project/projectkcmodule.h>
#include "kdevkernelplugin.h"
//#include <project/p>

class KDevKernelConfig;

class KDevKernelKCModule : public ProjectKCModule<KDevKernelConfig>
//class KDevKernelKCModule : public Pro
{
Q_OBJECT
public:
Expand Down
26 changes: 15 additions & 11 deletions kdevkernelconfigwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <interfaces/iprojectcontroller.h>
#include <interfaces/iruncontroller.h>
#include <language/backgroundparser/parseprojectjob.h>
#include <QUrl>
#include <kurl.h>

KDevKernelConfigWidget::KDevKernelConfigWidget(QWidget *parent, const QString &projectRoot) : QWidget(parent), _projectRoot(projectRoot)
{
Expand All @@ -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()) {
Expand All @@ -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);
}
Expand All @@ -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/"));
}
}

Expand Down Expand Up @@ -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();
}

Expand All @@ -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()));
Expand Down
4 changes: 2 additions & 2 deletions kdevkernelplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion kdevkernelplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
#include <project/interfaces/ibuildsystemmanager.h>
#include <project/interfaces/iprojectbuilder.h>
#include <project/abstractfilemanagerplugin.h>
#include <make/imakebuilder.h>
#include <makebuilder/imakebuilder.h>
#include <QVariant>
#include <QSet>
#include <QMap>
#include <QHash>
#include <QDateTime>
#include <kurl.h>

class KJob;
class IMakeBuilder;
Expand Down