diff --git a/CMakeLists.txt b/CMakeLists.txt index 5741400..c4b291c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/MSVC_NMake/README.txt b/MSVC_NMake/README.txt index d3ba16f..5438335 100644 --- a/MSVC_NMake/README.txt +++ b/MSVC_NMake/README.txt @@ -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 diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak index fe5a587..74e51d9 100644 --- a/MSVC_NMake/build-rules-msvc.mak +++ b/MSVC_NMake/build-rules-msvc.mak @@ -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$@ $< @@ -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): @@ -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) diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak index 86ee18b..52c72a0 100644 --- a/MSVC_NMake/config-msvc.mak +++ b/MSVC_NMake/config-msvc.mak @@ -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:/=\) @@ -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 diff --git a/MSVC_NMake/create-lists-msvc.mak b/MSVC_NMake/create-lists-msvc.mak index 2691d88..0689c89 100644 --- a/MSVC_NMake/create-lists-msvc.mak +++ b/MSVC_NMake/create-lists-msvc.mak @@ -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 @@ -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 diff --git a/MSVC_NMake/info-msvc.mak b/MSVC_NMake/info-msvc.mak index 30d1dba..76b2341 100644 --- a/MSVC_NMake/info-msvc.mak +++ b/MSVC_NMake/info-msvc.mak @@ -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] ^ + @echo nmake /f Makefile.vc CFG=[release^|debug] ^ ^ @echo. @echo Where: @echo ------ @@ -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. diff --git a/MSVC_NMake/install.mak b/MSVC_NMake/install.mak index f9f07e2..72b4402 100644 --- a/MSVC_NMake/install.mak +++ b/MSVC_NMake/install.mak @@ -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\" diff --git a/configure.ac b/configure.ac index 2256657..52237da 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/meson.build b/meson.build index e4630fe..4c975d4 100644 --- a/meson.build +++ b/meson.build @@ -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 = ''' @@ -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 @@ -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 @@ -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', diff --git a/sigc++.pc.in b/sigc++.pc.in index 16a5514..e162f2f 100644 --- a/sigc++.pc.in +++ b/sigc++.pc.in @@ -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@ diff --git a/sigc++/meson.build b/sigc++/meson.build index 9d9561f..d9c1231 100644 --- a/sigc++/meson.build +++ b/sigc++/meson.build @@ -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 = ['..'] diff --git a/sigc++config.h.cmake b/sigc++config.h.cmake index 74d348a..2c7e943 100644 --- a/sigc++config.h.cmake +++ b/sigc++config.h.cmake @@ -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__) @@ -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) diff --git a/sigc++config.h.in b/sigc++config.h.in index a82a86b..573bc36 100644 --- a/sigc++config.h.in +++ b/sigc++config.h.in @@ -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__) @@ -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) diff --git a/sigc++config.h.meson b/sigc++config.h.meson index 47cbd80..3027b26 100644 --- a/sigc++config.h.meson +++ b/sigc++config.h.meson @@ -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__) @@ -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)