1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
////////////////////////////////////////////////////////////////////////////////
//
// Qt4 project wizard
//
////////////////////////////////////////////////////////////////////////////////
// globals
QtPathDefault <- _T("/usr/local/Trolltech/Qt-4.2.1");
QtPathDefaultInc <- _T("/usr/local/Trolltech/Qt-4.2.1/include");
QtPathDefaultLib <- _T("/usr/local/Trolltech/Qt-4.2.1/lib");
QtPath <- _T("");
function BeginWizard()
{
local intro_msg = _T("Welcome to the new Trolltech Qt4 project wizard!\n" +
"This wizard will guide you to create a new Qt4 project\n" +
"using the Trolltech Qt4 cross-platform GUI toolkit\n\n" +
"When you're ready to proceed, please click \"Next\"...");
local qtpath_msg = _T("Please select the location of Trolltech Qt4 on your computer.\n" +
"This is the top-level folder where Qt4 was installed.\n" +
"To help you, this folder must contain the subfolders\n" +
"\"include\" and \"lib\".");
Wizard.AddInfoPage(_T("QtIntro"), intro_msg);
Wizard.AddProjectPathPage();
Wizard.AddGenericSelectPathPage(_T("QtPath"), qtpath_msg, _T("Qt's location:"), QtPathDefault);
Wizard.AddCompilerPage(_T(""), _T("gcc*"), true, true);
}
////////////////////////////////////////////////////////////////////////////////
// Qt's path page
////////////////////////////////////////////////////////////////////////////////
function OnLeave_QtPath(fwd)
{
if (fwd)
{
local dir = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
local dir_nomacro = VerifyDirectory(dir);
if (dir_nomacro.IsEmpty())
return false;
// verify include dependencies
local dir_nomacro_inc = GetCompilerIncludeDir(dir, QtPathDefault, QtPathDefaultInc);
if (dir_nomacro_inc.IsEmpty())
return false;
if (!VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("/usr/local/Trolltech/Qt-4.2.1/include/QtGui"), _T("QApplication"), _T("Qt's include"))) return false;
// verify library dependencies
local dir_nomacro_lib = GetCompilerLibDir(dir, QtPathDefault, QtPathDefaultLib);
if (dir_nomacro_lib.IsEmpty())
return false;
if (!VerifyLibFile(dir_nomacro_lib, _T("QtCore"), _T("Qt's"))) return false;
QtPath = dir; // Remember the original selection.
local is_macro = _T("");
// try to resolve the include directory as macro
is_macro = GetCompilerIncludeMacro(dir, QtPathDefault, QtPathDefaultInc);
if (is_macro.IsEmpty())
{
// not possible -> use the real inc path we had computed instead
QtPathDefaultInc = dir_nomacro_inc;
}
// try to resolve the library directory as macro
is_macro = GetCompilerLibMacro(dir, QtPathDefault, QtPathDefaultLib);
if (is_macro.IsEmpty())
{
// not possible -> use the real lib path we had computed instead
QtPathDefaultLib = dir_nomacro_lib;
}
}
return true;
}
// return the files this project contains
function GetFilesDir()
{
return _T("qt4/files");
}
// setup the already created project
function SetupProject(project)
{
project.AddIncludeDir(QtPathDefaultInc);
project.AddIncludeDir(QtPathDefaultInc + wxFILE_SEP_PATH + _T("QtGui"));
project.AddLibDir(QtPathDefaultLib);
// add link libraries
project.AddLinkLib(_T("/usr/local/Trolltech/Qt-4.2.1/include/QtCore"));
project.AddLinkLib(_T("/usr/local/Trolltech/Qt-4.2.1/include/QtGui"));
// enable compiler warnings (project-wide)
WarningsOn(project, Wizard.GetCompilerID());
// Debug
local target = project.GetBuildTarget(Wizard.GetDebugName());
if (!IsNull(target))
{
target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
// enable generation of debugging symbols for target
DebugSymbolsOn(target, Wizard.GetCompilerID());
}
// Release
target = project.GetBuildTarget(Wizard.GetReleaseName());
if (!IsNull(target))
{
target.SetTargetType(ttExecutable); // ttExecutable: no console
target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
// enable optimizations for target
OptimizationsOn(target, Wizard.GetCompilerID());
}
return true;
} |
Partager