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

« back to all changes in this revision

Viewing changes to src/plugins/scriptedwizard/resources/directx/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
// Direct/X project wizard
 
4
//
 
5
////////////////////////////////////////////////////////////////////////////////
 
6
 
 
7
// globals
 
8
DirectXPath <- _T("");
 
9
 
 
10
function BeginWizard()
 
11
{
 
12
    local intro_msg = _T("Welcome to the new Direct/X project wizard!\n\n" +
 
13
                         "This wizard will guide you to create a new project\n" +
 
14
                         "using the Direct/X extensions.\n\n" +
 
15
                         "This wizard expects the global variable \"dx\" to point\n" +
 
16
                         "to the appropriate DirectX SDK.\n" +
 
17
                         "This is the MS DirectX SDK for a Visual C++ Toolkit 2003 project\n" +
 
18
                         "and e.g. the DevPack folder for a GCC project.\n\n" +
 
19
                         "For a Visual C++ Toolkit 2003 project in addition the global variable\n" +
 
20
                         "\"psdk\" must point to the directory of the MS platform SDK.\n\n" +
 
21
                         "You will be asked to setup the variables accordingly. If this is\n" +
 
22
                         "not the case, verify \"Settings->Global variables\"\n" +
 
23
                         "after this wizard has completed.\n\n" +
 
24
                         "When you're ready to proceed, please click \"Next\"...");
 
25
 
 
26
    local dxpath_descr = _T("Please select the location of the Direct/X SDK on your computer.\n" +
 
27
                            "This is the top-level folder where Direct/X was installed (unpacked).\n" +
 
28
                            "To help you, this folder must contain the subfolders\n" +
 
29
                            "\"include\" and \"lib\".");
 
30
 
 
31
    Wizard.AddInfoPage(_T("DirectXIntro"), intro_msg);
 
32
    Wizard.AddProjectPathPage();
 
33
    Wizard.AddCompilerPage(_T(""), _T("gcc;msvctk"), true, true);
 
34
    Wizard.AddGenericSelectPathPage(_T("DirectXPath"), dxpath_descr, _T("Please select Direct/X's location:"), _T("$(#dx)"));
 
35
}
 
36
 
 
37
////////////////////////////////////////////////////////////////////////////////
 
38
// Direct/X's path page
 
39
////////////////////////////////////////////////////////////////////////////////
 
40
 
 
41
function OnLeave_DirectXPath(fwd)
 
42
{
 
43
    if (fwd)
 
44
    {
 
45
        local dir         = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
 
46
        local dir_nomacro = ReplaceMacros(dir, true);
 
47
        if (!IO.FileExists(dir_nomacro + _T("/include/d3d.h")))
 
48
        {
 
49
            ShowError(_T("The path you entered seems valid, but this wizard " +
 
50
                         "can't locate Direct/X's files in it..."));
 
51
            return false;
 
52
        }
 
53
        if (!IO.FileExists(dir_nomacro + _T("/include/d3d8.h")))
 
54
        {
 
55
            ShowError(_T("The path you entered is valid, but this wizard " +
 
56
                         "requires at least the Direct/X 8 SDK..."));
 
57
            return false;
 
58
        }
 
59
 
 
60
        if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("msvc*")))
 
61
        {
 
62
            local psdk = ReplaceMacros(_T("$(#psdk)"), true);
 
63
            if (!IO.DirectoryExists(psdk))
 
64
            {
 
65
                ShowError(_T("The path to the platform SDK seems not to be valid.\n" +
 
66
                             "This setup requires the MS platform SDK..."));
 
67
                return false;
 
68
            }
 
69
        }
 
70
 
 
71
        DirectXPath = dir;
 
72
    }
 
73
    return true;
 
74
}
 
75
 
 
76
// return the files this project contains
 
77
function GetFilesDir()
 
78
{
 
79
    return _T("directx/files");
 
80
}
 
81
 
 
82
// setup the already created project
 
83
function SetupProject(project)
 
84
{
 
85
    // set project options
 
86
    local gvar = ReplaceMacros(_T("$(#dx)"), true);
 
87
 
 
88
    // set compiler/linker search paths
 
89
    // see if the Direct/X SDK matches the global var. if it does, use the var instead...
 
90
    if (gvar.Matches(DirectXPath))
 
91
    {
 
92
        project.AddIncludeDir(_T("$(#dx.include)"));
 
93
        project.AddLibDir(_T("$(#dx.lib)"));
 
94
    }
 
95
    else
 
96
    {
 
97
        project.AddIncludeDir(DirectXPath + _T("/include"));
 
98
        project.AddLibDir(DirectXPath + _T("/lib/x86"));
 
99
    }
 
100
 
 
101
    // set compiler options
 
102
    project.AddCompilerOption(_T("-DWIN32"));
 
103
    project.AddCompilerOption(_T("-DNDEBUG"));
 
104
    project.AddCompilerOption(_T("-D_WINDOWS"));
 
105
    project.AddCompilerOption(_T("-D_MBCS"));
 
106
 
 
107
    // set linker options
 
108
    project.AddLinkLib(_T("kernel32"));
 
109
    project.AddLinkLib(_T("user32"));
 
110
    project.AddLinkLib(_T("gdi32"));
 
111
    project.AddLinkLib(_T("winspool"));
 
112
    project.AddLinkLib(_T("comdlg32"));
 
113
    project.AddLinkLib(_T("advapi32"));
 
114
    project.AddLinkLib(_T("shell32"));
 
115
    project.AddLinkLib(_T("ole32"));
 
116
    project.AddLinkLib(_T("oleaut32"));
 
117
    project.AddLinkLib(_T("uuid"));
 
118
    project.AddLinkLib(_T("odbc32"));
 
119
    project.AddLinkLib(_T("odbccp32"));
 
120
    project.AddLinkLib(_T("d3d8"));
 
121
 
 
122
    // set additional path's for MS VC++ Toolkit
 
123
    if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("msvc*")))
 
124
    {
 
125
        // set project options for MS Visual C++ Toolkit
 
126
        project.AddIncludeDir(_T("$(#psdk.include)"));
 
127
        project.AddLibDir(_T("$(#psdk.lib)"));
 
128
    }
 
129
 
 
130
    // enable compiler warnings (project-wide)
 
131
    WarningsOn(project, Wizard.GetCompilerID());
 
132
 
 
133
    // Debug
 
134
    local target = project.GetBuildTarget(Wizard.GetDebugName());
 
135
    if (!IsNull(target))
 
136
    {
 
137
        target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
 
138
        target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
 
139
        target.SetWorkingDir(Wizard.GetDebugOutputDir());
 
140
        // enable generation of debugging symbols for target
 
141
        DebugSymbolsOn(target, Wizard.GetCompilerID());
 
142
    }
 
143
 
 
144
    // Release
 
145
    target = project.GetBuildTarget(Wizard.GetReleaseName());
 
146
    if (!IsNull(target))
 
147
    {
 
148
        target.SetTargetType(ttExecutable); // ttExecutable: no console
 
149
        target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
 
150
        target.SetWorkingDir(Wizard.GetReleaseOutputDir());
 
151
        // enable optimizations for target
 
152
        OptimizationsOn(target, Wizard.GetCompilerID());
 
153
    }
 
154
 
 
155
    return true;
 
156
}