Skip to content

Commit

Permalink
Allow passing config macros from env (bkaradzic#2147)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu authored and rozgo committed Aug 14, 2020
1 parent 85a08cb commit 496defb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
4 changes: 1 addition & 3 deletions scripts/bgfx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ function bgfxProjectBase(_kind, _defines)
path.join(BIMG_DIR, "include"),
}

defines {
_defines,
}
defines (_defines)

links {
"bx",
Expand Down
19 changes: 17 additions & 2 deletions scripts/genie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,22 @@ end
dofile "bgfx.lua"

group "libs"
bgfxProject("", "StaticLib", {})

local function userdefines()
local defines = {}
local BGFX_CONFIG = os.getenv("BGFX_CONFIG")
if BGFX_CONFIG then
for def in BGFX_CONFIG:gmatch "[^%s:]+" do
table.insert(defines, "BGFX_CONFIG_" .. def)
end
end

return defines
end

BGFX_CONFIG = userdefines()

bgfxProject("", "StaticLib", BGFX_CONFIG)

dofile(path.join(BX_DIR, "scripts/bx.lua"))
dofile(path.join(BIMG_DIR, "scripts/bimg.lua"))
Expand Down Expand Up @@ -575,7 +590,7 @@ end

if _OPTIONS["with-shared-lib"] then
group "libs"
bgfxProject("-shared-lib", "SharedLib", {})
bgfxProject("-shared-lib", "SharedLib", BGFX_CONFIG)
end

if _OPTIONS["with-tools"] then
Expand Down

0 comments on commit 496defb

Please sign in to comment.