Skip to content

Commit 007e87b

Browse files
fanc999-1kjellahl
authored andcommitted
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.
1 parent 155ff45 commit 007e87b

File tree

6 files changed

+42
-13
lines changed

6 files changed

+42
-13
lines changed

MSVC_NMake/build-rules-msvc.mak

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ $<
2828
$<
2929
<<
3030

31+
{..\untracked\sigc++\adaptors\lambda\}.cc{$(CFG)\$(PLAT)\libsigcpp\}.obj::
32+
$(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(CFG)\$(PLAT)\libsigcpp\ /c @<<
33+
$<
34+
<<
35+
3136
$(CFG)\$(PLAT)\libsigcpp-tests\testutilities.obj: $(CFG)\$(PLAT)\libsigcpp-tests ..\tests\testutilities.cc
3237
$(CXX) $(SIGCPP_CFLAGS) /Fo$@ /c ..\tests\testutilities.cc
3338
# Rules for building .lib files
@@ -36,6 +41,9 @@ $(LIBSIGC_LIB): $(LIBSIGC_DLL)
3641
{.}.rc{$(CFG)\$(PLAT)\libsigcpp\}.res:
3742
rc /fo$@ $<
3843

44+
{..\untracked\MSVC_NMake\}.rc{$(CFG)\$(PLAT)\libsigcpp\}.res:
45+
rc /fo$@ $<
46+
3947
# Rules for linking DLLs
4048
# Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
4149
# $(dll_name_with_path): $(dependent_libs_files_objects_and_items)

MSVC_NMake/config-msvc.mak

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NMake Makefile portion for enabling features for Windows builds
22

3-
# These are the base minimum libraries required for building gjs.
3+
# These are the base minimum libraries required for building libsigc++.
44
BASE_INCLUDES = /I$(PREFIX)\include
55

66
# Please do not change anything beneath this line unless maintaining the NMake Makefiles
@@ -16,7 +16,7 @@ LIBSIGC_DEBUG_SUFFIX =
1616

1717
LIBSIGCPP_DEFINES = /DSIGC_BUILD /D_WINDLL
1818

19-
SIGCPP_BASE_CFLAGS = /I.. /I. /wd4530 $(CFLAGS)
19+
SIGCPP_BASE_CFLAGS = /I.. /I. /I..\untracked /I..\MSVC_NMake /wd4530 /EHsc $(CFLAGS)
2020

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

MSVC_NMake/install.mak

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ install: all
1212
@copy /b $(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib $(PREFIX)\lib
1313
@copy "..\sigc++\sigc++.h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\"
1414
@for %h in ($(LIBSIGC_INT_HDRS)) do @copy "..\sigc++\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h"
15-
@for %h in ($(base_built_h)) do @copy "..\sigc++\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h"
16-
@for %h in ($(functors_built_h)) do @copy "..\sigc++\functors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\functors\%h"
17-
@for %h in ($(adaptors_built_h)) do @copy "..\sigc++\adaptors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\%h"
18-
@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"
19-
@copy "sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\"
15+
@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")
16+
@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")
17+
@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")
18+
@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")
19+
@if exist sigc++config.h copy "sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\"
20+
@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\"

MSVC_NMake/meson.build

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,27 @@ sigc_rc = configure_file(
99
configuration: pkg_conf_data,
1010
)
1111

12+
generated_sigc_config_h_orig = project_build_root / 'sigc++config.h'
13+
1214
# Copy the generated configuration header into the MSVC project directory.
1315
cmd_py = '''
1416
import shutil
1517
shutil.copy2("@0@", "@1@")
16-
'''.format(project_build_root / 'sigc++config.h', project_build_root / 'MSVC_NMake')
18+
'''.format(generated_sigc_config_h_orig, project_build_root / 'MSVC_NMake')
1719
meson.add_postconf_script(python3.path(), '-c', cmd_py)
20+
21+
untracked_msvc_nmake = 'untracked' / 'MSVC_NMake'
22+
handle_built_files = project_source_root / 'tools' / 'handle-built-files.py'
23+
24+
if not meson.is_subproject()
25+
# Distribute built files.
26+
# (add_dist_script() is not allowed in a subproject)
27+
28+
meson.add_dist_script(
29+
python3.path(), dist_cmd,
30+
python3.path(), handle_built_files, 'dist_gen_msvc_files',
31+
meson.current_build_dir(),
32+
untracked_msvc_nmake,
33+
generated_sigc_config_h_orig, meson.current_build_dir() / 'sigc.rc',
34+
)
35+
endif

sigc++/meson.build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ install_headers(functors_h_files, subdir: sigcxx_pcname / 'sigc++' / 'functors')
9090
untracked_sigcxx = 'untracked' / 'sigc++'
9191
src_untracked_sigcxx = project_source_root / untracked_sigcxx
9292

93-
handle_built_files = project_source_root / 'tools' / 'handle-built-files.py'
94-
9593
extra_sigc_cppflags = []
9694
extra_sigc_objects = []
9795

tools/handle-built-files.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,20 @@ def install_built_h_files():
7373
return 0
7474

7575
# Invoked from meson.add_dist_script().
76-
def dist_built_files():
76+
def dist_built_files(is_msvc_files=False):
7777
# argv[2] argv[3] argv[4:]
7878
# <built_h_cc_dir> <dist_dir> <built_files>...
7979

8080
# <built_h_cc_dir> is an absolute path in the build directory or source directory.
8181
# <dist_dir> is a distribution directory, relative to MESON_DIST_ROOT.
8282
built_h_cc_dir = sys.argv[2]
8383
dist_dir_root = os.path.join(os.getenv('MESON_DIST_ROOT'), sys.argv[3])
84+
dist_dir = dist_dir_root
8485

85-
# Distribute .h and .cc files built from .m4 files.
86+
# Distribute .h and .cc files built from .m4 files, or generated MSVC files.
8687
for file in sys.argv[4:]:
87-
dist_dir = os.path.join(dist_dir_root, os.path.dirname(file))
88+
if not is_msvc_files:
89+
dist_dir = os.path.join(dist_dir_root, os.path.dirname(file))
8890

8991
# Create the distribution directory, if it does not exist.
9092
os.makedirs(dist_dir, exist_ok=True)
@@ -129,5 +131,7 @@ def copy_built_files():
129131
sys.exit(dist_built_files())
130132
if subcommand == 'copy_built_files':
131133
sys.exit(copy_built_files())
134+
if subcommand == 'dist_gen_msvc_files':
135+
sys.exit(dist_built_files(True))
132136
print(sys.argv[0], ': illegal subcommand,', subcommand)
133137
sys.exit(1)

0 commit comments

Comments
 (0)