summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2015-09-16 11:52:33 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2016-04-13 20:53:24 +0800
commitd7b5fb069ef764bb6e420a6ed98afad0d1f42991 (patch)
treefefad98a8c189d7c9850d4c57be2bf6275a0ec6e
parent8c77521e413d6e2078655f9f85749c20b971cf2e (diff)
downloadatk-d7b5fb069ef764bb6e420a6ed98afad0d1f42991.tar.gz
MSVC Builds: Generate the Introspection Build Commands
This uses the common autotools module that was added in the previous commit to generate the command lines used to generate the .gir and compile the .typelib files, as well as the file list that is to be consumed during the generation of the .gir files. This also makes the detectmsvc-msvc.mak and introspection-msvc.mak NMake modules the same as the ones in $(glib_srcroot)/build/win32 and $(gi_srcroot)/build/win32 respectively, so that they may be copied from these locations when they are updated. https://bugzilla.gnome.org/show_bug.cgi?id=764983
-rw-r--r--atk/Makefile.am35
-rw-r--r--build/Makefile.am10
-rw-r--r--build/atk-introspection-msvc.mak50
-rw-r--r--build/gen-file-list-atk.py35
-rw-r--r--build/introspection-msvc.mak65
-rw-r--r--build/msvcfiles.py254
-rw-r--r--build/win32/Makefile.am29
-rw-r--r--build/win32/atk-introspection-msvc.mak34
-rw-r--r--build/win32/detectenv-msvc.mak (renamed from build/detectenv-msvc.mak)28
-rw-r--r--build/win32/introspection-msvc.mak94
-rw-r--r--tests/testatk_vc.mak6
11 files changed, 213 insertions, 427 deletions
diff --git a/atk/Makefile.am b/atk/Makefile.am
index c194e82..875f616 100644
--- a/atk/Makefile.am
+++ b/atk/Makefile.am
@@ -217,9 +217,42 @@ atk_HEADERS_EXCLUDES = $(top_builddir)/atk/atkversion.h
include $(top_srcdir)/build/Makefile.msvcproj
+if HAVE_INTROSPECTION
+# Introspection Items for MSVC
+MSVC_INTROSPECT_GIRS = Atk-1.0.gir
+
+INTROSPECTION_INTERMEDIATE_ITEMS = \
+ $(top_builddir)/build/win32/Atk-1.0.gir.msvc.introspect \
+ $(top_builddir)/build/win32/Atk_1_0_gir_list
+
+Atk_1_0_gir_MSVC_EXPORT_PACKAGES = atk
+Atk_1_0_gir_MSVC_INCLUDE_GIRS = $(Atk_1_0_gir_INCLUDES)
+Atk_1_0_gir_MSVC_LIBS = atk-1.0
+Atk_1_0_gir_MSVC_FILES = \
+ $(introspection_sources) \
+ atkversion.h \
+ atk-enum-types.c \
+ atk-enum-types.h
+
+Atk_1_0_gir_MSVC_CFLAGS = \
+ -I../.. \
+ -DG_DISABLE_DEPRECATED \
+ -DATK_DISABLE_DEPRECATED \
+ -DATK_COMPILATION \
+ -DATK_LOCALEDIR="\\\"/dummy/share/locale\\\""
+
+Atk_1_0_gir_MSVC_SCANNERFLAGS = --warn-all --c-include "atk/atk.h"
+
+include $(top_srcdir)/build/Makefile.msvc-introspection
+
+else
+INTROSPECTION_INTERMEDIATE_ITEMS =
+endif
+
dist-hook: \
$(top_builddir)/build/win32/vs9/atk.vcproj \
- $(top_builddir)/build/win32/vs9/atk.headers
+ $(top_builddir)/build/win32/vs9/atk.headers \
+ $(INTROSPECTION_INTERMEDIATE_ITEMS)
distclean-local:
if test $(srcdir) = .; then :; else \
diff --git a/build/Makefile.am b/build/Makefile.am
index 583966b..f5bfe80 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -1,10 +1,2 @@
-SUBDIRS = \
- win32
-
-EXTRA_DIST = \
- msvcfiles.py \
- detectenv-msvc.mak \
- introspection-msvc.mak \
- atk-introspection-msvc.mak \
- gen-file-list-atk.py
+SUBDIRS = win32
diff --git a/build/atk-introspection-msvc.mak b/build/atk-introspection-msvc.mak
deleted file mode 100644
index 0824216..0000000
--- a/build/atk-introspection-msvc.mak
+++ /dev/null
@@ -1,50 +0,0 @@
-# NMake Makefile to build Introspection Files for ATK
-
-!include detectenv-msvc.mak
-
-APIVERSION = 1.0
-
-CHECK_PACKAGE = gobject-2.0
-
-!include introspection-msvc.mak
-
-!if "$(BUILD_INTROSPECTION)" == "TRUE"
-all: Atk-$(APIVERSION).gir Atk-$(APIVERSION).typelib
-
-atk_list:
- @-echo Generating Filelist to Introspect for ATK...
- $(PYTHON2) gen-file-list-atk.py
-
-Atk-$(APIVERSION).gir: atk_list
- @-echo Generating Atk-$(APIVERSION).gir...
- @set CC=$(CC)
- @set PYTHONPATH=$(BASEDIR)\lib\gobject-introspection
- @set PATH=win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(BASEDIR)\bin;$(PATH)
- @set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
- @set LIB=win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(BASEDIR)\lib;$(LIB)
- $(PYTHON2) $(G_IR_SCANNER) --verbose -I.. --add-include-path=.. \
- --namespace=Atk --nsversion=$(APIVERSION) --include=GObject-2.0 \
- --no-libtool --pkg=glib-2.0 --library=atk-1.0 \
- --reparse-validate --add-include-path=$(G_IR_INCLUDEDIR) \
- --pkg-export atk --warn-all --c-include "atk/atk.h" \
- -DATK_DISABLE_DEPRECATED -DATK_COMPILATION -DATK_LOCALEDIR=\"/dummy/share/locale\" \
- --filelist=atk_list -o Atk-$(APIVERSION).gir
-
-Atk-$(APIVERSION).typelib: Atk-$(APIVERSION).gir
- @-echo Compiling Atk-$(APIVERSION).typelib...
- $(G_IR_COMPILER) --includedir=. --debug --verbose Atk-1.0.gir -o Atk-1.0.typelib
-
-install-introspection: Atk-$(APIVERSION).gir Atk-$(APIVERSION).typelib
- @-copy Atk-$(APIVERSION).gir $(G_IR_INCLUDEDIR)
- @-copy /b Atk-$(APIVERSION).typelib $(G_IR_TYPELIBDIR)
-
-!else
-all:
- @-echo $(ERROR_MSG)
-!endif
-
-clean:
- @-del /f/q Atk-$(APIVERSION).typelib
- @-del /f/q Atk-$(APIVERSION).gir
- @-del /f/q atk_list
- @-del /f/q *.pyc
diff --git a/build/gen-file-list-atk.py b/build/gen-file-list-atk.py
deleted file mode 100644
index f008022..0000000
--- a/build/gen-file-list-atk.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/python
-# vim: encoding=utf-8
-# Generate the file lists for processing with g-ir-scanner
-import os
-import sys
-import re
-import string
-import subprocess
-import optparse
-
-from msvcfiles import read_vars_from_AM
-
-def gen_atk_filelist(srcroot, subdir, dest):
- vars = read_vars_from_AM(os.path.join(srcroot, subdir, 'Makefile.am'),
- vars = {'top_builddir':'.'},
- conds = {'HAVE_INTROSPECTION':True},
- filters = ['introspection_sources', 'introspection_generated_sources'])
-
- files = vars['introspection_sources'].split() + \
- vars['introspection_generated_sources'].split()
-
- with open(dest, 'w') as d:
- for i in files:
- if (i.startswith('./atk/')):
- i = i.replace('./atk/','')
- d.write(srcroot + '\\' + subdir + '\\' + i.replace('/', '\\') + '\n')
-
-def main(argv):
- srcroot = os.path.join('..')
- subdir = 'atk'
- gen_atk_filelist(srcroot, subdir, 'atk_list')
- return 0
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv))
diff --git a/build/introspection-msvc.mak b/build/introspection-msvc.mak
deleted file mode 100644
index 55eec45..0000000
--- a/build/introspection-msvc.mak
+++ /dev/null
@@ -1,65 +0,0 @@
-# Common Utility NMake Makefile Template
-# Used to Generate Introspection files for various Projects
-
-# Can Override with env vars as needed
-# You will need to have built gobject-introspection for this to work.
-# Change or pass in or set the following to suit your environment
-
-BASEDIR = ..\..\vs$(VSVER)\$(PLAT)
-GIR_SUBDIR = share\gir-1.0
-GIR_TYPELIBDIR = lib\girepository-1.0
-G_IR_SCANNER = $(BASEDIR)\bin\g-ir-scanner
-G_IR_COMPILER = $(BASEDIR)\bin\g-ir-compiler.exe
-G_IR_INCLUDEDIR = $(BASEDIR)\$(GIR_SUBDIR)
-G_IR_TYPELIBDIR = $(BASEDIR)\$(GIR_TYPELIBDIR)
-
-# Note: The PYTHON2 must be a Python 2.6.x or 2.7.x Interpretor!
-# Either having python.exe from Python 2.6.x/2.7.x in your PATH will work
-# or passing in PYTHON2=<full path to your Python 2.6.x/2.7.x interpretor> will do
-
-# This is required, and gobject-introspection needs to be built
-# before this can be successfully run.
-PYTHON2=python
-
-# Don't change anything following this line!
-VALID_PKG_CONFIG_PATH = FALSE
-VALID_GCC_INSTPATH = FALSE
-
-MSG_INVALID_PKGCONFIG = You must set or specifiy a valid PKG_CONFIG_PATH
-MSG_INVALID_CFG = You need to specify or set CFG to be release or debug to use this Makefile to build the Introspection Files
-
-ERROR_MSG =
-
-BUILD_INTROSPECTION = TRUE
-
-!if ![pkg-config --print-errors --errors-to-stdout $(CHECK_PACKAGE) > pkgconfig.x] \
- && ![setlocal] \
- && ![set file="pkgconfig.x"] \
- && ![FOR %A IN (%file%) DO @echo PKG_CHECK_SIZE=%~zA > pkgconfig.chksize] \
- && ![del $(ERRNUL) /q/f pkgconfig.x]
-!endif
-
-!include pkgconfig.chksize
-!if "$(PKG_CHECK_SIZE)" == "0"
-VALID_PKG_CONFIG_PATH = TRUE
-!else
-VALID_PKG_CONFIG_PATH = FALSE
-!endif
-
-!if ![del $(ERRNUL) /q/f pkgconfig.chksize]
-!endif
-
-VALID_CFGSET = FALSE
-!if "$(CFG)" == "release" || "$(CFG)" == "debug"
-VALID_CFGSET = TRUE
-!endif
-
-!if "$(VALID_PKG_CONFIG_PATH)" != "TRUE"
-BUILD_INTROSPECTION = FALSE
-ERROR_MSG = $(MSG_INVALID_PKGCONFIG)
-!endif
-
-!if "$(VALID_CFGSET)" != "TRUE"
-BUILD_INTROSPECTION = FALSE
-ERROR_MSG = $(MSG_INVALID_CFG)
-!endif
diff --git a/build/msvcfiles.py b/build/msvcfiles.py
deleted file mode 100644
index 05957ac..0000000
--- a/build/msvcfiles.py
+++ /dev/null
@@ -1,254 +0,0 @@
-#!/usr/bin/python
-# vim: encoding=utf-8
-#expand *.in files
-import os
-import sys
-import re
-import optparse
-
-def parent_dir(path):
- if not os.path.isabs(path):
- path = os.path.abspath(path)
- if os.path.isfile(path):
- path = os.path.dirname(path)
- return os.path.split(path)[0]
-
-def check_output_type (btype):
- print_bad_type = False
- output_type = -1
- if (btype is None):
- output_type = -1
- print_bad_type = False
- elif (btype == "vs9"):
- output_type = 1
- elif (btype == "vs10"):
- output_type = 2
- elif (btype == "nmake-exe"):
- output_type = 3
- else:
- output_type = -1
- print_bad_type = True
- if (output_type == -1):
- if (print_bad_type is True):
- print ("The entered output build file type '%s' is not valid" % btype)
- else:
- print ("Output build file type is not specified.\nUse -t <type> to specify the output build file type.")
- print ("Valid output build file types are: nmake-exe, vs9 , vs10")
- return output_type
-
-def read_vars_from_AM(path, vars = {}, conds = {}, filters = None):
- '''
- path: path to the Makefile.am
- vars: predefined variables
- conds: condition variables for Makefile
- filters: if None, all variables defined are returned,
- otherwise, it is a list contains that variables should be returned
- '''
- cur_vars = vars.copy()
- RE_AM_VAR_REF = re.compile(r'\$\((\w+?)\)')
- RE_AM_VAR = re.compile(r'^\s*(\w+)\s*=(.*)$')
- RE_AM_INCLUDE = re.compile(r'^\s*include\s+(\w+)')
- RE_AM_VAR_ADD = re.compile(r'^\s*(\w+)\s*\+=(.*)$')
- RE_AM_CONTINUING = re.compile(r'\\\s*$')
- RE_AM_IF = re.compile(r'^\s*if\s+(\w+)')
- RE_AM_ELSE = re.compile(r'^\s*else')
- RE_AM_ENDIF = re.compile(r'^\s*endif')
- def am_eval(cont):
- return RE_AM_VAR_REF.sub(lambda x: cur_vars.get(x.group(1), ''), cont)
- with open(path, 'r') as f:
- contents = f.readlines()
- #combine continuing lines
- i = 0
- ncont = []
- while i < len(contents):
- line = contents[i]
- if RE_AM_CONTINUING.search(line):
- line = RE_AM_CONTINUING.sub('', line)
- j = i + 1
- while j < len(contents) and RE_AM_CONTINUING.search(contents[j]):
- line += RE_AM_CONTINUING.sub('', contents[j])
- j += 1
- else:
- if j < len(contents):
- line += contents[j]
- i = j
- else:
- i += 1
- ncont.append(line)
-
- #include, var define, var evaluation
- i = -1
- skip = False
- oldskip = []
- while i < len(ncont) - 1:
- i += 1
- line = ncont[i]
- mo = RE_AM_IF.search(line)
- if mo:
- oldskip.append(skip)
- skip = False if mo.group(1) in conds and conds[mo.group(1)] \
- else True
- continue
- mo = RE_AM_ELSE.search(line)
- if mo:
- skip = not skip
- continue
- mo = RE_AM_ENDIF.search(line)
- if mo:
- if oldskip:
- skip = oldskip.pop()
- continue
- if not skip:
- mo = RE_AM_INCLUDE.search(line)
- if mo:
- cur_vars.update(read_vars_from_AM(am_eval(mo.group(1)), cur_vars, conds, None))
- continue
- mo = RE_AM_VAR.search(line)
- if mo:
- cur_vars[mo.group(1)] = am_eval(mo.group(2).strip())
- continue
- mo = RE_AM_VAR_ADD.search(line)
- if mo:
- try:
- cur_vars[mo.group(1)] += ' '
- except KeyError:
- cur_vars[mo.group(1)] = ''
- cur_vars[mo.group(1)] += am_eval(mo.group(2).strip())
- continue
-
- #filter:
- if filters != None:
- ret = {}
- for i in filters:
- ret[i] = cur_vars.get(i, '')
- return ret
- else:
- return cur_vars
-
-def process_include(src, dest, includes):
- RE_INCLUDE = re.compile(r'^\s*#include\s+"(.*)"')
- with open(src, 'r') as s:
- with open(dest, 'w') as d:
- for i in s:
- mo = RE_INCLUDE.search(i)
- if mo:
- target = ''
- for j in includes:
- #print "searching in ", j
- if mo.group(1) in os.listdir(j):
- target = os.path.join(j, mo.group(1))
- break
- if not target:
- raise Exception("Couldn't find include file %s" % mo.group(1))
- else:
- with open(target, 'r') as t:
- for inc in t.readlines():
- d.write(inc)
- else:
- d.write(i)
-
-#Generate the source files listing that is used
-def generate_src_list (srcroot, srcdir, filters_src, filter_conds, filter_c, mk_am_file):
- mkfile = ''
- if mk_am_file is None or mk_am_file == '':
- mkfile = 'Makefile.am'
- else:
- mkfile = mk_am_file
- vars = read_vars_from_AM(os.path.join(srcdir, mkfile),
- vars = {'top_srcdir': srcroot},
- conds = filter_conds,
- filters = filters_src)
- files = []
- for src_filters_item in filters_src:
- files += vars[src_filters_item].split()
- if filter_c is True:
- sources = [i for i in files if i.endswith('.c') ]
- return sources
- else:
- return files
-
-# Generate the Visual Studio 2008 Project Files from the templates
-def gen_vs9_project (projname, srcroot, srcdir_name, sources_list):
- vs_file_list_dir = os.path.join (srcroot, 'build', 'win32')
-
- with open (os.path.join (vs_file_list_dir,
- projname + '.sourcefiles'), 'w') as vs9srclist:
- for i in sources_list:
- vs9srclist.write ('\t\t\t<File RelativePath="..\\..\\..\\' + srcdir_name + '\\' + i.replace('/', '\\') + '" />\n')
-
- process_include (os.path.join(srcroot, 'build', 'win32', 'vs9', projname + '.vcprojin'),
- os.path.join(srcroot, 'build', 'win32', 'vs9', projname + '.vcproj'),
- includes = [vs_file_list_dir])
-
- os.unlink(os.path.join(srcroot, 'build', 'win32', projname + '.sourcefiles'))
-
-# Generate the Visual Studio 2010 Project Files from the templates
-def gen_vs10_project (projname, srcroot, srcdir_name, sources_list):
- vs_file_list_dir = os.path.join (srcroot, 'build', 'win32')
-
- with open (os.path.join (vs_file_list_dir,
- projname + '.vs10.sourcefiles'), 'w') as vs10srclist:
- for j in sources_list:
- vs10srclist.write (' <ClCompile Include="..\\..\\..\\' + srcdir_name + '\\' + j.replace('/', '\\') + '" />\n')
-
- with open (os.path.join (vs_file_list_dir,
- projname + '.vs10.sourcefiles.filters'), 'w') as vs10srclist_filter:
- for k in sources_list:
- vs10srclist_filter.write (' <ClCompile Include="..\\..\\..\\' + srcdir_name + '\\' + k.replace('/', '\\') + '"><Filter>Source Files</Filter></ClCompile>\n')
-
- process_include (os.path.join(srcroot, 'build', 'win32', 'vs10', projname + '.vcxprojin'),
- os.path.join(srcroot, 'build', 'win32', 'vs10', projname + '.vcxproj'),
- includes = [vs_file_list_dir])
- process_include (os.path.join(srcroot, 'build', 'win32', 'vs10', projname + '.vcxproj.filtersin'),
- os.path.join(srcroot, 'build', 'win32', 'vs10', projname + '.vcxproj.filters'),
- includes = [vs_file_list_dir])
-
- os.unlink(os.path.join(srcroot, 'build', 'win32', projname + '.vs10.sourcefiles'))
- os.unlink(os.path.join(srcroot, 'build', 'win32', projname + '.vs10.sourcefiles.filters'))
-
-def gen_vs_inst_list (projname, srcroot, srcdirs, inst_lists, destdir_names, isVS9):
- vs_file_list_dir = os.path.join (srcroot, 'build', 'win32')
- vsver = ''
- vsprops_line_ending = ''
- vsprops_file_ext = ''
- if isVS9 is True:
- vsver = '9'
- vsprops_line_ending = '&#x0D;&#x0A;\n'
- vsprops_file_ext = '.vsprops'
- else:
- vsver = '10'
- vsprops_line_ending = '\n\n'
- vsprops_file_ext = '.props'
-
- with open (os.path.join (vs_file_list_dir,
- projname + '.vs' + vsver + 'instfiles'), 'w') as vsinstlist:
-
- for file_list, srcdir, dir_name in zip (inst_lists, srcdirs, destdir_names):
- for i in file_list:
- vsinstlist.write ('copy ..\\..\\..\\' +
- srcdir + '\\' +
- i.replace ('/', '\\') +
- ' $(CopyDir)\\' +
- dir_name +
- vsprops_line_ending)
- process_include (os.path.join(srcroot, 'build', 'win32', 'vs' + vsver, projname + '-install' + vsprops_file_ext + 'in'),
- os.path.join(srcroot, 'build', 'win32', 'vs' + vsver, projname + '-install' + vsprops_file_ext),
- includes = [vs_file_list_dir])
-
- os.unlink(os.path.join (vs_file_list_dir, projname + '.vs' + vsver + 'instfiles'))
-
-def generate_nmake_makefiles(srcroot, srcdir, base_name, makefile_name, progs_list):
- file_list_dir = os.path.join (srcroot, 'build', 'win32')
-
- with open (os.path.join (file_list_dir,
- base_name + '_progs'), 'w') as proglist:
- for i in progs_list:
- proglist.write ('\t' + i + '$(EXEEXT)\t\\\n')
-
-
- process_include (os.path.join(srcdir, makefile_name + 'in'),
- os.path.join(srcdir, makefile_name),
- includes = [file_list_dir])
-
- os.unlink(os.path.join (file_list_dir, base_name + '_progs'))
-
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index 897dc8b..39eca58 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -1,6 +1,33 @@
-SUBDIRS = \
+if HAVE_INTROSPECTION
+GENERATED_ITEMS = \
+ introspection.body.mak \
+ Atk_1_0_gir_list
+
+introspection.body.mak: Atk-1.0.gir.msvc.introspect
+ -$(RM) introspection.body.mak
+ for F in `ls *.msvc.introspect`; do \
+ case $$F in \
+ *) cat $(top_builddir)/build/win32/$$F >>$@ \
+ ;; \
+ esac; \
+ done
+ $(RM) Atk-1.0.gir.msvc.introspect
+
+DISTCLEANFILES = $(GENERATED_ITEMS)
+
+else
+GENERATED_ITEMS =
+endif
+
+SUBDIRS = \
vs9 \
vs10 \
vs11 \
vs12 \
vs14
+
+EXTRA_DIST = \
+ detectenv-msvc.mak \
+ introspection-msvc.mak \
+ atk-introspection-msvc.mak \
+ $(GENERATED_ITEMS)
diff --git a/build/win32/atk-introspection-msvc.mak b/build/win32/atk-introspection-msvc.mak
new file mode 100644
index 0000000..8bc734f
--- /dev/null
+++ b/build/win32/atk-introspection-msvc.mak
@@ -0,0 +1,34 @@
+# NMake Makefile to build Introspection Files for ATK
+
+!include detectenv-msvc.mak
+
+APIVERSION = 1.0
+
+CHECK_PACKAGE = gobject-2.0
+
+!include introspection-msvc.mak
+
+!if "$(BUILD_INTROSPECTION)" == "TRUE"
+all: setgirbuildenv Atk-$(APIVERSION).gir Atk-$(APIVERSION).typelib
+
+setgirbuildenv:
+ @-set PYTHONPATH=$(PREFIX)\lib\gobject-introspection
+ @-set PATH=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(PREFIX)\bin;$(PATH)
+ @-set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
+ @-set LIB=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)
+
+!include introspection.body.mak
+
+install-introspection: all
+ @-copy Atk-$(APIVERSION).gir $(G_IR_INCLUDEDIR)
+ @-copy /b Atk-$(APIVERSION).typelib $(G_IR_TYPELIBDIR)
+
+!else
+all:
+ @-echo $(ERROR_MSG)
+!endif
+
+clean:
+ @-del /f/q Atk-$(APIVERSION).typelib
+ @-del /f/q Atk-$(APIVERSION).gir
+ @-del /f/q *.pyc
diff --git a/build/detectenv-msvc.mak b/build/win32/detectenv-msvc.mak
index 06c908e..61f979d 100644
--- a/build/detectenv-msvc.mak
+++ b/build/win32/detectenv-msvc.mak
@@ -1,3 +1,8 @@
+# Common NMake Makefile module for checking the build environment
+# This can be copied from $(glib_srcroot)\build\win32 for GNOME items
+# that support MSVC builds and introspection under MSVC, and can be used
+# for building test programs as well.
+
# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
!if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
@@ -35,6 +40,8 @@ VSVER = 10
VSVER = 11
!elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
VSVER = 12
+!elseif $(VCVERSION) > 1899 && $(VCVERSION) < 2000
+VSVER = 14
!else
VSVER = 0
!endif
@@ -42,20 +49,24 @@ VSVER = 0
!if "$(VSVER)" == "0"
MSG = ^
This NMake Makefile set supports Visual Studio^
-9 (2008) through 12 (2013). Your Visual Studio^
+9 (2008) through 14 (2015). Your Visual Studio^
version is not supported.
!error $(MSG)
!endif
VALID_CFGSET = FALSE
-!if "$(CFG)" == "release" || "$(CFG)" == "debug"
+!if "$(CFG)" == "release" || "$(CFG)" == "debug" || "$(CFG)" == "Release" || "$(CFG)" == "Debug"
VALID_CFGSET = TRUE
!endif
-!if "$(CFG)" == "release"
-CFLAGS_ADD = /MD /O2
+# We want debugging symbols logged for all builds,
+# using .pdb files for release builds
+CFLAGS_BASE = /Zi
+
+!if "$(CFG)" == "release" || "$(CFG)" == "Release"
+CFLAGS_ADD = /MD /O2 $(CFLAGS_BASE)
!else
-CFLAGS_ADD = /MDd /Od /Zi
+CFLAGS_ADD = /MDd /Od $(CFLAGS_BASE)
!endif
!if "$(PLAT)" == "x64"
@@ -63,10 +74,3 @@ LDFLAGS_ARCH = /machine:x64
!else
LDFLAGS_ARCH = /machine:x86
!endif
-
-LD = link.exe
-LD_CFLAGS = /link
-EXEEXT = .exe
-GLIB_LIBS = gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib
-
-ATK_API_VERSION = 1.0
diff --git a/build/win32/introspection-msvc.mak b/build/win32/introspection-msvc.mak
new file mode 100644
index 0000000..8739844
--- /dev/null
+++ b/build/win32/introspection-msvc.mak
@@ -0,0 +1,94 @@
+# Common NMake Makefile module for checking the build environment is sane
+# for building introspection files under MSVC/NMake.
+# This can be copied from $(gi_srcroot)\build\win32 for GNOME items
+# that support MSVC builds and introspection under MSVC.
+
+# Can override with env vars as needed
+# You will need to have built gobject-introspection for this to work.
+# Change or pass in or set the following to suit your environment
+
+!if "$(PREFIX)" == ""
+PREFIX = ..\..\..\vs$(VSVER)\$(PLAT)
+!endif
+
+!if ![setlocal] && \
+ ![set PFX=$(PREFIX)] && \
+ ![for %P in (%PFX%) do @echo PREFIX_FULL=%~dpnfP > pfx.x]
+!endif
+!include pfx.x
+
+!if "$(PKG_CONFIG_PATH)" == ""
+PKG_CONFIG_PATH=$(PREFIX_FULL)\lib\pkgconfig
+!else
+PKG_CONFIG_PATH=$(PREFIX_FULL)\lib\pkgconfig;$(PKG_CONFIG_PATH)
+!endif
+
+!if ![del $(ERRNUL) /q/f pfx.x]
+!endif
+
+# Note: The PYTHON must be the Python release series that was used to build
+# the GObject-introspection scanner Python module!
+# Either having python.exe your PATH will work or passing in
+# PYTHON=<full path to your Python interpretor> will do
+
+# This is required, and gobject-introspection needs to be built
+# before this can be successfully run.
+!if "$(PYTHON)" == ""
+PYTHON=python
+!endif
+
+# Path to the pkg-config tool, if not already in the PATH
+!if "$(PKG_CONFIG)" == ""
+PKG_CONFIG=pkg-config
+!endif
+
+# Don't change anything following this line!
+
+GIR_SUBDIR = share\gir-1.0
+GIR_TYPELIBDIR = lib\girepository-1.0
+G_IR_SCANNER = $(PREFIX)\bin\g-ir-scanner
+G_IR_COMPILER = $(PREFIX)\bin\g-ir-compiler.exe
+G_IR_INCLUDEDIR = $(PREFIX)\$(GIR_SUBDIR)
+G_IR_TYPELIBDIR = $(PREFIX)\$(GIR_TYPELIBDIR)
+
+VALID_PKG_CONFIG_PATH = FALSE
+
+MSG_INVALID_PKGCONFIG = You must set or specifiy a valid PKG_CONFIG_PATH
+MSG_INVALID_CFG = You need to specify or set CFG to be release or debug to use this Makefile to build the Introspection Files
+
+ERROR_MSG =
+
+BUILD_INTROSPECTION = TRUE
+
+!if ![set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)] \
+ && ![$(PKG_CONFIG) --print-errors --errors-to-stdout $(CHECK_PACKAGE) > pkgconfig.x] \
+ && ![setlocal] \
+ && ![set file="pkgconfig.x"] \
+ && ![FOR %A IN (%file%) DO @echo PKG_CHECK_SIZE=%~zA > pkgconfig.chksize] \
+ && ![del $(ERRNUL) /q/f pkgconfig.x]
+!endif
+
+!include pkgconfig.chksize
+!if "$(PKG_CHECK_SIZE)" == "0"
+VALID_PKG_CONFIG_PATH = TRUE
+!else
+VALID_PKG_CONFIG_PATH = FALSE
+!endif
+
+!if ![del $(ERRNUL) /q/f pkgconfig.chksize]
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "debug" || "$(CFG)" == "Release" || "$(CFG)" == "Debug"
+VALID_CFGSET = TRUE
+!endif
+
+!if "$(VALID_PKG_CONFIG_PATH)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_PKGCONFIG)
+!endif
+
+!if "$(VALID_CFGSET)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_CFG)
+!endif
diff --git a/tests/testatk_vc.mak b/tests/testatk_vc.mak
index 39aeee0..17e2a7a 100644
--- a/tests/testatk_vc.mak
+++ b/tests/testatk_vc.mak
@@ -1,5 +1,11 @@
!include ..\build\detectenv-msvc.mak
+LD_CFLAGS = /link
+EXEEXT = .exe
+GLIB_LIBS = gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib
+
+ATK_API_VERSION = 1.0
+
BUILD_PATH = ..\build\win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin
LDFLAGS_PATH = /libpath:$(BUILD_PATH) /libpath:..\..\vs$(VSVER)\$(PLAT)\lib