Commit 35d609dc authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Only wrap flatpak.h includes in extern "C" with older versions

Seems to be the only way to be compatible backwards and forwards.
parent 325eece3
......@@ -38,7 +38,6 @@ pkg_check_modules(Fwupd IMPORTED_TARGET fwupd>=1.5.0)
pkg_check_modules(Markdown IMPORTED_TARGET libmarkdown)
find_package(KUserFeedback)
if(NOT CMAKE_VERSION VERSION_LESS "3.10.0")
# CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros.
# 3.10+ lets us provide more macro names that require automoc.
......
......@@ -23,6 +23,11 @@ add_library(FlatpakNotifier MODULE FlatpakNotifier.cpp)
target_link_libraries(FlatpakNotifier Discover::Notifiers Qt::Concurrent PkgConfig::Flatpak)
set_target_properties(FlatpakNotifier PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/plasma-discover)
if (Flatpak_VERSION VERSION_LESS 1.10.2)
target_compile_definitions(flatpak-backend PRIVATE -DFLATPAK_EXTERNC_REQUIRED)
target_compile_definitions(FlatpakNotifier PRIVATE -DFLATPAK_EXTERNC_REQUIRED)
endif()
install(TARGETS FlatpakNotifier DESTINATION ${KDE_INSTALL_PLUGINDIR}/discover-notifier)
install(PROGRAMS org.kde.discover-flatpak.desktop DESTINATION ${KDE_INSTALL_APPDIR} )
install(FILES org.kde.discover.flatpak.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} )
......
......@@ -17,9 +17,7 @@
#include <AppStreamQt/component.h>
extern "C" {
#include <flatpak.h>
}
#include "flatpak-helper.h"
class FlatpakSourcesBackend;
class StandardBackendUpdater;
......
......@@ -8,10 +8,8 @@
#define FLATPAKFETCHDATAJOB_H
#include <QByteArray>
extern "C" {
#include <flatpak.h>
#include "flatpak-helper.h"
#include <glib.h>
}
class FlatpakResource;
......
......@@ -13,9 +13,6 @@
#include <QDebug>
#include <QTimer>
extern "C" {
}
FlatpakJobTransaction::FlatpakJobTransaction(FlatpakResource *app, Role role, bool delayStart)
: Transaction(app->backend(), app, role, {})
, m_app(app)
......
......@@ -10,12 +10,10 @@
#include <QPointer>
#include <Transaction/Transaction.h>
#include "flatpak-helper.h"
extern "C" {
#include <flatpak.h>
#include <gio/gio.h>
#include <glib.h>
}
class FlatpakResource;
class FlatpakTransactionThread;
......
......@@ -10,9 +10,7 @@
#include <BackendNotifierModule.h>
#include <functional>
extern "C" {
#include <flatpak.h>
}
#include "flatpak-helper.h"
class FlatpakNotifier : public BackendNotifierModule
{
......
......@@ -10,9 +10,7 @@
#include <resources/AbstractResource.h>
extern "C" {
#include <flatpak.h>
}
#include "flatpak-helper.h"
#include <AppStreamQt/component.h>
......
......@@ -13,9 +13,7 @@
#include <functional>
#include <resources/AbstractSourcesBackend.h>
extern "C" {
#include <flatpak.h>
}
#include "flatpak-helper.h"
class DiscoverAction;
class FlatpakResource;
......
......@@ -7,11 +7,9 @@
#ifndef FLATPAKTRANSACTIONTHREAD_H
#define FLATPAKTRANSACTIONTHREAD_H
extern "C" {
#include <flatpak.h>
#include "flatpak-helper.h"
#include <gio/gio.h>
#include <glib.h>
}
#include <QThread>
#include <Transaction/Transaction.h>
......
/*
* SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#ifndef FLATPAK_HELPER
#define FLATPAK_HELPER
#ifdef FLATPAK_EXTERNC_REQUIRED
extern "C" {
#endif
#include <flatpak.h>
#ifdef FLATPAK_EXTERNC_REQUIRED
}
#endif
#endif
......@@ -9,6 +9,9 @@ set(fwupd-backend_SRCS
add_library(fwupd-backend MODULE ${fwupd-backend_SRCS})
target_link_libraries(fwupd-backend Qt::Core KF5::CoreAddons KF5::ConfigCore Discover::Common PkgConfig::Fwupd)
if (Fwupd_VERSION VERSION_LESS 1.5.8)
target_compile_definitions(fwupd-backend PRIVATE -DFWUPD_EXTERNC_REQUIRED)
endif()
install(TARGETS fwupd-backend DESTINATION ${KDE_INSTALL_PLUGINDIR}/discover)
......@@ -24,9 +24,14 @@
#include <QTimer>
#include <QVariantList>
#ifdef FWUPD_EXTERNC_REQUIRED
extern "C" {
#endif
#include <fwupd.h>
#ifdef FWUPD_EXTERNC_REQUIRED
}
#endif
#include <glib-2.0/glib-object.h>
class DiscoverAction;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment