Skip to content

Support static builds for Visual Studio #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set (SIGCXX_MICRO_VERSION 0)
set (SIGCXX_API_VERSION 3.0)
set (PACKAGE_VERSION ${SIGCXX_MAJOR_VERSION}.${SIGCXX_MINOR_VERSION}.${SIGCXX_MICRO_VERSION})
set (LIBSIGCPP_SOVERSION 0)
set (MSVC_STATIC_CXXFLAG "")

option (SIGCXX_DISABLE_DEPRECATED "Disable deprecated" OFF)

Expand Down
4 changes: 4 additions & 0 deletions MSVC_NMake/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ PREFIX: Optional. Base directory of where the third-party headers, libraries
$(X) is the short version of the Visual Studio used, as follows:
2017: 15

STATIC: Optional. Set if building libsigc++ as a static library. Note that
for building items that use this static build, /DLIBSIGCXX_STATIC
must be passed into the compiler flags.

USE_COMPAT_LIBS: Build the sigc++ DLL and .lib with the filename
'sigc-vc150(d)-3_0' for all builds. This is for
compatibility reasons, if re-building dependent code is not
Expand Down
39 changes: 23 additions & 16 deletions MSVC_NMake/build-rules-msvc.mak
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
# $(CC)|$(CXX) $(cflags) /Fo$(destdir) /c @<<
# $<
# <<
{..\sigc++\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\sigc\}.obj:
{..\sigc++\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_INTDIR)\}.obj:
@if not exist .\sigc++config.h if not exist ..\untracked\MSVC_NMake\sigc++config.h $(MAKE) /f Makefile.vc CFG=$(CFG) sigc++config.h
@if not exist $(@D)\ md $(@D)
$(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<<
$<
<<

{..\sigc++\functors\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\sigc\}.obj:
{..\sigc++\functors\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_INTDIR)\}.obj:
@if not exist .\sigc++config.h if not exist ..\untracked\MSVC_NMake\sigc++config.h $(MAKE) /f Makefile.vc CFG=$(CFG) sigc++config.h
@if not exist $(@D)\ md $(@D)
$(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<<
$<
<<

{.}.rc{vs$(VSVER)\$(CFG)\$(PLAT)\sigc\}.res:
{.}.rc{vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_INTDIR)\}.res:
@if not exist $(@D)\ md $(@D)
rc /fo$@ $<

{..\untracked\MSVC_NMake\}.rc{vs$(VSVER)\$(CFG)\$(PLAT)\sigc\}.res:
{..\untracked\MSVC_NMake\}.rc{vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_INTDIR)\}.res:
@if not exist $(@D)\ md $(@D)
rc /fo$@ $<

Expand All @@ -42,13 +42,20 @@ $<
# $(dependent_objects)
# <<
# @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
!ifdef STATIC
$(LIBSIGC_LIB): $(libsigc_OBJS)
lib $(ARFLAGS) -out:$@ @<<
$(libsigc_OBJS)
<<
!else
$(LIBSIGC_LIB): $(LIBSIGC_DLL)

$(LIBSIGC_DLL): $(sigc_dll_OBJS)
$(LIBSIGC_DLL): $(libsigc_OBJS)
link /DLL $(LDFLAGS) /implib:$(LIBSIGC_LIB) -out:$@ @<<
$(sigc_dll_OBJS)
$(libsigc_OBJS)
<<
@-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
!endif

# Rules for linking Executables
# Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
Expand All @@ -65,13 +72,13 @@ clean:
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.ilk
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exp
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.lib
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\sigc-tests del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\sigc-tests\*.obj
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\sigc-tests del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\sigc-tests\*.pdb
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\sigc-examples\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\sigc-examples\*.pdb
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\sigc\*.res
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\sigc\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\sigc\*.pdb
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\sigc-tests rd vs$(VSVER)\$(CFG)\$(PLAT)\sigc-tests
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\sigc-examples
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\sigc
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\$(SIGC_TESTS_INTDIR) del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\$(SIGC_TESTS_INTDIR)\*.obj
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\$(SIGC_TESTS_INTDIR) del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\$(SIGC_TESTS_INTDIR)\*.pdb
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\$(SIGC_EX_INTDIR)\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\$(SIGC_EX_INTDIR)\*.pdb
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_INTDIR)\*.res
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_INTDIR)\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_INTDIR)\*.pdb
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\$(SIGC_TESTS_INTDIR) rd vs$(VSVER)\$(CFG)\$(PLAT)\$(SIGC_TESTS_INTDIR)
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\$(SIGC_EX_INTDIR)
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_INTDIR)
21 changes: 20 additions & 1 deletion MSVC_NMake/config-msvc.mak
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,31 @@ BASE_INCLUDES = /I$(PREFIX)\include
LIBSIGC_MAJOR_VERSION = 3
LIBSIGC_MINOR_VERSION = 0

