summaryrefslogtreecommitdiff
path: root/libcmark-gfm/libcmark-gfm/cmark-gfm_export.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcmark-gfm/libcmark-gfm/cmark-gfm_export.h')
-rw-r--r--libcmark-gfm/libcmark-gfm/cmark-gfm_export.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/libcmark-gfm/libcmark-gfm/cmark-gfm_export.h b/libcmark-gfm/libcmark-gfm/cmark-gfm_export.h
new file mode 100644
index 0000000..b6b42dc
--- /dev/null
+++ b/libcmark-gfm/libcmark-gfm/cmark-gfm_export.h
@@ -0,0 +1,54 @@
+/* file : libcmark-gfm/cmark-gfm_export.h -*- C -*-
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : FreeBSD License; see accompanying COPYING file
+ */
+
+#ifndef CMARK_GFM_EXPORT_H
+#define CMARK_GFM_EXPORT_H
+
+/*
+ * The upstream's version of this file is auto-generated by cmake. It looks
+ * quite convoluted and contains unused macro definitions. Moreover it seems
+ * to be broken, mismatching build/use pre-processor options (see the issue
+ * #156). Note that currently the upstream disables building shared libraries
+ * with VC.
+ *
+ * We implement this file from scratch using the standard build2 export header
+ * as a template.
+ */
+#if defined(CMARK_GFM_STATIC) // Using static.
+# define CMARK_GFM_EXPORT
+#elif defined(CMARK_GFM_STATIC_BUILD) // Building static.
+# define CMARK_GFM_EXPORT
+#elif defined(CMARK_GFM_SHARED) // Using shared.
+# ifdef _WIN32
+# define CMARK_GFM_EXPORT __declspec(dllimport)
+# else
+# define CMARK_GFM_EXPORT
+# endif
+#elif defined(CMARK_GFM_SHARED_BUILD) // Building shared.
+# ifdef _WIN32
+# define CMARK_GFM_EXPORT __declspec(dllexport)
+# else
+# define CMARK_GFM_EXPORT __attribute__((visibility("default")))
+# endif
+#else
+// If none of the above macros are defined, then we assume we are being used
+// by some third-party build system that cannot/doesn't signal the library
+// type. Note that this fallback works for both static and shared but in case
+// of shared will be sub-optimal compared to having dllimport.
+//
+# define CMARK_GFM_EXPORT // Using static or shared.
+#endif
+
+/*
+ * Undefining these cmake-generated macros is not technically required, but
+ * let's keep them for the record.
+ */
+#undef CMARK_GFM_NO_EXPORT
+#undef CMARK_GFM_DEPRECATED
+#undef CMARK_GFM_NO_DEPRECATED
+#undef CMARK_GFM_DEPRECATED_EXPORT
+#undef CMARK_GFM_DEPRECATED_NO_EXPORT
+
+#endif /* CMARK_GFM_EXPORT_H */