-
-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use an in-tree header for symbol export information
Relying on CMake's GenerateExportHeader produces a file that is longer than the one being added here, which for all that is just mostly defining macros not used here. And after all that, it only contains macros specific to a single compiler, while failing to consistently handle GNUC (that always supports symbol visibility even for static libraries). Replace this with a more targeted header that is easy to read or include into external build systems, and which is also more robust than the one that only exists inside CMake.
- Loading branch information
1 parent
b1d961c
commit d384a5b
Showing
2 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef CMARK_EXPORT_H | ||
#define CMARK_EXPORT_H | ||
|
||
/* Is this an exclusively static build */ | ||
#if @CMARK_STATIC_DEFINE@ && ! defined CMARK_STATIC_DEFINE | ||
# define CMARK_STATIC_DEFINE | ||
#endif | ||
|
||
/* | ||
* Here is the complicated part. Windows is special -- you cannot just define | ||
* entry points unconditionally. | ||
* */ | ||
#if defined _WIN32 || defined __CYGWIN__ | ||
/* When building static libraries, avoid marking public ones */ | ||
# if defined CMARK_STATIC_DEFINE | ||
# define CMARK_EXPORT | ||
/* We are building this library */ | ||
# elif defined libcmark_EXPORTS | ||
# define CMARK_EXPORT __declspec(dllexport) | ||
/* We are using this library */ | ||
# else | ||
# define CMARK_EXPORT __declspec(dllimport) | ||
# endif | ||
|
||
/* On to the easy part. GCC and lookalikes such as clang just work */ | ||
#elif defined __GNUC__ && __GNUC__ >= 4 | ||
# define CMARK_EXPORT __attribute__((visibility("default"))) | ||
|
||
/* Older solaris support, why not */ | ||
#elif defined __SUNPRO_C && __SUNPRO_C >= 0x550 | ||
# define CMARK_EXPORT __global | ||
|
||
/* All else failed, and we don't know about this compiler. Be conservative. */ | ||
#else | ||
# define CMARK_EXPORT | ||
#endif | ||
|
||
#endif /* CMARK_EXPORT_H */ |