!ifdef STATIC
LIBSIGC_INTDIR = sigc-static
SIGC_EX_INTDIR = sigc-examples-static
SIGC_TESTS_INTDIR = sigc-tests-static
!else
LIBSIGC_INTDIR = sigc
SIGC_EX_INTDIR = sigc-examples
SIGC_TESTS_INTDIR = sigc-tests
!endif

!if "$(CFG)" == "debug" || "$(CFG)" == "Debug"
DEBUG_SUFFIX = -d
!else
DEBUG_SUFFIX =
!endif

LIBSIGCPP_DEFINES = /DSIGC_BUILD /D_WINDLL
LIBSIGCPP_DEFINES = /DSIGC_BUILD

SIGCPP_BASE_CFLAGS = /I.. /I. /I..\untracked\MSVC_NMake /std:c++17 /EHsc $(CFLAGS)

# Define LIBSIGCXX_STATIC everywhere for static builds
!ifdef STATIC
SIGCPP_BASE_CFLAGS = $(SIGCPP_BASE_CFLAGS) /DLIBSIGCXX_STATIC
!endif

LIBSIGC_INT_SOURCES = $(sigc_sources_cc:/=\)
LIBSIGC_INT_HDRS = $(sigc_public_h:/=\)

Expand All @@ -35,8 +50,12 @@ LIBSIGC_LIBNAME = sigc-vc$(VSVER_LIB)$(DEBUG_SUFFIX)-$(LIBSIGC_MAJOR_VERSION)_$(
LIBSIGC_DLLNAME = $(LIBSIGC_LIBNAME)
!endif

!ifdef STATIC
LIBSIGC_LIB = vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME)-static.lib
!else
LIBSIGC_DLL = vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_DLLNAME).dll
LIBSIGC_LIB = vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib
!endif

# If your Boost libraries are built as DLLs, use BOOST_DLL=1 in your NMake command line
!ifdef BOOST_DLL
Expand Down
37 changes: 31 additions & 6 deletions MSVC_NMake/create-lists-msvc.mak
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,40 @@ NULL=

# For libsigc++

!if [call create-lists.bat header sigc.mak sigc_dll_OBJS]
!if [call create-lists.bat header sigc.mak libsigc_OBJS]
!endif

!if [for %c in ($(sigc_sources_cc)) do @if "%~xc" == ".cc" @call create-lists.bat file sigc.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\sigc\%~nc.obj]
!if [for %c in ($(sigc_sources_cc)) do @if "%~xc" == ".cc" @call create-lists.bat file sigc.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\$(LIBSIGC_INTDIR)\%~nc.obj]
!endif

!if [@call create-lists.bat file sigc.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\sigc\sigc.res]
# No point linking in version resource for static builds
!ifndef STATIC
!if [@call create-lists.bat file sigc.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\$(LIBSIGC_INTDIR)\sigc.res]
!endif
!endif

!if [call create-lists.bat footer sigc.mak]
!endif

!ifdef STATIC
# start of static executables
!if [for %d in (examples tests) do @call create-lists.bat header sigc.mak libsigc_%d & @(for %s in (..\%d\*.cc) do @if not "%~ns" == "testutilities" if not "%~ns" == "benchmark" call create-lists.bat file sigc.mak vs$(VSVER)\$(CFG)\$(PLAT)\%~ns-static.exe) & @call create-lists.bat footer sigc.mak]
!endif

!if [call create-lists.bat header sigc.mak libsigc_benchmark & @for %s in (..\tests\benchmark.cc) do @(call create-lists.bat file sigc.mak vs$(VSVER)\$(CFG)\$(PLAT)\%~ns-static.exe) & @call create-lists.bat footer sigc.mak]
!endif

