1
////////////////////////////////////////////////////////////////////////////////
3
// Lightfeather project wizard
5
////////////////////////////////////////////////////////////////////////////////
9
LFQuickProject <- false;
12
LF_NVidiaCg <- GetConfigManager().Read(_T("/lf_project_wizard/options/cgshaders"), true);
13
LF_NGPlant <- GetConfigManager().Read(_T("/lf_project_wizard/options/ngplant"), true);
14
LF_Net <- GetConfigManager().Read(_T("/lf_project_wizard/options/net"), false);
15
LF_WxCanvas <- GetConfigManager().Read(_T("/lf_project_wizard/options/wxcanvas"), false);
16
LF_LocalConfig <- GetConfigManager().Read(_T("/lf_project_wizard/options/localconfig"), false);
19
function BeginWizard()
22
local intro_msg = _T("Welcome to the new Lightfeather project wizard!\n\n" +
23
"This wizard will guide you to create a new project\n" +
24
"using the Lightfeather 3D rendering engine.\n\n" +
25
"When you 're ready to proceed, please click \"Next\"...");
27
// "select LF path" text
28
local lfpath_descr = _T("Please select the location of Lightfeather on your computer.\n" +
29
"This is the top-level folder where Lightfeather was installed\n(unpacked).\n");
31
// "select LF project to generate" text
32
local lfprjtype_descr = _T("Please select the type of project to generate.");
33
local lfprj_choices = _T("Structured with C++ classes;Quick single-file testbed");
35
Wizard.AddInfoPage(_T("LFIntro"), intro_msg);
36
Wizard.AddProjectPathPage();
37
Wizard.AddGenericSelectPathPage(_T("LFPath"), lfpath_descr, _T("Please select Lightfeather's location:"), _T(""));
38
Wizard.AddGenericSingleChoiceListPage(_T("LFPrjType"), lfprjtype_descr, lfprj_choices, 0);
39
Wizard.AddPage(_T("LfOptions"));
40
// Wizard.AddCompilerPage(_T(""), _T("gcc*"), true, false); // no target selections
41
Wizard.SetCompilerDefault(_T("gcc"));
42
Wizard.SetDebugTargetDefaults(true, _T("Debug"), _T("Debug/"), _T("Debug/"));
43
Wizard.SetReleaseTargetDefaults(false, _T(""), _T(""), _T(""));
46
////////////////////////////////////////////////////////////////////////////////
47
// Lightfeather's path page
48
////////////////////////////////////////////////////////////////////////////////
50
function OnLeave_LFPath(fwd)
55
local error =_T("The path you entered seems valid, but this wizard " +
56
"can't locate Lightfeather's files in it...");
58
local dir = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
59
local dir_nomacro = ReplaceMacros(dir, true);
61
// check for include files
62
if (!IO.FileExists(dir_nomacro + _T("/include/lf/Lightfeather.h")))
73
////////////////////////////////////////////////////////////////////////////////
74
// Project type to create
75
////////////////////////////////////////////////////////////////////////////////
77
function OnLeave_LFPrjType(fwd)
81
LFQuickProject = Wizard.GetListboxSelection(_T("GenericChoiceList")) == 1;
86
////////////////////////////////////////////////////////////////////////////////
87
// Lightfeather options
88
////////////////////////////////////////////////////////////////////////////////
90
function OnEnter_LfOptions(fwd)
92
Wizard.CheckCheckbox(_T("chkCG"), LF_NVidiaCg);
93
Wizard.CheckCheckbox(_T("chkNG"), LF_NGPlant);
94
Wizard.CheckCheckbox(_T("chkNet"), LF_Net);
95
Wizard.CheckCheckbox(_T("chkWx"), LF_WxCanvas);
96
Wizard.CheckCheckbox(_T("chkLocalConfig"), LF_LocalConfig);
99
function OnLeave_LfOptions(fwd)
101
LF_NVidiaCg = Wizard.IsCheckboxChecked(_T("chkCG"));
102
LF_NGPlant = Wizard.IsCheckboxChecked(_T("chkNG"));
103
LF_Net = Wizard.IsCheckboxChecked(_T("chkNet"));
104
LF_WxCanvas = Wizard.IsCheckboxChecked(_T("chkWx"));
105
LF_LocalConfig = Wizard.IsCheckboxChecked(_T("chkLocalConfig"));
107
GetConfigManager().Write(_T("/lf_project_wizard/options/cgshaders"), LF_NVidiaCg);
108
GetConfigManager().Write(_T("/lf_project_wizard/options/ngplant"), LF_NGPlant);
109
GetConfigManager().Write(_T("/lf_project_wizard/options/net"), LF_Net);
110
GetConfigManager().Write(_T("/lf_project_wizard/options/wxcanvas"), LF_WxCanvas);
111
GetConfigManager().Write(_T("/lf_project_wizard/options/localconfig"), LF_LocalConfig);
116
// return the files this project contains
117
function GetFilesDir()
119
local ret = _T("lf/files/common;");
121
ret = ret + _T("lf/files/quick");
123
ret = ret + _T("lf/files/structured");
127
// setup the already created project
128
function SetupProject(project)
130
// set a variable to reference lf's dir
131
project.SetVar(_T("lf"), LFPath, false);
133
// set defaults for all targets
134
if (PLATFORM != PLATFORM_MSW)
136
project.AddCompilerOption(_T("-fPIC"));
137
project.AddCompilerOption(_T("-DPIC"));
139
project.AddCompilerOption(_T("-DPNG_NO_ASSEMBLER_CODE"));
143
if (PLATFORM == PLATFORM_MSW)
145
project.AddIncludeDir(_T("$(lf)/ext/Cg/include"));
146
project.AddLibDir(_T("$(lf)/ext/Cg/lib/windows"));
148
project.AddCompilerOption(_T("-DHAVE_CG"));
152
if (PLATFORM == PLATFORM_MSW)
153
project.AddLibDir(_T("$(lf)/ext/ngplant/lib/devcpp"));
154
else if (PLATFORM == PLATFORM_GTK)
156
project.AddLibDir(_T("$(lf)/ext/ngplant/lib/linux"));
157
project.AddLibDir(_T("$(lf)/ext/ngplant/lib/linux64"));
160
project.AddLibDir(_T("$(lf)/ext/ngplant/lib/mac"));
161
project.AddIncludeDir(_T("$(lf)/ext/ngplant/include"));
162
project.AddCompilerOption(_T("-DHAVE_NGPLANT"));
165
project.AddCompilerOption(_T("-DHAVE_NETWORK"));
168
if (PLATFORM == PLATFORM_GTK)
170
project.AddCompilerOption(_T("`wx-config --cxxflags`"));
171
project.AddLinkerOption(_T("`wx-config --libs gl`"));
173
project.AddCompilerOption(_T("-DLF_HAVE_WX"));
176
project.AddCompilerOption(_T("-DHAVE_LOCAL_LF_CONFIG"));
178
project.AddIncludeDir(_T("$(lf)/include"));
180
// first rename "default" target (index 0 - could do it by name too) to "Debug"
181
project.RenameBuildTarget(0, _T("Debug"));
183
local debugTarget = project.GetBuildTarget(0);
184
debugTarget.SetTargetType(ttConsoleOnly);
186
// and now duplicate it to create the rest of the targets
187
// (easier than creating new targets and adding files manually)
188
project.DuplicateBuildTarget(0, _T("Release"));
189
project.DuplicateBuildTarget(0, _T("Standard"));
191
local releaseTarget = project.GetBuildTarget(1);
192
local standardTarget = project.GetBuildTarget(2);
195
TargetFinalSetup(debugTarget, "Debug", true, false);
198
TargetFinalSetup(releaseTarget, "Release", false, false);
201
TargetFinalSetup(standardTarget, "Standard", true, false);
206
function TargetFinalSetup(target, dir, isDebug, isLib)
208
// just setup the different things per-target
209
target.SetOutputFilename(_T("bin/" + dir + "/") + Wizard.GetProjectTitle());
210
target.SetObjectOutput(_T("bin/obj/" + dir));
212
target.AddLibDir(_T("$(lf)/bin/" + dir));
214
target.AddLinkLib(_T("Lightfeather"));
218
target.AddCompilerOption(_T("-g"));
219
target.AddCompilerOption(_T("-DDEBUG"));
223
target.AddCompilerOption(_T("-O2"));
224
target.AddCompilerOption(_T("-s"));
231
target.AddLinkLib(_T("Cg"));
232
target.AddLinkLib(_T("CgGL"));
234
target.AddLinkLib(_T("GL"));
235
target.AddLinkLib(_T("GLU"));
236
target.AddLinkLib(_T("Xxf86vm"));
237
target.AddLinkLib(_T("pthread"));