CompilerPtr CompilerLocatorMinGW::Locate(const wxString& folder)
{
    m_compilers.clear();
    wxFileName gcc(folder, "gcc");
#ifdef __WXMSW__
    gcc.SetExt("exe");
#endif

    bool found = gcc.FileExists();
    if ( ! found ) {
        // try to see if we have a bin folder here
        gcc.AppendDir("bin");
        found = gcc.FileExists();
    }
    
    if ( found ) {
        AddTools(gcc.GetPath(), GetGCCVersion(gcc.GetFullPath() ));
        return *m_compilers.begin();
    }
    return NULL;
}
Esempio n. 2
0
wxArrayString Compiler::GetDefaultIncludePaths() const
{
    wxArrayString defaultPaths;
    if(GetCompilerFamily() == COMPILER_FAMILY_MINGW) {
        wxString ver = GetGCCVersion();
        if(ver.IsEmpty()) {
            return defaultPaths;
        }

        // FIXME : support 64 bit compilers
        defaultPaths.Add(GetIncludePath("lib/gcc/mingw32/" + ver + "/include/c++"));
        defaultPaths.Add(GetIncludePath("lib/gcc/mingw32/" + ver + "/include/c++/mingw32"));
        defaultPaths.Add(GetIncludePath("lib/gcc/mingw32/" + ver + "/include/c++/backward"));
        defaultPaths.Add(GetIncludePath("lib/gcc/mingw32/" + ver + "/include"));
        defaultPaths.Add(GetIncludePath("include"));
        defaultPaths.Add(GetIncludePath("lib/gcc/mingw32/" + ver + "/include-fixed"));

    } else if(GetCompilerFamily() == COMPILER_FAMILY_CLANG || GetCompilerFamily() == COMPILER_FAMILY_GCC) {
#ifndef __WXMSW__
        defaultPaths = POSIXGetIncludePaths();
#endif
    }
    return defaultPaths;
}
CompilerPtr CompilerLocatorCygwin::Locate(const wxString& folder)
{
    m_compilers.clear();
    
    wxString binFolder;
    wxFileName gcc(folder, "gcc.exe");
    if ( gcc.FileExists() ) {
        binFolder = gcc.GetPath();
    } else {
        gcc.AppendDir("bin");
        if ( gcc.FileExists() ) {
            binFolder = gcc.GetPath();
        }
    }
    
    if ( binFolder.IsEmpty() )
        return NULL;
    
    wxArrayString suffixes = GetSuffixes(binFolder);
    if ( suffixes.IsEmpty() )
        return NULL;
    
    for(size_t i=0; i<suffixes.GetCount(); ++i) {
        gcc.SetFullName( "gcc-" + suffixes.Item(i) + ".exe" );
        wxString gccVer = GetGCCVersion( gcc.GetFullPath() );

        wxString compilerName;
        compilerName << "Cygwin";
        if ( !gccVer.IsEmpty() ) {
            compilerName <<  " - " << gccVer;
        }
        // Add the tools (use the bin folder)
        AddTools(gcc.GetPath(), compilerName, suffixes.Item(i));
    }
    return m_compilers.at(0);
}