[pangomm/use-dllexport-2-42: 2/2] NMake Makefiles: Detect whether we can use __declspec(dllexport)
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/use-dllexport-2-42: 2/2] NMake Makefiles: Detect whether we can use __declspec(dllexport)
- Date: Sat, 4 Apr 2020 14:06:11 +0000 (UTC)
commit 07c6f16c400b42b50624bcbe7bc97ba88308bee2
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Mar 30 22:48:07 2020 +0800
NMake Makefiles: Detect whether we can use __declspec(dllexport)
The generated pangomm headers must be generated with a recent gmmproc so
that we may ensure that all the needed classes, functions and methods
are marked with PANGOMM_API, so that we can build pangomm without using
gendef.exe.
If the headers are generated with an older gmmproc, then we build
pangomm using gendef.exe, as we did before.
MSVC_NMake/build-rules-msvc.mak | 6 +++---
MSVC_NMake/create-lists-msvc.mak | 15 +++++++++++++++
MSVC_NMake/filelist.am | 1 +
MSVC_NMake/get-gmmproc-ver.bat | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 53 insertions(+), 3 deletions(-)
---
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
index b49f588..3e7174b 100644
--- a/MSVC_NMake/build-rules-msvc.mak
+++ b/MSVC_NMake/build-rules-msvc.mak
@@ -30,7 +30,7 @@ $<
{..\pango\src\}.ccg{vs$(PDBVER)\$(CFG)\$(PLAT)\pangomm\}.obj:
@if not exist $(@D)\private\ $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)\private
- @for %%s in ($(<D)\*.ccg) do @if not exist ..\pango\pangomm\%%~ns.cc if not exist $(@D)\%%~ns.cc
$(PERL) -- $(GMMPROC_DIR)/gmmproc -I ../tools/m4 --defs $(<D:\=/) %%~ns $(<D:\=/) $(@D)
+ @for %%s in ($(<D)\*.ccg) do @if not exist ..\pango\pangomm\%%~ns.cc if not exist
..\untracked\pango\pangomm\%%~ns.cc if not exist $(@D)\%%~ns.cc $(PERL) -- $(GMMPROC_DIR)/gmmproc -I
../tools/m4 --defs $(<D:\=/) %%~ns $(<D:\=/) $(@D)
@if exist $(@D)\$(<B).cc $(CXX) $(PANGOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /Fd$(@D)\ /c $(@D)\$(<B).cc
@if exist ..\pango\pangomm\$(<B).cc $(CXX) $(PANGOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /Fd$(@D)\ /c
..\pango\pangomm\$(<B).cc
@if exist ..\untracked\pango\pangomm\$(<B).cc $(CXX) $(PANGOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\
/Fd$(@D)\ /c ..\pango\pangomm\$(<B).cc
@@ -48,8 +48,8 @@ $(PANGOMM_LIB): $(PANGOMM_DLL)
# $(dependent_objects)
# <<
# @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
-$(PANGOMM_DLL): vs$(PDBVER)\$(CFG)\$(PLAT)\pangomm\pangomm.def $(pangomm_OBJS)
- link /DLL $(LDFLAGS_NOLTCG) $(PANGO_LIBS) $(CAIROMM_LIB) $(GLIBMM_LIB) $(LIBSIGC_LIB)
/implib:$(PANGOMM_LIB) /def:vs$(PDBVER)\$(CFG)\$(PLAT)\pangomm\pangomm.def -out:$@ @<<
+$(PANGOMM_DLL): $(PANGOMM_INT_TARGET) $(pangomm_OBJS)
+ link /DLL $(LDFLAGS_NOLTCG) $(PANGO_LIBS) $(CAIROMM_LIB) $(GLIBMM_LIB) $(LIBSIGC_LIB)
/implib:$(PANGOMM_LIB) $(PANGOMM_DEF_LDFLAG) -out:$@ @<<
$(pangomm_OBJS)
<<
@-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
diff --git a/MSVC_NMake/create-lists-msvc.mak b/MSVC_NMake/create-lists-msvc.mak
index 8646f3b..989db43 100644
--- a/MSVC_NMake/create-lists-msvc.mak
+++ b/MSVC_NMake/create-lists-msvc.mak
@@ -63,7 +63,22 @@ files_extra_ph_int = $(files_extra_ph:/=\)
!if [call create-lists.bat footer pangomm.mak]
!endif
+!if [for %f in (pangomm\attributes.h) do @if not exist ..\pango\%f if not exist ..\untracked\pango\%f if not
exist vs$(PDBVER)\$(CFG)\$(PLAT)\%f (md vs$(PDBVER)\$(CFG)\$(PLAT)\pangomm\private) & ($(PERL) --
$(GMMPROC_DIR)/gmmproc -I ../tools/m4 --defs ../pango/src attributes ../pango/src
vs$(PDBVER)/$(CFG)/$(PLAT)/pangomm)]
+!endif
+
+!if [for %d in (vs$(PDBVER)\$(CFG)\$(PLAT)\pangomm ..\pango\pangomm ..\untracked\pango\pangomm) do @if exist
%d\attributes.h call get-gmmproc-ver %d\attributes.h>>pangomm.mak]
+!endif
+
!include pangomm.mak
!if [del /f /q pangomm.mak]
!endif
+
+!if "$(GMMPROC_VER)" >= "2.64.3"
+PANGOMM_INT_TARGET = vs$(PDBVER)\$(CFG)\$(PLAT)\pangomm
+PANGOMM_DEF_LDFLAG =
+!else
+PANGOMM_INT_TARGET = vs$(PDBVER)\$(CFG)\$(PLAT)\pangomm\pangomm.def
+PANGOMM_DEF_LDFLAG = /def:$(PANGOMM_INT_TARGET)
+PANGOMM_BASE_CFLAGS = $(PANGOMM_BASE_CFLAGS) /DPANGOMM_USE_GENDEF
+!endif
diff --git a/MSVC_NMake/filelist.am b/MSVC_NMake/filelist.am
index 50aa019..647275a 100644
--- a/MSVC_NMake/filelist.am
+++ b/MSVC_NMake/filelist.am
@@ -9,6 +9,7 @@ msvc_nmake_data = \
gendef/gendef.cc \
gendef/meson.build \
generate-msvc.mak \
+ get-gmmproc-ver.bat \
info-msvc.mak \
install.mak \
Makefile.vc \
diff --git a/MSVC_NMake/get-gmmproc-ver.bat b/MSVC_NMake/get-gmmproc-ver.bat
new file mode 100644
index 0000000..f9b340f
--- /dev/null
+++ b/MSVC_NMake/get-gmmproc-ver.bat
@@ -0,0 +1,34 @@
+@echo off
+REM get-gmmproc-ver: Grab first line of a gmmproc-generated
+REM .h file to see which version of gmmproc is used to
+REM generate the header
+
+if "%1" == "" goto :usage
+
+call :print_first_line %1
+goto :eof
+
+:print_first_line
+setlocal EnableDelayedExpansion
+set /a line=0
+
+for /f ^"usebackq^ eol^=^ delims^=^" %%l in (%1) do (
+ if "!line!" == "1" goto :eof
+ echo %%l>tmp.txt
+ for /f "tokens=1-5" %%a in (tmp.txt) do (
+ if not "%%a" == "//" goto :not_gmmproc
+ if not "%%b" == "Generated" goto :not_gmmproc
+ if not "%%c" == "by" goto :not_gmmproc
+ if not "%%d" == "gmmproc" goto :not_gmmproc
+ echo GMMPROC_VER=%%e
+ )
+ del /f tmp.txt
+ set /a line+=1
+)
+
+:not_gmmproc
+echo This is not a gmmproc generated file.
+goto :eof
+
+:usage
+echo Usage: get-gmmproc-ver ^<generated-header^>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]