Skip to content

Commit

Permalink
added so bam uses the CC, CXX, CFLAGS, CXXFLAGS and LDFLAGS if they a…
Browse files Browse the repository at this point in the history
…re available
  • Loading branch information
Magnus Auvinen committed Jun 7, 2016
1 parent 11c8f83 commit 2e65531
Showing 1 changed file with 42 additions and 6 deletions.
48 changes: 42 additions & 6 deletions src/tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,55 @@ function SetDefaultDrivers(settings)
-- check for compilers first time
if _checked_default_drivers == false then
_checked_default_drivers = true
if ExecuteSilent("cl") == 0 then
SetDriversDefault = SetDriversCL
elseif ExecuteSilent("gcc -v") == 0 then
SetDriversDefault = SetDriversGCC
elseif ExecuteSilent("clang -v") == 0 then
SetDriversDefault = SetDriversClang
if os.getenv("CC") then
if string.match(os.getenv("CC"), "^clang") then
print("CLANG!")
SetDriversDefault = SetDriversClang
elseif string.match(os.getenv("CC"), "^gcc") then
print("GCC!")
SetDriversDefault = SetDriversGCC
elseif string.match(os.getenv("CC"), "^clang") then
print("CL!")
SetDriversDefault = SetDriversCL
end
else
if ExecuteSilent("cl") == 0 then
SetDriversDefault = SetDriversCL
elseif ExecuteSilent("gcc -v") == 0 then
SetDriversDefault = SetDriversGCC
elseif ExecuteSilent("clang -v") == 0 then
SetDriversDefault = SetDriversClang
end
end
end

-- set default drivers
if SetDriversDefault then
SetDriversDefault(settings)
end

-- find out flags from the
if os.getenv("CC") then
settings.cc.exe_c = os.getenv("CC")
end

if os.getenv("CXX") then
settings.cc.exe_cxx = os.getenv("CXX")
settings.link.exe = os.getenv("CXX")
end

if os.getenv("CFLAGS") then
settings.cc.flags_c:Add(os.getenv("CFLAGS"))
end

if os.getenv("CXXFLAGS") then
settings.cc.flags_cxx:Add(os.getenv("CXXFLAGS"))
end

if os.getenv("LDFLAGS") then
settings.link.flags:Add(os.getenv("LDFLAGS"))
end

end

--[[@GROUP Common Settings (settings) @END]]--
Expand Down

0 comments on commit 2e65531

Please sign in to comment.