!if [for %d in (examples tests) do @for %s in (..\%d\*.cc) do @if not "%~ns" == "benchmark" echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\sigc-%d-static\%~ns.obj: %s>>sigc.mak & @echo. @if not exist ^$(@D)\ md ^$(@D)>>sigc.mak & @echo. ^$(CXX) ^$(SIGCPP_CFLAGS) /Fo^$(@D)\ /Fd^$(@D)\ ^$** /c>>sigc.mak & @echo.>>sigc.mak]
!endif

!if [for %s in (..\examples\*.cc) do @echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns-static.exe: ^$(LIBSIGC_LIB) vs^$(VSVER)\^$(CFG)\^$(PLAT)\$(SIGC_EX_INTDIR)\%~ns.obj>>sigc.mak & @echo. link ^$(LDFLAGS) ^$** /out:^$@>>sigc.mak & @echo.>>sigc.mak]
!endif

!if [for %s in (..\tests\*.cc) do @if not "%~ns" == "testutilities" echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns-static.exe: ^$(LIBSIGC_LIB) vs^$(VSVER)\^$(CFG)\^$(PLAT)\$(SIGC_TESTS_INTDIR)\%~ns.obj vs^$(VSVER)\^$(CFG)\^$(PLAT)\$(SIGC_TESTS_INTDIR)\testutilities.obj>>sigc.mak & @echo. link ^$(LDFLAGS) ^$** /out:^$@>>sigc.mak & @echo.>>sigc.mak]
!endif
# end of static executables
!else
# start of shared executables
!if [for %d in (examples tests) do @call create-lists.bat header sigc.mak libsigc_%d & @(for %s in (..\%d\*.cc) do @if not "%~ns" == "testutilities" if not "%~ns" == "benchmark" call create-lists.bat file sigc.mak vs$(VSVER)\$(CFG)\$(PLAT)\%~ns.exe) & @call create-lists.bat footer sigc.mak]
!endif

Expand All @@ -56,13 +78,16 @@ NULL=
!if [for %d in (examples tests) do @for %s in (..\%d\*.cc) do @if not "%~ns" == "benchmark" echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\sigc-%d\%~ns.obj: %s>>sigc.mak & @echo. @if not exist ^$(@D)\ md ^$(@D)>>sigc.mak & @echo. ^$(CXX) ^$(SIGCPP_CFLAGS) /Fo^$(@D)\ /Fd^$(@D)\ ^$** /c>>sigc.mak & @echo.>>sigc.mak]
!endif

!if [for %s in (..\tests\benchmark.cc) do @echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\sigc-tests\%~ns.obj: %s>>sigc.mak & @echo. @if not exist ^$(@D)\ md ^$(@D)>>sigc.mak & @echo. ^$(CXX) ^$(SIGCPP_BENCHMARK_CFLAGS) /Fo^$(@D)\ /Fd^$(@D)\ ^$** /c>>sigc.mak & @echo.>>sigc.mak]
!if [for %s in (..\examples\*.cc) do @echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe: ^$(LIBSIGC_LIB) vs^$(VSVER)\^$(CFG)\^$(PLAT)\$(SIGC_EX_INTDIR)\%~ns.obj>>sigc.mak & @echo. link ^$(LDFLAGS) ^$** /out:^$@>>sigc.mak & @echo.>>sigc.mak]
!endif

!if [for %s in (..\tests\*.cc) do @if not "%~ns" == "testutilities" echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe: ^$(LIBSIGC_LIB) vs^$(VSVER)\^$(CFG)\^$(PLAT)\$(SIGC_TESTS_INTDIR)\%~ns.obj vs^$(VSVER)\^$(CFG)\^$(PLAT)\$(SIGC_TESTS_INTDIR)\testutilities.obj>>sigc.mak & @echo. link ^$(LDFLAGS) ^$** /out:^$@>>sigc.mak & @echo.>>sigc.mak]
!endif

!if [for %s in (..\examples\*.cc) do @echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe: ^$(LIBSIGC_LIB) vs^$(VSVER)\^$(CFG)\^$(PLAT)\sigc-examples\%~ns.obj>>sigc.mak & @echo. link ^$(LDFLAGS) ^$** /out:^$@>>sigc.mak & @echo.>>sigc.mak]
# end of shared executables
!endif

