Skip to content

Commit 29adb51

Browse files
committed
meson: Disallow default_library == 'both' on Visual Studio
We need different defines/cflags for building static and shared builds of libsigc++, so we can't really support default_library = 'both' for libsigc++ without much retinkering. So, just disallow such builds at least for now. Also, save up whether we are attempting a static build in the Visual Studio build.
1 parent bc91a4f commit 29adb51

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ cpp_compiler = meson.get_compiler('cpp')
4343
is_msvc = cpp_compiler.get_id() == 'msvc'
4444
python3 = find_program('python3', version: '>=3.5')
4545

46+
# MSVC: We currently do not support shared and static builds at the,
47+
# same time, since we need different defines/cflags for proper
48+
# linking.
49+
if is_msvc
50+
if get_option('default_library') == 'both'
51+
error('-Ddefault_library=both is currently not supported for Visual Studio')
52+
endif
53+
is_msvc_static = get_option('default_library') == 'static'
54+
else
55+
is_msvc_static = false
56+
endif
57+
4658
# Do we build from a git repository?
4759
# Suppose we do if and only if the meson.build file is tracked by git.
4860
cmd_py = '''

sigc++/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extra_sigc_objects = []
7474

7575
# Make sure we are exporting the symbols from the DLL
7676
if is_msvc
77-
extra_sigc_cppflags += ['-DSIGC_BUILD', '-D_WINDLL']
77+
extra_sigc_cppflags += ['-DSIGC_BUILD']
7878
endif
7979

8080
# Build the .rc file for Windows builds and link to it

sigc++config.h.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
# if defined(_MSC_VER)
1717
# define SIGC_MSC 1
1818
# define SIGC_WIN32 1
19-
# define SIGC_DLL 1
19+
# ifndef LIBSIGCXX_STATIC
20+
# define SIGC_DLL 1
21+
# endif
2022
# elif defined(__CYGWIN__)
2123
# define SIGC_CONFIGURE 1
2224
# elif defined(__MINGW32__)
@@ -54,7 +56,7 @@
5456
#endif /* !SIGC_MSC */
5557

5658
#ifdef SIGC_DLL
57-
# if defined(SIGC_BUILD) && defined(_WINDLL)
59+
# ifdef SIGC_BUILD
5860
# define SIGC_API __declspec(dllexport)
5961
# elif !defined(SIGC_BUILD)
6062
# define SIGC_API __declspec(dllimport)

sigc++config.h.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
#if defined(_MSC_VER)
1717
#define SIGC_MSC 1
1818
#define SIGC_WIN32 1
19+
#ifndef LIBSIGCXX_STATIC
1920
#define SIGC_DLL 1
21+
#endif
2022
#elif defined(__CYGWIN__)
2123
#define SIGC_CONFIGURE 1
2224
#elif defined(__MINGW32__)
@@ -54,7 +56,7 @@
5456
#endif /* !SIGC_MSC */
5557

5658
#ifdef SIGC_DLL
57-
#if defined(SIGC_BUILD) && defined(_WINDLL)
59+
#ifdef SIGC_BUILD
5860
#define SIGC_API __declspec(dllexport)
5961
#elif !defined(SIGC_BUILD)
6062
#define SIGC_API __declspec(dllimport)

sigc++config.h.meson

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#if defined(_MSC_VER)
2020
#define SIGC_MSC 1
2121
#define SIGC_WIN32 1
22+
#ifndef LIBSIGCXX_STATIC
2223
#define SIGC_DLL 1
24+
#endif
2325
#elif defined(__CYGWIN__)
2426
#define SIGC_CONFIGURE 1
2527
#elif defined(__MINGW32__)
@@ -57,7 +59,7 @@
5759
#endif /* !SIGC_MSC */
5860

5961
#ifdef SIGC_DLL
60-
#if defined(SIGC_BUILD) && defined(_WINDLL)
62+
#ifdef SIGC_BUILD
6163
#define SIGC_API __declspec(dllexport)
6264
#elif !defined(SIGC_BUILD)
6365
#define SIGC_API __declspec(dllimport)

0 commit comments

Comments
 (0)