Skip to content

Commit

Permalink
MSC Fixed missing externalwarnings level for external include
Browse files Browse the repository at this point in the history
  • Loading branch information
GamesTrap committed Dec 4, 2023
1 parent ed8f59e commit 6f11146
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 51 deletions.
93 changes: 46 additions & 47 deletions _preload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,55 @@
-- Copyright: (c) 2015 Dmitry Ivanov, (c) 2023 Jan "GamesTrap" Schürkamp
--

local p = premake

newaction
{
-- Metadata for the command line and help system
trigger = "ninja",
shortname = "ninja",
description = "Ninja is a small build system with a focus on speed",

-- The capabilities of this action
valid_kinds = {"ConsoleApp", "WindowedApp", "SharedLib", "StaticLib", "None"}, -- Not supported: Makefile, Packaging, SharedItems, Utility
valid_languages = {"C", "C++"},
valid_tools = {cc = { "gcc", "clang", "msc" }},

toolset = iif(os.target() == "windows", "msc-v142", -- Visual Studio 2019
iif(os.target() == "macosx", "clang",
"gcc")),

-- Workspace and project generation logic
onWorkspace = function(wks)
p.eol("\r\n")
p.indent(" ")
p.generate(wks, "build.ninja", p.modules.ninja.generateWorkspace)
end,
onProject = function(prj)
p.eol("\r\n")
p.indent(" ")
p.modules.ninja.generateProject(prj)
end,
onBranch = function(prj)
p.eol("\r\n")
p.indent(" ")
p.modules.ninja.generateProject(prj)
end,
onCleanSolution = function(sln)
-- TODO
end,
onCleanProject = function(prj)
-- TODO
end,
onCleanTarget = function(prj)
-- TODO
end,
}
local p = premake

newaction
{
-- Metadata for the command line and help system
trigger = "ninja",
shortname = "ninja",
description = "Ninja is a small build system with a focus on speed",

-- The capabilities of this action
valid_kinds = {"ConsoleApp", "WindowedApp", "SharedLib", "StaticLib", "None"}, -- Not supported: Makefile, Packaging, SharedItems, Utility
valid_languages = {"C", "C++"},
valid_tools = {cc = { "gcc", "clang", "msc" }},

toolset = iif(os.target() == "windows", "msc-v143",
iif(os.target() == "macosx", "clang", "gcc")),

-- Workspace and project generation logic
onWorkspace = function(wks)
p.eol("\r\n")
p.indent(" ")
p.generate(wks, "build.ninja", p.modules.ninja.generateWorkspace)
end,
onProject = function(prj)
p.eol("\r\n")
p.indent(" ")
p.modules.ninja.generateProject(prj)
end,
onBranch = function(prj)
p.eol("\r\n")
p.indent(" ")
p.modules.ninja.generateProject(prj)
end,
onCleanSolution = function(sln)
-- TODO
end,
onCleanProject = function(prj)
-- TODO
end,
onCleanTarget = function(prj)
-- TODO
end,
}


--
-- Decide when the full module should be loaded.
--

return function(cfg)
return (_ACTION == "ninja")
end
return function(cfg)
return (_ACTION == "ninja")
end
12 changes: 8 additions & 4 deletions ninja.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ local function getcflags(toolset, cfg, filecfg)
local cppflags = ninja.list(toolset.getcppflags(filecfg))
local cflags = ninja.list(toolset.getcflags(filecfg)) --Note MSVC is missing the correct cdialect

local MSVCcdialect = ""
if toolset == p.tools.msc and ninja.MSVCCDialects[cfg.cdialect] ~= nil then
local MSVCcdialect
if toolset == p.tools.msc then
MSVCcdialect = " " .. ninja.MSVCCDialects[cfg.cdialect] .. " "
end

Expand All @@ -260,8 +260,8 @@ local function getcxxflags(toolset, cfg, filecfg)
local cppflags = ninja.list(toolset.getcppflags(filecfg))
local cxxflags = ninja.list(toolset.getcxxflags(filecfg)) --Note MSVC is missing the correct cppdialect

local MSVCcppdialect = ""
if toolset == p.tools.msc and ninja.MSVCCPPDialects[cfg.cppdialect] ~= nil then
local MSVCcppdialect
if toolset == p.tools.msc then
MSVCcppdialect = " " .. ninja.MSVCCPPDialects[cfg.cppdialect] .. " "
end

Expand Down Expand Up @@ -642,6 +642,10 @@ function ninja.generateProjectCfg(cfg)
-- Some toolset fixes
cfg.gccprefix = cfg.gccprefix or ""

if cfg.externalwarnings == nil then
cfg.externalwarnings = "Default"
end

p.outln("# project build file")
p.outln("# generated with premake ninja")
p.outln("")
Expand Down

0 comments on commit 6f11146

Please sign in to comment.