!if [for %s in (..\tests\*.cc) do @if not "%~ns" == "testutilities" echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe: ^$(LIBSIGC_LIB) vs^$(VSVER)\^$(CFG)\^$(PLAT)\sigc-tests\%~ns.obj vs^$(VSVER)\^$(CFG)\^$(PLAT)\sigc-tests\testutilities.obj>>sigc.mak & @echo. link ^$(LDFLAGS) ^$** /out:^$@>>sigc.mak & @echo.>>sigc.mak]
!if [for %s in (..\tests\benchmark.cc) do @echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\$(SIGC_TESTS_INTDIR)\%~ns.obj: %s>>sigc.mak & @echo. @if not exist ^$(@D)\ md ^$(@D)>>sigc.mak & @echo. ^$(CXX) ^$(SIGCPP_BENCHMARK_CFLAGS) /Fo^$(@D)\ /Fd^$(@D)\ ^$** /c>>sigc.mak & @echo.>>sigc.mak]
!endif

!include sigc.mak
Expand Down
8 changes: 7 additions & 1 deletion MSVC_NMake/info-msvc.mak
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ all-build-info:
@echo Build info
@echo ---------
@echo Build Type: $(CFG)
@if not "$(STATIC)" == "" echo Library Build Type: static
@if "$(STATIC)" == "" echo Library Build Type: DLL

help:
@echo.
@echo ==============================
@echo Building libsigc++ Using NMake
@echo ==============================
@echo nmake /f Makefile.vc CFG=[release^|debug] ^<PREFIX=PATH^>
@echo nmake /f Makefile.vc CFG=[release^|debug] ^<PREFIX=PATH^> ^<STATIC=1^>
@echo.
@echo Where:
@echo ------
Expand All @@ -24,6 +26,10 @@ help:
@echo where ^$(short_vs_ver) is 15 for VS 2017 and so on; and
@echo ^$(platform) is Win32 for 32-bit builds and x64 for x64 builds.
@echo.
@echo STATIC: Optional, enable to build static libsigc++. Define
@echo LIBSIGCXX_STATIC in the compiler flags to use the static build of
@echo libsigc++.
@echo.
@echo ======
@echo A 'clean' target is supported to remove all generated files, intermediate
@echo object files and binaries for the specified configuration.
Expand Down
6 changes: 3 additions & 3 deletions MSVC_NMake/install.mak
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ install: all
@if not exist $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\ @md $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors
@if not exist $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\functors\ @md $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\functors
@if not exist $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\tuple-utils\ @md $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\tuple-utils
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).dll $(PREFIX)\bin
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).pdb $(PREFIX)\bin
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib $(PREFIX)\lib
@if "$(STATIC)" == "" copy /b $(LIBSIGC_DLL) $(PREFIX)\bin
@if "$(STATIC)" == "" copy /b $(LIBSIGC_DLL:.dll=.pdb) $(PREFIX)\bin
@copy /b $(LIBSIGC_LIB) $(PREFIX)\lib
@copy "..\sigc++\sigc++.h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\"
@for %h in ($(LIBSIGC_INT_HDRS)) do @copy "..\sigc++\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h"
@if exist sigc++config.h copy "sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\"
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ AS_IF([test "x$enable_benchmark" = xyes],[
AX_BOOST_TIMER
])

AC_SUBST(MSVC_STATIC_CXXFLAG, '')

