Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gmake/gmake2 action mixing up compilers #2240

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/gmake/tests/cpp/test_tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
function suite.usesCorrectTools()
make.cppTools(cfg, p.tools.gcc)
test.capture [[
ifeq ($(origin CC), default)
CC = gcc
endif
ifeq ($(origin CXX), default)
CXX = g++
endif
ifeq ($(origin AR), default)
AR = ar
endif
RESCOMP = windres
]]
end
27 changes: 26 additions & 1 deletion modules/gmake2/tests/test_gmake2_tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,34 @@
-- Make sure that the correct tools are used.
--

function suite.usesCorrectTools()
function suite.usesCorrectTools_gcc()
gmake2.cpp.tools(cfg, p.tools.gcc)
test.capture [[
ifeq ($(origin CC), default)
tritao marked this conversation as resolved.
Show resolved Hide resolved
CC = gcc
endif
ifeq ($(origin CXX), default)
CXX = g++
endif
ifeq ($(origin AR), default)
AR = ar
endif
RESCOMP = windres
]]
end

function suite.usesCorrectTools_clang()
gmake2.cpp.tools(cfg, p.tools.clang)
test.capture [[
ifeq ($(origin CC), default)
CC = clang
endif
ifeq ($(origin CXX), default)
CXX = clang++
endif
ifeq ($(origin AR), default)
AR = ar
endif
RESCOMP = windres
]]
end
5 changes: 1 addition & 4 deletions src/tools/gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,5 @@
else
version = ""
end
if ((cfg.gccprefix or version ~= "") and gcc.tools[tool]) or tool == "rc" then
return (cfg.gccprefix or "") .. gcc.tools[tool] .. version
end
return nil
return (cfg.gccprefix or "") .. gcc.tools[tool] .. version
end
15 changes: 12 additions & 3 deletions tests/tools/test_gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@

function suite.tools_onDefaults()
prepare()
test.isnil(gcc.gettoolname(cfg, "cc"))
test.isnil(gcc.gettoolname(cfg, "cxx"))
test.isnil(gcc.gettoolname(cfg, "ar"))
test.isequal("gcc", gcc.gettoolname(cfg, "cc"))
test.isequal("g++", gcc.gettoolname(cfg, "cxx"))
test.isequal("ar", gcc.gettoolname(cfg, "ar"))
test.isequal("windres", gcc.gettoolname(cfg, "rc"))
end

function suite.tools_withGcc()
toolset "gcc"
prepare()
test.isequal("gcc", gcc.gettoolname(cfg, "cc"))
test.isequal("g++", gcc.gettoolname(cfg, "cxx"))
test.isequal("ar", gcc.gettoolname(cfg, "ar"))
test.isequal("windres", gcc.gettoolname(cfg, "rc"))
end

Expand Down