Avoid the need to set MINGW32 or MINGW64 environment variables when using a standard MSYS environment on Windows.

This commit is contained in:
Vas Crabb 2025-04-19 00:30:54 +10:00
parent aa3dc30a18
commit c5328f94c1
4 changed files with 27 additions and 21 deletions

View File

@ -31,7 +31,6 @@ jobs:
os: windows-latest
msys: MINGW64
slug: mingw-w64-x86_64
root: "/mingw64"
cc: gcc
cxx: g++
subtarget: mame
@ -40,7 +39,6 @@ jobs:
os: windows-latest
msys: MINGW64
slug: mingw-w64-x86_64
root: "/mingw64"
cc: clang
cxx: clang++
subtarget: tiny
@ -50,7 +48,6 @@ jobs:
msys: CLANGARM64
slug: mingw-w64-clang-aarch64
extrapkg: mingw-w64-clang-aarch64-gcc-compat
root: "/clangarm64"
cc: clang
cxx: clang++
subtarget: mame
@ -69,7 +66,6 @@ jobs:
fetch-depth: 0
- name: Build
env:
MINGW64: ${{ matrix.root }}
OVERRIDE_AR: "llvm-ar"
OVERRIDE_CC: ${{ matrix.cc }}
OVERRIDE_CXX: ${{ matrix.cxx }}

View File

@ -150,14 +150,8 @@ with MSYS2 and the **pacman** package manager.
* To generate API documentation from source, youll need ``doxygen``.
* If you plan to rebuild bgfx shaders and you want to rebuild the GLSL parser,
youll need ``bison``.
* For 64-bit builds, open **MSYS2 MinGW 64-bit** from the start menu, and set
up the environment variables ``MINGW64`` to ``/mingw64`` and ``MINGW32`` to an
empty string (e.g. using the command **export MINGW64=/mingw64 MINGW32=** in
the Bash shell).
* For 32-bit builds, open **MSYS2 MinGW 32-bit** from the start menu, and set
up the environment variables ``MINGW32`` to ``/mingw32`` and ``MINGW64`` to an
empty string (e.g. using the command **export MINGW32=/mingw32 MINGW64=** in
the Bash shell).
* For 64-bit builds, open **MSYS2 MinGW 64-bit** from the start menu.
* For 32-bit builds, open **MSYS2 MinGW 32-bit** from the start menu.
For example you could use these commands to ensure you have the packages you
need to compile MAME, omitting the ones for configurations you dont plan to

View File

@ -234,12 +234,28 @@ $(error Unable to detect OS from uname -a: $(UNAME))
endif
endif
MINGW:=
ifdef MSYSTEM
MINGW := $(MINGW_PREFIX)
ifeq ($(MSYSTEM),MINGW32)
MINGW32 := $(MINGW_PREFIX)
endif
ifeq ($(MSYSTEM),MINGW64)
MINGW64 := $(MINGW_PREFIX)
endif
ifeq ($(MSYSTEM),CLANGARM64)
MINGW64 := $(MINGW_PREFIX)
endif
ifndef TOOLCHAIN
TOOLCHAIN := $(MINGW_PREFIX)/bin/
endif
else # MSYSTEM
MINGW :=
ifdef MINGW64
MINGW := $(MINGW64)
else
else # MINGW64
MINGW := $(MINGW32)
endif
endif # MINGW64
endif # MSYSTEM
#-------------------------------------------------
# specify core target: mame, ldplayer

View File

@ -163,10 +163,10 @@ function toolchain(_buildDir, _subDir)
end
if "mingw32-gcc" == _OPTIONS["gcc"] then
if not os.getenv("MINGW32") then
print("Set MINGW32 envrionment variable.")
end
if toolchainPrefix == nil or toolchainPrefix == "" then
if not os.getenv("MINGW32") then
print("Set MINGW32 envrionment variable.")
end
toolchainPrefix = "$(MINGW32)/bin/i686-w64-mingw32-"
end
premake.gcc.cc = toolchainPrefix .. "gcc"
@ -176,10 +176,10 @@ function toolchain(_buildDir, _subDir)
end
if "mingw64-gcc" == _OPTIONS["gcc"] then
if not os.getenv("MINGW64") then
print("Set MINGW64 envrionment variable.")
end
if toolchainPrefix == nil or toolchainPrefix == "" then
if not os.getenv("MINGW64") then
print("Set MINGW64 envrionment variable.")
end
toolchainPrefix = "$(MINGW64)/bin/x86_64-w64-mingw32-"
end
premake.gcc.cc = toolchainPrefix .. "gcc"