Remove deprecated tool interfaces

This commit is contained in:
Jason Perkins 2012-11-27 10:28:17 -05:00
parent b4334e51cc
commit 547513a1d9
12 changed files with 7 additions and 645 deletions

View File

@ -48,7 +48,6 @@
"tools/dotnet.lua",
"tools/gcc.lua",
"tools/msc.lua",
"tools/ow.lua",
"tools/snc.lua",
-- GNU make action

View File

@ -17,7 +17,7 @@
function make.generate_csharp(prj)
-- I've only got one .NET toolset right now
local toolset = premake.dotnet
local toolset = premake.tools.dotnet
make.header(prj)

View File

@ -9,7 +9,7 @@
local cs2005 = premake.vstudio.cs2005
local project = premake5.project
local config = premake5.config
local dotnet = premake.dotnet
local dotnet = premake.tools.dotnet
--
@ -134,7 +134,7 @@
local cfg = project.getfirstconfig(prj)
local filecfg = config.getfileconfig(cfg, node.abspath)
local action = premake.dotnet.getbuildaction(filecfg)
local action = dotnet.getbuildaction(filecfg)
local fname = path.translate(node.relpath)
local elements, dependency = cs2005.getrelated(prj, filecfg, action)

View File

@ -16,7 +16,6 @@
description = "Choose a C/C++ compiler set",
allowed = {
{ "gcc", "GNU GCC (gcc/g++)" },
{ "ow", "OpenWatcom" },
}
}

View File

@ -5,10 +5,10 @@
--
premake.dotnet = { }
local dotnet = premake.dotnet
premake.tools.dotnet = {}
local dotnet = premake.tools.dotnet
premake.dotnet.namestyle = "windows"
dotnet.namestyle = "windows"
--

View File

