gtk/build/win32/gtkpc.py
Chun-wei Fan ac875073fc GSK: Add initial Visual Studio projects
This adds the initial MSVC build items needed to build GSK under Visual Studio,
this is part of it that is required, we need to add items to the property sheets
to generate the code that is generated via glib-mkenums and glib-compile-resources.

This set includes, with the autotools scripts for the complete:
-GSK project files, which is integrated into the gtk+-4.sln.
-The NMake snippets to build the introspection files for GSK.
-The .bat files to call glib-mkenums to generate the enumeration sources.
2016-10-26 18:30:09 +08:00

104 lines
3.9 KiB
Python

#!/usr/bin/python
#
# Utility script to generate .pc files for GTK+
# for Visual Studio builds, to be used for
# building introspection files
# Author: Fan, Chun-wei
# Date: April 26, 2016
import os
import sys
import argparse
from replace import replace_multi, replace
from pc_base import BasePCItems
def main(argv):
base_pc = BasePCItems()
gdk_parser = argparse.ArgumentParser(description='Setup basic .pc file info')
gdk_parser.add_argument('--broadway',
action='store_const',
const=1,
help='GDK with Broadway backend')
gdk_parser.add_argument('--host',
required=True,
help='Build type')
base_pc.setup(argv, gdk_parser)
atk_min_ver = '2.15.1'
cairo_min_ver = '1.14.0'
gdk_pixbuf_min_ver = '2.30.0'
gdk_win32_sys_libs = '-lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi'
glib_min_ver = '2.45.8'
epoxy_min_ver = '1.0'
graphene_min_ver = '1.2'
cairo_backends = 'cairo-win32'
gdk_backends = 'win32'
gio_package = 'gio-2.0 >= ' + glib_min_ver
broadway_extra_libs = ''
gdk_args = gdk_parser.parse_args()
if getattr(gdk_args, 'broadway', None) is 1:
# On Visual Studio, we link to zlib1.lib
broadway_extra_libs = '-lzlib1'
gdk_backends += ' broadway'
cairo_backends += ' cairo'
pkg_replace_items = {'@GTK_API_VERSION@': '4.0',
'@GDK_BACKENDS@': gdk_backends}
pkg_required_packages = 'gdk-pixbuf >= ' + gdk_pixbuf_min_ver + ' ' + \
'cairo >= ' + cairo_min_ver + ' ' + \
'cairo-gobject >= ' + cairo_min_ver
gdk_pc_replace_items = {'@GDK_PACKAGES@': gio_package + ' ' + \
'pangowin32 pangocairo' + ' ' + \
pkg_required_packages,
'@GDK_PRIVATE_PACKAGES@': gio_package + ' ' + cairo_backends,
'@GDK_EXTRA_LIBS@': gdk_win32_sys_libs + broadway_extra_libs,
'@GDK_EXTRA_CFLAGS@': '',
'gdk-4': 'gdk-4.0'}
gsk_pc_replace_items = {'@GSK_PACKAGES@': pkg_required_packages, + ' ' + \
'graphene-1.0 >= ' + graphene_min_ver
'@GSK_PRIVATE_PACKAGES@': 'epoxy >= ' + epoxy_min_ver,
'@GSK_EXTRA_LIBS@': '',
'@GSK_EXTRA_CFLAGS@': '',
'gsk-4': 'gsk-4.0'}
gtk_pc_replace_items = {'@host@': gdk_args.host,
'@GTK_BINARY_VERSION@': '4.0.0',
'@GTK_PACKAGES@': 'atk >= ' + atk_min_ver + ' ' + \
pkg_required_packages + ' ' + \
gio_package,
'@GTK_PRIVATE_PACKAGES@': 'atk',
'@GTK_EXTRA_CFLAGS@': '',
'@GTK_EXTRA_LIBS@': '',
'@GTK_EXTRA_CFLAGS@': '',
'gtk-4': 'gtk-4.0'}
pkg_replace_items.update(base_pc.base_replace_items)
gdk_pc_replace_items.update(pkg_replace_items)
gtk_pc_replace_items.update(pkg_replace_items)
# Generate gdk-4.0.pc
replace_multi(base_pc.top_srcdir + '/gdk-4.0.pc.in',
base_pc.srcdir + '/gdk-4.0.pc',
gdk_pc_replace_items)
# Generate gsk-4.0.pc
replace_multi(base_pc.top_srcdir + '/gsk-4.0.pc.in',
base_pc.srcdir + '/gsk-4.0.pc',
gsk_pc_replace_items)
# Generate gtk+-4.0.pc
replace_multi(base_pc.top_srcdir + '/gtk+-4.0.pc.in',
base_pc.srcdir + '/gtk+-4.0.pc',
gtk_pc_replace_items)
if __name__ == '__main__':
sys.exit(main(sys.argv))