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

« back to all changes in this revision

Viewing changes to src/plugins/compilergcc/compilerGNUMSP430.cpp

  • 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
 * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
 
3
 * http://www.gnu.org/licenses/gpl-3.0.html
 
4
 *
 
5
 * $Revision$
 
6
 * $Id$
 
7
 * $HeadURL$
 
8
 */
 
9
 
 
10
#include <sdk.h>
 
11
#include <prep.h>
 
12
#ifndef CB_PRECOMP
 
13
    #include <wx/intl.h>
 
14
    #include <wx/regex.h>
 
15
    #include <wx/utils.h> // wxGetOSDirectory, wxGetEnv
 
16
#endif
 
17
#include <wx/filefn.h> // wxFileExists
 
18
#include <wx/fileconf.h> // wxFileConfig
 
19
#include <wx/msgdlg.h>
 
20
#ifdef __WXMSW__
 
21
#include <wx/msw/registry.h>
 
22
#endif // __WXMSW__
 
23
#include "compilerGNUMSP430.h"
 
24
 
 
25
CompilerGNUMSP430::CompilerGNUMSP430()
 
26
        : Compiler(_("GNU GCC Compiler for MSP430"),_T("msp430-gcc"))
 
27
{
 
28
    Reset();
 
29
}
 
30
 
 
31
CompilerGNUMSP430::~CompilerGNUMSP430()
 
32
{
 
33
    //dtor
 
34
}
 
35
 
 
36
Compiler * CompilerGNUMSP430::CreateCopy()
 
37
{
 
38
    Compiler* c = new CompilerGNUMSP430(*this);
 
39
    c->SetExtraPaths(m_ExtraPaths); // wxArrayString doesn't seem to be copied with the default copy ctor...
 
40
    return c;
 
41
}
 
42
 
 
43
void CompilerGNUMSP430::Reset()
 
