1
////////////////////////////////////////////////////////////////////////////////
5
////////////////////////////////////////////////////////////////////////////////
7
// globals (used under windows only)
8
SFMLPathDefault <- _T("$(#sfml)");
9
SFMLPathDefaultInc <- _T("$(#sfml.include)");
10
SFMLPathDefaultLib <- _T("$(#sfml.lib)");
13
function BeginWizard()
15
local intro_msg = _T("Welcome to the new SFML project wizard!\n\n" +
16
"This wizard will guide you to create a new project\n" +
17
"using the SFML multimedia library.\n\n" +
18
"When you 're ready to proceed, please click \"Next\"...");
20
local sfmlpath_descr = _T("Please select the location of SFML on your computer.\n" +
21
"This is the top-level folder where SFML was installed (unpacked).\n" +
22
"To help you, this folder must contain the subfolders\n" +
23
"\"include\" and \"lib\".");
25
Wizard.AddInfoPage(_T("SFMLIntro"), intro_msg);
26
Wizard.AddProjectPathPage();
27
if (PLATFORM == PLATFORM_MSW)
28
Wizard.AddGenericSelectPathPage(_T("SFMLPath"), sfmlpath_descr, _T("Please select SFML's location:"), SFMLPathDefault);
29
Wizard.AddCompilerPage(_T(""), _T("*"), true, true);
32
////////////////////////////////////////////////////////////////////////////////
34
////////////////////////////////////////////////////////////////////////////////
36
function OnLeave_SFMLPath(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, SFMLPathDefault, SFMLPathDefaultInc);
48
if (dir_nomacro_inc.IsEmpty())
50
if (!VerifyFile(dir_nomacro_inc, _T("Audio.hpp"), _T("SFML's include")))
52
if (!VerifyFile(dir_nomacro_inc, _T("Config.hpp"), _T("SFML's include")))
54
if (!VerifyFile(dir_nomacro_inc, _T("Graphics.hpp"), _T("SFML's include")))
56
if (!VerifyFile(dir_nomacro_inc, _T("Network.hpp"), _T("SFML's include")))
58
if (!VerifyFile(dir_nomacro_inc, _T("System.hpp"), _T("SFML's include")))
60
if (!VerifyFile(dir_nomacro_inc, _T("Window.hpp"), _T("SFML's include")))
63
// verify library dependencies
64
local dir_nomacro_lib = GetCompilerLibDir(dir, SFMLPathDefault, SFMLPathDefaultLib);
65
if (dir_nomacro_lib.IsEmpty())
68
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-audio"), _T("SFML's")))
70
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-graphics"), _T("SFML's")))
72
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-network"), _T("SFML's")))
74
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-system"), _T("SFML's")))
76
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-window"), _T("SFML's")))
79
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-audio.dll"), _T("SFML's")))
81
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-graphics.dll"), _T("SFML's")))
83
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-network.dll"), _T("SFML's")))
85
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-system.dll"), _T("SFML's")))
87
if (!VerifyLibFile(dir_nomacro_lib, _T("sfml-window.dll"), _T("SFML's")))
90
SFMLPath = dir; // Remember the original selection.
92
local is_macro = _T("");
94
// try to resolve the include directory as macro
95
is_macro = GetCompilerIncludeMacro(dir, SFMLPathDefault, SFMLPathDefaultInc);
96
if (is_macro.IsEmpty())
98
// not possible -> use the real inc path we had computed instead
99
SFMLPathDefaultInc = dir_nomacro_inc;
102
// try to resolve the library directory as macro
103
is_macro = GetCompilerLibMacro(dir, SFMLPathDefault, SFMLPathDefaultLib);
104
if (is_macro.IsEmpty())
106
// not possible -> use the real lib path we had computed instead
107
SFMLPathDefaultLib = dir_nomacro_lib;
113
// return the files this project contains
114
function GetFilesDir()
116
return _T("sfml/files");
119
// setup the already created project
120
function SetupProject(project)
122
if (PLATFORM == PLATFORM_MSW)
124
project.AddIncludeDir(SFMLPathDefaultInc);
125
project.AddLibDir(SFMLPathDefaultLib);
127
// add link libraries
128
project.AddLinkLib(_T("mingw32"));
129
project.AddLinkLib(_T("sfml-audio.dll"));
130
project.AddLinkLib(_T("sfml-graphics.dll"));
131
project.AddLinkLib(_T("sfml-network.dll"));
132
project.AddLinkLib(_T("sfml-system.dll"));
133
project.AddLinkLib(_T("sfml-window.dll"));
134
project.AddLinkLib(_T("user32"));
135
project.AddLinkLib(_T("gdi32"));
136
project.AddLinkLib(_T("winmm"));
137
project.AddLinkLib(_T("dxguid"));
139
else if (PLATFORM == PLATFORM_MAC)
141
//project.AddCompilerOption(_T("-D_GNU_SOURCE=1 -D_THREAD_SAFE"));
142
project.AddLinkerOption(_T("-framework SFML"));
143
project.AddLinkLib(_T("sfml-audio"));
144
project.AddLinkLib(_T("sfml-graphics"));
145
project.AddLinkLib(_T("sfml-network"));
146
project.AddLinkLib(_T("sfml-system"));
147
project.AddLinkLib(_T("sfml-window"));
152
project.AddLinkLib(_T("sfml-audio"));
153
project.AddLinkLib(_T("sfml-graphics"));
154
project.AddLinkLib(_T("sfml-network"));
155
project.AddLinkLib(_T("sfml-system"));
156
project.AddLinkLib(_T("sfml-window"));
157
// TODO: Enable these once SFML gets a sfml.pc
158
//project.AddCompilerOption(_T("`pkg-config sfml --cflags`"));
159
//project.AddLinkerOption(_T("`pkg-config sfml --libs`"));
162
// enable compiler warnings (project-wide)
163
WarningsOn(project, Wizard.GetCompilerID());
166
local target = project.GetBuildTarget(Wizard.GetDebugName());
169
target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
170
target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
171
// enable generation of debugging symbols for target
172
DebugSymbolsOn(target, Wizard.GetCompilerID());
176
target = project.GetBuildTarget(Wizard.GetReleaseName());
179
target.SetTargetType(ttExecutable); // ttExecutable: no console
180
target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
181
// enable optimizations for target
182
OptimizationsOn(target, Wizard.GetCompilerID());