[glibmm/glibmm-2-62] MSVC_NMake: Add rules to generate and build sources



commit cae25113c0a8accb53cd07fea0a1d06b4229e72b
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Feb 25 14:25:04 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     | 16 ++++++++++++++--
 4 files changed, 80 insertions(+), 4 deletions(-)
---
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
index d52d284f..727d370d 100644
--- a/MSVC_NMake/build-rules-msvc.mak
+++ b/MSVC_NMake/build-rules-msvc.mak
@@ -18,11 +18,39 @@
 $<
 <<
 
+{vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\}.cc{vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\}.obj::
+       $(CXX) $(LIBGLIBMM_CFLAGS) $(CFLAGS_NOGL) /Fovs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\ 
/Fdvs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\ /c @<<
+$<
+<<
+
+{..\glib\src\}.cc.m4{vs$(PDBVER)\$(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$(PDBVER)\$(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
+
 {..\gio\giomm\}.cc{vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\}.obj::
        $(CXX) $(LIBGIOMM_CFLAGS) $(CFLAGS_NOGL) /Fovs$(PDBVER)\$(CFG)\$(PLAT)\giomm\ 
/Fdvs$(PDBVER)\$(CFG)\$(PLAT)\giomm\ /c @<<
 $<
 <<
 
+{vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\}.cc{vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\}.obj::
+       $(CXX) $(LIBGIOMM_CFLAGS) $(CFLAGS_NOGL) /Fovs$(PDBVER)\$(CFG)\$(PLAT)\giomm\ 
/Fdvs$(PDBVER)\$(CFG)\$(PLAT)\giomm\ /c @<<
+$<
+<<
+
+{..\gio\src\}.ccg{vs$(PDBVER)\$(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$(PDBVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\}.obj::
        @if not exist vs$(PDBVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\ $(MAKE) /f Makefile.vc CFG=$(CFG) 
vs$(PDBVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen
        $(CXX) $(GLIBMM_BASE_CFLAGS) $(GLIBMM_EXTRA_INCLUDES) $(CFLAGS_NOGL) 
/Fovs$(PDBVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\ /Fdvs$(PDBVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\ /c @<<
@@ -217,6 +245,9 @@ clean:
        @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\*.res
        @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\*.obj
        @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\*.pdb
+       @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\*.cc
+       @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\private\*.h
+       @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\*.h
        @-if exist vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-tests del /f /q 
vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-tests\*.obj
        @-if exist vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-tests del /f /q 
vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-tests\*.pdb
        @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-ex\*.obj
@@ -225,13 +256,20 @@ clean:
        @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\*.res
        @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\*.obj
        @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\*.pdb
+       @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\*.cc
+       @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\private\*.h
+       @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\*.h
        @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\gendef\*.obj
        @-del /f /q vs$(PDBVER)\$(CFG)\$(PLAT)\gendef\*.pdb
        @-if exist vs$(PDBVER)\$(CFG)\$(PLAT)\giomm-tests rd vs$(PDBVER)\$(CFG)\$(PLAT)\giomm-tests
        @-rd vs$(PDBVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen
        @-rd vs$(PDBVER)\$(CFG)\$(PLAT)\giomm-ex
+       @-rd vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\private
        @-rd vs$(PDBVER)\$(CFG)\$(PLAT)\giomm
        @-if exist vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-tests rd vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-tests
        @-rd vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-ex
+       @-rd vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\private
        @-rd vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm
        @-rd vs$(PDBVER)\$(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 843b5e73..b2d2d31e 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$(PDBVER)\$(CFG)\$(PLAT)    \
+       /I..\glib /I..\glib\glibmm /I.\glibmm           \
        /wd4530 /EHsc   \
        /FImsvc_recommended_pragmas.h
 
-GIOMM_BASE_CFLAGS = /I..\gio /I.\giomm $(GLIBMM_BASE_CFLAGS)
+GIOMM_BASE_CFLAGS =    \
+       /Ivs$(PDBVER)\$(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 2ade91ad..3a6c0fa8 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 1ca9a7ab..6ff5d665 100644
--- a/MSVC_NMake/generate-msvc.mak
+++ b/MSVC_NMake/generate-msvc.mak
@@ -6,13 +6,15 @@
 # Create the build directories
 vs$(PDBVER)\$(CFG)\$(PLAT)\gendef      \
 vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm      \
+vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\private      \
 vs$(PDBVER)\$(CFG)\$(PLAT)\giomm       \
+vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\private       \
 vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-ex   \
 vs$(PDBVER)\$(CFG)\$(PLAT)\giomm-ex    \
 vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm-tests        \
 vs$(PDBVER)\$(CFG)\$(PLAT)\giomm-tests \
 vs$(PDBVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen:
-       @-mkdir $@
+       @-md $@
 
 # Generate .def files
 vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm\glibmm.def: $(GENDEF) vs$(PDBVER)\$(CFG)\$(PLAT)\glibmm $(glibmm_OBJS)
@@ -23,4 +25,14 @@ vs$(PDBVER)\$(CFG)\$(PLAT)\giomm\giomm.def: $(GENDEF) vs$(PDBVER)\$(CFG)\$(PLAT)
 
 # Compile schema for giomm settings example
 vs$(PDBVER)\$(CFG)\$(PLAT)\gschema.compiled: ..\examples\settings\org.gtkmm.demo.gschema.xml
-       $(GLIB_COMPILE_SCHEMAS) --targetdir=vs$(PDBVER)\$(CFG)\$(PLAT) ..\examples\settings
\ No newline at end of file
+       $(GLIB_COMPILE_SCHEMAS) --targetdir=vs$(PDBVER)\$(CFG)\$(PLAT) ..\examples\settings
+
+# Generate wrap_init.cc files
+
+vs$(PDBVER)\$(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:\=/)>$@
+       @if exist ..\glib\glibmm\wrap_init.cc if not exist $@ copy ..\glib\glibmm\wrap_init.cc $@
+
+vs$(PDBVER)\$(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:\=/)>$@
+       @if exist ..\gio\giomm\wrap_init.cc if not exist $@ copy ..\gio\giomm\wrap_init.cc $@


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]