~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/scriptedwizard/resources/fltk/wizard.script

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
////////////////////////////////////////////////////////////////////////////////
 
2
//
 
3
// FLTK project wizard
 
4
//
 
5
////////////////////////////////////////////////////////////////////////////////
 
6
 
 
7
// globals (windows only)
 
8
FltkPathDefault    <- _T("$(#fl)");
 
9
FltkPathDefaultInc <- _T("$(#fl.include)");
 
10
FltkPathDefaultLib <- _T("$(#fl.lib)");
 
11
FltkPath <- _T("");
 
12
 
 
13
FLTKQuickProject <- true;
 
14
 
 
15
function BeginWizard()
 
16
{
 
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\"...");
 
21
 
 
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\".");
 
26
 
 
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");
 
30
 
 
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);
 
37
}
 
38
 
 
39
////////////////////////////////////////////////////////////////////////////////
 
40
// FLTK's path page
 
41
////////////////////////////////////////////////////////////////////////////////
 
42
 
 
43
function OnLeave_FltkPath(fwd)
 
44
{
 
45
    if (fwd)
 
46
    {
 
47
        local dir         = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
 
48
        local dir_nomacro = VerifyDirectory(dir);
 
49
 
 
50
        if (dir_nomacro.IsEmpty())
 
51
            return false;
 
52
 
 
53
        // verify include dependencies
 
54
        local dir_nomacro_inc = GetCompilerIncludeDir(dir, FltkPathDefault, FltkPathDefaultInc);
 
55
        if (dir_nomacro_inc.IsEmpty())
 
56
            return false;
 
57
        if (!VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("FL"), _T("Fl.h"), _T("FLTK's include"))) return false;
 
58
 
 
59
        // verify library dependencies
 
60
        local dir_nomacro_lib = GetCompilerLibDir(dir, FltkPathDefault, FltkPathDefaultLib);
 
61
        if (dir_nomacro_lib.IsEmpty())
 
62
            return false;
 
63
        if (!VerifyLibFile(dir_nomacro_lib, _T("fltk"), _T("FLTK's"))) return false;
 
64
 
 
65
 
 
66
        FltkPath = dir; // Remember the original selection.
 
67
 
 
68
        local is_macro = _T("");
 
69
 
 
70
        // try to resolve the include directory as macro
 
71
        is_macro = GetCompilerIncludeMacro(dir, FltkPathDefault, FltkPathDefaultInc);
 
72
        if (is_macro.IsEmpty())
 
73
        {
 
74
            // not possible -> use the real inc path we had computed instead
 
75
            FltkPathDefaultInc = dir_nomacro_inc;
 
76
        }
 
77
 
 
78
        // try to resolve the library directory as macro
 
79
        is_macro = GetCompilerLibMacro(dir, FltkPathDefault, FltkPathDefaultLib);
 
80
        if (is_macro.IsEmpty())
 
81
        {
 
82
            // not possible -> use the real lib path we had computed instead
 
83
            FltkPathDefaultLib = dir_nomacro_lib;
 
84
        }
 
85
    }
 
86
    return true;
 
87
}
 
88
 
 
89
////////////////////////////////////////////////////////////////////////////////
 
90
// Project type to create
 
91
////////////////////////////////////////////////////////////////////////////////
 
92
 
 
93
function OnLeave_FLTKPrjType(fwd)
 
94
{
 
95
    if (fwd)
 
96
    {
 
97
        FLTKQuickProject = Wizard.GetListboxSelection(_T("GenericChoiceList")) == 0;
 
98
    }
 
99
    return true;
 
100
}
 
101
 
 
102
// return the files this project contains
 
103
function GetFilesDir()
 
104
{
 
105
    if (FLTKQuickProject)
 
106
        return _T("fltk/files");
 
107
    return _T("fltk/fluid");
 
108
}
 
109
 
 
110
// setup the already created project
 
111
function SetupProject(project)
 
112
{
 
113
    if (PLATFORM == PLATFORM_MSW)
 
114
    {
 
115
        // set project options
 
116
        project.AddIncludeDir(FltkPathDefaultInc);
 
117
        project.AddLibDir(FltkPathDefaultLib);
 
118
 
 
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"));
 
129
 
 
130
        project.AddCompilerOption(_T("-DWIN32"))
 
131
        project.AddCompilerOption(_T("-mms-bitfields"))
 
132
    }
 
133
    else // PLATFORM != PLATFORM_MSW
 
134
    {
 
135
        // fltk-config based: things are ultra-simple :)
 
136
        project.AddCompilerOption(_T("`fltk-config --cxxflags`"));
 
137
        project.AddLinkerOption(_T("`fltk-config --ldstaticflags`"));
 
138
    }
 
139
 
 
140
    // Debug
 
141
    local target = project.GetBuildTarget(Wizard.GetDebugName());
 
142
    if (!IsNull(target))
 
143
    {
 
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")))
 
147
        {
 
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"));
 
151
        }
 
152
    }
 
153
 
 
154
    // Release
 
155
    target = project.GetBuildTarget(Wizard.GetReleaseName());
 
156
    if (!IsNull(target))
 
157
    {
 
158
        target.SetTargetType(ttExecutable); // ttExecutable: no console
 
159
        target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
 
160
        if (Wizard.GetCompilerID().Matches(_T("gcc")))
 
161
        {
 
162
            // enable optimizations for target.
 
163
            // Note: OptimizationsOn() won't work because of -I-!
 
164
            target.AddCompilerOption(_T("-O2"));
 
165
            target.AddCompilerOption(_T("-s"));
 
166
        }
 
167
    }
 
168
 
 
169
    return true;
 
170
}