Visual C++ toolkit to compile T2D?
by Jason McIntosh · in Torque Game Builder · 11/08/2005 (11:37 am) · 6 replies
Has anyone tried compiling T2D with the free command-line version of VC7? Would this require a makefile, and is there already one for T2D?
Thanks for any insights.
Thanks for any insights.
About the author
#2
@Jason, I put several hours into trying to get vctoolkit2003 to build Torque. The problem is there is no makefile / project / workspace utility to maintain all your dependencies between the many different sub-projects of torque. Compiling any given file is not the problem, getting it all to LINK it really the challenge. In the end I switched to GCC because the makefiles are available and are maintained and supported by the GG community.
11/08/2005 (5:12 pm)
@Joe - Can Code::Blocks use VC++ workspaces? @Jason, I put several hours into trying to get vctoolkit2003 to build Torque. The problem is there is no makefile / project / workspace utility to maintain all your dependencies between the many different sub-projects of torque. Compiling any given file is not the problem, getting it all to LINK it really the challenge. In the end I switched to GCC because the makefiles are available and are maintained and supported by the GG community.
#3
11/08/2005 (8:21 pm)
Thanks for the info, guys. I might give GCC a try, then.
#4
"Ed From Mars" made a resource to compile Torque with Code::Blocks, it should be easy to edit that for T2D. Check it out.
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8727
11/08/2005 (11:51 pm)
Sure it can Alex, that's one of it's best features to me. I get confused with it's different sets of options, but I managed to compile the OpenGL2d3d files ok when I couldn't with GCC. It does support GCC too, I think, but I only use it for MSVC stuff."Ed From Mars" made a resource to compile Torque with Code::Blocks, it should be easy to edit that for T2D. Check it out.
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8727
#5
Create a file conf.VC2K3.mk in SDK\mk with the following content:
>> SNIP <<
CFLAGS = $(CFLAGS.GENERAL) $(CFLAGS.$(BUILD))
LFLAGS = $(LFLAGS.GENERAL) $(LFLAGS.$(BUILD))
LINK.LIBS = $(LINK.LIBS.GENERAL) $(LINK.LIBS.$(BUILD))
define DO.COMPILE.C
@echo "--> Compiling $(<)"
@$(COMPILER.c) $(CFLAGS) -I. $(PATH.H.SYS) -c -Fo$(@) $(<)
endef
define DO.COMPILE.CC
@echo "--> Compiling $(<)"
@$(COMPILER.cc) $(CFLAGS) -I. $(PATH.H.SYS) -c -Fo$(@) $(<)
endef
define DO.COMPILE.ASM
@echo "--> Assembling $(<)"
@$(COMPILER.asm) $(ASMFLAGS) -o $@ $(<)
endef
define DO.LINK.CONSOLE.EXE
@echo "--> Linking $@"
@$(LINK.cc) /OUT:$@ $(LFLAGS) $(LINK.SOURCES) $(LINK.LIBS)
endef
define DO.LINK.LIB
@echo "Creating library $@"
@$(LINK) /OUT:$@ $(LINK.SOURCES)
endef
>> SNIP <<
Next create a file conf.VC2K3.WIN32.mk in the same directory with the following content
(note the D3D setting at the end! Set it to true / false according to your needs):
>> SNIP <<
O=.obj
# there is no "exe" for x86 UNIX, but the makefiles need some extension so use this for now.
EXT.EXE=$(BUILD_SUFFIX).exe
EXT.LIB=$(BUILD_SUFFIX).lib
PRE.LIBRARY.LIB=../lib/$(DIR.OBJ)/
PRE.ENGINE.LIB=../engine/$(DIR.OBJ)/
# we won't be needing any DLLs, but just leave the def'n in place.
EXT.DLL=$(BUILD_SUFFIX).dll
EXT.DLE=$(BUILD_SUFFIX).dle
EXT.DEP=.d
MKDIR=mkdir $(@:/=)
RM=rm -f
RMDIR=rm -rf
CP=cp
LN=cp
COMPILER.c =cl
COMPILER.cc =cl
COMPILER.asm =../bin/nasm/nasmw.exe
LINK =link //lib
LINK.cc =link
# NOTE: if the warnings bother you, you can added a -w here to shut them off.
# be warned that you will then get no warnings.
CFLAGS.GENERAL = -c -arch:SSE2 -GA -G7 -GR -GX- -GF -GL-
CFLAGS.RELEASE = -Ox -Op- \
# -malign-double -ffast-math # these haven't been tested
CFLAGS.DEBUG = -Od -Zi -DTORQUE_DEBUG
ASMFLAGS = -f win32
LFLAGS.GENERAL =//MACHINE:X86 //SUBSYSTEM:WINDOWS //NOLOGO
LFLAGS.RELEASE =//NODEFAULTLIB:LIBCMT //NODEFAULTLIB:LIBCMT //DEFAULTLIB:LIBCMT //RELEASE
LFLAGS.DEBUG =//NODEFAULTLIB:LIBCMTD //NODEFAULTLIB:LIBCMT //DEFAULTLIB:LIBCMT //DEBUG
LINK.LIBS.VORBIS = ../lib/vorbis/win32/libogg.lib ../lib/vorbis/win32/libvorbis.lib ../lib/vorbis/win32/libogg.lib
LINK.LIBS.GENERAL = comdlg32.lib user32.lib advapi32.lib gdi32.lib winmm.lib wsock32.lib vfw32.lib $(LINK.LIBS.VORBIS)
LINK.LIBS.TOOLS = comdlg32.lib user32.lib advapi32.lib gdi32.lib winmm.lib wsock32.lib vfw32.lib
LINK.LIBS.SERVER =
LINK.LIBS.RELEASE =
LINK.LIBS.DEBUG =
PATH.H.SYS =
COMPILE_D3D=false
>> SNIP <<
Part 2 follows ...
11/21/2005 (6:34 pm)
Here comes my solution to this using gnu make with msys / cygwin installed:Create a file conf.VC2K3.mk in SDK\mk with the following content:
>> SNIP <<
CFLAGS = $(CFLAGS.GENERAL) $(CFLAGS.$(BUILD))
LFLAGS = $(LFLAGS.GENERAL) $(LFLAGS.$(BUILD))
LINK.LIBS = $(LINK.LIBS.GENERAL) $(LINK.LIBS.$(BUILD))
define DO.COMPILE.C
@echo "--> Compiling $(<)"
@$(COMPILER.c) $(CFLAGS) -I. $(PATH.H.SYS) -c -Fo$(@) $(<)
endef
define DO.COMPILE.CC
@echo "--> Compiling $(<)"
@$(COMPILER.cc) $(CFLAGS) -I. $(PATH.H.SYS) -c -Fo$(@) $(<)
endef
define DO.COMPILE.ASM
@echo "--> Assembling $(<)"
@$(COMPILER.asm) $(ASMFLAGS) -o $@ $(<)
endef
define DO.LINK.CONSOLE.EXE
@echo "--> Linking $@"
@$(LINK.cc) /OUT:$@ $(LFLAGS) $(LINK.SOURCES) $(LINK.LIBS)
endef
define DO.LINK.LIB
@echo "Creating library $@"
@$(LINK) /OUT:$@ $(LINK.SOURCES)
endef
>> SNIP <<
Next create a file conf.VC2K3.WIN32.mk in the same directory with the following content
(note the D3D setting at the end! Set it to true / false according to your needs):
>> SNIP <<
O=.obj
# there is no "exe" for x86 UNIX, but the makefiles need some extension so use this for now.
EXT.EXE=$(BUILD_SUFFIX).exe
EXT.LIB=$(BUILD_SUFFIX).lib
PRE.LIBRARY.LIB=../lib/$(DIR.OBJ)/
PRE.ENGINE.LIB=../engine/$(DIR.OBJ)/
# we won't be needing any DLLs, but just leave the def'n in place.
EXT.DLL=$(BUILD_SUFFIX).dll
EXT.DLE=$(BUILD_SUFFIX).dle
EXT.DEP=.d
MKDIR=mkdir $(@:/=)
RM=rm -f
RMDIR=rm -rf
CP=cp
LN=cp
COMPILER.c =cl
COMPILER.cc =cl
COMPILER.asm =../bin/nasm/nasmw.exe
LINK =link //lib
LINK.cc =link
# NOTE: if the warnings bother you, you can added a -w here to shut them off.
# be warned that you will then get no warnings.
CFLAGS.GENERAL = -c -arch:SSE2 -GA -G7 -GR -GX- -GF -GL-
CFLAGS.RELEASE = -Ox -Op- \
# -malign-double -ffast-math # these haven't been tested
CFLAGS.DEBUG = -Od -Zi -DTORQUE_DEBUG
ASMFLAGS = -f win32
LFLAGS.GENERAL =//MACHINE:X86 //SUBSYSTEM:WINDOWS //NOLOGO
LFLAGS.RELEASE =//NODEFAULTLIB:LIBCMT //NODEFAULTLIB:LIBCMT //DEFAULTLIB:LIBCMT //RELEASE
LFLAGS.DEBUG =//NODEFAULTLIB:LIBCMTD //NODEFAULTLIB:LIBCMT //DEFAULTLIB:LIBCMT //DEBUG
LINK.LIBS.VORBIS = ../lib/vorbis/win32/libogg.lib ../lib/vorbis/win32/libvorbis.lib ../lib/vorbis/win32/libogg.lib
LINK.LIBS.GENERAL = comdlg32.lib user32.lib advapi32.lib gdi32.lib winmm.lib wsock32.lib vfw32.lib $(LINK.LIBS.VORBIS)
LINK.LIBS.TOOLS = comdlg32.lib user32.lib advapi32.lib gdi32.lib winmm.lib wsock32.lib vfw32.lib
LINK.LIBS.SERVER =
LINK.LIBS.RELEASE =
LINK.LIBS.DEBUG =
PATH.H.SYS =
COMPILE_D3D=false
>> SNIP <<
Part 2 follows ...
#6
Last modify your configure.mk in the same directory to match the following:
>> SNIP <<
COMPILER_OPTIONS=CW6 VC6 GCC2 GCC3 VC2K3
BUILD_OPTIONS=DEBUG RELEASE
OS_OPTIONS=WIN32 BEOS LINUX OpenBSD FreeBSD Solaris
OS=
DIR.OBJ=out
-include mk/conf.mk
CONFIG_STATUS=VALID
ifeq ($(findstring $(OS), $(OS_OPTIONS)),)
targets += badOS
CONFIG_STATUS=INVALID
endif
ifeq ($(findstring $(COMPILER), $(COMPILER_OPTIONS)),)
targets +=badCompiler
CONFIG_STATUS=INVALID
endif
ifeq ($(findstring $(BUILD), $(BUILD_OPTIONS)),)
targets += badBuild
CONFIG_STATUS=INVALID
endif
default: $(targets) print save
badOS:
@echo ERROR: OS variable not set or is an illegal value
badCompiler:
@echo ERROR: COMPILER variable not set or is an illegal value
badBuild:
@echo ERROR: BUILD variable not set or is an illegal value
print:
@echo
@echo "Current Configuration: this config is $(CONFIG_STATUS)"
@echo " OS: $(OS)"
@echo " COMPILER: $(COMPILER)"
@echo " BUILD: $(BUILD)"
@echo " DIR.OBJ: $(DIR.OBJ)"
@echo
@echo "To change the current configuration type:"
@echo
@echo "make -f mk/configure.mk {arguments, ...}"
@echo
@echo "required arguments:"
@echo " OS={$(OS_OPTIONS)}"
@echo " COMPILER={$(COMPILER_OPTIONS)}"
@echo " BUILD={$(BUILD_OPTIONS)}"
@echo
@echo "optional arguments:"
@echo " DIR.OBJ={path to store intermediate obj files}"
@echo
@echo "Note: all arguments are case sensitive."
@echo
save:
@echo OS=$(OS) > mk/conf.mk
@echo COMPILER=$(COMPILER) >> mk/conf.mk
@echo BUILD=$(BUILD) >> mk/conf.mk
@echo ifeq \"$(BUILD)\" \"DEBUG\" >> mk/conf.mk
@echo BUILD_SUFFIX:=_DEBUG >> mk/conf.mk
@echo else >> mk/conf.mk
@echo BUILD_SUFFIX:= >> mk/conf.mk
@echo endif >> mk/conf.mk
@echo CONFIG_STATUS=$(CONFIG_STATUS) >> mk/conf.mk
@echo DIR.OBJ=$(DIR.OBJ) >> mk/conf.mk
@echo ifndef COMPILER_OPTIONS >> mk/conf.mk
@echo DIR.OBJ:=$(DIR.OBJ).$(COMPILER).$(BUILD) >> mk/conf.mk
@echo endif >> mk/conf.mk
>> SNIP <<
And that's it. Run configure setting the compiler to VC2K3 and you're good to go ... at least it works for me ;-)
Please make sure you check for the all path settings I to make sure all files are found ;-) and if I didn't forget anything it should be working.
Cheers,
Chris
11/21/2005 (6:37 pm)
Part 2:Last modify your configure.mk in the same directory to match the following:
>> SNIP <<
COMPILER_OPTIONS=CW6 VC6 GCC2 GCC3 VC2K3
BUILD_OPTIONS=DEBUG RELEASE
OS_OPTIONS=WIN32 BEOS LINUX OpenBSD FreeBSD Solaris
OS=
DIR.OBJ=out
-include mk/conf.mk
CONFIG_STATUS=VALID
ifeq ($(findstring $(OS), $(OS_OPTIONS)),)
targets += badOS
CONFIG_STATUS=INVALID
endif
ifeq ($(findstring $(COMPILER), $(COMPILER_OPTIONS)),)
targets +=badCompiler
CONFIG_STATUS=INVALID
endif
ifeq ($(findstring $(BUILD), $(BUILD_OPTIONS)),)
targets += badBuild
CONFIG_STATUS=INVALID
endif
default: $(targets) print save
badOS:
@echo ERROR: OS variable not set or is an illegal value
badCompiler:
@echo ERROR: COMPILER variable not set or is an illegal value
badBuild:
@echo ERROR: BUILD variable not set or is an illegal value
print:
@echo
@echo "Current Configuration: this config is $(CONFIG_STATUS)"
@echo " OS: $(OS)"
@echo " COMPILER: $(COMPILER)"
@echo " BUILD: $(BUILD)"
@echo " DIR.OBJ: $(DIR.OBJ)"
@echo
@echo "To change the current configuration type:"
@echo
@echo "make -f mk/configure.mk {arguments, ...}"
@echo
@echo "required arguments:"
@echo " OS={$(OS_OPTIONS)}"
@echo " COMPILER={$(COMPILER_OPTIONS)}"
@echo " BUILD={$(BUILD_OPTIONS)}"
@echo
@echo "optional arguments:"
@echo " DIR.OBJ={path to store intermediate obj files}"
@echo
@echo "Note: all arguments are case sensitive."
@echo
save:
@echo OS=$(OS) > mk/conf.mk
@echo COMPILER=$(COMPILER) >> mk/conf.mk
@echo BUILD=$(BUILD) >> mk/conf.mk
@echo ifeq \"$(BUILD)\" \"DEBUG\" >> mk/conf.mk
@echo BUILD_SUFFIX:=_DEBUG >> mk/conf.mk
@echo else >> mk/conf.mk
@echo BUILD_SUFFIX:= >> mk/conf.mk
@echo endif >> mk/conf.mk
@echo CONFIG_STATUS=$(CONFIG_STATUS) >> mk/conf.mk
@echo DIR.OBJ=$(DIR.OBJ) >> mk/conf.mk
@echo ifndef COMPILER_OPTIONS >> mk/conf.mk
@echo DIR.OBJ:=$(DIR.OBJ).$(COMPILER).$(BUILD) >> mk/conf.mk
@echo endif >> mk/conf.mk
>> SNIP <<
And that's it. Run configure setting the compiler to VC2K3 and you're good to go ... at least it works for me ;-)
Please make sure you check for the all path settings I to make sure all files are found ;-) and if I didn't forget anything it should be working.
Cheers,
Chris
Torque Owner Joe Rossi
Indri Games