plugins: setup new helper macros to define shared utils
This commit is contained in:

committed by
Aleksander Morgado

parent
f0a9f09558
commit
1dd70be4c8
@@ -31,6 +31,9 @@
|
||||
#define MM_PLUGIN_MAJOR_VERSION 5
|
||||
#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_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))
|
||||
|
@@ -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 */
|
||||
|
@@ -13,8 +13,6 @@
|
||||
* Copyright (C) 2022 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include "mm-shared.h"
|
||||
#include "mm-shared-common.h"
|
||||
|
||||
MM_SHARED_DEFINE_MAJOR_VERSION
|
||||
MM_SHARED_DEFINE_MINOR_VERSION
|
||||
MM_SHARED_DEFINE_NAME(Intel)
|
||||
MM_DEFINE_SHARED (fibocom)
|
||||
|
@@ -13,8 +13,5 @@
|
||||
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include "mm-shared.h"
|
||||
|
||||
MM_SHARED_DEFINE_MAJOR_VERSION
|
||||
MM_SHARED_DEFINE_MINOR_VERSION
|
||||
MM_SHARED_DEFINE_NAME(Foxconn)
|
||||
#include "mm-shared-common.h"
|
||||
MM_DEFINE_SHARED (foxconn)
|
||||
|
@@ -13,8 +13,6 @@
|
||||
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include "mm-shared.h"
|
||||
#include "mm-shared-common.h"
|
||||
|
||||
MM_SHARED_DEFINE_MAJOR_VERSION
|
||||
MM_SHARED_DEFINE_MINOR_VERSION
|
||||
MM_SHARED_DEFINE_NAME(Icera)
|
||||
MM_DEFINE_SHARED (icera)
|
||||
|
41
src/plugins/mm-shared-common.h
Normal file
41
src/plugins/mm-shared-common.h
Normal 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 */
|
@@ -13,8 +13,6 @@
|
||||
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include "mm-shared.h"
|
||||
#include "mm-shared-common.h"
|
||||
|
||||
MM_SHARED_DEFINE_MAJOR_VERSION
|
||||
MM_SHARED_DEFINE_MINOR_VERSION
|
||||
MM_SHARED_DEFINE_NAME(Novatel)
|
||||
MM_DEFINE_SHARED (novatel)
|
||||
|
@@ -13,8 +13,6 @@
|
||||
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include "mm-shared.h"
|
||||
#include "mm-shared-common.h"
|
||||
|
||||
MM_SHARED_DEFINE_MAJOR_VERSION
|
||||
MM_SHARED_DEFINE_MINOR_VERSION
|
||||
MM_SHARED_DEFINE_NAME(Option)
|
||||
MM_DEFINE_SHARED (option)
|
||||
|
@@ -13,8 +13,6 @@
|
||||
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include "mm-shared.h"
|
||||
#include "mm-shared-common.h"
|
||||
|
||||
MM_SHARED_DEFINE_MAJOR_VERSION
|
||||
MM_SHARED_DEFINE_MINOR_VERSION
|
||||
MM_SHARED_DEFINE_NAME(Sierra)
|
||||
MM_DEFINE_SHARED (sierra)
|
||||
|
@@ -13,8 +13,6 @@
|
||||
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include "mm-shared.h"
|
||||
#include "mm-shared-common.h"
|
||||
|
||||
MM_SHARED_DEFINE_MAJOR_VERSION
|
||||
MM_SHARED_DEFINE_MINOR_VERSION
|
||||
MM_SHARED_DEFINE_NAME(Telit)
|
||||
MM_DEFINE_SHARED (telit)
|
||||
|
@@ -13,8 +13,6 @@
|
||||
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include "mm-shared.h"
|
||||
#include "mm-shared-common.h"
|
||||
|
||||
MM_SHARED_DEFINE_MAJOR_VERSION
|
||||
MM_SHARED_DEFINE_MINOR_VERSION
|
||||
MM_SHARED_DEFINE_NAME(Xmm)
|
||||
MM_DEFINE_SHARED (xmm)
|
||||
|
Reference in New Issue
Block a user