Skip to content

Commit

Permalink
Support compiling with MinGW/mingw32.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcy committed Mar 5, 2016
1 parent c10771c commit 20e663f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 21 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,26 @@ cd build
make
```

### MinGW
### Cygwin/MinGW

Clone [ioquake3](https://github.com/ioquake/ioq3) to the same parent directory as ioq3-renderer-bgfx.

For Cygwin/MinGW-w64/MSYS2:
```
./premake5.exe shaders
./premake5.exe gmake
cd build
make
```

For MinGW/mingw32:
```
./premake5.exe shaders
./premake5.exe --mingw=mingw gmake
cd build
mingw32-make
```

### Visual Studio
1. Run `CompileShaders.bat`
2. Use [ioq3-premake-msvc](https://github.com/jpcy/ioq3-premake-msvc).
Expand Down
56 changes: 38 additions & 18 deletions premake5.lua
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
local BGFX_PATH = path.join(path.getabsolute(".."), "bgfx")

if not os.isdir(BGFX_PATH) then
if _ACTION ~= nil and not os.isdir(BGFX_PATH) then
print("bgfx not found at " .. BGFX_PATH)
os.exit()
end

local BX_PATH = path.join(path.getabsolute(".."), "bx")

if not os.isdir(BX_PATH) then
print("bx not found at " .. BX_PATH)
os.exit()
end

local IOQ3_PATH = path.join(path.getabsolute(".."), "ioq3")
local RENDERER_PATH = path.getabsolute(".")

if os.is("windows") then
if not os.isdir(IOQ3_PATH) then
print("ioquake3 not found at " .. IOQ3_PATH)
os.exit()
end
end

newaction
{
trigger = "shaders",
Expand Down Expand Up @@ -359,6 +342,43 @@ newaction
end,
}

newoption
{
trigger = "mingw",
value = "VALUE",
description = "MinGW variety",
allowed =
{
{ "mingw", "MinGW or mingw32" },
{ "mingw-w64", "MinGW-w64" }
}
}

if _ACTION == nil then
return
end

if not _OPTIONS["mingw"] then
_OPTIONS["mingw"] = "mingw-w64"
end

local BX_PATH = path.join(path.getabsolute(".."), "bx")

if not os.isdir(BX_PATH) then
print("bx not found at " .. BX_PATH)
os.exit()
end

local IOQ3_PATH = path.join(path.getabsolute(".."), "ioq3")
local RENDERER_PATH = path.getabsolute(".")

if os.is("windows") then
if not os.isdir(IOQ3_PATH) then
print("ioquake3 not found at " .. IOQ3_PATH)
os.exit()
end
end

solution "renderer_bgfx"
configurations { "Release", "Debug" }
location "build"
Expand Down
7 changes: 5 additions & 2 deletions renderer_bgfx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,14 @@ function createRendererProject(bgfxPath, bxPath, rendererPath, sdlIncludeDir, sd
configuration { "windows", "gmake" }
includedirs(path.join(bxPath, "include/compat/mingw"))
linkoptions { "-static-libgcc", "-static-libstdc++" }

configuration { "windows", "gmake", "mingw=mingw" }
gccprefix "mingw32-"

configuration { "windows", "gmake", "x86" }
configuration { "windows", "gmake", "mingw=mingw-w64", "x86" }
gccprefix "i686-w64-mingw32-"

configuration { "windows", "gmake", "x86_64" }
configuration { "windows", "gmake", "mingw=mingw-w64", "x86_64" }
gccprefix "x86_64-w64-mingw32-"

configuration { "windows", "x86" }
Expand Down

0 comments on commit 20e663f

Please sign in to comment.