build: Use dllimport/dllexport on Win32 targets.

Tested with x86_64-w64-mingw32-gcc.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-08-09 01:11:50 -05:00 committed by Alexandre Julliard
parent d27fee64ab
commit cdb9c5808e
5 changed files with 23 additions and 10 deletions

View File

@ -179,7 +179,7 @@ libvkd3d_shader_la_SOURCES = \
libs/vkd3d-shader/vkd3d_shader.map \
libs/vkd3d-shader/vkd3d_shader_main.c \
libs/vkd3d-shader/vkd3d_shader_private.h
libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/libs/vkd3d-shader @SPIRV_TOOLS_CFLAGS@
libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SHADER_SOURCE -I$(srcdir)/libs/vkd3d-shader @SPIRV_TOOLS_CFLAGS@
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0
libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@ -lm
if HAVE_LD_VERSION_SCRIPT
@ -207,6 +207,7 @@ libvkd3d_la_SOURCES = \
libs/vkd3d/vkd3d_private.h \
libs/vkd3d/vkd3d_shaders.h \
libs/vkd3d/vulkan_procs.h
libvkd3d_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SOURCE
libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 3:0:2
libvkd3d_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la @DL_LIBS@ @PTHREAD_LIBS@
if HAVE_LD_VERSION_SCRIPT
@ -218,6 +219,7 @@ libvkd3d_utils_la_SOURCES = \
libs/vkd3d-utils/vkd3d_utils.map \
libs/vkd3d-utils/vkd3d_utils_main.c \
libs/vkd3d-utils/vkd3d_utils_private.h
libvkd3d_utils_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_UTILS_SOURCE
libvkd3d_utils_la_LDFLAGS = $(AM_LDFLAGS) -version-info 2:0:1
libvkd3d_utils_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la libvkd3d.la @PTHREAD_LIBS@
if HAVE_LD_VERSION_SCRIPT

View File

@ -153,10 +153,10 @@ struct vkd3d_image_resource_create_info
D3D12_RESOURCE_STATES present_state;
};
#if defined(__GNUC__) && !defined(__MINGW32__)
# define VKD3D_API __attribute__((visibility("default")))
#ifdef LIBVKD3D_SOURCE
# define VKD3D_API VKD3D_EXPORT
#else
# define VKD3D_API
# define VKD3D_API VKD3D_IMPORT
#endif
#ifndef VKD3D_NO_PROTOTYPES

View File

@ -1340,10 +1340,10 @@ static inline uint32_t vkd3d_shader_create_swizzle(enum vkd3d_shader_swizzle_com
| ((w & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(3));
}
#if defined(__GNUC__) && !defined(__MINGW32__)
# define VKD3D_SHADER_API __attribute__((visibility("default")))
#ifdef LIBVKD3D_SHADER_SOURCE
# define VKD3D_SHADER_API VKD3D_EXPORT
#else
# define VKD3D_SHADER_API
# define VKD3D_SHADER_API VKD3D_IMPORT
#endif
#ifndef VKD3D_SHADER_NO_PROTOTYPES

View File

@ -53,6 +53,17 @@ enum vkd3d_result
VKD3D_FORCE_32_BIT_ENUM(VKD3D_RESULT),
};
#ifdef _WIN32
# define VKD3D_IMPORT __declspec(dllimport)
# define VKD3D_EXPORT __declspec(dllexport)
#elif defined(__GNUC__)
# define VKD3D_IMPORT
# define VKD3D_EXPORT __attribute__((visibility("default")))
#else
# define VKD3D_IMPORT
# define VKD3D_EXPORT
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -34,10 +34,10 @@ extern "C" {
#define VKD3D_WAIT_FAILED (~0u)
#define VKD3D_INFINITE (~0u)
#if defined(__GNUC__) && !defined(__MINGW32__)
# define VKD3D_UTILS_API __attribute__((visibility("default")))
#ifdef LIBVKD3D_UTILS_SOURCE
# define VKD3D_UTILS_API VKD3D_EXPORT
#else
# define VKD3D_UTILS_API
# define VKD3D_UTILS_API VKD3D_IMPORT
#endif
/* 1.0 */