ok then here is my newest tested version, without the additions of biplab to support dx8, since i neither use nor support dx8 - only dx9.
////////////////////////////////////////////////////////////////////////////////
//
// Direct/X project wizard
// modded by patlecat, june07
//
////////////////////////////////////////////////////////////////////////////////
// globals
DirectXPath <- _T("");
function BeginWizard()
{
local intro_msg = _T("Welcome to the new Direct/X project wizard!\n\n" +
"This wizard will guide you to create a new project\n" +
"using the Direct/X extensions.\n\n" +
"This wizard expects the global variable \"dx\" to point\n" +
"to the appropriate DirectX SDK.\n" +
"This is the MS DirectX SDK for a Visual C++ Toolkit 2003 project\n" +
"and e.g. the DevPack folder for a GCC project.\n\n" +
"For a Visual C++ Toolkit 2003 project in addition the global variable\n" +
"\"psdk\" must point to the directory of the MS platform SDK.\n\n" +
"You will be asked to setup the variables accordingly. If this is\n" +
"not the case, verify \"Settings->Global variables\"\n" +
"after this wizard has completed.\n\n" +
"When you're ready to proceed, please click \"Next\"...");
local dxpath_descr = _T("Please select the location of the Direct/X SDK on your computer.\n" +
"This is the top-level folder where Direct/X was installed (unpacked).\n" +
"To help you, this folder must contain the subfolders\n" +
"\"include\" and \"lib\".");
Wizard.AddInfoPage(_T("DirectXIntro"), intro_msg);
Wizard.AddProjectPathPage();
Wizard.AddCompilerPage(_T(""), _T("gcc;msvctk"), true, true);
Wizard.AddGenericSelectPathPage(_T("DirectXPath"), dxpath_descr, _T("Please select Direct/X's location:"), _T("$(#dx)"));
}
////////////////////////////////////////////////////////////////////////////////
// Direct/X's path page
////////////////////////////////////////////////////////////////////////////////
function OnLeave_DirectXPath(fwd)
{
if (fwd)
{
local dir = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
local dir_nomacro = ReplaceMacros(dir, true);
if (!IO.FileExists(dir_nomacro + _T("/include/d3d.h")))
{
ShowError(_T("The path you entered seems valid, but this wizard " +
"can't locate Direct/X's files in it..."));
return false;
}
if (!IO.FileExists(dir_nomacro + _T("/include/d3d9.h")))
{
ShowError(_T("The path you entered is valid, but this wizard " +
"requires at least the Direct/X 9.0c SDK..."));
return false;
}
if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("msvc*")))
{
local psdk = ReplaceMacros(_T("$(#psdk)"), true);
if (!IO.DirectoryExists(psdk))
{
ShowError(_T("The path to the platform SDK seems not to be valid.\n" +
"This setup requires the MS platform SDK..."));
return false;
}
}
DirectXPath = dir;
}
return true;
}
// return the files this project contains
function GetFilesDir()
{
return _T("directx/files");
}
// setup the already created project
function SetupProject(project)
{
// set project options
local gvar = ReplaceMacros(_T("$(#dx)"), true);
// set compiler/linker search paths
// see if the Direct/X SDK matches the global var. if it does, use the var instead...
if (gvar.Matches(DirectXPath))
{
project.AddIncludeDir(_T("$(#dx.include)"));
project.AddLibDir(_T("$(#dx.lib)"));
}
else
{
project.AddIncludeDir(DirectXPath + _T("/include"));
project.AddLibDir(DirectXPath + _T("/lib/x86"));
}
// set compiler options
project.AddCompilerOption(_T("-DWIN32"));
project.AddCompilerOption(_T("-D_WINDOWS"));
project.AddCompilerOption(_T("-D_MBCS"));
// set linker options
project.AddLinkLib(_T("kernel32"));
project.AddLinkLib(_T("user32"));
project.AddLinkLib(_T("gdi32"));
project.AddLinkLib(_T("winspool"));
project.AddLinkLib(_T("comdlg32"));
project.AddLinkLib(_T("advapi32"));
project.AddLinkLib(_T("shell32"));
project.AddLinkLib(_T("ole32"));
project.AddLinkLib(_T("oleaut32"));
project.AddLinkLib(_T("uuid"));
project.AddLinkLib(_T("odbc32"));
project.AddLinkLib(_T("odbccp32"));
project.AddLinkLib(_T("d3d9"));
// set additional path's for MS VC++ Toolkit
if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("msvc*")))
{
// set project options for MS Visual C++ Toolkit
project.AddIncludeDir(_T("$(#psdk.include)"));
project.AddLibDir(_T("$(#psdk.lib)"));
}
// enable compiler warnings (project-wide)
WarningsOn(project, Wizard.GetCompilerID());
// Debug
local target = project.GetBuildTarget(Wizard.GetDebugName());
if (!IsNull(target))
{
target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
target.SetWorkingDir(Wizard.GetDebugOutputDir());
// enable generation of debugging symbols for target
DebugSymbolsOn(target, Wizard.GetCompilerID());
if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("gcc")))
{
target.AddCompilerOption(_T("-D_DEBUG"));
target.AddCompilerOption(_T("-ggdb")); // Build for GDB
target.AddLinkLib(_T("d3dx9d"));
}
}
// Release
target = project.GetBuildTarget(Wizard.GetReleaseName());
if (!IsNull(target))
{
target.SetTargetType(ttExecutable); // ttExecutable: no console
target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
target.SetWorkingDir(Wizard.GetReleaseOutputDir());
// enable optimizations for target
OptimizationsOn(target, Wizard.GetCompilerID());
if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("gcc")))
{
//target.AddCompilerOption(_T("-march=athlon-xp"));
target.AddLinkLib(_T("d3dx9"));
target.AddCompilerOption(_T("-DNDEBUG"));
}
}
return true;
}