-
-
Notifications
You must be signed in to change notification settings - Fork 640
Added ability for toolsets to specify tool output extensions #2509
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,25 +58,33 @@ | |
| function cpp.initialize() | ||
| rule 'cpp' | ||
| fileExtension { ".cc", ".cpp", ".cxx", ".mm" } | ||
| buildoutputs { "$(OBJDIR)/%{file.objname}.o" } | ||
| buildoutputs { "$(OBJDIR)/%{file.objname}%{premake.modules.gmake.cpp.gettooloutputext('cxx', cfg)}" } | ||
| buildmessage '$(notdir $<)' | ||
| buildcommands {'$(CXX) %{premake.modules.gmake.cpp.fileFlags(cfg, file)} $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"'} | ||
|
|
||
| rule 'cc' | ||
| fileExtension {".c", ".s", ".m"} | ||
| buildoutputs { "$(OBJDIR)/%{file.objname}.o" } | ||
| buildoutputs { "$(OBJDIR)/%{file.objname}%{premake.modules.gmake.cpp.gettooloutputext('cc', cfg)}" } | ||
| buildmessage '$(notdir $<)' | ||
| buildcommands {'$(CC) %{premake.modules.gmake.cpp.fileFlags(cfg, file)} $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"'} | ||
|
|
||
| rule 'resource' | ||
| fileExtension ".rc" | ||
| buildoutputs { "$(OBJDIR)/%{file.objname}.res" } | ||
| buildoutputs { "$(OBJDIR)/%{file.objname}%{premake.modules.gmake.cpp.gettooloutputext('rc', cfg)}" } | ||
| buildmessage '$(notdir $<)' | ||
| buildcommands {'$(RESCOMP) $< -O coff -o "$@" $(ALL_RESFLAGS)'} | ||
|
|
||
| global(nil) | ||
| end | ||
|
|
||
| function cpp.gettooloutputext(tool, cfg) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why gcc/clang don't provide it too? Or move that function as helper method (usable by other toolset (as ninja))
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I couldn't decide if I should or not, but I'm leaning towards I should now. This function needs to exist though with the fallback, otherwise all modules that introduce C and C++ toolsets won't use extensions on their files.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
| local toolset = gmake.getToolSet(cfg) | ||
| if toolset.gettooloutputext ~= nil then | ||
| return toolset.gettooloutputext(tool) | ||
| end | ||
|
|
||
| return iif(tool == "rc", ".res", ".o") | ||
| end | ||
|
|
||
| function cpp.createRuleTable(prj) | ||
| local rules = {} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -364,3 +364,7 @@ | |
| end | ||
| return value | ||
| end | ||
|
|
||
| function clang.gettooloutputext(tool) | ||
| return gcc.gettooloutputext(tool) | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that
.oalso be changed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"$(@:%.o=%.d)"hardcode.o, should it be"$(@:%%%{premake.modules.gmake.cpp.gettooloutputext('cxx', cfg)}=%.d)"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the line you've commented on here.