# -*- mode: mak; -*-
###############################################################################
# File:         TOOLSET/vcwin32_net2012.def
# Contents:     Visual Studio .NET 2012 C/C++ defines
###############################################################################

toolset		= vcwin.net2012

o		= obj
s		= asm
a		= lib
exe		= .exe

.SUFFIXES:	.asm

#
#   Setup the basic .NET environment paths
#   This is taken from "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat"
#
#   Cannot use vsvars.bat data imported from the environment as it
#   will conflict with other versions of MS
#
#   The following are the default installed locations
#   Currently assume default installation of .NET 2012
#
PROGRAMFILES        ?= C:/Program Files
WINDIR              ?= C:/WINDOWS

VSINSTALLDIR        ?= $(PROGRAMFILES)/Microsoft Visual Studio 11.0
VCINSTALLDIR        ?= $(VSINSTALLDIR)/VC
FrameworkDir        ?= $(WINDIR)/Microsoft.NET/Framework
FrameworkDir32      ?= $(WINDIR)/Microsoft.NET/Framework
FrameworkVersion    ?= v4.0.30319
FrameworkVersion32  ?= v4.0.30319
Framework35Version  ?= v3.5
WindowsSdkDir       ?= $(PROGRAMFILES)/Windows Kits/8.0
WindowsSdkDir_35    ?= $(PROGRAMFILES)/Microsoft SDKs/Windows/v7.0A/Bin

DevEnvDir   := $(VSINSTALLDIR)/Common7/IDE
MSVCDir     := $(VCINSTALLDIR)/VC

# Clean up directory paths and remove trailing backslash
VSINSTALLDIR        := $(subst \,/,$(patsubst %\,%,$(VSINSTALLDIR)))
VCINSTALLDIR        := $(subst \,/,$(patsubst %\,%,$(VCINSTALLDIR)))
FrameworkDir        := $(subst \,/,$(patsubst %\,%,$(FrameworkDir)))
FrameworkDir32      := $(subst \,/,$(patsubst %\,%,$(FrameworkDir32)))
WindowsSdkDir       := $(subst \,/,$(patsubst %\,%,$(WindowsSdkDir)))
WindowsSdkDir       := $(subst \,/,$(patsubst %\,%,$(WindowsSdkDir)))
WindowsSdkDir_35    := $(subst \,/,$(patsubst %\,%,$(WindowsSdkDir_35)))

DevEnvDir           := $(subst \,/,$(patsubst %\,%,$(DevEnvDir)))
MSVCDir             := $(subst \,/,$(patsubst %\,%,$(MSVCDir)))

# Check for required update installed
GBE_VS2012_ENVVER   ?= HKCU/SOFTWARE/Microsoft/VisualStudio/11.0_Config/SplashInfo/EnvVersion
GBE_VS2012_ENVVAL4   ?= 11.0.61030.00 Update 4
GBE_VS2012_ENVVAL5   ?= 11.0.61219.00 Update 5
 

# Verify environment variable requirements
.PHONY:		visualc
visualc:
  ifndef GBE_NOTOOLSTEST
	    $(AA_PRE)$(echo) '[Toolset VCWIN32 - Visual Studio .NET 2012]'; \
	    if [ ! -d "$(VSINSTALLDIR)" ]; then echo "Directory VSINSTALLDIR does not exist: $(VSINSTALLDIR)"; exit 2; fi; \
	    if [ ! -d "$(VCINSTALLDIR)" ]; then echo "Directory VCINSTALLDIR does not exist: $(VCINSTALLDIR)"; exit 2; fi; \
	    if [ ! -d "$(FrameworkDir)" ]; then echo "Directory FrameworkDir does not exist: $(FrameworkDir)"; exit 2; fi; \
	    if [ ! -d "$(FrameworkDir)/$(FrameworkVersion)" ]; then echo "Directory FrameworkVersion does not exist: $(FrameworkVersion)"; exit 2; fi; \
	    if [ ! -d "$(WindowsSdkDir)" ]; then echo "Directory WindowsSdkDir does not exist: $(WindowsSdkDir)"; exit 2; fi ; \
		checkReg "-key:$(GBE_VS2012_ENVVER)" "-value:$(GBE_VS2012_ENVVAL4)" && update4=1 ;\
		checkReg "-key:$(GBE_VS2012_ENVVER)" "-value:$(GBE_VS2012_ENVVAL5)" && update5=1 ;\
	    if [ "$${update4}$${update5}" ]; then true; else echo "VS2012 Update 4 or 5 not installed"; exit 2; fi;
  endif

