gtk2/build/win32/gen-gdkversionmacros-h.py
Chun-wei Fan 58ee7adc29 MSVC builds: Generate most of the built sources in gdk/
With the exception of the enumeration sources (gdkenumtypes.h and
gdkenumtypes.c), the generared sources in gdk/ (gdkversionmacros.h,
gdkresources.[c|h], gdkmarshalers.[c|h] are now generated in the
gtk3-prebuild projects with the NMake Makefiles.

Make build/win32/config-msvc.mak filled with the version info from
autotools, too.
2019-07-25 18:04:58 +08:00

34 lines
1.1 KiB
Python

#!/usr/bin/python3
# Generate gdk/gdkversionmacros.h
# Author: Fan, Chun-wei
# Date: July 25, 2019
import os
import sys
import argparse
from replace import replace_multi, replace
def main(argv):
srcdir = os.path.dirname(__file__)
top_srcdir = os.path.join(srcdir, os.pardir, os.pardir)
parser = argparse.ArgumentParser(description='Generate gdkversionmacros.h')
parser.add_argument('--version', help='Version of the package',
required=True)
args = parser.parse_args()
gdk_sourcedir = os.path.join(top_srcdir, 'gdk')
version_parts = args.version.split('.')
gdkversionmacro_replace_items = {'@GTK_MAJOR_VERSION@': version_parts[0],
'@GTK_MINOR_VERSION@': version_parts[1],
'@GTK_MICRO_VERSION@': version_parts[2]}
replace_multi(os.path.join(gdk_sourcedir, 'gdkversionmacros.h.in'),
os.path.join(gdk_sourcedir, 'gdkversionmacros.h'),
gdkversionmacro_replace_items)
if __name__ == '__main__':
sys.exit(main(sys.argv))