[pangomm/use-dllexport: 12/13] Visual Studio builds: Do not use gendef.exe
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/use-dllexport: 12/13] Visual Studio builds: Do not use gendef.exe
- Date: Thu, 12 Mar 2020 07:11:40 +0000 (UTC)
commit b66258de5e182c1b0cba8966699ee3daf28a47c1
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Mar 11 18:31:46 2020 +0800
Visual Studio builds: Do not use gendef.exe
Instead, use compiler directives to build the pangomm DLLs.
MSVC_NMake/build-rules-msvc.mak | 13 ++-------
MSVC_NMake/config-msvc.mak | 1 -
MSVC_NMake/generate-msvc.mak | 5 ----
pango/pangomm/meson.build | 59 +++++++++++------------------------------
4 files changed, 18 insertions(+), 60 deletions(-)
---
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
index 02a0166..386473a 100644
--- a/MSVC_NMake/build-rules-msvc.mak
+++ b/MSVC_NMake/build-rules-msvc.mak
@@ -48,8 +48,8 @@ $(PANGOMM_LIB): $(PANGOMM_DLL)
# $(dependent_objects)
# <<
# @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
-$(PANGOMM_DLL): vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\pangomm.def $(pangomm_OBJS)
- link /DLL $(LDFLAGS_NOLTCG) $(PANGOMM_DEP_LIBS) /implib:$(PANGOMM_LIB)
/def:vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\pangomm.def -out:$@ @<<
+$(PANGOMM_DLL): vs$(VSVER)\$(CFG)\$(PLAT)\pangomm $(pangomm_OBJS)
+ link /DLL $(LDFLAGS_NOLTCG) $(PANGOMM_DEP_LIBS) /implib:$(PANGOMM_LIB) -out:$@ @<<
$(pangomm_OBJS)
<<
@@ -63,11 +63,6 @@ $(pangomm_OBJS)
# <<
# @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
-# For the gendef tool
-{.\gendef\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\}.exe:
- @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\gendef\ $(MAKE) -f Makefile.vc CFG=$(CFG)
vs$(VSVER)\$(CFG)\$(PLAT)\gendef
- $(CXX) $(PANGOMM_BASE_CFLAGS) $(CFLAGS) /Fo$(@D)\gendef\ /Fd$(@D)\gendef\ $< /link $(LDFLAGS) /out:$@
-
clean:
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exe
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.dll
@@ -75,17 +70,13 @@ clean:
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.ilk
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exp
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.lib
- @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\*.def
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\*.res
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\*.pdb
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\private\*.h
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\*.h
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\*.cc
- @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\gendef\*.pdb
- @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\gendef\*.obj
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\private
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\pangomm
- @-rd vs$(VSVER)\$(CFG)\$(PLAT)\gendef
.SUFFIXES: .cc .h .ccg .hg .obj
diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak
index 2356cad..b939034 100644
--- a/MSVC_NMake/config-msvc.mak
+++ b/MSVC_NMake/config-msvc.mak
@@ -76,7 +76,6 @@ PANGOMM_LIBNAME = pangomm-vc$(VSVER)0$(DEBUG_SUFFIX)-$(PANGOMM_MAJOR_VERSION)_$(
PANGOMM_DLL = vs$(VSVER)\$(CFG)\$(PLAT)\$(PANGOMM_LIBNAME).dll
PANGOMM_LIB = vs$(VSVER)\$(CFG)\$(PLAT)\$(PANGOMM_LIBNAME).lib
-GENDEF = vs$(VSVER)\$(CFG)\$(PLAT)\gendef.exe
GOBJECT_LIBS = gobject-$(GLIB_API_VERSION).lib glib-$(GLIB_API_VERSION).lib
CAIRO_LIB = cairo.lib
PANGO_LIBS = pangocairo-$(PANGO_API_VERSION).lib pango-$(PANGO_API_VERSION).lib $(GOBJECT_LIBS) $(CAIRO_LIB)
diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak
index 53991a6..9ed646b 100644
--- a/MSVC_NMake/generate-msvc.mak
+++ b/MSVC_NMake/generate-msvc.mak
@@ -4,15 +4,10 @@
# one is maintaining the NMake build files.
# Create the build directories
-vs$(VSVER)\$(CFG)\$(PLAT)\gendef \
vs$(VSVER)\$(CFG)\$(PLAT)\pangomm \
vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\private:
@-md $@
-# Generate .def files
-vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\pangomm.def: $(GENDEF) vs$(VSVER)\$(CFG)\$(PLAT)\pangomm $(pangomm_OBJS)
- vs$(VSVER)\$(CFG)\$(PLAT)\gendef.exe $@ $(PANGOMM_LIBNAME) vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\*.obj
-
# Generate wrap_init.cc files
vs$(VSVER)\$(CFG)\$(PLAT)\pangomm\wrap_init.cc: $(pangomm_real_hg)
@if not exist ..\pango\pangomm\wrap_init.cc $(PERL) -- "$(GMMPROC_DIR)/generate_wrap_init.pl"
--namespace=Pango --parent_dir=pangomm $(pangomm_real_hg:\=/)>$@
diff --git a/pango/pangomm/meson.build b/pango/pangomm/meson.build
index 593fb90..9e1fa29 100644
--- a/pango/pangomm/meson.build
+++ b/pango/pangomm/meson.build
@@ -67,6 +67,15 @@ src_untracked_pangomm = project_source_root / untracked_pangomm
pangomm_cpp_args = [ '-DPANGOMM_BUILD=1' ]
+extra_pangomm_objects = []
+
+# Build the .rc file for Windows builds and link to it
+if host_machine.system() == 'windows'
+ windows = import('windows')
+ pangomm_res = windows.compile_resources(pangomm_rc)
+ extra_pangomm_objects += pangomm_res
+endif
+
if maintainer_mode
# Maintainer mode. Generate .h and .cc files from .hg and .ccg files in ../src.
@@ -124,14 +133,13 @@ if maintainer_mode
extra_include_dirs = ['..']
- # We need this so that we can run gendef.exe to get the .def file
- # needed for obtaining the .lib file for the pangomm DLL
- pango_int_lib = static_library('pangomm-int',
+ pangomm_library = library(pangomm_pcname, extra_pangomm_objects,
built_cc_file_targets, built_h_file_targets, extra_cc_files,
+ version: pangomm_libversion,
include_directories: extra_include_dirs,
cpp_args: pangomm_cpp_args,
dependencies: pangomm_build_dep,
- install: false,
+ install: true,
)
built_h_cc_dir = meson.current_build_dir()
@@ -168,54 +176,19 @@ else # not maintainer_mode
extra_include_dirs = [ '..', '..' / '..' / 'untracked' / 'pango' ]
- # We need this so that we can run gendef.exe to get the .def file
- # needed for obtaining the .lib file for the pangomm DLL
- pango_int_lib = static_library('pangomm-int',
+ pangomm_library = library(pangomm_pcname, extra_pangomm_objects,
built_cc_files, extra_cc_files,
+ version: pangomm_libversion,
include_directories: extra_include_dirs,
cpp_args: pangomm_cpp_args,
dependencies: pangomm_build_dep,
- install: false,)
+ install: true
+ )
built_h_cc_dir = src_untracked_pangomm
endif
-pangomm_def = []
-pangomm_extra_link_args = []
-extra_pangomm_objects = []
-
-if is_msvc
- pangomm_def = custom_target('pangomm.def',
- output: 'pangomm.def',
- depends: pango_int_lib,
- command: [ gendef,
- '@OUTPUT@',
- '@0@-@1@.dll'.format(pangomm_pcname,
- libtool_soversion[0] - libtool_soversion[2]),
- pango_int_lib.full_path(),
- ],
- install: false,
- )
- pangomm_extra_link_args = ['/def:@0@'.format(pangomm_def.full_path())]
-endif
-
-# Build the .rc file for Windows builds and link to it
-if host_machine.system() == 'windows'
- windows = import('windows')
- pangomm_res = windows.compile_resources(pangomm_rc)
- extra_pangomm_objects += pangomm_res
-endif
-
-pangomm_library = library(pangomm_pcname, extra_pangomm_objects,
- objects: pango_int_lib.extract_all_objects(),
- version: pangomm_libversion,
- dependencies: pangomm_build_dep,
- link_depends: pangomm_def,
- link_args: pangomm_extra_link_args,
- install: true,
-)
-
# Install built .h and _p.h files.
meson.add_install_script(
python3.path(), generate_binding, 'install_built_h_files',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]