meson: Build the .rc files on Windows
This will ensure that the version info is easily visible from the GDK/GTK+ DLLs, and ensure that the print dialogs will have a more modern look and feel.
This commit is contained in:
		
				
					committed by
					
						
						Christoph Reiter
					
				
			
			
				
	
			
			
			
						parent
						
							0e24d35e3b
						
					
				
				
					commit
					1cd99d63d1
				
			@ -177,6 +177,9 @@ gdkversion_cdata = configuration_data()
 | 
			
		||||
gdkversion_cdata.set('GTK_MAJOR_VERSION', gtk_major_version)
 | 
			
		||||
gdkversion_cdata.set('GTK_MINOR_VERSION', gtk_minor_version)
 | 
			
		||||
gdkversion_cdata.set('GTK_MICRO_VERSION', gtk_micro_version)
 | 
			
		||||
gdkversion_cdata.set('GTK_API_VERSION', gtk_api_version)
 | 
			
		||||
gdkversion_cdata.set('GTK_BINARY_VERSION', gtk_binary_version)
 | 
			
		||||
gdkversion_cdata.set('GTK_VERSION', meson.project_version())
 | 
			
		||||
 | 
			
		||||
gdkversionmacros = configure_file(
 | 
			
		||||
  input  : 'gdkversionmacros.h.in',
 | 
			
		||||
@ -212,6 +215,14 @@ if win32_enabled
 | 
			
		||||
               cc.find_library('imm32'),
 | 
			
		||||
               cc.find_library('setupapi'),
 | 
			
		||||
               cc.find_library('winmm')]
 | 
			
		||||
 | 
			
		||||
  gdk_rc = configure_file(
 | 
			
		||||
    input: 'win32/rc/gdk.rc.in',
 | 
			
		||||
    output: 'gdk.rc',
 | 
			
		||||
    configuration: gdkversion_cdata,
 | 
			
		||||
  )
 | 
			
		||||
  gdk_res = import('windows').compile_resources(gdk_rc, include_directories: include_directories('win32/rc'))
 | 
			
		||||
  gdk_sources += gdk_res
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
gdk_sources = [
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ VS_VERSION_INFO VERSIONINFO
 | 
			
		||||
	VALUE "FileDescription", "GIMP Drawing Kit"
 | 
			
		||||
	VALUE "FileVersion", "@GTK_VERSION@.0"
 | 
			
		||||
	VALUE "InternalName", "libgdk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@"
 | 
			
		||||
	VALUE "LegalCopyright", "Copyright <EFBFBD> 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2011."
 | 
			
		||||
	VALUE "LegalCopyright", "Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2011."
 | 
			
		||||
	VALUE "OriginalFilename", "libgdk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll"
 | 
			
		||||
	VALUE "ProductName", "GTK+"
 | 
			
		||||
	VALUE "ProductVersion", "@GTK_VERSION@"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										21
									
								
								gtk/gen-rc.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								gtk/gen-rc.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
#! /usr/bin/env python3
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
out_file = sys.argv[1]
 | 
			
		||||
in_file = sys.argv[2]
 | 
			
		||||
old_msvc = sys.argv[3]
 | 
			
		||||
 | 
			
		||||
with open(out_file, 'w') as o:
 | 
			
		||||
    if old_msvc is not None and old_msvc == "1":
 | 
			
		||||
        o.write("#define ISOLATION_AWARE_ENABLED 1\n")
 | 
			
		||||
    o.write('#include <winuser.h>\n')
 | 
			
		||||
 | 
			
		||||
    with open(in_file, 'r') as f:
 | 
			
		||||
        for line in f:
 | 
			
		||||
            o.write(line)
 | 
			
		||||
 | 
			
		||||
    o.write('\n')
 | 
			
		||||
    o.write('ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk3.manifest')
 | 
			
		||||
@ -17,7 +17,7 @@ VS_VERSION_INFO VERSIONINFO
 | 
			
		||||
	VALUE "FileDescription", "GIMP Toolkit"
 | 
			
		||||
	VALUE "FileVersion", "@GTK_VERSION@.0"
 | 
			
		||||
	VALUE "InternalName", "libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@"
 | 
			
		||||
	VALUE "LegalCopyright", "Copyright <EFBFBD> 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2011."
 | 
			
		||||
	VALUE "LegalCopyright", "Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2011."
 | 
			
		||||
	VALUE "OriginalFilename", "libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll"
 | 
			
		||||
	VALUE "ProductName", "GTK+"
 | 
			
		||||
	VALUE "ProductVersion", "@GTK_VERSION@"
 | 
			
		||||
 | 
			
		||||
@ -784,6 +784,10 @@ gtkversion_cdata.set('GTK_MINOR_VERSION', gtk_minor_version)
 | 
			
		||||
gtkversion_cdata.set('GTK_MICRO_VERSION', gtk_micro_version)
 | 
			
		||||
gtkversion_cdata.set('GTK_BINARY_AGE', gtk_binary_age)
 | 
			
		||||
gtkversion_cdata.set('GTK_INTERFACE_AGE', gtk_interface_age)
 | 
			
		||||
gtkversion_cdata.set('GTK_API_VERSION', gtk_api_version)
 | 
			
		||||
gtkversion_cdata.set('GTK_BINARY_VERSION', gtk_binary_version)
 | 
			
		||||
gtkversion_cdata.set('GTK_VERSION', meson.project_version())
 | 
			
		||||
gtkversion_cdata.set('EXE_MANIFEST_ARCHITECTURE', '*')
 | 
			
		||||
 | 
			
		||||
gtkversion = configure_file(input: 'gtkversion.h.in',
 | 
			
		||||
                            output: 'gtkversion.h',
 | 
			
		||||
@ -840,6 +844,41 @@ if win32_enabled
 | 
			
		||||
  gtk_cargs += []
 | 
			
		||||
  gtk_sources += gtk_use_win32_sources
 | 
			
		||||
  gtk_deps += [ giowin32_dep, pangowin32_dep ]
 | 
			
		||||
 | 
			
		||||
  gtk_rc_body = configure_file(
 | 
			
		||||
    input: 'gtk-win32.rc.body.in',
 | 
			
		||||
    output: 'gtk-win32.rc.body',
 | 
			
		||||
	configuration: gtkversion_cdata,
 | 
			
		||||
  )
 | 
			
		||||
  gtk_rc_manifest = configure_file(
 | 
			
		||||
    input: 'libgtk3.manifest.in',
 | 
			
		||||
    output: 'libgtk3.manifest',
 | 
			
		||||
    configuration: gtkversion_cdata,
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  # Unfortunately, an extra directive in the .rc file is required for earlier
 | 
			
		||||
  # Visual Studio for embedding manifests via .rc files (2010 [v16] and earlier)
 | 
			
		||||
  # using ISOLATIONAWARE_MANIFEST_RESOURCE_ID to really work.  Somehow for
 | 
			
		||||
  # Visual Studio 2008 builds, this does not yet work.
 | 
			
		||||
  old_msvc = false
 | 
			
		||||
 | 
			
		||||
  if cc.get_id() == 'msvc' and cc.version().split('.')[0].to_int() < 17
 | 
			
		||||
    old_msvc = true
 | 
			
		||||
  endif
 | 
			
		||||
 | 
			
		||||
  gtk_rc = custom_target(
 | 
			
		||||
             'gtk.rc',
 | 
			
		||||
             output: 'gtk.rc',
 | 
			
		||||
             input: gtk_rc_body,
 | 
			
		||||
             command: [find_program('gen-rc.py'),
 | 
			
		||||
               '@OUTPUT@',
 | 
			
		||||
               '@INPUT@',
 | 
			
		||||
               old_msvc ? '1' : ''
 | 
			
		||||
             ],
 | 
			
		||||
             install: false,
 | 
			
		||||
           )
 | 
			
		||||
  gtk_res = import('windows').compile_resources(gtk_rc)
 | 
			
		||||
  gtk_sources += gtk_res
 | 
			
		||||
else
 | 
			
		||||
  gtk_deps += [ atkbridge_dep, ]
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user