@ -280,262 +280,3 @@
return sysflags[tool]
end
-----------------------------------------------------------------------------
-- Everything below this point is a candidate for deprecation
-----------------------------------------------------------------------------
premake.gcc = { }
--
-- Set default tools
--
premake.gcc.cc = "gcc"
premake.gcc.cxx = "g++"
premake.gcc.ar = "ar"
--
-- Translation of Premake flags into GCC flags
--
local cflags =
{
EnableSSE = "-msse",
EnableSSE2 = "-msse2",
ExtraWarnings = "-Wall",
FatalWarnings = "-Werror",
FloatFast = "-ffast-math",
FloatStrict = "-ffloat-store",
NoFramePointer = "-fomit-frame-pointer",
Optimize = "-O2",
OptimizeSize = "-Os",
OptimizeSpeed = "-O3",
Symbols = "-g",
}
local cxxflags =
{
NoExceptions = "-fno-exceptions",
NoRTTI = "-fno-rtti",
}
--
-- Map platforms to flags
--
premake.gcc.platforms =
{
Native = {
cppflags = "-MMD",
},
x32 = {
cppflags = "-MMD",
flags = "-m32",
ldflags = "-L/usr/lib32",
},
x64 = {
cppflags = "-MMD",
flags = "-m64",
ldflags = "-L/usr/lib64",
},
Universal = {
cppflags = "",
flags = "-arch i386 -arch x86_64 -arch ppc -arch ppc64",
},
Universal32 = {
cppflags = "",
flags = "-arch i386 -arch ppc",
},
Universal64 = {
cppflags = "",
flags = "-arch x86_64 -arch ppc64",
},
PS3 = {
cc = "ppu-lv2-g++",
cxx = "ppu-lv2-g++",
ar = "ppu-lv2-ar",
cppflags = "-MMD",
},
WiiDev = {
cppflags = "-MMD -MP -I$(LIBOGC_INC) $(MACHDEP)",
ldflags = "-L$(LIBOGC_LIB) $(MACHDEP)",
cfgsettings = [[
ifeq ($(strip $(DEVKITPPC)),)
$(error "DEVKITPPC environment variable is not set")'
endif
include $(DEVKITPPC)/wii_rules']],
},
}
local platforms = premake.gcc.platforms
--
-- Returns a list of compiler flags, based on the supplied configuration.
--
function premake.gcc.getcppflags(cfg)
local flags = { }
table.insert(flags, platforms[cfg.platform].cppflags)
-- We want the -MP flag for dependency generation (creates phony rules
-- for headers, prevents make errors if file is later deleted), but
-- Haiku doesn't support it (yet)
if flags[1]:startswith("-MMD") and cfg.system ~= "haiku" then
table.insert(flags, "-MP")
end
return flags
end
function premake.gcc.getcflags(cfg)
local result = table.translate(cfg.flags, cflags)
table.insert(result, platforms[cfg.platform].flags)
if cfg.system ~= "windows" and cfg.kind == "SharedLib" then
table.insert(result, "-fPIC")
end
return result
end
function premake.gcc.getcxxflags(cfg)
local result = table.translate(cfg.flags, cxxflags)
return result
end
--
-- Returns a list of linker flags, based on the supplied configuration.
--
function premake.gcc.getldflags(cfg)
local result = { }
-- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html
if not cfg.flags.Symbols then
if cfg.system == "macosx" then
table.insert(result, "-Wl,-x")
else
table.insert(result, "-s")
end
end
if cfg.kind == "SharedLib" then
if cfg.system == "macosx" then
table.insert(result, "-dynamiclib")
else
table.insert(result, "-shared")
end
if cfg.system == "windows" and not cfg.flags.NoImportLib then
table.insert(result, '-Wl,--out-implib="' .. cfg.linktarget.fullpath .. '"')
end
end
if cfg.kind == "WindowedApp" and cfg.system == "windows" then
table.insert(result, "-mwindows")
end
local platform = platforms[cfg.platform]
table.insert(result, platform.flags)
table.insert(result, platform.ldflags)
return result
end
--
-- Return a list of library search paths. Technically part of LDFLAGS but need to
-- be separated because of the way Visual Studio calls GCC for the PS3. See bug
-- #1729227 for background on why library paths must be split.
--
function premake.gcc.getlibdirflags(cfg)
local result = { }
for _, value in ipairs(premake.getlinks(cfg, "all", "directory")) do
table.insert(result, '-L' .. make.esc(value))
end
return result
end
--
-- Returns a list of linker flags for library search directories and library
-- names. See bug #1729227 for background on why the path must be split.
--
function premake.gcc.getlinkflags(cfg)
local result = { }
for _, value in ipairs(premake.getlinks(cfg, "siblings", "object")) do
if (value.kind == "StaticLib") then
-- don't use "-lname" when linking static libraries
-- instead use path/Name.ext so as not to link with a SharedLib of the same name
-- if one is present.
local pathstyle = premake.getpathstyle(value)
local namestyle = premake.getnamestyle(value)
local linktarget = premake.gettarget(value, "link", pathstyle, namestyle, cfg.system)
local rebasedpath = path.rebase(linktarget.fullpath, value.location, cfg.location)
table.insert(result, rebasedpath)
else
--premake does not support creating frameworks so this is just a SharedLib link
--link using -lname
table.insert(result, '-l' .. premake.make.esc(value.linktarget.basename))
end
end
-- "-llib" is fine for system dependencies
for _, value in ipairs(premake.getlinks(cfg, "system", "basename")) do
if path.getextension(value) == ".framework" then
table.insert(result, '-framework ' .. premake.make.esc(path.getbasename(value)))
else
table.insert(result, '-l' .. premake.make.esc(value))
end
end
return result
end
--
-- Decorate defines for the GCC command line.
--
function premake.gcc.getdefines(defines)
local result = { }
for _,def in ipairs(defines) do
table.insert(result, '-D' .. def)
end
return result
end
--
-- Decorate include file search paths for the GCC command line.
--
function premake.gcc.getincludedirs(includedirs)
local result = { }
for _,dir in ipairs(includedirs) do
table.insert(result, "-I" .. premake.make.esc(dir))
end
return result
end
--
-- Return platform specific project and configuration level
-- makesettings blocks.
--
function premake.gcc.getcfgsettings(cfg)
return platforms[cfg.platform].cfgsettings
end

View File

@ -165,14 +165,3 @@
function msc.gettoolname(cfg, tool)
return nil
end
-----------------------------------------------------------------------------
-- Everything below this point is a candidate for deprecation
-----------------------------------------------------------------------------
premake.msc = { }
premake.msc.namestyle = "windows"

View File

@ -1,162 +0,0 @@
--
-- ow.lua
-- Provides Open Watcom-specific configuration strings.
-- Copyright (c) 2008 Jason Perkins and the Premake project
--
premake.ow = { }
local ow = premake.ow
premake.ow.namestyle = "windows"
--
-- Set default tools
--
ow.cc = "WCL386"
ow.cxx = "WCL386"
ow.ar = "ar"
--
-- Translation of Premake flags into OpenWatcom flags
--
local cflags =
{
ExtraWarnings = "-wx",
FatalWarning = "-we",
FloatFast = "-omn",
FloatStrict = "-op",
Optimize = "-ox",
OptimizeSize = "-os",
OptimizeSpeed = "-ot",
Symbols = "-d2",
}
local cxxflags =
{
NoExceptions = "-xd",
NoRTTI = "-xr",
}
--
-- No specific platform support yet
--
ow.platforms =
{
Native = {
flags = ""
},
}
--
-- Returns a list of compiler flags, based on the supplied configuration.
--
function ow.getcppflags(cfg)
return {}
end
function ow.getcflags(cfg)
local result = table.translate(cfg.flags, cflags)
if (cfg.flags.Symbols) then
table.insert(result, "-hw") -- Watcom debug format for Watcom debugger
end
return result
end
function ow.getcxxflags(cfg)
local result = table.translate(cfg.flags, cxxflags)
return result
end
--
-- Returns a list of linker flags, based on the supplied configuration.
--
function ow.getldflags(cfg)
local result = { }
if (cfg.flags.Symbols) then
table.insert(result, "op symf")
end
return result
end
--
-- Returns a list of linker flags for library search directories and
-- library names.
--
function ow.getlinkflags(cfg)
local result = { }
return result
end
--
-- Decorate defines for the command line.
--
function ow.getdefines(defines)
local result = { }
for _,def in ipairs(defines) do
table.insert(result, '-D' .. def)
end
return result
end
--
-- Decorate include file search paths for the command line.
--
function ow.getincludedirs(includedirs)
local result = { }
for _,dir in ipairs(includedirs) do
table.insert(result, '-I "' .. dir .. '"')
end
return result
end
--
-- Returns makefile-specific configuration rules.
--
function ow.getmakesettings(cfg)
return nil
end
--
-- Retrieves the executable command name for a tool, based on the
-- provided configuration and the operating environment.
--
-- @param cfg
-- The configuration to query.
-- @param tool
-- The tool to fetch, one of "cc" for the C compiler, "cxx" for
-- the C++ compiler, or "ar" for the static linker.
-- @return
-- The executable command name for a tool, or nil if the system's
-- default value should be used.
--
function ow.gettoolname(cfg, tool)
return ow[tool]
end

View File

@ -109,167 +109,3 @@
return sysflags[tool]
end
-----------------------------------------------------------------------------
-- Everything below this point is a candidate for deprecation
-----------------------------------------------------------------------------
premake.snc = { }
-- TODO: Will cfg.system == "windows" ever be true for SNC? If
-- not, remove the conditional blocks that use this test.
--
-- Set default tools
--
premake.snc.cc = "snc"
premake.snc.cxx = "g++"
premake.snc.ar = "ar"
--
-- Translation of Premake flags into SNC flags
--
local cflags =
{
ExtraWarnings = "-Xdiag=2",
FatalWarnings = "-Xquit=2",
}
local cxxflags =
{
NoExceptions = "", -- No exceptions is the default in the SNC compiler.
NoRTTI = "-Xc-=rtti",
}
--
-- Map platforms to flags
--
premake.snc.platforms =
{
PS3 = {
cc = "ppu-lv2-g++",
cxx = "ppu-lv2-g++",
ar = "ppu-lv2-ar",
cppflags = "-MMD -MP",
}
}
local platforms = premake.snc.platforms
--
-- Returns a list of compiler flags, based on the supplied configuration.
--
function premake.snc.getcppflags(cfg)
local result = { }
table.insert(result, platforms[cfg.platform].cppflags)
return result
end
function premake.snc.getcflags(cfg)
local result = table.translate(cfg.flags, cflags)
table.insert(result, platforms["PS3"].flags)
if cfg.kind == "SharedLib" then
table.insert(result, "-fPIC")
end
return result
end
function premake.snc.getcxxflags(cfg)
local result = table.translate(cfg.flags, cxxflags)
return result
end
--
-- Returns a list of linker flags, based on the supplied configuration.
--
function premake.snc.getldflags(cfg)
local result = { }
if not cfg.flags.Symbols then
table.insert(result, "-s")
end
if cfg.kind == "SharedLib" then
table.insert(result, "-shared")
if not cfg.flags.NoImportLib then
table.insert(result, '-Wl,--out-implib="' .. cfg.linktarget.fullpath .. '"')
end
end
local platform = platforms["PS3"]
table.insert(result, platform.flags)
table.insert(result, platform.ldflags)
return result
end
--
-- Return a list of library search paths. Technically part of LDFLAGS but need to
-- be separated because of the way Visual Studio calls SNC for the PS3. See bug
-- #1729227 for background on why library paths must be split.
--
function premake.snc.getlibdirflags(cfg)
local result = { }
for _, value in ipairs(premake.getlinks(cfg, "all", "directory")) do
table.insert(result, '-L' .. premake.make.esc(value))
end
return result
end
--
-- Returns a list of linker flags for library search directories and library
-- names. See bug #1729227 for background on why the path must be split.
--
function premake.snc.getlinkflags(cfg)
local result = { }
for _, value in ipairs(premake.getlinks(cfg, "all", "basename")) do
table.insert(result, '-l' .. premake.make.esc(value))
end
return result
end
--
-- Decorate defines for the SNC command line.
--
function premake.snc.getdefines(defines)
local result = { }
for _,def in ipairs(defines) do
table.insert(result, '-D' .. def)
end
return result
end
--
-- Decorate include file search paths for the SNC command line.
--
function premake.snc.getincludedirs(includedirs)
local result = { }
for _,dir in ipairs(includedirs) do
table.insert(result, "-I" .. premake.make.esc(dir))
end
return result
end

View File

@ -84,7 +84,6 @@
dofile("tools/test_dotnet.lua")
dofile("tools/test_gcc.lua")
dofile("tools/test_msc.lua")
dofile("tools/test_ow.lua")
dofile("tools/test_snc.lua")
-- Visual Studio 2005-2010 C# projects

View File

@ -6,8 +6,7 @@
T.tools_dotnet = {}
local suite = T.tools_dotnet
local dotnet = premake.dotnet
local dotnet = premake.tools.dotnet
--

View File

@ -1,38 +0,0 @@
--
-- tests/test_ow.lua
-- Automated test suite for the OpenWatcom toolset interface.
-- Copyright (c) 2012 Jason Perkins and the Premake project
--
T.tools_ow = { }
local suite = T.tools_ow
local ow = premake.ow
--
-- Setup/teardown
--
local sln, prj, cfg
function suite.setup()
sln = test.createsolution()
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
cfg = premake5.project.getconfig(prj, "Debug")
end
--
-- Check the selection of tools based on the target system.
--
function suite.tools_onDefaults()
prepare()
test.isequal("WCL386", ow.gettoolname(cfg, "cc"))
test.isequal("WCL386", ow.gettoolname(cfg, "cxx"))
test.isequal("ar", ow.gettoolname(cfg, "ar"))
end