AC_CONFIG_FILES([Makefile
${SIGCXX_MODULE_NAME}.pc:sigc++.pc.in
${SIGCXX_MODULE_NAME}-uninstalled.pc:sigc++-uninstalled.pc.in
Expand Down
17 changes: 17 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ cpp_compiler = meson.get_compiler('cpp')
is_msvc = cpp_compiler.get_id() == 'msvc'
python3 = find_program('python3', version: '>=3.5')

# MSVC: We currently do not support shared and static builds at the,
# same time, since we need different defines/cflags for proper
# linking.
if is_msvc
if get_option('default_library') == 'both'
error('-Ddefault_library=both is currently not supported for Visual Studio')
endif
is_msvc_static = get_option('default_library') == 'static'
else
is_msvc_static = false
endif

# Do we build from a git repository?
# Suppose we do if and only if the meson.build file is tracked by git.
cmd_py = '''
Expand Down Expand Up @@ -181,6 +193,7 @@ add_project_arguments(warning_flags, language: 'cpp')

# MSVC: Ignore warnings that aren't really harmful, but make those
# that should not be overlooked stand out.
static_cxxflag = '-DLIBSIGCXX_STATIC'
if is_msvc
disable_warnings_list = [
'/EHsc', # avoid warnings caused by exception handling model used
Expand All @@ -204,6 +217,9 @@ if is_msvc
cpp_compiler.get_supported_arguments(disable_warnings_list),
language: 'cpp'
)
if is_msvc_static
add_project_arguments(static_cxxflag, language: 'cpp')
endif
endif

# Configure files
Expand All @@ -224,6 +240,7 @@ endif
pkg_conf_data.set('SIGCXX_MAJOR_VERSION', sigcxx_major_version)
pkg_conf_data.set('SIGCXX_MINOR_VERSION', sigcxx_minor_version)
pkg_conf_data.set('SIGCXX_MICRO_VERSION', sigcxx_micro_version)
pkg_conf_data.set('MSVC_STATIC_CXXFLAG', is_msvc_static ? static_cxxflag : '')

configure_file(
input: 'sigc++.pc.in',
Expand Down
2 changes: 1 addition & 1 deletion sigc++.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ Description: Typesafe signal and callback system for C++
Version: @PACKAGE_VERSION@
URL: https://libsigcplusplus.github.io/libsigcplusplus/
Libs: -L${libdir} -lsigc-@SIGCXX_API_VERSION@
Cflags: -I${includedir}/sigc++-@SIGCXX_API_VERSION@ -I${libdir}/sigc++-@SIGCXX_API_VERSION@/include
Cflags: -I${includedir}/sigc++-@SIGCXX_API_VERSION@ -I${libdir}/sigc++-@SIGCXX_API_VERSION@/include @MSVC_STATIC_CXXFLAG@
8 changes: 5 additions & 3 deletions sigc++/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ extra_sigc_objects = []

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

# Build the .rc file for Windows builds and link to it
if host_machine.system() == 'windows'
windows = import('windows')
sigc_res = windows.compile_resources(sigc_rc)
extra_sigc_objects += sigc_res
if get_option('default_library') == 'shared'
sigc_res = windows.compile_resources(sigc_rc)
extra_sigc_objects += sigc_res
endif
endif

extra_include_dirs = ['..']
Expand Down
6 changes: 4 additions & 2 deletions sigc++config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
# if defined(_MSC_VER)
# define SIGC_MSC 1
# define SIGC_WIN32 1
# define SIGC_DLL 1
# ifndef LIBSIGCXX_STATIC
# define SIGC_DLL 1
# endif
# elif defined(__CYGWIN__)
# define SIGC_CONFIGURE 1
# elif defined(__MINGW32__)
Expand Down Expand Up @@ -54,7 +56,7 @@
#endif /* !SIGC_MSC */

#ifdef SIGC_DLL
# if defined(SIGC_BUILD) && defined(_WINDLL)
# ifdef SIGC_BUILD
# define SIGC_API __declspec(dllexport)
# elif !defined(SIGC_BUILD)
# define SIGC_API __declspec(dllimport)
Expand Down
4 changes: 3 additions & 1 deletion sigc++config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
#if defined(_MSC_VER)
#define SIGC_MSC 1
#define SIGC_WIN32 1
#ifndef LIBSIGCXX_STATIC
#define SIGC_DLL 1
#endif
#elif defined(__CYGWIN__)
#define SIGC_CONFIGURE 1
#elif defined(__MINGW32__)
Expand Down Expand Up @@ -54,7 +56,7 @@
#endif /* !SIGC_MSC */

#ifdef SIGC_DLL
#if defined(SIGC_BUILD) && defined(_WINDLL)
#ifdef SIGC_BUILD
#define SIGC_API __declspec(dllexport)
#elif !defined(SIGC_BUILD)
#define SIGC_API __declspec(dllimport)
Expand Down
4 changes: 3 additions & 1 deletion sigc++config.h.meson
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#if defined(_MSC_VER)
#define SIGC_MSC 1
#define SIGC_WIN32 1
#ifndef LIBSIGCXX_STATIC
#define SIGC_DLL 1
#endif
#elif defined(__CYGWIN__)
#define SIGC_CONFIGURE 1
#elif defined(__MINGW32__)
Expand Down Expand Up @@ -57,7 +59,7 @@
#endif /* !SIGC_MSC */

#ifdef SIGC_DLL
#if defined(SIGC_BUILD) && defined(_WINDLL)
#ifdef SIGC_BUILD
#define SIGC_API __declspec(dllexport)
#elif !defined(SIGC_BUILD)
#define SIGC_API __declspec(dllimport)
Expand Down