Code::Blocks  SVN r11506
compilerGNUARM.cpp
Go to the documentation of this file.
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: 8757 $
6  * $Id: compilerGNUARM.cpp 8757 2013-01-05 08:47:13Z mortenmacfly $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/plugins/compilergcc/compilerGNUARM.cpp $
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 "compilerGNUARM.h"
20 
22  : Compiler(_("GNU GCC Compiler for ARM"), _T("arm-elf-gcc"))
23 {
24  m_Weight = 56;
25  Reset();
26 }
27 
29 {
30  //dtor
31 }
32 
34 {
35  return (new CompilerGNUARM(*this));
36 }
37 
39 {
41  if (platform::windows)
42  {
43  // Search for GNUARM installation dir
44  wxString windir = wxGetOSDirectory();
45  wxFileConfig ini(_T(""), _T(""), windir + _T("/GnuARM.ini"), _T(""), wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_NO_ESCAPE_CHARACTERS);
46  // need it as const , so correct overloaded method will be selected
47  wxString Programs = _T("C:\\Program Files");
48  // what's the "Program Files" location
49  // TO DO : support 64 bit -> 32 bit apps are in "ProgramFiles(x86)"
50  // 64 bit apps are in "ProgramFiles"
51  wxGetEnv(_T("ProgramFiles"), &Programs);
52  // need it as const , so correct overloaded method will be selected
53  const wxString ProgramsConst = Programs + _T("\\GNUARM");
54  m_MasterPath = ini.Read(_T("/InstallSettings/InstallPath"), ProgramsConst);
55 
56  if (wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C))
57  {
58  m_Programs.MAKE = _T("make.exe"); // we distribute "make" not "mingw32-make"
59  }
60  }
61  else
62  m_MasterPath = _T("/usr");
63 
65  if (ret == adrDetected)
66  {
67  AddIncludeDir(m_MasterPath + sep + _T("include"));
68  AddLibDir(m_MasterPath + sep + _T("lib"));
69  }
70  return ret;
71 } // end of AutoDetectInstallationDir
bool wxGetEnv(const wxString &var, wxString *value)
bool Read(const wxString &key, wxString *str) const
bool wxFileExists(const wxString &filename)
virtual Compiler * CreateCopy()
Implement this in new compilers, to return a new copy.
virtual void Reset()
Reset settings to defaults.
Definition: compiler.cpp:157
#define _T(string)
virtual void AddIncludeDir(const wxString &option)
CompilerPrograms m_Programs
Definition: compiler.h:412
AutoDetectResult
Definition: compiler.h:190
virtual ~CompilerGNUARM()
virtual void AddLibDir(const wxString &option)
wxString MAKE
Definition: compiler.h:204
static const wxString sep
static wxUniChar GetPathSeparator(wxPathFormat format=wxPATH_NATIVE)
wxString wxGetOSDirectory()
const wxString & _(const wxString &string)
Abstract base class for compilers.
Definition: compiler.h:274
virtual AutoDetectResult AutoDetectInstallationDir()
Try to auto-detect the compiler&#39;s installation directory.
wxString C
Definition: compiler.h:199
wxString m_MasterPath
Definition: compiler.h:409
int m_Weight
Definition: compiler.h:422