1
////////////////////////////////////////////////////////////////////////////////
5
////////////////////////////////////////////////////////////////////////////////
7
// globals (used under windows only)
8
SDLPathDefault <- _T("$(#sdl)");
9
SDLPathDefaultInc <- _T("$(#sdl.include)");
10
SDLPathDefaultLib <- _T("$(#sdl.lib)");
13
function BeginWizard()
15
local intro_msg = _T("Welcome to the new SDL project wizard!\n\n" +
16
"This wizard will guide you to create a new project\n" +
17
"using the SDL graphics library.\n\n" +
18
"When you 're ready to proceed, please click \"Next\"...");
20
local sdlpath_descr = _T("Please select the location of SDL on your computer.\n" +
21
"This is the top-level folder where SDL was installed (unpacked).\n" +
22
"To help you, this folder must contain the subfolders\n" +
23
"\"include\" and \"lib\".");
25
Wizard.AddInfoPage(_T("SDLIntro"), intro_msg);
26
Wizard.AddProjectPathPage();
27
if (PLATFORM == PLATFORM_MSW)
28
Wizard.AddGenericSelectPathPage(_T("SDLPath"), sdlpath_descr, _T("Please select SDL's location:"), SDLPathDefault);
29
Wizard.AddCompilerPage(_T(""), _T("*"), true, true);
32
////////////////////////////////////////////////////////////////////////////////
34
////////////////////////////////////////////////////////////////////////////////
36
function OnLeave_SDLPath(fwd)
40
local dir = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
41
local dir_nomacro = VerifyDirectory(dir);
43
if (dir_nomacro.IsEmpty())
46
// verify include dependencies
47
local dir_nomacro_inc = GetCompilerIncludeDir(dir, SDLPathDefault, SDLPathDefaultInc);
48
if (dir_nomacro_inc.IsEmpty())
50
if (!VerifyFile(dir_nomacro_inc, _T("SDL.h"), _T("SDL's include")))
53
// verify library dependencies
54
local dir_nomacro_lib = GetCompilerLibDir(dir, SDLPathDefault, SDLPathDefaultLib);
55
if (dir_nomacro_lib.IsEmpty())
58
if (!VerifyLibFile(dir_nomacro_lib, _T("SDLmain"), _T("SDL's")))
61
if (!VerifyLibFile(dir_nomacro_lib, _T("SDL.dll"), _T("SDL's")))
64
SDLPath = dir; // Remember the original selection.
66
local is_macro = _T("");
68
// try to resolve the include directory as macro
69
is_macro = GetCompilerIncludeMacro(dir, SDLPathDefault, SDLPathDefaultInc);
70
if (is_macro.IsEmpty())
72
// not possible -> use the real inc path we had computed instead
73
SDLPathDefaultInc = dir_nomacro_inc;
76
// try to resolve the library directory as macro
77
is_macro = GetCompilerLibMacro(dir, SDLPathDefault, SDLPathDefaultLib);
78
if (is_macro.IsEmpty())
80
// not possible -> use the real lib path we had computed instead
81
SDLPathDefaultLib = dir_nomacro_lib;
87
// return the files this project contains
88
function GetFilesDir()
90
return _T("sdl/files");
93
// setup the already created project
94
function SetupProject(project)
96
if (PLATFORM == PLATFORM_MSW)
98
project.AddIncludeDir(SDLPathDefaultInc);
99
project.AddLibDir(SDLPathDefaultLib);
101
// add link libraries
102
project.AddLinkLib(_T("mingw32"));
103
project.AddLinkLib(_T("SDLmain"));
104
project.AddLinkLib(_T("SDL.dll"));
105
project.AddLinkLib(_T("user32"));
106
project.AddLinkLib(_T("gdi32"));
107
project.AddLinkLib(_T("winmm"));
108
project.AddLinkLib(_T("dxguid"));
110
else if (PLATFORM == PLATFORM_MAC)
112
//project.AddCompilerOption(_T("-D_GNU_SOURCE=1 -D_THREAD_SAFE"));
113
project.AddLinkerOption(_T("-framework SDL"));
114
// libSDLmain.a does not exist by default, needs to be built from SDLMain.m:
115
project.AddLinkLib(_T("SDLmain"));
117
project.AddLinkerOption(_T("-framework Cocoa")); // SDL dependency
122
project.AddCompilerOption(_T("`sdl-config --cflags`"));
123
project.AddLinkerOption(_T("`sdl-config --libs`"));
126
// enable compiler warnings (project-wide)
127
WarningsOn(project, Wizard.GetCompilerID());
130
local target = project.GetBuildTarget(Wizard.GetDebugName());
133
target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
134
target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
135
// enable generation of debugging symbols for target
136
DebugSymbolsOn(target, Wizard.GetCompilerID());
140
target = project.GetBuildTarget(Wizard.GetReleaseName());
143
target.SetTargetType(ttExecutable); // ttExecutable: no console
144
target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
145
// enable optimizations for target
146
OptimizationsOn(target, Wizard.GetCompilerID());