44
{
 
45
    if (platform::windows)
 
46
    {
 
47
        m_Programs.C = _T("msp430-gcc.exe");
 
48
        m_Programs.CPP = _T("msp430-g++.exe");
 
49
        m_Programs.LD = _T("msp430-g++.exe");
 
50
        m_Programs.DBG = _T("msp430-insight.exe");
 
51
        m_Programs.LIB = _T("msp430-ar.exe");
 
52
        m_Programs.WINDRES = _T("");
 
53
        m_Programs.MAKE = _T("make.exe");
 
54
    }
 
55
    else
 
56
    {
 
57
        m_Programs.C = _T("msp430-gcc");
 
58
        m_Programs.CPP = _T("msp430-g++");
 
59
        m_Programs.LD = _T("msp430-g++");
 
60
        m_Programs.DBG = _T("msp430-insight");
 
61
        m_Programs.LIB = _T("msp430-ar");
 
62
        m_Programs.WINDRES = _T("");
 
63
        m_Programs.MAKE = _T("make");
 
64
    }
 
65
    m_Switches.includeDirs = _T("-I");
 
66
    m_Switches.libDirs = _T("-L");
 
67
    m_Switches.linkLibs = _T("-l");
 
68
    m_Switches.defines = _T("-D");
 
69
    m_Switches.genericSwitch = _T("-");
 
70
    m_Switches.objectExtension = _T("o");
 
71
    m_Switches.needDependencies = true;
 
72
    m_Switches.forceCompilerUseQuotes = false;
 
73
    m_Switches.forceLinkerUseQuotes = false;
 
74
    m_Switches.logging = clogFull;
 
75
    m_Switches.libPrefix = _T("lib");
 
76
    m_Switches.libExtension = _T("a");
 
77
    m_Switches.linkerNeedsLibPrefix = false;
 
78
    m_Switches.linkerNeedsLibExtension = false;
 
79
 
 
80
    // Summary of GCC options: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html
 
81
 
 
82
    m_Options.ClearOptions();
 
83
    m_Options.AddOption(_("Produce debugging symbols"),
 
84
                        _T("-g"),
 
85
                        _("Debugging"),
 
86
                        _T(""),
 
87
                        true,
 
88
                        _T("-O -O1 -O2 -O3 -Os"),
 
89
                        _("You have optimizations enabled. This will make debugging difficult because variables may be optimized away etc."));
 
90
    wxString gprof_link = _T("-pg");
 
91
    if (platform::windows)
 
92
        gprof_link = _T("-pg -lgmon");
 
93
    m_Options.AddOption(_("Profile code when executed"), _T("-pg"), _("Profiling"), gprof_link);
 
94
 
 
95
    wxString category = _("Warnings");
 
96
 
 
97
    // warnings
 
98
    m_Options.AddOption(_("In C mode, support all ISO C90 programs. In C++ mode, remove GNU extensions that conflict with ISO C++"), _T("-ansi"), category);
 
99
    m_Options.AddOption(_("Enable all compiler warnings (overrides every other setting)"), _T("-Wall"), category);
 
100
    m_Options.AddOption(_("Enable standard compiler warnings"), _T("-W"), category);
 
101
    m_Options.AddOption(_("Stop compiling after first error"), _T("-Wfatal-errors"), category);
 
102
    m_Options.AddOption(_("Inhibit all warning messages"), _T("-w"), category);
 
103
    m_Options.AddOption(_("Enable warnings demanded by strict ISO C and ISO C++"), _T("-pedantic"), category);
 
104
    m_Options.AddOption(_("Treat as errors the warnings demanded by strict ISO C and ISO C++"), _T("-pedantic-errors"), category);
 
105
    m_Options.AddOption(_("Warn if main() is not conformant"), _T("-Wmain"), category);
 
106
 
 
107
    category = _("General Options");
 
108
 
 
109
    // general options
 
110
    m_Options.AddOption(_("Output an error if same variable is declared without extern in different modules"), _T("-fno-common"), category);
 
111
    m_Options.AddOption(_("Save intermediate files in the build directory"), _T("-save-temps"), category);
 
112
 
 
113
    // Startup options
 
114
    category = _("Linker and startup code");
 
115
    m_Options.AddOption(_("do not link against the default crt0.o, so you can add your own startup code (MSP430 specific)"), _T("-nocrt0"), category);
 
116
    m_Options.AddOption(_("do not link against standard system startup files"), _T("-nostartfiles"), category);
 
117
    m_Options.AddOption(_("only search library directories explicitly specified on the command line"), _T("-nostdlib"), category);
 
118
 
 
119
    // optimization
 
120
    category = _("Optimization");
 
121
    m_Options.AddOption(_("Strip all symbols from binary (minimizes size)"), _T(""), category, _T("-s"), true, _T("-g -ggdb"), _("Stripping the binary will strip debugging symbols as well!"));
 
122
    m_Options.AddOption(_("Optimize generated code (for speed)"), _T("-O"), category);
 
123
    m_Options.AddOption(_("Optimize more (for speed)"), _T("-O1"), category);
 
124
    m_Options.AddOption(_("Optimize even more (for speed)"), _T("-O2"), category);
 
125
    m_Options.AddOption(_("Optimize fully (for speed)"), _T("-O3"), category);
 
126
    m_Options.AddOption(_("Optimize generated code (for size)"), _T("-Os"), category);
 
127
    m_Options.AddOption(_("Expensive optimizations"), _T("-fexpensive-optimizations"), category);
 
128
    m_Options.AddOption(_("No instruction scheduling before reload"), _T("-fno-schedule-insns"), category);
 
129
    m_Options.AddOption(_("No instruction scheduling after reload"), _T("-fno-schedule-insns2"), category);
 
130
 
 
131
    // machine dependent options
 
132
    category = _("MSP430 achitecture specific");
 
133
 
 
134
    m_Options.AddOption(_("Use subroutine call for function prologue/epilogue when possible"), _T("-msave-prologue"), category);
 
135
    m_Options.AddOption(_("Do not perform volatile workaround for bitwise operations"), _T("-mno-volatile-workaround"), category);
 
136
    m_Options.AddOption(_("No stack init in main()"), _T("-mno-stack-init"), category);
 
137
    m_Options.AddOption(_("Produce IAR assembler syntax"), _T("-mIAR"), category);
 
138
    m_Options.AddOption(_("Assume interrupt routine does not do hardware multiply"), _T("-mnoint-hwmul"), category);
 
139
    m_Options.AddOption(_("Issue inline multiplication code for 32-bit integers"), _T("-minline-hwmul"), category);
 
140
    m_Options.AddOption(_("Disable hardware multiplier"), _T("-mdisable-hwmul"), category);
 
141
    m_Options.AddOption(_("Force hardware multiplier"), _T("-mforce-hwmul"), category);
 
142
    m_Options.AddOption(_("Strict alignment for all structures"), _T("-mstrict-align"), category);
 
143
    m_Options.AddOption(_("Add stack information to profiler"), _T("-mpgr"), category);
 
144
    m_Options.AddOption(_("Add library profile information"), _T("-mpgl"), category);
 
145
    m_Options.AddOption(_("Add ordinary profile information"), _T("-mpgs"), category);
 
146
    m_Options.AddOption(_("Jump to specified routine at the end of main()"), _T("-mendup-at="), category);
 
147
    m_Options.AddOption(_("Specify the initial stack address"), _T("-minit-stack="), category);
 
148
    m_Options.AddOption(_("enable relaxation at assembly time"), _T("-mQ"), category);
 
149
    m_Options.AddOption(_("enable polymorph instructions"), _T("-mP"), category);
 
150
 
 
151
    // machine dependent options
 
152
    category = _("MSP430 MCU derivatives");
 
153
 
 
154
    m_Options.AddOption(_("MSP430 MSP1"), _T("-mmcu=msp1"), category);
 
155
    m_Options.AddOption(_("MSP430 MSP2"), _T("-mmcu=msp2"), category);
 
156
    m_Options.AddOption(_("MSP430 110"), _T("-mmcu=msp430x110"), category);
 
157
    m_Options.AddOption(_("MSP430 112"), _T("-mmcu=msp430x112"), category);
 
158
    m_Options.AddOption(_("MSP430 1101"), _T("-mmcu=msp430x1101"), category);
 
159
    m_Options.AddOption(_("MSP430 1111"), _T("-mmcu=msp430x1111"), category);
 
160
    m_Options.AddOption(_("MSP430 1121"), _T("-mmcu=msp430x1121"), category);
 
161
    m_Options.AddOption(_("MSP430 1122"), _T("-mmcu=msp430x1122"), category);
 
162
    m_Options.AddOption(_("MSP430 1132"), _T("-mmcu=msp430x1132"), category);
 
163
    m_Options.AddOption(_("MSP430 122"), _T("-mmcu=msp430x122"), category);
 
164
    m_Options.AddOption(_("MSP430 123"), _T("-mmcu=msp430x123"), category);
 
165
    m_Options.AddOption(_("MSP430 1222"), _T("-mmcu=msp430x1222"), category);
 
166
    m_Options.AddOption(_("MSP430 1232"), _T("-mmcu=msp430x1232"), category);
 
167
    m_Options.AddOption(_("MSP430 133"), _T("-mmcu=msp430x133"), category);
 
168
    m_Options.AddOption(_("MSP430 135"), _T("-mmcu=msp430x135"), category);
 
169
    m_Options.AddOption(_("MSP430 1331"), _T("-mmcu=msp430x1331"), category);
 
170
    m_Options.AddOption(_("MSP430 1351"), _T("-mmcu=msp430x1351"), category);
 
171
    m_Options.AddOption(_("MSP430 147"), _T("-mmcu=msp430x147"), category);
 
172
    m_Options.AddOption(_("MSP430 148"), _T("-mmcu=msp430x148"), category);
 
173
    m_Options.AddOption(_("MSP430 149"), _T("-mmcu=msp430x149"), category);
 
174
    m_Options.AddOption(_("MSP430 1471"), _T("-mmcu=msp430x1471"), category);
 
175
    m_Options.AddOption(_("MSP430 1481"), _T("-mmcu=msp430x1481"), category);
 
176
    m_Options.AddOption(_("MSP430 1491"), _T("-mmcu=msp430x1491"), category);
 
177
    m_Options.AddOption(_("MSP430 155"), _T("-mmcu=msp430x155"), category);
 
178
    m_Options.AddOption(_("MSP430 156"), _T("-mmcu=msp430x156"), category);
 
179
    m_Options.AddOption(_("MSP430 157"), _T("-mmcu=msp430x157"), category);
 
180
    m_Options.AddOption(_("MSP430 167"), _T("-mmcu=msp430x167"), category);
 
181
    m_Options.AddOption(_("MSP430 168"), _T("-mmcu=msp430x168"), category);
 
182
    m_Options.AddOption(_("MSP430 169"), _T("-mmcu=msp430x169"), category);
 
183
    m_Options.AddOption(_("MSP430 1610"), _T("-mmcu=msp430x1610"), category);
 
184
    m_Options.AddOption(_("MSP430 1611"), _T("-mmcu=msp430x1611"), category);
 
185
    m_Options.AddOption(_("MSP430 1612"), _T("-mmcu=msp430x1612"), category);
 
186
    m_Options.AddOption(_("MSP430 2001"), _T("-mmcu=msp430x2001"), category);
 
187
    m_Options.AddOption(_("MSP430 2011"), _T("-mmcu=msp430x2011"), category);
 
188
    m_Options.AddOption(_("MSP430 2002"), _T("-mmcu=msp430x2002"), category);
 
189
    m_Options.AddOption(_("MSP430 2012"), _T("-mmcu=msp430x2012"), category);
 
190
    m_Options.AddOption(_("MSP430 2003"), _T("-mmcu=msp430x2003"), category);
 
191
    m_Options.AddOption(_("MSP430 2013"), _T("-mmcu=msp430x2013"), category);
 
192
    m_Options.AddOption(_("MSP430 2101"), _T("-mmcu=msp430x2101"), category);
 
193
    m_Options.AddOption(_("MSP430 2111"), _T("-mmcu=msp430x2111"), category);
 
194
    m_Options.AddOption(_("MSP430 2121"), _T("-mmcu=msp430x2121"), category);
 
195
    m_Options.AddOption(_("MSP430 2131"), _T("-mmcu=msp430x2131"), category);
 
196
    m_Options.AddOption(_("MSP430 2234"), _T("-mmcu=msp430x2234"), category);
 
197
    m_Options.AddOption(_("MSP430 2254"), _T("-mmcu=msp430x2254"), category);
 
198
    m_Options.AddOption(_("MSP430 2274"), _T("-mmcu=msp430x2274"), category);
 
199
    m_Options.AddOption(_("MSP430 311"), _T("-mmcu=msp430x311"), category);
 
200
    m_Options.AddOption(_("MSP430 312"), _T("-mmcu=msp430x312"), category);
 
201
    m_Options.AddOption(_("MSP430 313"), _T("-mmcu=msp430x313"), category);
 
202
    m_Options.AddOption(_("MSP430 314"), _T("-mmcu=msp430x314"), category);
 
203
    m_Options.AddOption(_("MSP430 315"), _T("-mmcu=msp430x315"), category);
 
204
    m_Options.AddOption(_("MSP430 323"), _T("-mmcu=msp430x323"), category);
 
205
    m_Options.AddOption(_("MSP430 325"), _T("-mmcu=msp430x325"), category);
 
206
    m_Options.AddOption(_("MSP430 336"), _T("-mmcu=msp430x336"), category);
 
207
    m_Options.AddOption(_("MSP430 337"), _T("-mmcu=msp430x337"), category);
 
208
    m_Options.AddOption(_("MSP430 412"), _T("-mmcu=msp430x412"), category);
 
209
    m_Options.AddOption(_("MSP430 413"), _T("-mmcu=msp430x413"), category);
 
210
    m_Options.AddOption(_("MSP430 415"), _T("-mmcu=msp430x415"), category);
 
211
    m_Options.AddOption(_("MSP430 417"), _T("-mmcu=msp430x417"), category);
 
212
    m_Options.AddOption(_("MSP430 423"), _T("-mmcu=msp430x423"), category);
 
213
    m_Options.AddOption(_("MSP430 425"), _T("-mmcu=msp430x425"), category);
 
214
    m_Options.AddOption(_("MSP430 427"), _T("-mmcu=msp430x427"), category);
 
215
    m_Options.AddOption(_("MSP430 4250"), _T("-mmcu=msp430x4250"), category);
 
216
    m_Options.AddOption(_("MSP430 4260"), _T("-mmcu=msp430x4260"), category);
 
217
    m_Options.AddOption(_("MSP430 4270"), _T("-mmcu=msp430x4270"), category);
 
218
    m_Options.AddOption(_("MSP430 E423"), _T("-mmcu=msp430xE423"), category);
 
219
    m_Options.AddOption(_("MSP430 E425"), _T("-mmcu=msp430xE425"), category);
 
220
    m_Options.AddOption(_("MSP430 E427"), _T("-mmcu=msp430xE427"), category);
 
221
    m_Options.AddOption(_("MSP430 W423"), _T("-mmcu=msp430xW423"), category);
 
222
    m_Options.AddOption(_("MSP430 W425"), _T("-mmcu=msp430xW425"), category);
 
223
    m_Options.AddOption(_("MSP430 W427"), _T("-mmcu=msp430xW427"), category);
 
224
    m_Options.AddOption(_("MSP430 G437"), _T("-mmcu=msp430xG437"), category);
 
225
    m_Options.AddOption(_("MSP430 G438"), _T("-mmcu=msp430xG438"), category);
 
226
    m_Options.AddOption(_("MSP430 G439"), _T("-mmcu=msp430xG439"), category);
 
227
    m_Options.AddOption(_("MSP430 435"), _T("-mmcu=msp430x435"), category);
 
228
    m_Options.AddOption(_("MSP430 436"), _T("-mmcu=msp430x436"), category);
 
229
    m_Options.AddOption(_("MSP430 437"), _T("-mmcu=msp430x437"), category);
 
230
    m_Options.AddOption(_("MSP430 447"), _T("-mmcu=msp430x447"), category);
 
231
    m_Options.AddOption(_("MSP430 448"), _T("-mmcu=msp430x448"), category);
 
232
    m_Options.AddOption(_("MSP430 449"), _T("-mmcu=msp430x449"), category);
 
233
    m_Options.AddOption(_("MSP430 4616"), _T("-mmcu=msp430xG4616"), category);
 
234
    m_Options.AddOption(_("MSP430 4617"), _T("-mmcu=msp430xG4617"), category);
 
235
    m_Options.AddOption(_("MSP430 4618"), _T("-mmcu=msp430xG4618"), category);
 
236
    m_Options.AddOption(_("MSP430 4619"), _T("-mmcu=msp430xG4619"), category);
 
237
 
 
238
    m_Commands[(int)ctCompileObjectCmd].push_back(CompilerTool(_T("$compiler $options $includes -c $file -o $object")));
 
239
    m_Commands[(int)ctGenDependenciesCmd].push_back(CompilerTool(_T("$compiler -MM $options -MF $dep_object -MT $object $includes $file")));
 
240
    m_Commands[(int)ctCompileResourceCmd].push_back(CompilerTool(_T("$rescomp -i $file -J rc -o $resource_output -O coff $res_includes")));
 
241
    m_Commands[(int)ctLinkConsoleExeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs")));
 
242
    if (platform::windows)
 
243
    {
 
244
        m_Commands[(int)ctLinkExeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs -mwindows")));
 
245
        m_Commands[(int)ctLinkDynamicCmd].push_back(CompilerTool(_T("$linker -shared -Wl,--output-def=$def_output -Wl,--out-implib=$static_output -Wl,--dll $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs")));
 
246
    }
 
247
    else
 
248
    {
 
249
        m_Commands[(int)ctLinkExeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // no -mwindows
 
250
        m_Commands[(int)ctLinkDynamicCmd].push_back(CompilerTool(_T("$linker -shared $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs")));
 
251
    }
 
252
    m_Commands[(int)ctLinkStaticCmd].push_back(CompilerTool(_T("$lib_linker -rs $static_output $link_objects")));
 
253
    m_Commands[(int)ctLinkNativeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // unsupported currently
 
254
 
 
255
    LoadDefaultRegExArray();
 
256
 
 
257
    m_CompilerOptions.Clear();
 
258
    m_LinkerOptions.Clear();
 
259
    m_LinkLibs.Clear();
 
260
    m_CmdsBefore.Clear();
 
261
    m_CmdsAfter.Clear();
 
262
}
 
263
 
 
264
void CompilerGNUMSP430::LoadDefaultRegExArray()
 
265
{
 
266
    m_RegExes.Clear();
 
267
    m_RegExes.Add(RegExStruct(_("Fatal error"), cltError, _T("FATAL:[ \t]*(.*)"), 1));
 
268
    m_RegExes.Add(RegExStruct(_("'In function...' info"), cltInfo, _T("(") + FilePathWithSpaces + _T("):[ \t]+") + _T("([iI]n ([cC]lass|[cC]onstructor|[dD]estructor|[fF]unction|[mM]ember [fF]unction).*)"), 2, 1));
 
269
    m_RegExes.Add(RegExStruct(_("'Instantiated from' info"), cltInfo, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]+([iI]nstantiated from .*)"), 3, 1, 2));
 
270
    m_RegExes.Add(RegExStruct(_("Resource compiler error"), cltError, _T("windres.exe:[ \t](") + FilePathWithSpaces + _T("):([0-9]+):[ \t](.*)"), 3, 1, 2));
 
271
    m_RegExes.Add(RegExStruct(_("Resource compiler error (2)"), cltError, _T("windres.exe:[ \t](.*)"), 1));
 
272
    m_RegExes.Add(RegExStruct(_("Preprocessor warning"), cltWarning, _T("(") + FilePathWithSpaces + _T("):([0-9]+):([0-9]+):[ \t]([Ww]arning:[ \t].*)"), 4, 1, 2));
 
273
    m_RegExes.Add(RegExStruct(_("Preprocessor error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[0-9]+:[ \t](.*)"), 3, 1, 2));
 
274
    m_RegExes.Add(RegExStruct(_("Compiler warning"), cltWarning, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]([Ww]arning:[ \t].*)"), 3, 1, 2));
 
275
    m_RegExes.Add(RegExStruct(_("Compiler note"), cltInfo, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]([Nn]ote:[ \t].*)"), 3, 1, 2));
 
276
    m_RegExes.Add(RegExStruct(_("General note"), cltInfo, _T("([Nn]ote:[ \t].*)"), 1));
 
277
    m_RegExes.Add(RegExStruct(_("Compiler error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t](.*)"), 3, 1, 2));
 
278
    m_RegExes.Add(RegExStruct(_("Linker error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[0-9]+:[ \t](.*)"), 3, 1, 2));
 
279
    m_RegExes.Add(RegExStruct(_("Linker error (2)"), cltError, FilePathWithSpaces + _T("\\(.text\\+[0-9A-Za-z]+\\):([ \tA-Za-z0-9_:+/\\.-]+):[ \t](.*)"), 2, 1));
 
280
    m_RegExes.Add(RegExStruct(_("Linker error (lib not found)"), cltError, _T(".*(ld.*):[ \t](cannot find.*)"), 2, 1));
 
281
    m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
 
282
    m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));
 
283
    m_RegExes.Add(RegExStruct(_("Auto-import info"), cltInfo, _T("([Ii]nfo:[ \t].*)\\(auto-import\\)"), 1));
 
284
}
 
285
 
 
286
AutoDetectResult CompilerGNUMSP430::AutoDetectInstallationDir()
 
287
{
 
288
    wxString sep = wxFileName::GetPathSeparator();
 
289
#ifdef __WXMSW__
 
290
        m_MasterPath = _T("C:\\HighTec\\Msp430"); // just a guess
 
291
 
 
292
    //    wxLogNull ln;
 
293
        wxRegKey key; // defaults to HKCR
 
294
        key.SetName(_T("HKEY_LOCAL_MACHINE\\Software\\HighTec EDV-Systeme\\Msp430\\"));
 
295
        if (key.Exists() && key.Open(wxRegKey::Read))
 
296
        {
 
297
            // found; read it
 
298
            if (key.HasValue(_T("InstallPath")))
 
299
            {
 
300
                key.QueryValue(_T("InstallPath"), m_MasterPath);
 
301
            }
 
302
        }
 
303
#else
 
304
        m_MasterPath = _T("/usr/local/msp430");
 
305
#endif // __WXMSW__
 
306
    AutoDetectResult ret = wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C) ? adrDetected : adrGuessed;
 
307
    if (ret == adrDetected)
 
308
    {
 
309
          AddIncludeDir(m_MasterPath + sep + _T("msp430") + sep + _T("include"));
 
310
    }
 
311
    return ret;
 
312
}