From e5a56f02f13c667d747e2a273edb3317385a0de0 Mon Sep 17 00:00:00 2001 From: mutouyun Date: Mon, 6 Jan 2025 16:21:03 +0800 Subject: [PATCH] Move the export.h file to the imp directory --- include/libipc/buffer.h | 2 +- include/libipc/condition.h | 2 +- include/libipc/export.h | 54 ------------------------------------- include/libipc/imp/export.h | 45 +++++++++++++++++++++++++++++++ include/libipc/ipc.h | 2 +- include/libipc/mutex.h | 2 +- include/libipc/pool_alloc.h | 2 +- include/libipc/semaphore.h | 2 +- include/libipc/shm.h | 2 +- 9 files changed, 52 insertions(+), 61 deletions(-) delete mode 100755 include/libipc/export.h create mode 100755 include/libipc/imp/export.h diff --git a/include/libipc/buffer.h b/include/libipc/buffer.h index 3f8c229..ea80140 100755 --- a/include/libipc/buffer.h +++ b/include/libipc/buffer.h @@ -5,7 +5,7 @@ #include #include -#include "libipc/export.h" +#include "libipc/imp/export.h" #include "libipc/def.h" namespace ipc { diff --git a/include/libipc/condition.h b/include/libipc/condition.h index 072074a..6c15746 100644 --- a/include/libipc/condition.h +++ b/include/libipc/condition.h @@ -2,7 +2,7 @@ #include // std::uint64_t -#include "libipc/export.h" +#include "libipc/imp/export.h" #include "libipc/def.h" #include "libipc/mutex.h" diff --git a/include/libipc/export.h b/include/libipc/export.h deleted file mode 100755 index 6024f2f..0000000 --- a/include/libipc/export.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#if defined(Q_DECL_EXPORT) && defined(Q_DECL_IMPORT) - -# define IPC_DECL_EXPORT Q_DECL_EXPORT -# define IPC_DECL_IMPORT Q_DECL_IMPORT - -#else // defined(Q_DECL_EXPORT) && defined(Q_DECL_IMPORT) - -/* - * Compiler & system detection for IPC_DECL_EXPORT & IPC_DECL_IMPORT. - * Not using QtCore cause it shouldn't depend on Qt. -*/ - -#if defined(_MSC_VER) -# define IPC_DECL_EXPORT __declspec(dllexport) -# define IPC_DECL_IMPORT __declspec(dllimport) -#elif defined(__ARMCC__) || defined(__CC_ARM) -# if defined(ANDROID) || defined(__linux__) || defined(__linux) -# define IPC_DECL_EXPORT __attribute__((visibility("default"))) -# define IPC_DECL_IMPORT __attribute__((visibility("default"))) -# else -# define IPC_DECL_EXPORT __declspec(dllexport) -# define IPC_DECL_IMPORT __declspec(dllimport) -# endif -#elif defined(__GNUC__) -# if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || \ - defined(WIN64) || defined(_WIN64) || defined(__WIN64__) -# define IPC_DECL_EXPORT __declspec(dllexport) -# define IPC_DECL_IMPORT __declspec(dllimport) -# else -# define IPC_DECL_EXPORT __attribute__((visibility("default"))) -# define IPC_DECL_IMPORT __attribute__((visibility("default"))) -# endif -#else -# define IPC_DECL_EXPORT __attribute__((visibility("default"))) -# define IPC_DECL_IMPORT __attribute__((visibility("default"))) -#endif - -#endif // defined(Q_DECL_EXPORT) && defined(Q_DECL_IMPORT) - -/* - * Define IPC_EXPORT for exporting function & class. -*/ - -#ifndef IPC_EXPORT -#if defined(LIBIPC_LIBRARY_SHARED_BUILDING__) -# define IPC_EXPORT IPC_DECL_EXPORT -#elif defined(LIBIPC_LIBRARY_SHARED_USING__) -# define IPC_EXPORT IPC_DECL_IMPORT -#else -# define IPC_EXPORT -#endif -#endif /*IPC_EXPORT*/ diff --git a/include/libipc/imp/export.h b/include/libipc/imp/export.h new file mode 100755 index 0000000..740dd82 --- /dev/null +++ b/include/libipc/imp/export.h @@ -0,0 +1,45 @@ +/** + * \file libimp/export.h + * \author mutouyun (orz@orzz.org) + * \brief Define the symbol export interfaces. + */ +#pragma once + +#include "libipc/imp/detect_plat.h" + +#if defined(Q_DECL_EXPORT) && defined(Q_DECL_IMPORT) + +# define IPC_DECL_EXPORT Q_DECL_EXPORT +# define IPC_DECL_IMPORT Q_DECL_IMPORT + +#else // defined(Q_DECL_EXPORT) && defined(Q_DECL_IMPORT) + +/** + * \brief Compiler & system detection for IPC_DECL_EXPORT & IPC_DECL_IMPORT. + * Not using QtCore cause it shouldn't depend on Qt. + */ +# if defined(LIBIPC_CC_MSVC) || defined(LIBIPC_OS_WIN) +# define IPC_DECL_EXPORT __declspec(dllexport) +# define IPC_DECL_IMPORT __declspec(dllimport) +# elif defined(LIBIPC_OS_ANDROID) || defined(LIBIPC_OS_LINUX) || defined(LIBIPC_CC_GNUC) +# define IPC_DECL_EXPORT __attribute__((visibility("default"))) +# define IPC_DECL_IMPORT __attribute__((visibility("default"))) +# else +# define IPC_DECL_EXPORT __attribute__((visibility("default"))) +# define IPC_DECL_IMPORT __attribute__((visibility("default"))) +# endif + +#endif // defined(Q_DECL_EXPORT) && defined(Q_DECL_IMPORT) + +/** + * \brief Define IPC_EXPORT for exporting function & class. + */ +#ifndef IPC_EXPORT +# if defined(LIBIPC_LIBRARY_SHARED_BUILDING__) +# define IPC_EXPORT IPC_DECL_EXPORT +# elif defined(LIBIPC_LIBRARY_SHARED_USING__) +# define IPC_EXPORT IPC_DECL_IMPORT +# else +# define IPC_EXPORT +# endif +#endif /*IPC_EXPORT*/ diff --git a/include/libipc/ipc.h b/include/libipc/ipc.h index e6fe61a..05877be 100755 --- a/include/libipc/ipc.h +++ b/include/libipc/ipc.h @@ -2,7 +2,7 @@ #include -#include "libipc/export.h" +#include "libipc/imp/export.h" #include "libipc/def.h" #include "libipc/buffer.h" #include "libipc/shm.h" diff --git a/include/libipc/mutex.h b/include/libipc/mutex.h index 0b2a0e4..9bbb2fd 100644 --- a/include/libipc/mutex.h +++ b/include/libipc/mutex.h @@ -3,7 +3,7 @@ #include // std::uint64_t #include -#include "libipc/export.h" +#include "libipc/imp/export.h" #include "libipc/def.h" namespace ipc { diff --git a/include/libipc/pool_alloc.h b/include/libipc/pool_alloc.h index c6be5a0..9c94bff 100755 --- a/include/libipc/pool_alloc.h +++ b/include/libipc/pool_alloc.h @@ -3,7 +3,7 @@ #include #include -#include "libipc/export.h" +#include "libipc/imp/export.h" #include "libipc/def.h" namespace ipc { diff --git a/include/libipc/semaphore.h b/include/libipc/semaphore.h index 397ec3e..72d5679 100644 --- a/include/libipc/semaphore.h +++ b/include/libipc/semaphore.h @@ -2,7 +2,7 @@ #include // std::uint64_t -#include "libipc/export.h" +#include "libipc/imp/export.h" #include "libipc/def.h" namespace ipc { diff --git a/include/libipc/shm.h b/include/libipc/shm.h index dc24ab4..e115fba 100755 --- a/include/libipc/shm.h +++ b/include/libipc/shm.h @@ -3,7 +3,7 @@ #include #include -#include "libipc/export.h" +#include "libipc/imp/export.h" namespace ipc { namespace shm {