plugins: setup new helper macros to define shared utils

This commit is contained in:
Aleksander Morgado
2022-12-11 23:44:20 +00:00
committed by Aleksander Morgado
parent f0a9f09558
commit 1dd70be4c8
11 changed files with 60 additions and 68 deletions

View File

@@ -31,6 +31,9 @@
#define MM_PLUGIN_MAJOR_VERSION 5 #define MM_PLUGIN_MAJOR_VERSION 5
#define MM_PLUGIN_MINOR_VERSION 0 #define MM_PLUGIN_MINOR_VERSION 0
#define MM_SHARED_MAJOR_VERSION 1
#define MM_SHARED_MINOR_VERSION 0
#define MM_TYPE_PLUGIN (mm_plugin_get_type ()) #define MM_TYPE_PLUGIN (mm_plugin_get_type ())
#define MM_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN, MMPlugin)) #define MM_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN, MMPlugin))
#define MM_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN, MMPluginClass)) #define MM_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN, MMPluginClass))

View File

@@ -1,35 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
*/
#ifndef MM_SHARED_H
#define MM_SHARED_H
#include <glib.h>
#include <glib-object.h>
#define MM_SHARED_MAJOR_VERSION 1
#define MM_SHARED_MINOR_VERSION 0
#if defined (G_HAVE_GNUC_VISIBILITY)
#define VISIBILITY __attribute__((visibility("protected")))
#else
#define VISIBILITY
#endif
#define MM_SHARED_DEFINE_MAJOR_VERSION VISIBILITY int mm_shared_major_version = MM_SHARED_MAJOR_VERSION;
#define MM_SHARED_DEFINE_MINOR_VERSION VISIBILITY int mm_shared_minor_version = MM_SHARED_MINOR_VERSION;
#define MM_SHARED_DEFINE_NAME(NAME) VISIBILITY const char *mm_shared_name = #NAME;
#endif /* MM_SHARED_H */

View File

@@ -13,8 +13,6 @@
* Copyright (C) 2022 Aleksander Morgado <aleksander@aleksander.es> * Copyright (C) 2022 Aleksander Morgado <aleksander@aleksander.es>
*/ */
#include "mm-shared.h" #include "mm-shared-common.h"
MM_SHARED_DEFINE_MAJOR_VERSION MM_DEFINE_SHARED (fibocom)
MM_SHARED_DEFINE_MINOR_VERSION
MM_SHARED_DEFINE_NAME(Intel)

View File

@@ -13,8 +13,5 @@
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es> * Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
*/ */
#include "mm-shared.h" #include "mm-shared-common.h"
MM_DEFINE_SHARED (foxconn)
MM_SHARED_DEFINE_MAJOR_VERSION
MM_SHARED_DEFINE_MINOR_VERSION
MM_SHARED_DEFINE_NAME(Foxconn)

View File

@@ -13,8 +13,6 @@
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es> * Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
*/ */
#include "mm-shared.h" #include "mm-shared-common.h"
MM_SHARED_DEFINE_MAJOR_VERSION MM_DEFINE_SHARED (icera)
MM_SHARED_DEFINE_MINOR_VERSION
MM_SHARED_DEFINE_NAME(Icera)

View File

@@ -0,0 +1,41 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
* Copyright (C) 2022 Google, Inc.
*/
#ifndef MM_SHARED_COMMON_H
#define MM_SHARED_COMMON_H
#if !defined MM_MODULE_NAME
# error MM_MODULE_NAME must be defined
#endif
#include <config.h>
#include <glib.h>
#include <glib-object.h>
#include "mm-plugin.h"
#if defined (G_HAVE_GNUC_VISIBILITY)
#define MM_VISIBILITY __attribute__((visibility("protected")))
#else
#define MM_VISIBILITY
#endif
#define MM_DEFINE_SHARED(MyShared) \
MM_VISIBILITY int mm_shared_major_version = MM_SHARED_MAJOR_VERSION; \
MM_VISIBILITY int mm_shared_minor_version = MM_SHARED_MINOR_VERSION; \
MM_VISIBILITY const char *mm_shared_name = #MyShared;
#endif /* MM_SHARED_COMMON_H */

View File

@@ -13,8 +13,6 @@
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es> * Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
*/ */
#include "mm-shared.h" #include "mm-shared-common.h"
MM_SHARED_DEFINE_MAJOR_VERSION MM_DEFINE_SHARED (novatel)
MM_SHARED_DEFINE_MINOR_VERSION
MM_SHARED_DEFINE_NAME(Novatel)

View File

@@ -13,8 +13,6 @@
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es> * Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
*/ */
#include "mm-shared.h" #include "mm-shared-common.h"
MM_SHARED_DEFINE_MAJOR_VERSION MM_DEFINE_SHARED (option)
MM_SHARED_DEFINE_MINOR_VERSION
MM_SHARED_DEFINE_NAME(Option)

View File

@@ -13,8 +13,6 @@
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es> * Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
*/ */
#include "mm-shared.h" #include "mm-shared-common.h"
MM_SHARED_DEFINE_MAJOR_VERSION MM_DEFINE_SHARED (sierra)
MM_SHARED_DEFINE_MINOR_VERSION
MM_SHARED_DEFINE_NAME(Sierra)

View File

@@ -13,8 +13,6 @@
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es> * Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
*/ */
#include "mm-shared.h" #include "mm-shared-common.h"
MM_SHARED_DEFINE_MAJOR_VERSION MM_DEFINE_SHARED (telit)
MM_SHARED_DEFINE_MINOR_VERSION
MM_SHARED_DEFINE_NAME(Telit)

View File

@@ -13,8 +13,6 @@
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es> * Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
*/ */
#include "mm-shared.h" #include "mm-shared-common.h"
MM_SHARED_DEFINE_MAJOR_VERSION MM_DEFINE_SHARED (xmm)
MM_SHARED_DEFINE_MINOR_VERSION
MM_SHARED_DEFINE_NAME(Xmm)