Skip to content

Commit

Permalink
Windows: when locating compiler based on PATH, set the SHELL to `cmd.…
Browse files Browse the repository at this point in the history
…exe`

    Related issue: #3326

Signed-off-by: Eran Ifrah <[email protected]>
  • Loading branch information
eranif committed Jan 13, 2025
1 parent 4756a44 commit 50349b6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
10 changes: 8 additions & 2 deletions Plugin/CompilerLocator/CompilerLocatorMSYS2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CompilerLocatorMSYS2Mingw64::~CompilerLocatorMSYS2Mingw64() {}
CompilerLocatorMSYS2Clang64::CompilerLocatorMSYS2Clang64() { m_msys2.SetChroot("\\clang64"); }
CompilerLocatorMSYS2Clang64::~CompilerLocatorMSYS2Clang64() {}

CompilerLocatorMSYS2Env::CompilerLocatorMSYS2Env() {}
CompilerLocatorMSYS2Env::CompilerLocatorMSYS2Env() { m_cmdShell = true; }
CompilerLocatorMSYS2Env::~CompilerLocatorMSYS2Env() {}

bool CompilerLocatorMSYS2Env::Locate()
Expand Down Expand Up @@ -128,7 +128,13 @@ CompilerPtr CompilerLocatorMSYS2::TryToolchain(const wxString& folder,
compiler->SetTool("AS", as.GetFullPath());

size_t cpu_count = wxThread::GetCPUCount();
compiler->SetTool("MAKE", wxString() << make.GetFullPath() << " -j" << cpu_count);
wxString make_extra_args;
make_extra_args << "-j" << cpu_count;
if (m_cmdShell) {
make_extra_args << " SHELL=cmd.exe";
}

compiler->SetTool("MAKE", wxString() << make.GetFullPath() << " " << make_extra_args);
compiler->SetTool("ResourceCompiler", windres.GetFullPath());
compiler->SetTool("Debugger", gdb.GetFullPath());
return compiler;
Expand Down
22 changes: 11 additions & 11 deletions Plugin/CompilerLocator/CompilerLocatorMSYS2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@
/// Locate for GCC compilers
class WXDLLIMPEXP_SDK CompilerLocatorMSYS2 : public ICompilerLocator
{
protected:
MSYS2 m_msys2;

protected:
wxFileName GetFileName(const wxString& bin_dir, const wxString& fullname) const;

CompilerLocatorMSYS2();
virtual ~CompilerLocatorMSYS2();

CompilerPtr TryToolchain(const wxString& folder, const std::unordered_map<wxString, wxString>& toolchain);

public:
/**
* @brief locate the compiler
Expand All @@ -30,6 +19,17 @@ class WXDLLIMPEXP_SDK CompilerLocatorMSYS2 : public ICompilerLocator
* @brief locate a compiler in a directory
*/
CompilerPtr Locate(const wxString& folder) override;

protected:
wxFileName GetFileName(const wxString& bin_dir, const wxString& fullname) const;

CompilerLocatorMSYS2();
virtual ~CompilerLocatorMSYS2();

CompilerPtr TryToolchain(const wxString& folder, const std::unordered_map<wxString, wxString>& toolchain);

MSYS2 m_msys2;
bool m_cmdShell = false;
};

class WXDLLIMPEXP_SDK CompilerLocatorMSYS2Usr : public CompilerLocatorMSYS2
Expand Down

0 comments on commit 50349b6

Please sign in to comment.