~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

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

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
////////////////////////////////////////////////////////////////////////////////
 
2
//
 
3
// Smartwin project wizard
 
4
//
 
5
////////////////////////////////////////////////////////////////////////////////
 
6
 
 
7
// globals
 
8
SmartwinPathDefault    <- _T("$(#sw)");
 
9
SmartwinPathDefaultInc <- _T("$(#sw.include)");
 
10
SmartwinPathDefaultLib <- _T("$(#sw.lib)");
 
11
SmartwinPath           <- _T("");
 
12
 
 
13
function BeginWizard()
 
14
{
 
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\"...");
 
19
 
 
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\".");
 
24
 
 
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);
 
29
}
 
30
 
 
31
////////////////////////////////////////////////////////////////////////////////
 
32
// Smartwin's path page
 
33
////////////////////////////////////////////////////////////////////////////////
 
34
 
 
35
function OnLeave_SmartwinPath(fwd)
 
36
{
 
37
    if (fwd)
 
38
    {
 
39
        local dir         = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
 
40
        local dir_nomacro = VerifyDirectory(dir);
 
41
 
 
42
        if (dir_nomacro.IsEmpty())
 
43
            return false;
 
44
 
 
45
        // verify include dependencies
 
46
        local dir_nomacro_inc = GetCompilerIncludeDir(dir, SmartwinPathDefault, SmartwinPathDefaultInc);
 
47
        if (dir_nomacro_inc.IsEmpty())
 
48
            return false;
 
49
        if (!VerifyFile(dir_nomacro_inc, _T("SmartWin.h"), _T("Smartwin's include"))) return false;
 
50
 
 
51
        // verify library dependencies
 
52
        local dir_nomacro_lib = GetCompilerLibDir(dir, SmartwinPathDefault, SmartwinPathDefaultLib);
 
53
        if (dir_nomacro_lib.IsEmpty())
 
54
            return false;
 
55
        if (!VerifyLibFile(dir_nomacro_lib, _T("smartwin"), _T("Smartwin's library"))) return false;
 
56
 
 
57
 
 
58
        SmartwinPath = dir; // Remember the original selection.
 
59
 
 
60
        local is_macro = _T("");
 
61
 
 
62
        // try to resolve the include directory as macro
 
63
        is_macro = GetCompilerIncludeMacro(dir, SmartwinPathDefault, SmartwinPathDefaultInc);
 
64
        if (is_macro.IsEmpty())
 
65
        {
 
66
            // not possible -> use the real inc path we had computed instead
 
67
            SmartwinPathDefaultInc = dir_nomacro_inc;
 
68
        }
 
69
 
 
70
        // try to resolve the library directory as macro
 
71
        is_macro = GetCompilerLibMacro(dir, SmartwinPathDefault, SmartwinPathDefaultLib);
 
72
        if (is_macro.IsEmpty())
 
73
        {
 
74
            // not possible -> use the real lib path we had computed instead
 
75
            SmartwinPathDefaultLib = dir_nomacro_lib;
 
76
        }
 
77
    }
 
78
    return true;
 
79
}
 
80
 
 
81
// return the files this project contains
 
82
function GetFilesDir()
 
83
{
 
84
    return _T("smartwin/files");
 
85
}
 
86
 
 
87
// setup the already created project
 
88
function SetupProject(project)
 
89
{
 
90
    // set project options
 
91
    project.AddIncludeDir(SmartwinPathDefaultInc);
 
92
    project.AddLibDir(SmartwinPathDefaultLib);
 
93
 
 
94
 
 
95
    // add link libraries
 
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"));
 
101
 
 
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
 
105
 
 
106
    // Debug
 
107
    local target = project.GetBuildTarget(Wizard.GetDebugName());
 
108
    if (!IsNull(target))
 
109
    {
 
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")))
 
113
        {
 
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"));
 
117
        }
 
118
    }
 
119
 
 
120
    // Release
 
121
    target = project.GetBuildTarget(Wizard.GetReleaseName());
 
122
    if (!IsNull(target))
 
123
    {
 
124
        target.SetTargetType(ttExecutable); // ttExecutable: no console
 
125
        target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
 
126
        if (Wizard.GetCompilerID().Matches(_T("gcc")))
 
127
        {
 
128
            // enable optimizations for target.
 
129
            // Note: OptimizationsOn() won't work because of -I-!
 
130
            target.AddCompilerOption(_T("-O2"));
 
131
            target.AddCompilerOption(_T("-s"));
 
132
        }
 
133
    }
 
134
 
 
135
    return true;
 
136
}