summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2019-12-27 13:06:22 +0800
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2019-12-29 18:12:25 +0100
commit007e87b93ecab692a80f3dff953de01359be6895 (patch)
tree6c2a17aebca8177c779e28ff772a324f8dee178f
parent155ff459b9398248ec042194958edce82810c0fd (diff)
downloadsigc++-007e87b93ecab692a80f3dff953de01359be6895.tar.gz
build: Support NMake builds from Meson tarballs
This adds inference rules to the NMake Makefiles to also look for the sources that are in untracked/, and to ensure that the generated MSVC build files (sigc++-config.h and sigc.rc) are copied into untracked/MSVC_NMake, so that they can be built properly even with NMake.
-rw-r--r--MSVC_NMake/build-rules-msvc.mak8
-rw-r--r--MSVC_NMake/config-msvc.mak4
-rw-r--r--MSVC_NMake/install.mak11
-rw-r--r--MSVC_NMake/meson.build20
-rw-r--r--sigc++/meson.build2
-rwxr-xr-xtools/handle-built-files.py10
6 files changed, 42 insertions, 13 deletions
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
index 4bc9764..128992d 100644
--- a/MSVC_NMake/build-rules-msvc.mak
+++ b/MSVC_NMake/build-rules-msvc.mak
@@ -28,6 +28,11 @@ $<
$<
<<
+{..\untracked\sigc++\adaptors\lambda\}.cc{$(CFG)\$(PLAT)\libsigcpp\}.obj::
+ $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(CFG)\$(PLAT)\libsigcpp\ /c @<<
+$<
+<<
+
$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj: $(CFG)\$(PLAT)\libsigcpp-tests ..\tests\testutilities.cc
$(CXX) $(SIGCPP_CFLAGS) /Fo$@ /c ..\tests\testutilities.cc
# Rules for building .lib files
@@ -36,6 +41,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 3a933ac..3cddbde 100644
--- a/MSVC_NMake/config-msvc.mak
+++ b/MSVC_NMake/config-msvc.mak
@@ -1,6 +1,6 @@
# NMake Makefile portion for enabling features for Windows builds
-# These are the base minimum libraries required for building gjs.
+# These are the base minimum libraries required for building libsigc++.
BASE_INCLUDES = /I$(PREFIX)\include
# Please do not change anything beneath this line unless maintaining the NMake Makefiles
@@ -16,7 +16,7 @@ LIBSIGC_DEBUG_SUFFIX =
LIBSIGCPP_DEFINES = /DSIGC_BUILD /D_WINDLL
-SIGCPP_BASE_CFLAGS = /I.. /I. /wd4530 $(CFLAGS)
+SIGCPP_BASE_CFLAGS = /I.. /I. /I..\untracked /I..\MSVC_NMake /wd4530 /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 c0d76c8..6c1857e 100644
--- a/MSVC_NMake/install.mak
+++ b/MSVC_NMake/install.mak
@@ -12,8 +12,9 @@ install: all
@copy /b $(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).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"
- @for %h in ($(base_built_h)) do @copy "..\sigc++\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h"
- @for %h in ($(functors_built_h)) do @copy "..\sigc++\functors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\functors\%h"
- @for %h in ($(adaptors_built_h)) do @copy "..\sigc++\adaptors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\%h"
- @for %h in ($(lambda_built_h)) do @copy "..\sigc++\adaptors\lambda\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\lambda\%h"
- @copy "sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\"
+ @for %d in (sigc++ untracked\sigc++) do @(for %h in ($(base_built_h)) do @if exist ..\%d\%h copy "..\%d\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h")
+ @for %d in (sigc++ untracked\sigc++) do @(for %h in ($(functors_built_h)) do @if exist ..\%d\functors\%h copy "..\%d\functors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\functors\%h")
+ @for %d in (sigc++ untracked\sigc++) do @(for %h in ($(adaptors_built_h)) do @if exist ..\%d\adaptors\%h copy "..\%d\adaptors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\%h")
+ @for %d in (sigc++ untracked\sigc++) do @(for %h in ($(lambda_built_h)) do @if exist ..\%d\adaptors\lambda\%h copy "..\%d\adaptors\lambda\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\lambda\%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\"
diff --git a/MSVC_NMake/meson.build b/MSVC_NMake/meson.build
index 510daa4..8eba3dc 100644
--- a/MSVC_NMake/meson.build
+++ b/MSVC_NMake/meson.build
@@ -9,9 +9,27 @@ sigc_rc = configure_file(
configuration: pkg_conf_data,
)
+generated_sigc_config_h_orig = project_build_root / 'sigc++config.h'
+
# Copy the generated configuration header into the MSVC project directory.
cmd_py = '''
import shutil
shutil.copy2("@0@", "@1@")
-'''.format(project_build_root / 'sigc++config.h', project_build_root / 'MSVC_NMake')
+'''.format(generated_sigc_config_h_orig, 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,
+ generated_sigc_config_h_orig, meson.current_build_dir() / 'sigc.rc',
+ )
+endif
diff --git a/sigc++/meson.build b/sigc++/meson.build
index 731df06..b398661 100644
--- a/sigc++/meson.build
+++ b/sigc++/meson.build
@@ -90,8 +90,6 @@ install_headers(functors_h_files, subdir: sigcxx_pcname / 'sigc++' / 'functors')
untracked_sigcxx = 'untracked' / 'sigc++'
src_untracked_sigcxx = project_source_root / untracked_sigcxx
-handle_built_files = project_source_root / 'tools' / 'handle-built-files.py'
-
extra_sigc_cppflags = []
extra_sigc_objects = []
diff --git a/tools/handle-built-files.py b/tools/handle-built-files.py
index 57409f2..59601c5 100755
--- a/tools/handle-built-files.py
+++ b/tools/handle-built-files.py
@@ -73,7 +73,7 @@ def install_built_h_files():
return 0
# Invoked from meson.add_dist_script().
-def dist_built_files():
+def dist_built_files(is_msvc_files=False):
# argv[2] argv[3] argv[4:]
# <built_h_cc_dir> <dist_dir> <built_files>...
@@ -81,10 +81,12 @@ def dist_built_files():
# <dist_dir> 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.
+ # Distribute .h and .cc files built from .m4 files, or generated MSVC files.
for file in sys.argv[4:]:
- dist_dir = os.path.join(dist_dir_root, os.path.dirname(file))
+ 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)
@@ -129,5 +131,7 @@ if subcommand == 'dist_built_files':
sys.exit(dist_built_files())
if subcommand == 'copy_built_files':
sys.exit(copy_built_files())
+if subcommand == 'dist_gen_msvc_files':
+ sys.exit(dist_built_files(True))
print(sys.argv[0], ': illegal subcommand,', subcommand)
sys.exit(1)