diff --git a/.github/workflows/msvc-env.yml b/.github/workflows/msvc-env.yml index b462135..5cbe0dc 100644 --- a/.github/workflows/msvc-env.yml +++ b/.github/workflows/msvc-env.yml @@ -20,4 +20,4 @@ jobs: action: test directory: _build options: "--verbose" - meson-version: "0.55.3" + meson-version: "1.0.0" diff --git a/.github/workflows/ubuntu-clang-latest.yml b/.github/workflows/ubuntu-clang-latest.yml index 5d9807c..732597b 100644 --- a/.github/workflows/ubuntu-clang-latest.yml +++ b/.github/workflows/ubuntu-clang-latest.yml @@ -16,7 +16,7 @@ jobs: - name: set up environment run: | sudo apt-get install clang gir1.2-glib-2.0 gobject-introspection gtk-doc-tools libgirepository1.0-dev libglib2.0-dev ninja-build python3-setuptools python3-wheel - sudo pip3 install meson==0.55.3 + sudo pip3 install meson==1.0.0 - name: default build run: | diff --git a/.github/workflows/ubuntu-gcc-latest.yml b/.github/workflows/ubuntu-gcc-latest.yml index 22fe9f3..3c96b68 100644 --- a/.github/workflows/ubuntu-gcc-latest.yml +++ b/.github/workflows/ubuntu-gcc-latest.yml @@ -16,7 +16,7 @@ jobs: - name: set up environment run: | sudo apt-get install gcc gir1.2-glib-2.0 gobject-introspection gtk-doc-tools libgirepository1.0-dev libglib2.0-dev ninja-build python3-setuptools python3-wheel - sudo pip3 install meson==0.55.3 + sudo pip3 install meson==1.0.0 - name: default build run: | diff --git a/doc/meson.build b/doc/meson.build index 193d075..7f1d946 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -20,9 +20,9 @@ html_images = [ 'triangle-barycentric.png', ] -glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix') -glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') -docpath = join_paths(graphene_datadir, 'gtk-doc', 'html') +glib_prefix = dependency('glib-2.0').get_variable(pkgconfig: 'prefix') +glib_docpath = glib_prefix / 'share' / 'gtk-doc' / 'html' +docpath = graphene_datadir / 'gtk-doc' / 'html' gnome.gtkdoc('graphene', main_xml: 'graphene-docs.xml', @@ -42,8 +42,8 @@ gnome.gtkdoc('graphene', ], fixxref_args: [ '--html-dir=@0@'.format(docpath), - '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')), - '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')), + '--extra-dir=@0@'.format(glib_docpath / 'glib'), + '--extra-dir=@0@'.format(glib_docpath / 'gobject'), ], html_assets: html_images, install: true, diff --git a/include/graphene-macros.h b/include/graphene-macros.h index 4f2bb38..7df898c 100644 --- a/include/graphene-macros.h +++ b/include/graphene-macros.h @@ -29,10 +29,6 @@ #error "Only graphene.h can be included directly." #endif -#ifndef _GRAPHENE_PUBLIC -#define _GRAPHENE_PUBLIC extern -#endif - #ifdef GRAPHENE_COMPILATION # define GRAPHENE_PRIVATE_FIELD(type,name) type name #else diff --git a/include/graphene-version-macros.h b/include/graphene-version-macros.h index 0844996..acc00eb 100644 --- a/include/graphene-version-macros.h +++ b/include/graphene-version-macros.h @@ -31,6 +31,25 @@ #include "graphene-version.h" +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(GRAPHENE_STATIC_COMPILATION) +# define _GRAPHENE_EXPORT __declspec(dllexport) +# define _GRAPHENE_IMPORT __declspec(dllimport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define _GRAPHENE_EXPORT __attribute__((visibility("default"))) +# define _GRAPHENE_IMPORT +#else +# define _GRAPHENE_EXPORT +# define _GRAPHENE_IMPORT +#endif + +#ifdef GRAPHENE_COMPILATION +# define _GRAPHENE_API _GRAPHENE_EXPORT +#else +# define _GRAPHENE_API _GRAPHENE_IMPORT +#endif + +#define _GRAPHENE_PUBLIC _GRAPHENE_API extern + /** * GRAPHENE_ENCODE_VERSION: * @major: a major version diff --git a/meson.build b/meson.build index 7dcb9e6..d989905 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('graphene', 'c', version: '1.11.1', license: 'MIT', - meson_version: '>= 0.55.3', + meson_version: '>= 1.0', default_options: [ 'buildtype=debugoptimized', 'c_std=c99', @@ -202,13 +202,6 @@ extra_args = [] if get_option('default_library') != 'static' if host_system == 'windows' conf.set('DLL_EXPORT', true) - conf.set('_GRAPHENE_PUBLIC', '__declspec(dllexport) extern') - if cc.get_id() != 'msvc' - extra_args += ['-fvisibility=hidden'] - endif - else - conf.set('_GRAPHENE_PUBLIC', '__attribute__((visibility("default"))) extern') - extra_args += ['-fvisibility=hidden'] endif endif @@ -414,6 +407,31 @@ endif # Scalar is always available as a fallback graphene_simd += [ 'scalar' ] +graphene_build_shared = false +graphene_build_static = false +if get_option('default_library') == 'both' + graphene_build_static = true + graphene_build_shared = true +elif get_option('default_library') == 'static' + graphene_build_static = true +elif get_option('default_library') == 'shared' + graphene_build_shared = true +endif + +graphene_build_both = graphene_build_static and graphene_build_shared +graphene_build_static_only = graphene_build_static and not graphene_build_shared +graphene_build_shared_only = graphene_build_shared and not graphene_build_static + +if graphene_build_shared and graphene_build_static and ( + host_system == 'windows' or host_system == 'cygwin') + error('On Windows default_library must be "shared" or "static" but not "both"') +endif + +if graphene_build_static_only + graphene_conf.set('GRAPHENE_STATIC_COMPILATION', '1') +endif + + python = import('python') gnome = import('gnome') diff --git a/src/meson.build b/src/meson.build index 29c1920..8303fc8 100644 --- a/src/meson.build +++ b/src/meson.build @@ -45,6 +45,7 @@ libgraphene = library( version: libversion, soversion: soversion, darwin_versions: darwin_versions, + gnu_symbol_visibility: 'hidden', install: true, dependencies: [ mathlib, threadlib ] + platform_deps, c_args: extra_args + common_cflags + debug_flags + [