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

Add basic support for cuda via nvcc toolset #506

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions src/_manifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"tools/msc.lua",
"tools/snc.lua",
"tools/clang.lua",
"tools/nvcc.lua",

-- GNU make action
"actions/make/_make.lua",
Expand Down
1 change: 1 addition & 0 deletions src/_premake_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
"C++14",
"C90",
"C99",
"RelocatableDeviceCode",
},
aliases = {
FatalWarnings = { "FatalWarnings", "FatalCompileWarnings", "FatalLinkWarnings" },
Expand Down
15 changes: 13 additions & 2 deletions src/actions/make/make_cpp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@
function cpp.buildcommand(prj, objext, node)
local iscfile = node and path.iscfile(node.abspath) or false
local flags = iif(prj.language == "C" or iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')
_p('\t$(SILENT) %s $(FORCE_INCLUDE) -o "$@" -MF "$(@:%%.%s=%%.d)" -c "$<"', flags, objext)
if prj.toolset == "nvcc" then
_p('\t$(SILENT) %s $(FORCE_INCLUDE) -o "$(@:%%.%s=%%.d)" -M "$<"', flags, objext)
_p('\t$(SILENT) %s $(FORCE_INCLUDE) -o "$@" -c "$<"', flags, objext)
else
_p('\t$(SILENT) %s $(FORCE_INCLUDE) -o "$@" -MF "$(@:%%.%s=%%.d)" -c "$<"', flags, objext)
end
end


Expand Down Expand Up @@ -512,8 +517,14 @@
_p('$(GCH): $(PCH)')
_p('\t@echo $(notdir $<)')


local cmd = iif(prj.language == "C", "$(CC) -x c-header $(ALL_CFLAGS)", "$(CXX) -x c++-header $(ALL_CXXFLAGS)")
_p('\t$(SILENT) %s -o "$@" -MF "$(@:%%.gch=%%.d)" -c "$<"', cmd)
if prj.toolset == "nvcc" then
_p('\t$(SILENT) %s -o "$(@:%%.gch=%%.d)" -M "$<"', cmd)
_p('\t$(SILENT) %s -o "$@" -c "$<"', cmd)
else
_p('\t$(SILENT) %s -o "$@" -MF "$(@:%%.gch=%%.d)" -c "$<"', cmd)
end

_p('endif')
_p('')
Expand Down
2 changes: 1 addition & 1 deletion src/base/path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
end

function path.iscppfile(fname)
return path.hasextension(fname, { ".cc", ".cpp", ".cxx", ".c", ".s", ".m", ".mm" })
return path.hasextension(fname, { ".cc", ".cpp", ".cxx", ".c", ".s", ".m", ".mm", ".cu" })
end

function path.iscppheader(fname)
Expand Down
2 changes: 1 addition & 1 deletion src/tools/gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
["SSE4.1"] = "-msse4.1",
},
warnings = {
Extra = "-Wall -Wextra",
Extra = { "-Wall", "-Wextra" },
Off = "-w",
},
symbols = {
Expand Down
Loading