1
////////////////////////////////////////////////////////////////////////////////
3
// Smartwin project wizard
5
////////////////////////////////////////////////////////////////////////////////
8
SmartwinPathDefault <- _T("$(#sw)");
9
SmartwinPathDefaultInc <- _T("$(#sw.include)");
10
SmartwinPathDefaultLib <- _T("$(#sw.lib)");
11
SmartwinPath <- _T("");
13
function BeginWizard()
15
local intro_msg = _T("Welcome to the new Smartwin project wizard!\n\n" +
16
"This wizard will guide you to create a new project\n" +
17
"using the Smartwin GUI C++ library.\n\n" +
18
"When you 're ready to proceed, please click \"Next\"...");
20
local swpath_descr = _T("Please select the location of SmartWin on your computer.\n" +
21
"This is the top-level folder where SmartWin was installed (unpacked).\n" +
22
"To help you, this folder must contain the subfolders\n" +
23
"\"include\" and \"lib\".");
25
Wizard.AddInfoPage(_T("SmartwinIntro"), intro_msg);
26
Wizard.AddProjectPathPage();
27
Wizard.AddGenericSelectPathPage(_T("SmartwinPath"), swpath_descr, _T("Please select SmartWin's location:"), SmartwinPathDefault);
28
Wizard.AddCompilerPage(_T(""), _T("*"), true, true);
31
////////////////////////////////////////////////////////////////////////////////
32
// Smartwin's path page
33
////////////////////////////////////////////////////////////////////////////////
35
function OnLeave_SmartwinPath(fwd)
39
local dir = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
40
local dir_nomacro = VerifyDirectory(dir);
42
if (dir_nomacro.IsEmpty())
45
// verify include dependencies
46
local dir_nomacro_inc = GetCompilerIncludeDir(dir, SmartwinPathDefault, SmartwinPathDefaultInc);
47
if (dir_nomacro_inc.IsEmpty())
49
if (!VerifyFile(dir_nomacro_inc, _T("SmartWin.h"), _T("Smartwin's include"))) return false;
51
// verify library dependencies
52
local dir_nomacro_lib = GetCompilerLibDir(dir, SmartwinPathDefault, SmartwinPathDefaultLib);
53
if (dir_nomacro_lib.IsEmpty())
55
if (!VerifyLibFile(dir_nomacro_lib, _T("smartwin"), _T("Smartwin's library"))) return false;
58
SmartwinPath = dir; // Remember the original selection.
60
local is_macro = _T("");
62
// try to resolve the include directory as macro
63
is_macro = GetCompilerIncludeMacro(dir, SmartwinPathDefault, SmartwinPathDefaultInc);
64
if (is_macro.IsEmpty())
66
// not possible -> use the real inc path we had computed instead
67
SmartwinPathDefaultInc = dir_nomacro_inc;
70
// try to resolve the library directory as macro
71
is_macro = GetCompilerLibMacro(dir, SmartwinPathDefault, SmartwinPathDefaultLib);
72
if (is_macro.IsEmpty())
74
// not possible -> use the real lib path we had computed instead
75
SmartwinPathDefaultLib = dir_nomacro_lib;
81
// return the files this project contains
82
function GetFilesDir()
84
return _T("smartwin/files");
87
// setup the already created project
88
function SetupProject(project)
90
// set project options
91
project.AddIncludeDir(SmartwinPathDefaultInc);
92
project.AddLibDir(SmartwinPathDefaultLib);
96
project.AddLinkLib(_T("smartwin"));
97
project.AddLinkLib(_T("comctl32"));
98
project.AddLinkLib(_T("gdi32"));
99
project.AddLinkLib(_T("user32"));
100
project.AddLinkLib(_T("kernel32"));
102
// This has to be done to disable the "-I-" compiler switch which
103
// would break the compilation of any Smartwin application.
104
project.SetModeForPCH(pchSourceDir); // pch dir
107
local target = project.GetBuildTarget(Wizard.GetDebugName());
110
target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
111
target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
112
if (Wizard.GetCompilerID().Matches(_T("gcc")))
114
// enable generation of debugging symbols for target
115
// Note: DebugSymbolsOn() won't work because -Wall produces far too many warnings
116
target.AddCompilerOption(_T("-g"));
121
target = project.GetBuildTarget(Wizard.GetReleaseName());
124
target.SetTargetType(ttExecutable); // ttExecutable: no console
125
target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
126
if (Wizard.GetCompilerID().Matches(_T("gcc")))
128
// enable optimizations for target.
129
// Note: OptimizationsOn() won't work because of -I-!
130
target.AddCompilerOption(_T("-O2"));
131
target.AddCompilerOption(_T("-s"));