[libcalamares] Document DllMacro.h and add STATICTEST

- document the export macros
 - introduce a "static" that is switched off when re-building code
   for tests.
This commit is contained in:
Adriaan de Groot 2020-02-17 11:43:20 +01:00
parent b044549013
commit 92260e7d0b

View File

@ -21,6 +21,10 @@
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
/*
* Mark symbols exported from Calamares libraries with DLLEXPORT.
* These are the public API of the libraries.
*/
#ifndef DLLEXPORT #ifndef DLLEXPORT
#if defined( DLLEXPORT_PRO ) #if defined( DLLEXPORT_PRO )
#define DLLEXPORT Q_DECL_EXPORT #define DLLEXPORT Q_DECL_EXPORT
@ -29,6 +33,11 @@
#endif #endif
#endif #endif
/*
* Mark symbols exported from Calamares C++ plugins with PLUGINDLLEXPORT.
* These are the public API of the libraries (generally, the plugin
* entry point)
*/
#ifndef PLUGINDLLEXPORT #ifndef PLUGINDLLEXPORT
#if defined( PLUGINDLLEXPORT_PRO ) #if defined( PLUGINDLLEXPORT_PRO )
#define PLUGINDLLEXPORT Q_DECL_EXPORT #define PLUGINDLLEXPORT Q_DECL_EXPORT
@ -37,4 +46,17 @@
#endif #endif
#endif #endif
/*
* For functions that should be static in production but also need to
* be tested, use STATICTEST as linkage specifier. When built as part
* of a test, the function will be given normal linkage.
*/
#ifndef STATICTEST
#if defined( BUILD_AS_TEST )
#define STATICTEST
#else
#define STATICTEST static
#endif
#endif
#endif #endif