1
////////////////////////////////////////////////////////////////////////////////
5
////////////////////////////////////////////////////////////////////////////////
7
// globals (windows only)
8
FltkPathDefault <- _T("$(#fl)");
9
FltkPathDefaultInc <- _T("$(#fl.include)");
10
FltkPathDefaultLib <- _T("$(#fl.lib)");
13
FLTKQuickProject <- true;
15
function BeginWizard()
17
local intro_msg = _T("Welcome to the new FLTK project wizard!\n\n" +
18
"This wizard will guide you to create a new project\n" +
19
"using the FLTK GUI C++ library.\n\n" +
20
"When you 're ready to proceed, please click \"Next\"...");
22
local fltkpath_descr = _T("Please select the location of FLTK on your computer.\n" +
23
"This is the top-level folder where FLTK was installed (unpacked).\n" +
24
"To help you, this folder must contain the subfolders\n" +
25
"\"include\" and \"lib\".");
27
// "select fltk project to generate" text
28
local fltkprjtype_descr = _T("Please select the type of project to generate.");
29
local fltkprj_choices = _T("Simple main() example;FLUID-based project");
31
Wizard.AddInfoPage(_T("FltkIntro"), intro_msg);
32
Wizard.AddProjectPathPage();
33
if (PLATFORM == PLATFORM_MSW)
34
Wizard.AddGenericSelectPathPage(_T("FltkPath"), fltkpath_descr, _T("Please select FLTK's location:"), FltkPathDefault);
35
Wizard.AddGenericSingleChoiceListPage(_T("FLTKPrjType"), fltkprjtype_descr, fltkprj_choices, 0);
36
Wizard.AddCompilerPage(_T(""), _T("*"), true, true);
39
////////////////////////////////////////////////////////////////////////////////
41
////////////////////////////////////////////////////////////////////////////////
43
function OnLeave_FltkPath(fwd)
47
local dir = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
48
local dir_nomacro = VerifyDirectory(dir);
50
if (dir_nomacro.IsEmpty())
53
// verify include dependencies
54
local dir_nomacro_inc = GetCompilerIncludeDir(dir, FltkPathDefault, FltkPathDefaultInc);
55
if (dir_nomacro_inc.IsEmpty())
57
if (!VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("FL"), _T("Fl.h"), _T("FLTK's include"))) return false;
59
// verify library dependencies
60
local dir_nomacro_lib = GetCompilerLibDir(dir, FltkPathDefault, FltkPathDefaultLib);
61
if (dir_nomacro_lib.IsEmpty())
63
if (!VerifyLibFile(dir_nomacro_lib, _T("fltk"), _T("FLTK's"))) return false;
66
FltkPath = dir; // Remember the original selection.
68
local is_macro = _T("");
70
// try to resolve the include directory as macro
71
is_macro = GetCompilerIncludeMacro(dir, FltkPathDefault, FltkPathDefaultInc);
72
if (is_macro.IsEmpty())
74
// not possible -> use the real inc path we had computed instead
75
FltkPathDefaultInc = dir_nomacro_inc;
78
// try to resolve the library directory as macro
79
is_macro = GetCompilerLibMacro(dir, FltkPathDefault, FltkPathDefaultLib);
80
if (is_macro.IsEmpty())
82
// not possible -> use the real lib path we had computed instead
83
FltkPathDefaultLib = dir_nomacro_lib;
89
////////////////////////////////////////////////////////////////////////////////
90
// Project type to create
91
////////////////////////////////////////////////////////////////////////////////
93
function OnLeave_FLTKPrjType(fwd)
97
FLTKQuickProject = Wizard.GetListboxSelection(_T("GenericChoiceList")) == 0;
102
// return the files this project contains
103
function GetFilesDir()
105
if (FLTKQuickProject)
106
return _T("fltk/files");
107
return _T("fltk/fluid");
110
// setup the already created project
111
function SetupProject(project)
113
if (PLATFORM == PLATFORM_MSW)
115
// set project options
116
project.AddIncludeDir(FltkPathDefaultInc);
117
project.AddLibDir(FltkPathDefaultLib);
119
// add link libraries
120
project.AddLinkLib(_T("fltk"));
121
project.AddLinkLib(_T("ole32"));
122
project.AddLinkLib(_T("uuid"));
123
project.AddLinkLib(_T("comctl32"));
124
project.AddLinkLib(_T("wsock32"));
125
project.AddLinkLib(_T("m"));
126
project.AddLinkLib(_T("gdi32"));
127
project.AddLinkLib(_T("user32"));
128
project.AddLinkLib(_T("kernel32"));
130
project.AddCompilerOption(_T("-DWIN32"))
131
project.AddCompilerOption(_T("-mms-bitfields"))
133
else // PLATFORM != PLATFORM_MSW
135
// fltk-config based: things are ultra-simple :)
136
project.AddCompilerOption(_T("`fltk-config --cxxflags`"));
137
project.AddLinkerOption(_T("`fltk-config --ldstaticflags`"));
141
local target = project.GetBuildTarget(Wizard.GetDebugName());
144
target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
145
target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
146
if (Wizard.GetCompilerID().Matches(_T("gcc")))
148
// enable generation of debugging symbols for target
149
// Note: DebugSymbolsOn() won't work because -Wall produces far too many warnings
150
target.AddCompilerOption(_T("-g"));
155
target = project.GetBuildTarget(Wizard.GetReleaseName());
158
target.SetTargetType(ttExecutable); // ttExecutable: no console
159
target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
160
if (Wizard.GetCompilerID().Matches(_T("gcc")))
162
// enable optimizations for target.
163
// Note: OptimizationsOn() won't work because of -I-!
164
target.AddCompilerOption(_T("-O2"));
165
target.AddCompilerOption(_T("-s"));