validate: cleanup the use of GST_VALIDATE_API on Windows
authorStéphane Cerveau <scerveau@igalia.com>
Thu, 17 Nov 2022 16:09:51 +0000 (16:09 +0000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 18 Nov 2022 02:17:27 +0000 (02:17 +0000)
Export or import properly the method from GST_VALIDATE_API
with a proper config.h

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3429>

subprojects/gst-devtools/validate/gst/validate/gst-validate-enum-types.c.template
subprojects/gst-devtools/validate/gst/validate/gst-validate-extra-checks.c
subprojects/gst-devtools/validate/gst/validate/gst-validate-runner.c
subprojects/gst-devtools/validate/gst/validate/media-descriptor-parser.c
subprojects/gst-devtools/validate/gst/validate/media-descriptor-writer.c
subprojects/gst-devtools/validate/gst/validate/media-descriptor.c
subprojects/gst-devtools/validate/gst/validate/meson.build
subprojects/gst-devtools/validate/gst/validate/validate-prelude.h
subprojects/gst-devtools/validate/meson.build

index ee4787b..e0a8625 100644 (file)
@@ -1,4 +1,9 @@
 /*** BEGIN file-header ***/
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include "gst-validate-enum-types.h"
 #include <gst/validate/validate.h>
 #define C_ENUM(v) ((gint) v)
index 01b82fe..270580b 100644 (file)
@@ -1,11 +1,13 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <gst/gst.h>
 #include "validate.h"
 #include "gst-validate-utils.h"
 #include "gst-validate-internal.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+
 
 #define EXTRA_CHECKS_WRONG_NUMBER_OF_INSTANCES g_quark_from_static_string ("extrachecks::wrong-number-of-instances")
 
index 8cf64f2..bf19cbf 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#include <string.h>
-#include <stdlib.h>
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
 #endif
 
+#include <string.h>
+#include <stdlib.h>
+
 #include "validate.h"
 #include "gst-validate-internal.h"
 #include "gst-validate-report.h"
index a71ca24..daaeb82 100644 (file)
@@ -18,6 +18,9 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
 
 #include "media-descriptor-parser.h"
 #include <string.h>
index 66fcb03..a96c3a0 100644 (file)
@@ -18,6 +18,9 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/validate/validate.h>
 #include "media-descriptor-writer.h"
index 962bb9a..d123106 100644 (file)
@@ -19,6 +19,9 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
 
 #include <string.h>
 #include "media-descriptor.h"
index ad3be46..0a574df 100644 (file)
@@ -58,14 +58,14 @@ gst_validate_enums = gnome.mkenums('gstvalidateenumtypes',
 
 validate_deps = [gst_check_dep, gst_dep, gst_controller_dep, gstbase_dep,
                  gio_dep, gmodule_dep, gst_pbutils_dep, mathlib, json_dep]
-gstvalidate = library('gstvalidate-1.0',
+gstvalidate = library('gstvalidate-@0@'.format(apiversion),
     sources: gstvalidate_sources + gst_validate_enums + runner_file,
     version : libversion,
     soversion : soversion,
     darwin_versions : osxversion,
     include_directories : [inc_dirs],
     install: true,
-    c_args : [gst_c_args] + ['-D_GNU_SOURCE'],
+    c_args : [gst_c_args] + ['-D_GNU_SOURCE', '-DBUILDING_GST_VALIDATE'],
     dependencies : validate_deps)
 
 if not static_build
@@ -73,7 +73,7 @@ if not static_build
       sources: gst_validate_enums + runner_file,
       include_directories : [inc_dirs],
       install: true,
-      c_args : [gst_c_args] + ['-D__GST_VALIDATE_PLUGIN', '-D_GNU_SOURCE'],
+      c_args : [gst_c_args] + ['-D__GST_VALIDATE_PLUGIN', '-D_GNU_SOURCE', '-DBUILDING_GST_VALIDATE'],
       install_dir : plugins_install_dir,
       objects: gstvalidate.extract_objects(gstvalidate_sources),
       dependencies : validate_deps)
index 5163463..59a0754 100644 (file)
 #include <gst/gst.h>
 
 #ifndef GST_VALIDATE_API
-#define GST_VALIDATE_API GST_EXPORT
+#ifdef BUILDING_GST_VALIDATE
+#define GST_VALIDATE_API GST_API_EXPORT        /* from config.h */
+#else
+#define GST_VALIDATE_API GST_API_IMPORT
+#endif
 #endif
 
 #endif /* __GST_VALIDATE_PRELUDE_H__ */
index 84ad240..17ca36a 100644 (file)
@@ -16,6 +16,19 @@ if cc.has_header('unistd.h')
   cdata.set('HAVE_UNISTD_H', 1)
 endif
 
+# Symbol visibility
+if cc.get_id() == 'msvc'
+  export_define = '__declspec(dllexport) extern'
+elif cc.has_argument('-fvisibility=hidden')
+  add_project_arguments('-fvisibility=hidden', language: 'c')
+  export_define = 'extern __attribute__ ((visibility ("default")))'
+else
+  export_define = 'extern'
+endif
+
+# Passing this through the command line would be too messy
+cdata.set('GST_API_EXPORT', export_define)
+
 configure_file(output : 'config.h', configuration : cdata)
 
 validate_plugins_install_dir = '@0@/gstreamer-1.0/validate'.format(get_option('libdir'))