[glibmm] MSVC_NMake: Add rules to generate and build sources
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] MSVC_NMake: Add rules to generate and build sources
- Date: Wed, 26 Feb 2020 03:55:48 +0000 (UTC)
commit 9ec8f10bd5aec50f8acecbc41a6f918c4a151ec0
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Feb 26 10:50:24 2020 +0800
MSVC_NMake: Add rules to generate and build sources
...from a GIT checkout, from the various .ccg/.hg and the *.[cc|h].m4 sources,
as well as the wrap_init.cc sources. This will obviously require PERL, as well
as a Cygwin or MSYS installation that has a working m4 executable for Windows
for this to work. Note that release tarballs continue to build on Visual
Studio as they did before, without the need for PERL nor m4.
Note that this does not yet support generating [glib|gio]mmconfig.h nor
[glib|gio]mm.rc from their .in counterparts, as well as tools\gmmproc
and tools\generate_wrap_init.pl, which will be done in a later commit.
MSVC_NMake/build-rules-msvc.mak | 38 ++++++++++++++++++++++++++++++++++++++
MSVC_NMake/config-msvc.mak | 12 ++++++++++--
MSVC_NMake/create-lists-msvc.mak | 18 ++++++++++++++++++
MSVC_NMake/generate-msvc.mak | 13 +++++++++++--
4 files changed, 77 insertions(+), 4 deletions(-)
---
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
index cb35d487..e1f78ad7 100644
--- a/MSVC_NMake/build-rules-msvc.mak
+++ b/MSVC_NMake/build-rules-msvc.mak
@@ -13,16 +13,44 @@
# $(CC)|$(CXX) $(cflags) /Fo$(destdir) /c @<<
# $<
# <<
+{vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\}.obj::
+ $(CXX) $(LIBGLIBMM_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\glibmm\
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\glibmm\ /c @<<
+$<
+<<
+
{..\glib\glibmm\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\}.obj::
$(CXX) $(LIBGLIBMM_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\glibmm\
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\glibmm\ /c @<<
$<
<<
+{..\glib\src\}.cc.m4{vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\}.obj:
+ @if not exist $(@D)\ $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)
+ @for %%s in ($(<D)\*.cc.m4 $(<D)\*.h.m4) do @if not exist ..\glib\glibmm\%%~ns if not exist
$(@D)\%%~ns $(M4) -I$(<D:\=/) %%s $(<D:\=/)/template.macros.m4 > $(@D)\%%~ns
+ @if exist $(@D)\$(<B) $(CXX) $(LIBGLIBMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /Fd$(@D)\ /c $(@D)\$(<B)
+ @if exist ..\glib\glibmm\$(<B) $(CXX) $(LIBGLIBMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /Fd$(@D)\ /c
..\glib\glibmm\$(<B)
+
+{..\glib\src\}.ccg{vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\}.obj:
+ @if not exist $(@D)\private\ $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)\private
+ @for %%s in ($(<D)\*.ccg) do @if not exist ..\glib\glibmm\%%~ns.cc if not exist $(@D)\%%~ns.cc
$(PERL) -I ../tools/pm -- ../tools/gmmproc -I ../tools/m4 --defs $(<D:\=/) %%~ns $(<D:\=/) $(@D)
+ @if exist $(@D)\$(<B).cc $(CXX) $(LIBGLIBMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /Fd$(@D)\ /c
$(@D)\$(<B).cc
+ @if exist ..\glib\glibmm\$(<B).cc $(CXX) $(LIBGLIBMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /Fd$(@D)\ /c
..\glib\glibmm\$(<B).cc
+
+{vs$(VSVER)\$(CFG)\$(PLAT)\giomm\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\giomm\}.obj::
+ $(CXX) $(LIBGIOMM_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\giomm\
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\giomm\ /c @<<
+$<
+<<
+
{..\gio\giomm\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\giomm\}.obj::
$(CXX) $(LIBGIOMM_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\giomm\
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\giomm\ /c @<<
$<
<<
+{..\gio\src\}.ccg{vs$(VSVER)\$(CFG)\$(PLAT)\giomm\}.obj:
+ @if not exist $(@D)\private\ $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)\private
+ @for %%s in ($(<D)\*.ccg) do @if not exist ..\gio\giomm\%%~ns.cc if not exist $(@D)\%%~ns.cc $(PERL)
-I ../tools/pm -- ../tools/gmmproc -I ../tools/m4 --defs $(<D:\=/) %%~ns $(<D:\=/) $(@D)
+ @if exist $(@D)\$(<B).cc $(CXX) $(LIBGIOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /Fd$(@D)\ /c
$(@D)\$(<B).cc
+ @if exist ..\gio\giomm\$(<B).cc $(CXX) $(LIBGIOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /Fd$(@D)\ /c
$(@D)\$(<B).cc
+
{..\tools\extra_defs_gen\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\}.obj::
@if not exist vs$(VSVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\ $(MAKE) /f Makefile.vc CFG=$(CFG)
vs$(VSVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen
$(CXX) $(GLIBMM_BASE_CFLAGS) $(GLIBMM_EXTRA_INCLUDES) $(CFLAGS_NOGL)
/Fovs$(VSVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\ /Fdvs$(VSVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\ /c @<<
@@ -213,6 +241,9 @@ clean:
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\giomm\*.res
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\giomm\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\giomm\*.pdb
+ @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\giomm\*.cc
+ @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\giomm\private\*.h
+ @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\giomm\*.h
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-tests del /f /q
vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-tests\*.obj
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-tests del /f /q
vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-tests\*.pdb
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-ex\*.obj
@@ -221,13 +252,20 @@ clean:
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\*.res
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\*.pdb
+ @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\*.cc
+ @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\private\*.h
+ @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\*.h
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\gendef\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\gendef\*.pdb
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\giomm-tests rd vs$(VSVER)\$(CFG)\$(PLAT)\giomm-tests
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\giomm-ex
+ @-rd vs$(VSVER)\$(CFG)\$(PLAT)\giomm\private
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\giomm
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-tests rd vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-tests
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-ex
+ @-rd vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\private
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\glibmm
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\gendef
+
+.SUFFIXES: .cc .h .ccg .hg .obj .cc.m4 .h.m4
diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak
index 2c058ea7..53ab1aa1 100644
--- a/MSVC_NMake/config-msvc.mak
+++ b/MSVC_NMake/config-msvc.mak
@@ -18,12 +18,20 @@ DEBUG_SUFFIX = -d
DEBUG_SUFFIX =
!endif
+!ifndef M4
+M4 = m4
+!endif
+
GLIBMM_BASE_CFLAGS = \
- /I..\glib /I.\glibmm \
+ /Ivs$(VSVER)\$(CFG)\$(PLAT) \
+ /I..\glib /I..\glib\glibmm /I.\glibmm \
/wd4530 /std:c++17 \
/FImsvc_recommended_pragmas.h
-GIOMM_BASE_CFLAGS = /I..\gio /I.\giomm $(GLIBMM_BASE_CFLAGS)
+GIOMM_BASE_CFLAGS = \
+ /Ivs$(VSVER)\$(CFG)\$(PLAT) \
+ /I..\gio /I..\gio\giomm /I.\giomm \
+ $(GLIBMM_BASE_CFLAGS)
GLIBMM_EXTRA_INCLUDES = \
/I$(PREFIX)\include\gio-win32-$(GLIB_API_VERSION) \
diff --git a/MSVC_NMake/create-lists-msvc.mak b/MSVC_NMake/create-lists-msvc.mak
index d2f6d7b5..4044bb3b 100644
--- a/MSVC_NMake/create-lists-msvc.mak
+++ b/MSVC_NMake/create-lists-msvc.mak
@@ -58,6 +58,15 @@ glibmm_files_extra_ph_int = $(glibmm_files_extra_ph:/=\)
!if [call create-lists.bat footer glibmm.mak]
!endif
+!if [call create-lists.bat header glibmm.mak glibmm_real_hg]
+!endif
+
+!if [for %c in ($(glibmm_files_used_hg)) do @call create-lists.bat file glibmm.mak ..\glib\src\%c]
+!endif
+
+!if [call create-lists.bat footer glibmm.mak]
+!endif
+
# For giomm
!if [call create-lists.bat header glibmm.mak giomm_OBJS]
@@ -75,6 +84,15 @@ glibmm_files_extra_ph_int = $(glibmm_files_extra_ph:/=\)
!if [call create-lists.bat footer glibmm.mak]
!endif
+!if [call create-lists.bat header glibmm.mak giomm_real_hg]
+!endif
+
+!if [for %c in ($(giomm_files_any_hg)) do @call create-lists.bat file glibmm.mak ..\gio\src\%c]
+!endif
+
+!if [call create-lists.bat footer glibmm.mak]
+!endif
+
!if [call create-lists.bat header glibmm.mak glibmm_ex]
!endif
diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak
index 221ba87f..aa4b16b9 100644
--- a/MSVC_NMake/generate-msvc.mak
+++ b/MSVC_NMake/generate-msvc.mak
@@ -6,13 +6,15 @@
# Create the build directories
vs$(VSVER)\$(CFG)\$(PLAT)\gendef \
vs$(VSVER)\$(CFG)\$(PLAT)\glibmm \
+vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\private \
vs$(VSVER)\$(CFG)\$(PLAT)\giomm \
+vs$(VSVER)\$(CFG)\$(PLAT)\giomm\private \
vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-ex \
vs$(VSVER)\$(CFG)\$(PLAT)\giomm-ex \
vs$(VSVER)\$(CFG)\$(PLAT)\glibmm-tests \
vs$(VSVER)\$(CFG)\$(PLAT)\giomm-tests \
vs$(VSVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen:
- @-mkdir $@
+ @-md $@
# Generate .def files
vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\glibmm.def: $(GENDEF) vs$(VSVER)\$(CFG)\$(PLAT)\glibmm $(glibmm_OBJS)
@@ -23,4 +25,11 @@ vs$(VSVER)\$(CFG)\$(PLAT)\giomm\giomm.def: $(GENDEF) vs$(VSVER)\$(CFG)\$(PLAT)\g
# Compile schema for giomm settings example
vs$(VSVER)\$(CFG)\$(PLAT)\gschema.compiled: ..\examples\settings\org.gtkmm.demo.gschema.xml
- $(GLIB_COMPILE_SCHEMAS) --targetdir=vs$(VSVER)\$(CFG)\$(PLAT) ..\examples\settings
\ No newline at end of file
+ $(GLIB_COMPILE_SCHEMAS) --targetdir=vs$(VSVER)\$(CFG)\$(PLAT) ..\examples\settings
+
+# Generate wrap_init.cc files
+vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\wrap_init.cc: $(glibmm_real_hg)
+ @if not exist ..\glib\glibmm\wrap_init.cc $(PERL) -- "../tools/generate_wrap_init.pl"
--namespace=Glib --parent_dir=glibmm $(glibmm_real_hg:\=/)>$@
+
+vs$(VSVER)\$(CFG)\$(PLAT)\giomm\wrap_init.cc: $(giomm_real_hg)
+ @if not exist ..\gio\giomm\wrap_init.cc $(PERL) -- "../tools/generate_wrap_init.pl" --namespace=Gio
--parent_dir=giomm $(giomm_real_hg:\=/)>$@
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]