1
////////////////////////////////////////////////////////////////////////////////
3
// Direct/X project wizard
5
////////////////////////////////////////////////////////////////////////////////
10
function BeginWizard()
12
local intro_msg = _T("Welcome to the new Direct/X project wizard!\n\n" +
13
"This wizard will guide you to create a new project\n" +
14
"using the Direct/X extensions.\n\n" +
15
"This wizard expects the global variable \"dx\" to point\n" +
16
"to the appropriate DirectX SDK.\n" +
17
"This is the MS DirectX SDK for a Visual C++ Toolkit 2003 project\n" +
18
"and e.g. the DevPack folder for a GCC project.\n\n" +
19
"For a Visual C++ Toolkit 2003 project in addition the global variable\n" +
20
"\"psdk\" must point to the directory of the MS platform SDK.\n\n" +
21
"You will be asked to setup the variables accordingly. If this is\n" +
22
"not the case, verify \"Settings->Global variables\"\n" +
23
"after this wizard has completed.\n\n" +
24
"When you're ready to proceed, please click \"Next\"...");
26
local dxpath_descr = _T("Please select the location of the Direct/X SDK on your computer.\n" +
27
"This is the top-level folder where Direct/X was installed (unpacked).\n" +
28
"To help you, this folder must contain the subfolders\n" +
29
"\"include\" and \"lib\".");
31
Wizard.AddInfoPage(_T("DirectXIntro"), intro_msg);
32
Wizard.AddProjectPathPage();
33
Wizard.AddCompilerPage(_T(""), _T("gcc;msvctk"), true, true);
34
Wizard.AddGenericSelectPathPage(_T("DirectXPath"), dxpath_descr, _T("Please select Direct/X's location:"), _T("$(#dx)"));
37
////////////////////////////////////////////////////////////////////////////////
38
// Direct/X's path page
39
////////////////////////////////////////////////////////////////////////////////
41
function OnLeave_DirectXPath(fwd)
45
local dir = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
46
local dir_nomacro = ReplaceMacros(dir, true);
47
if (!IO.FileExists(dir_nomacro + _T("/include/d3d.h")))
49
ShowError(_T("The path you entered seems valid, but this wizard " +
50
"can't locate Direct/X's files in it..."));
53
if (!IO.FileExists(dir_nomacro + _T("/include/d3d8.h")))
55
ShowError(_T("The path you entered is valid, but this wizard " +
56
"requires at least the Direct/X 8 SDK..."));
60
if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("msvc*")))
62
local psdk = ReplaceMacros(_T("$(#psdk)"), true);
63
if (!IO.DirectoryExists(psdk))
65
ShowError(_T("The path to the platform SDK seems not to be valid.\n" +
66
"This setup requires the MS platform SDK..."));
76
// return the files this project contains
77
function GetFilesDir()
79
return _T("directx/files");
82
// setup the already created project
83
function SetupProject(project)
85
// set project options
86
local gvar = ReplaceMacros(_T("$(#dx)"), true);
88
// set compiler/linker search paths
89
// see if the Direct/X SDK matches the global var. if it does, use the var instead...
90
if (gvar.Matches(DirectXPath))
92
project.AddIncludeDir(_T("$(#dx.include)"));
93
project.AddLibDir(_T("$(#dx.lib)"));
97
project.AddIncludeDir(DirectXPath + _T("/include"));
98
project.AddLibDir(DirectXPath + _T("/lib/x86"));
101
// set compiler options
102
project.AddCompilerOption(_T("-DWIN32"));
103
project.AddCompilerOption(_T("-DNDEBUG"));
104
project.AddCompilerOption(_T("-D_WINDOWS"));
105
project.AddCompilerOption(_T("-D_MBCS"));
107
// set linker options
108
project.AddLinkLib(_T("kernel32"));
109
project.AddLinkLib(_T("user32"));
110
project.AddLinkLib(_T("gdi32"));
111
project.AddLinkLib(_T("winspool"));
112
project.AddLinkLib(_T("comdlg32"));
113
project.AddLinkLib(_T("advapi32"));
114
project.AddLinkLib(_T("shell32"));
115
project.AddLinkLib(_T("ole32"));
116
project.AddLinkLib(_T("oleaut32"));
117
project.AddLinkLib(_T("uuid"));
118
project.AddLinkLib(_T("odbc32"));
119
project.AddLinkLib(_T("odbccp32"));
120
project.AddLinkLib(_T("d3d8"));
122
// set additional path's for MS VC++ Toolkit
123
if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("msvc*")))
125
// set project options for MS Visual C++ Toolkit
126
project.AddIncludeDir(_T("$(#psdk.include)"));
127
project.AddLibDir(_T("$(#psdk.lib)"));
130
// enable compiler warnings (project-wide)
131
WarningsOn(project, Wizard.GetCompilerID());
134
local target = project.GetBuildTarget(Wizard.GetDebugName());
137
target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
138
target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
139
target.SetWorkingDir(Wizard.GetDebugOutputDir());
140
// enable generation of debugging symbols for target
141
DebugSymbolsOn(target, Wizard.GetCompilerID());
145
target = project.GetBuildTarget(Wizard.GetReleaseName());
148
target.SetTargetType(ttExecutable); // ttExecutable: no console
149
target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
150
target.SetWorkingDir(Wizard.GetReleaseOutputDir());
151
// enable optimizations for target
152
OptimizationsOn(target, Wizard.GetCompilerID());