From 81d7445a553b2f0d36b12fed41f100ecdd71c487 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 26 Dec 2019 14:50:27 +0800 Subject: [PATCH 1/5] meson.build: Fix 'meson dist' on Windows Since we are assured that we are using Python 3.x on when we run Meson, we do not really need to look for the 'python3' executable, but we could just use whatever Python interpreter that is used to run Meson. This will fix situations where it is commonly the case where we may have multiple Python 3.x installations on Windows (www.python.org, and those from Cygwin/mingw-w64), so that Meson really uses one and only one Python installation to run everything that is Python-related, which will thus fix '[meson|ninja] dist' on Visual Studio builds. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index a91e12db..f05c8a0b 100644 --- a/meson.build +++ b/meson.build @@ -39,7 +39,7 @@ project_build_root = meson.current_build_dir() cpp_compiler = meson.get_compiler('cpp') is_msvc = cpp_compiler.get_id() == 'msvc' -python3 = import('python').find_installation('python3') +python3 = import('python').find_installation() python_version = python3.language_version() python_version_req = '>= 3.5' From 911322ca6a8c87bc711e3976ad80e309d87b0a30 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 26 Dec 2019 15:15:39 +0800 Subject: [PATCH 2/5] meson/Windows: Fix builds when builddir is a subdir of source tree It appears that Meson did not construct the paths properly for shutil.copy2() when building in a build directory that is a subdirectory of the sources, when using meson.current_build_dir(), possibly due how path separators are handled. Fix this by constructing the paths using project_build_root / 'MSVC_NMake'. --- MSVC_NMake/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MSVC_NMake/meson.build b/MSVC_NMake/meson.build index 89db786c..e9964ca2 100644 --- a/MSVC_NMake/meson.build +++ b/MSVC_NMake/meson.build @@ -13,5 +13,5 @@ configure_file( cmd_py = ''' import shutil shutil.copy2("@0@", "@1@") -'''.format(project_build_root / 'sigc++config.h', meson.current_build_dir()) +'''.format(project_build_root / 'sigc++config.h', project_build_root / 'MSVC_NMake') meson.add_postconf_script(python3.path(), '-c', cmd_py) From 38e8e679fefb04d0b21f34549a9681c59a53684a Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 27 Dec 2019 10:36:00 +0800 Subject: [PATCH 3/5] meson: Build Windows .rc files on Windows This ensures that on Windows, the version info resources are indeed linked into the libsigc++ DLL. --- MSVC_NMake/meson.build | 2 +- sigc++/meson.build | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/MSVC_NMake/meson.build b/MSVC_NMake/meson.build index e9964ca2..510daa42 100644 --- a/MSVC_NMake/meson.build +++ b/MSVC_NMake/meson.build @@ -3,7 +3,7 @@ # Input: pkg_conf_data, project_build_root, python3 # Output: - -configure_file( +sigc_rc = configure_file( input: 'sigc.rc.in', output: '@BASENAME@', configuration: pkg_conf_data, diff --git a/sigc++/meson.build b/sigc++/meson.build index 3ab7c695..519e3cb1 100644 --- a/sigc++/meson.build +++ b/sigc++/meson.build @@ -69,15 +69,24 @@ install_headers(functors_h_files, subdir: sigcxx_pcname / 'sigc++' / 'functors') install_headers(tuple_utils_h_files, subdir: sigcxx_pcname / 'sigc++' / 'tuple-utils') extra_sigc_cppflags = [] +extra_sigc_objects = [] # Make sure we are exporting the symbols from the DLL if is_msvc extra_sigc_cppflags += ['-DSIGC_BUILD', '-D_WINDLL'] 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 +endif + extra_include_dirs = ['..'] sigcxx_library = library(sigcxx_pcname, source_cc_files, + extra_sigc_objects, version: sigcxx_libversion, include_directories: extra_include_dirs, cpp_args: extra_sigc_cppflags, From 159cd33be0e2d0e074f4681a639084aaa182eaa4 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 27 Dec 2019 15:16:49 +0800 Subject: [PATCH 4/5] build: Support NMake builds from Meson tarballs This adds the MSVC files in MSVC_NMake/ that are generated during Meson's configure step to the generated release tarball. The NMake Makefiles are updated so that they will be able to find files that are now in untracked/MSVC_NMake, when a release tarball is generated with Meson. --- MSVC_NMake/build-rules-msvc.mak | 3 +++ MSVC_NMake/config-msvc.mak | 2 +- MSVC_NMake/install.mak | 3 ++- MSVC_NMake/meson.build | 16 ++++++++++++ Makefile.am | 1 + tools/handle-built-files.py | 43 +++++++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 tools/handle-built-files.py diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak index 47d385d5..6097d07e 100644 --- a/MSVC_NMake/build-rules-msvc.mak +++ b/MSVC_NMake/build-rules-msvc.mak @@ -31,6 +31,9 @@ $(LIBSIGC_LIB): $(LIBSIGC_DLL) {.}.rc{$(CFG)\$(PLAT)\libsigcpp\}.res: rc /fo$@ $< +{..\untracked\MSVC_NMake\}.rc{$(CFG)\$(PLAT)\libsigcpp\}.res: + rc /fo$@ $< + # Rules for linking DLLs # Format is as follows (the mt command is needed for MSVC 2005/2008 builds): # $(dll_name_with_path): $(dependent_libs_files_objects_and_items) diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak index b091de0f..c3d957ce 100644 --- a/MSVC_NMake/config-msvc.mak +++ b/MSVC_NMake/config-msvc.mak @@ -16,7 +16,7 @@ LIBSIGC_DEBUG_SUFFIX = LIBSIGCPP_DEFINES = /DSIGC_BUILD /D_WINDLL -SIGCPP_BASE_CFLAGS = /I.. /I. /wd4530 /std:c++17 $(CFLAGS) +SIGCPP_BASE_CFLAGS = /I.. /I. /I..\untracked\MSVC_NMake /wd4530 /std:c++17 /EHsc $(CFLAGS) LIBSIGC_INT_SOURCES = $(sigc_sources_cc:/=\) LIBSIGC_INT_HDRS = $(sigc_public_h:/=\) diff --git a/MSVC_NMake/install.mak b/MSVC_NMake/install.mak index 4903a251..eea26822 100644 --- a/MSVC_NMake/install.mak +++ b/MSVC_NMake/install.mak @@ -11,4 +11,5 @@ install: all @copy /b $(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).pdb $(PREFIX)\bin @copy /b $(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib $(PREFIX)\lib @for %h in ($(LIBSIGC_INT_HDRS)) do @copy "..\sigc++\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h" - @copy "sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\" + @if exist sigc++config.h copy "sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\" + @if exist ..\untracked\MSVC_NMake\sigc++config.h copy "..\untracked\MSVC_NMake\sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\" diff --git a/MSVC_NMake/meson.build b/MSVC_NMake/meson.build index 510daa42..a799535c 100644 --- a/MSVC_NMake/meson.build +++ b/MSVC_NMake/meson.build @@ -15,3 +15,19 @@ import shutil shutil.copy2("@0@", "@1@") '''.format(project_build_root / 'sigc++config.h', project_build_root / 'MSVC_NMake') meson.add_postconf_script(python3.path(), '-c', cmd_py) + +untracked_msvc_nmake = 'untracked' / 'MSVC_NMake' +handle_built_files = project_source_root / 'tools' / 'handle-built-files.py' + +if not meson.is_subproject() + # Distribute built files. + # (add_dist_script() is not allowed in a subproject) + + meson.add_dist_script( + python3.path(), dist_cmd, + python3.path(), handle_built_files, 'dist_gen_msvc_files', + meson.current_build_dir(), + untracked_msvc_nmake, + project_build_root / 'sigc++config.h', meson.current_build_dir() / 'sigc.rc', + ) +endif diff --git a/Makefile.am b/Makefile.am index 76d04829..80b41368 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,7 @@ EXTRA_DIST = \ sigc++/meson.build \ tests/meson.build \ tools/dist-cmd.py \ + tools/handle-built-files.py \ tools/tutorial-custom-cmd.py \ untracked/README diff --git a/tools/handle-built-files.py b/tools/handle-built-files.py new file mode 100644 index 00000000..d6957efe --- /dev/null +++ b/tools/handle-built-files.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 + +# External command, intended to be called with run_command(), custom_target(), +# meson.add_install_script() and meson.add_dist_script(). + +# argv[1] argv[2:] +# handle-built-files.py ... + +import os +import sys +import shutil +import subprocess +from pathlib import Path + +subcommand = sys.argv[1] + +# Invoked from meson.add_dist_script(). +def dist_built_files(is_msvc_files=False): + # argv[2] argv[3] argv[4:] + # ... + + # is an absolute path in the build directory or source directory. + # is a distribution directory, relative to MESON_DIST_ROOT. + built_h_cc_dir = sys.argv[2] + dist_dir_root = os.path.join(os.getenv('MESON_DIST_ROOT'), sys.argv[3]) + dist_dir = dist_dir_root + + # Distribute .h and .cc files built from .m4 files, or generated MSVC files. + for file in sys.argv[4:]: + if not is_msvc_files: + dist_dir = os.path.join(dist_dir_root, os.path.dirname(file)) + + # Create the distribution directory, if it does not exist. + os.makedirs(dist_dir, exist_ok=True) + + shutil.copy(os.path.join(built_h_cc_dir, file), dist_dir) + return 0 + +# ----- Main ----- +if subcommand == 'dist_gen_msvc_files': + sys.exit(dist_built_files(True)) +print(sys.argv[0], ': illegal subcommand,', subcommand) +sys.exit(1) From f35b5454b2b26a7c57d4171232b667e125ed12d4 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 27 Dec 2019 16:05:01 +0800 Subject: [PATCH 5/5] NMake: Split outdir by toolset version This makes it less likely for one to accidently mix binaries linked to different CRTs in a single buildtree. --- MSVC_NMake/build-rules-msvc.mak | 66 ++++++++++++++++---------------- MSVC_NMake/config-msvc.mak | 6 +-- MSVC_NMake/create-lists-msvc.mak | 8 ++-- MSVC_NMake/detectenv-msvc.mak | 3 ++ MSVC_NMake/generate-msvc.mak | 4 +- MSVC_NMake/install.mak | 6 +-- 6 files changed, 50 insertions(+), 43 deletions(-) diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak index 6097d07e..9911a478 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{$(CFG)\$(PLAT)\libsigcpp\}.obj:: - $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(CFG)\$(PLAT)\libsigcpp\ /c @<< +{..\sigc++\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj: + $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<< $< << -{..\sigc++\functors\}.cc{$(CFG)\$(PLAT)\libsigcpp\}.obj:: - $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(CFG)\$(PLAT)\libsigcpp\ /c @<< +{..\sigc++\functors\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj: + $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<< $< << -$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj: $(CFG)\$(PLAT)\libsigcpp-tests ..\tests\testutilities.cc - $(CXX) $(SIGCPP_CFLAGS) /Fo$@ /c ..\tests\testutilities.cc +vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj: vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests ..\tests\testutilities.cc + $(CXX) $(SIGCPP_CFLAGS) /Fo$@ /Fd$(@D)\ /c ..\tests\testutilities.cc # Rules for building .lib files $(LIBSIGC_LIB): $(LIBSIGC_DLL) -{.}.rc{$(CFG)\$(PLAT)\libsigcpp\}.res: +{.}.rc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.res: rc /fo$@ $< -{..\untracked\MSVC_NMake\}.rc{$(CFG)\$(PLAT)\libsigcpp\}.res: +{..\untracked\MSVC_NMake\}.rc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.res: rc /fo$@ $< # Rules for linking DLLs @@ -41,7 +41,7 @@ $(LIBSIGC_LIB): $(LIBSIGC_DLL) # $(dependent_objects) # << # @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2 -$(LIBSIGC_DLL): $(CFG)\$(PLAT)\libsigcpp $(libsigcpp_dll_OBJS) +$(LIBSIGC_DLL): vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp $(libsigcpp_dll_OBJS) link /DLL $(LDFLAGS) /implib:$(LIBSIGC_LIB) -out:$@ @<< $(libsigcpp_dll_OBJS) << @@ -55,36 +55,38 @@ $(libsigcpp_dll_OBJS) # << # @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1 -{..\examples\}.cc{$(CFG)\$(PLAT)\}.exe: - @if not exist $(CFG)\$(PLAT)\libsigcpp-ex $(MAKE) -f Makefile.vc CFG=$(CFG) $(CFG)\$(PLAT)\libsigcpp-ex +{..\examples\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\}.exe: + @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-ex $(MAKE) -f Makefile.vc CFG=$(CFG) vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-ex @if not exist $(LIBSIGC_LIB) $(MAKE) -f Makefile.vc CFG=$(CFG) $(LIBSIGC_LIB) - $(CXX) $(SIGCPP_CFLAGS) /Fo$(CFG)\$(PLAT)\libsigcpp-ex\ $< /Fe$@ /link $(LDFLAGS) $(LIBSIGC_LIB) + $(CXX) $(SIGCPP_CFLAGS) /Fo$(@D)\libsigcpp-ex\ /Fd$(@D)\libsigcpp-ex\ $< /Fe$@ /link $(LDFLAGS) $(LIBSIGC_LIB) @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1 -{..\tests\}.cc{$(CFG)\$(PLAT)\}.exe: +{..\tests\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\}.exe: @if not exist $(LIBSIGC_LIB) $(MAKE) -f Makefile.vc CFG=$(CFG) $(LIBSIGC_LIB) - @if not exist $(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj $(MAKE) -f Makefile.vc CFG=$(CFG) $(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj - $(CXX) $(SIGCPP_CFLAGS) /Fo$(CFG)\$(PLAT)\libsigcpp-tests\ $< /Fe$@ /link $(LDFLAGS) $(LIBSIGC_LIB) $(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj + @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj $(MAKE) -f Makefile.vc CFG=$(CFG) vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj + $(CXX) $(SIGCPP_CFLAGS) /Fo$(@D)\libsigcpp-tests\ /Fd$(@D)\libsigcpp-tests\ $< /Fe$@ /link $(LDFLAGS) $(LIBSIGC_LIB) vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1 -$(CFG)\$(PLAT)\libsigc++-benchmark.exe: ..\tests\benchmark.cc +vs$(VSVER)\$(CFG)\$(PLAT)\libsigc++-benchmark.exe: ..\tests\benchmark.cc @if not exist $(LIBSIGC_LIB) $(MAKE) -f Makefile.vc CFG=$(CFG) $(LIBSIGC_LIB) - @if not exist $(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj $(MAKE) -f Makefile.vc CFG=$(CFG) $(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj - $(CXX) $(SIGCPP_BENCHMARK_CFLAGS) /Fo$(CFG)\$(PLAT)\libsigcpp-tests\ ..\tests\benchmark.cc /Fe$@ /link $(LDFLAGS) $(LIBSIGC_LIB) $(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj + @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj $(MAKE) -f Makefile.vc CFG=$(CFG) vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj + $(CXX) $(SIGCPP_BENCHMARK_CFLAGS) /Fo$(@D)\libsigcpp-tests\ /Fd$(@D)\libsigcpp-tests\ ..\tests\benchmark.cc /Fe$@ /link $(LDFLAGS) $(LIBSIGC_LIB) vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1 clean: - @-del /f /q $(CFG)\$(PLAT)\*.exe - @-del /f /q $(CFG)\$(PLAT)\*.dll - @-del /f /q $(CFG)\$(PLAT)\*.pdb - @-del /f /q $(CFG)\$(PLAT)\*.ilk - @-del /f /q $(CFG)\$(PLAT)\*.exp - @-del /f /q $(CFG)\$(PLAT)\*.lib - @-if exist $(CFG)\$(PLAT)\libsigcpp-tests del /f /q $(CFG)\$(PLAT)\libsigcpp-tests\*.obj - @-del /f /q $(CFG)\$(PLAT)\libsigcpp-ex\*.obj - @-del /f /q $(CFG)\$(PLAT)\libsigcpp\*.res - @-del /f /q $(CFG)\$(PLAT)\libsigcpp\*.obj - @-if exist $(CFG)\$(PLAT)\libsigcpp-tests rd $(CFG)\$(PLAT)\libsigcpp-tests - @-rd $(CFG)\$(PLAT)\libsigcpp-ex - @-rd $(CFG)\$(PLAT)\libsigcpp - @-del /f /q vc$(PDBVER)0.pdb + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exe + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.dll + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.pdb + @-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)\libsigcpp-tests del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests\*.obj + @-if exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests\*.pdb + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-ex\*.obj + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-ex\*.pdb + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\*.res + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\*.obj + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\*.pdb + @-if exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests + @-rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-ex + @-rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak index c3d957ce..8783cc0e 100644 --- a/MSVC_NMake/config-msvc.mak +++ b/MSVC_NMake/config-msvc.mak @@ -29,11 +29,11 @@ LIBSIGCPP_CFLAGS = $(SIGCPP_CFLAGS) $(LIBSIGCPP_DEFINES) LIBSIGC_LIBNAME = sigc-vc$(VSVER)0$(LIBSIGC_DEBUG_SUFFIX)-$(LIBSIGC_MAJOR_VERSION)_$(LIBSIGC_MINOR_VERSION) -LIBSIGC_DLL = $(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).dll -LIBSIGC_LIB = $(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib +LIBSIGC_DLL = vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).dll +LIBSIGC_LIB = vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib # Note that building the benchmark requires Boost! -libsigc_bench = $(CFG)\$(PLAT)\libsigc++-benchmark.exe +libsigc_bench = vs$(VSVER)\$(CFG)\$(PLAT)\libsigc++-benchmark.exe # 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 36924fa2..e1efb498 100644 --- a/MSVC_NMake/create-lists-msvc.mak +++ b/MSVC_NMake/create-lists-msvc.mak @@ -38,10 +38,10 @@ NULL= !if [call create-lists.bat header libsigcpp.mak libsigcpp_dll_OBJS] !endif -!if [for %c in ($(sigc_sources_cc)) do @if "%~xc" == ".cc" @call create-lists.bat file libsigcpp.mak ^$(CFG)\^$(PLAT)\libsigcpp\%~nc.obj] +!if [for %c in ($(sigc_sources_cc)) do @if "%~xc" == ".cc" @call create-lists.bat file libsigcpp.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\libsigcpp\%~nc.obj] !endif -!if [@call create-lists.bat file libsigcpp.mak ^$(CFG)\^$(PLAT)\libsigcpp\sigc.res] +!if [@call create-lists.bat file libsigcpp.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\libsigcpp\sigc.res] !endif !if [call create-lists.bat footer libsigcpp.mak] @@ -50,7 +50,7 @@ NULL= !if [call create-lists.bat header libsigcpp.mak libsigc_ex] !endif -!if [for %s in (..\examples\*.cc) do @call create-lists.bat file libsigcpp.mak ^$(CFG)\^$(PLAT)\%~ns.exe] +!if [for %s in (..\examples\*.cc) do @call create-lists.bat file libsigcpp.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe] !endif !if [call create-lists.bat footer libsigcpp.mak] @@ -61,7 +61,7 @@ NULL= # Skipping testutilities.cc: Not to be built as a .exe, but is a common dependency for the tests # benchmark: Not built on default; requires Boost -!if [for %s in (..\tests\*.cc) do @if not "%~ns" == "testutilities" if not "%~ns" == "benchmark" @call create-lists.bat file libsigcpp.mak ^$(CFG)\^$(PLAT)\%~ns.exe] +!if [for %s in (..\tests\*.cc) do @if not "%~ns" == "testutilities" if not "%~ns" == "benchmark" @call create-lists.bat file libsigcpp.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe] !endif !if [call create-lists.bat footer libsigcpp.mak] diff --git a/MSVC_NMake/detectenv-msvc.mak b/MSVC_NMake/detectenv-msvc.mak index e5dadaf8..c421f01e 100644 --- a/MSVC_NMake/detectenv-msvc.mak +++ b/MSVC_NMake/detectenv-msvc.mak @@ -121,6 +121,9 @@ CFLAGS_ADD = /MD /O2 /GL /MP !if "$(VSVER)" != "9" CFLAGS_ADD = $(CFLAGS_ADD) /d2Zi+ !endif +!if $(VSVER) >= 14 +CFLAGS_ADD = $(CFLAGS_ADD) /utf-8 +!endif !else CFLAGS_ADD = /MDd /Od !endif diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak index 5f9496e3..6af27f48 100644 --- a/MSVC_NMake/generate-msvc.mak +++ b/MSVC_NMake/generate-msvc.mak @@ -4,5 +4,7 @@ # one is maintaining the NMake build files. # Create the build directories -$(CFG)\$(PLAT)\libsigcpp $(CFG)\$(PLAT)\libsigcpp-ex $(CFG)\$(PLAT)\libsigcpp-tests: +vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp \ +vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-ex \ +vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests: @-mkdir $@ diff --git a/MSVC_NMake/install.mak b/MSVC_NMake/install.mak index eea26822..3be8e4be 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\ @mkdir $(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\ @mkdir $(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\ @mkdir $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\tuple-utils - @copy /b $(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).dll $(PREFIX)\bin - @copy /b $(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).pdb $(PREFIX)\bin - @copy /b $(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib $(PREFIX)\lib + @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 @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\" @if exist ..\untracked\MSVC_NMake\sigc++config.h copy "..\untracked\MSVC_NMake\sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\"