#******************************************************************************
#
#       Copyright:      2005-2010 Paul Obermeier (obermeier@tcl3d.org)
#
#                       See the file "Tcl3D_License.txt" for information on
#                       usage and redistribution of this file, and for a
#                       DISCLAIMER OF ALL WARRANTIES.
#
#       Module:         Tcl3D
#       Filename:       config_win32
#
#       Author:         Paul Obermeier
#
#       Description:    Configuration file for Windows based systems using
#                       the following Microsoft Visual Studio suites:
#                       Visual Studio  7 (VS 2003)
#                       Visual Studio  8 (VS 2005)
#                       Visual Studio  9 (VS 2008)
#                       Visual Studio 10 (VS 2010)
#                       Checking the correct version is based on the environment
#                       variable VSINSTALLDIR in file make.oscheck.
#                       Makefiles are called from a DOS command shell.
#                       This file is included from the global Makefile.
#                       The syntax is based on GNU make.
#
#******************************************************************************

# Set the following variable to 1, if compiling with stubs.
WITH_STUBS = 1

# Set the following variable to 1, if compiling with debugging information.
# WITH_DEBUG = 1

# Set the following variable to the path of the Windows SDK.
# Typically only needed with older Visual Studio Express editions.
# SDK_DIR = D:\programme\Microsoft SDKs\Windows\v6.0A
# SDK_DIR = C:\Programme\Microsoft Platform SDK

INSTDIR = "C:\Program Files\Tcl"
TCLDIR  = "C:\Program Files\Tcl"
TKDIR   = "C:\Program Files\Tcl"

TCLMAJOR     = 8
TCLMINOR     = 5

INSTBIN  = $(INSTDIR)\bin
INSTLIB  = $(INSTDIR)\lib
INSTINC  = $(INSTDIR)\include

# GX: Synchronous exception handling
# GR: Run-time type information (RTTI)
CXX_PARAMS = -GX -GR
CC_PARAMS  =
ifeq (yes,$(HAVE_DOTNET_COMPILER))
CXX_PARAMS = -Zc:wchar_t -EHsc
CC_PARAMS  = -Zc:wchar_t
endif

ifdef WITH_DEBUG
# Debug version
OPT        = -Od -MDd -Zi -FR -RTC1
LD_PARAMS  = -debug:full -debugtype:cv
ifeq (yes,$(HAVE_DOTNET_COMPILER))
LD_PARAMS  = -debug -debugtype:cv -force
endif
DEBUG_SUFFIX=d

else
# Optimized version
OPT       = -O2 -MD -DNDEBUG
LD_PARAMS =
ifeq (yes,$(HAVE_DOTNET_COMPILER))
LD_PARAMS = -force
endif
DEBUG_SUFFIX=
endif

# Add the manifest generation option, if using a .NET compiler.
# This should be the default behaviour of a .NET linker according
# to the Microsoft documentation, but is needed for VS 2010.
ifeq (yes,$(HAVE_DOTNET_COMPILER))
LD_PARAMS += /MANIFEST
endif

PPSTUBS   = -DUSE_TCL_STUBS -DUSE_TK_STUBS
PPNOSTUBS = -D$(OS_TYPE) -DWIN32 -D_WIN32

CC           = cl -nologo -Zm1000 -c $(CC_PARAMS)
CXX          = cl -nologo -Zm1000 -c $(CXX_PARAMS)
MAKE         = gmake
LD           = link -nologo $(LD_PARAMS)
LDOUT        = -out:
SHLIB_LD     = link -nologo $(LD_PARAMS)
SHLIB_LDXX   = link -nologo $(LD_PARAMS)
SHLIB_CFLAGS = -dll

OBJEXT   = .obj
LIBEXT   = .lib
SHLIBEXT = .dll
BINEXT   = .exe
DSEP     = \\

ifdef SDK_DIR
GLLIBS = /LIBPATH:"$(SDK_DIR)\Lib" glu32.lib opengl32.lib
else
GLLIBS = glu32.lib opengl32.lib
endif

SYSLIBS = user32.lib gdi32.lib ws2_32.lib

TCLVERSION   = $(TCLMAJOR)$(TCLMINOR)
TCLINCDIR    = $(TCLDIR)\include
TKINCDIR     = $(TKDIR)\include
TCLLIBDIR    = $(TCLDIR)\lib
TKLIBDIR     = $(TKDIR)\lib
TCLSTUBLIBS  = $(TKLIBDIR)\tkstub$(TCLVERSION)$(LIBEXT) $(TCLLIBDIR)\tclstub$(TCLVERSION)$(LIBEXT)
TCLSTDLIBS   = $(TKLIBDIR)\tk$(TCLVERSION)$(LIBEXT) $(TCLLIBDIR)\tcl$(TCLVERSION)$(LIBEXT)
TCLSH        = tclsh$(TCLVERSION)

RM           = del
RMDIR        = rmdir /S /Q
CP           = copy
CPDIR        = xcopy /E /I /Y /Q
MKDIR        = md

INCL  = -I. -I$(TCLINCDIR)
ifdef SDK_DIR
INCL += -I"$(SDK_DIR)\Include"
endif

ifdef WITH_STUBS
TCLLIBS = $(TCLSTUBLIBS)
PPDEFS  = $(PPNOSTUBS) $(PPSTUBS)
else
TCLLIBS = $(TCLSTDLIBS)
PPDEFS  = $(PPNOSTUBS)
endif

# Needed for Togl to identify platform
PPDEFS += -DTOGL_WGL

# Compile GLEW as static version.
PPDEFS += -DGLEW_STATIC

# Additional debugging options

# Debug tcl3dVector allocation and destruction.
# PPDEFS += -DDEBUG_VECTOR=1

# If compiling with VS2005 or VS2008, add the following define to get rid 
# of warnings regarding use of unsafe, deprecated functions like strcpy,
# and sprintf.
ifeq (yes,$(HAVE_DOTNET_COMPILER))
PPDEFS += -D_CRT_SECURE_NO_DEPRECATE
endif
