Commit 12f83062 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by 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 46535bdc
......@@ -37,7 +37,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,8 +23,14 @@ add_library(FlatpakNotifier MODULE FlatpakNotifier.cpp)
target_link_libraries(FlatpakNotifier Discover::Notifiers Qt5::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 ${PLUGIN_INSTALL_DIR}/discover-notifier)
install(PROGRAMS org.kde.discover-flatpak.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install(FILES org.kde.discover.flatpak.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} )
ecm_install_icons(
......
......@@ -18,9 +18,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 <Transaction/Transaction.h>
#include <QPointer>
#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
{
......
......@@ -11,9 +11,7 @@
#include <resources/AbstractResource.h>
extern "C" {
#include <flatpak.h>
}
#include "flatpak-helper.h"
#include <AppStreamQt/component.h>
......
......@@ -13,9 +13,7 @@
#include <QStack>
#include <functional>
extern "C" {
#include <flatpak.h>
}
#include "flatpak-helper.h"
class FlatpakResource;
class FlatpakSourcesBackend : public AbstractSourcesBackend
......
......@@ -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 <Transaction/Transaction.h>
#include <QThread>
......
/*
* 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 Qt5::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 ${PLUGIN_INSTALL_DIR}/discover)
......@@ -25,9 +25,14 @@
#include <QCryptographicHash>
#include <QMap>
#ifdef FWUPD_EXTERNC_REQUIRED
extern "C" {
#endif
#include <fwupd.h>
#ifdef FWUPD_EXTERNC_REQUIRED
}
#endif
#include <glib-2.0/glib-object.h>
class QAction;
......
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