VISUALC		:= $(subst \,/,$(strip $(MSVCDir)))
visualc		:= $(subst $(space),$(spacealt),$(subst \,/,$(strip $(MSVCDir))))

#
#   Setup PATH, VC_LIB and INCLUDE for the SDK
#
NET_PATH:= $(DevEnvDir)/CommonExtensions/Microsoft/TestWindow
NET_PATH:= $(NET_PATH);$(PROGRAMFILES)/Microsoft SDKs/F#/3.0/Framework/v4.0
NET_PATH:= $(NET_PATH);$(VSINSTALLDIR)/VSTSDB/Deploy
NET_PATH:= $(NET_PATH);$(DevEnvDir)
NET_PATH:= $(NET_PATH);$(VCINSTALLDIR)/BIN
NET_PATH:= $(NET_PATH);$(VSINSTALLDIR)/Common7/Tools
NET_PATH:= $(NET_PATH);$(FrameworkDir)/$(FrameworkVersion)
NET_PATH:= $(NET_PATH);$(FrameworkDir)/$(Framework35Version)
NET_PATH:= $(NET_PATH);$(VCINSTALLDIR)/VCPackages
NET_PATH:= $(NET_PATH);$(PROGRAMFILES)/HTML Help Workshop
NET_PATH:= $(NET_PATH);$(VSINSTALLDIR)/Team Tools/Performance Tools
NET_PATH:= $(NET_PATH);$(WindowsSdkDir)/bin/x86
NET_PATH:= $(NET_PATH);$(PROGRAMFILES)/Microsoft SDKs/Windows/v8.0A/bin/NETFX 4.0 Tools
NET_PATH:= $(NET_PATH);$(WindowsSdkDir_35)

ifeq "$(findstring $(NET_PATH),$(PATH))" ""
PATH    := $(NET_PATH);$(PATH)
endif
Path    := $(PATH)
export PATH

INCLUDE := $(VCINSTALLDIR)/PlatformSDK/INCLUDE
INCLUDE  := $(VCINSTALLDIR)/INCLUDE
INCLUDE  := $(INCLUDE);$(VCINSTALLDIR)/ATLMFC/INCLUDE
INCLUDE  := $(INCLUDE);$(WindowsSdkDir)/include/shared
INCLUDE  := $(INCLUDE);$(WindowsSdkDir)/include/um
INCLUDE  := $(INCLUDE);$(WindowsSdkDir)/include/winrt
export INCLUDE


LIB :=
export LIB

VC_LIB     := $(VCINSTALLDIR)/LIB
VC_LIB     := $(VC_LIB);$(VCINSTALLDIR)/ATLMFC/LIB
VC_LIB     := $(VC_LIB);$(WindowsSdkDir)/lib/win8/um/x86
VC_LIB     := $(VC_LIB);$(FrameworkDir)/$(FrameworkVersion)
VC_LIB     := $(VC_LIB);$(FrameworkDir)/$(Framework35Version)
VC_LIB     := $(VC_LIB);$(WindowsSdkDir)/References/CommonConfiguration/Neutral
VC_LIB     := $(VC_LIB);$(PROGRAMFILES)/Microsoft SDKs/Windows/v8.0/ExtensionSDKs/Microsoft.VCLibs/11.0/References/CommonConfiguration/neutral

# rpcgen configuration
#
RPCGEN_CPP	:= cl
RPCGEN_CFLAGS	:= -EP
export RPCGEN_CPP RPCGEN_CFLAGS

#
