Added PS3-specific target naming

This commit is contained in:
starkos 2009-05-08 20:18:47 +00:00
parent c4e20902fa
commit f2b52173c7
23 changed files with 535 additions and 298 deletions

View File

@ -19,8 +19,9 @@
"base/configs.lua",
"base/api.lua",
"base/cmdline.lua",
"tools/csc.lua",
"tools/dotnet.lua",
"tools/gcc.lua",
"tools/msc.lua",
"tools/ow.lua",
"base/validate.lua",
"base/help.lua",

View File

@ -8,7 +8,6 @@
trigger = "codelite",
shortname = "CodeLite",
description = "CodeLite (experimental)",
targetstyle = "linux",
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },

View File

@ -75,7 +75,6 @@
trigger = "gmake",
shortname = "GNU Make",
description = "GNU makefiles for POSIX, MinGW, and Cygwin",
targetstyle = "linux",
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
@ -83,7 +82,7 @@
valid_tools = {
cc = { "gcc" },
dotnet = { "mono", "ms", "pnet" },
dotnet = { "mono", "msnet", "pnet" },
},
solutiontemplates = {

View File

@ -28,7 +28,7 @@
--
function premake.make_csharp(prj)
local csc = premake.csc
local csc = premake.dotnet
-- Do some processing up front: build a list of configuration-dependent libraries.
-- Libraries that are built to a location other than $(TARGETDIR) will need to

View File

@ -319,6 +319,11 @@
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },
dotnet = { "msnet" },
},
solutiontemplates = {
{ ".sln", premake.vs2002_solution },
@ -342,6 +347,11 @@
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },
dotnet = { "msnet" },
},
solutiontemplates = {
{ ".sln", premake.vs2003_solution },
@ -365,6 +375,11 @@
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },
dotnet = { "msnet" },
},
solutiontemplates = {
{ ".sln", premake.vs2005_solution },
@ -388,6 +403,11 @@
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },
dotnet = { "msnet" },
},
solutiontemplates = {
{ ".sln", premake.vs2005_solution },

View File

@ -54,7 +54,7 @@
if _ACTION == "vs2002" then
_p('\t\t\t\tNoStandardLibraries = "false"')
end
_p('\t\t\t\tOutputType = "%s"', premake.csc.getkind(prj))
_p('\t\t\t\tOutputType = "%s"', premake.dotnet.getkind(prj))
if _ACTION == "vs2003" then
_p('\t\t\t\tPreBuildEvent = ""')
_p('\t\t\t\tPostBuildEvent = ""')
@ -119,7 +119,7 @@
_p('\t\t<Files>')
_p('\t\t\t<Include>')
for fcfg in premake.eachfile(prj) do
local action = premake.csc.getbuildaction(fcfg)
local action = premake.dotnet.getbuildaction(fcfg)
local fname = path.translate(premake.esc(fcfg.name), "\\")
local elements, dependency = getelements(prj, action, fcfg.name)

View File

@ -85,7 +85,7 @@
_p(' <ProductVersion>%s</ProductVersion>', vsversion)
_p(' <SchemaVersion>2.0</SchemaVersion>')
_p(' <ProjectGuid>{%s}</ProjectGuid>', prj.uuid)
_p(' <OutputType>%s</OutputType>', premake.csc.getkind(prj))
_p(' <OutputType>%s</OutputType>', premake.dotnet.getkind(prj))
_p(' <AppDesignerFolder>Properties</AppDesignerFolder>')
_p(' <RootNamespace>%s</RootNamespace>', prj.buildtarget.basename)
_p(' <AssemblyName>%s</AssemblyName>', prj.buildtarget.basename)
@ -127,7 +127,7 @@
_p(' <ItemGroup>')
for fcfg in premake.eachfile(prj) do
local action = premake.csc.getbuildaction(fcfg)
local action = premake.dotnet.getbuildaction(fcfg)
local fname = path.translate(premake.esc(fcfg.name), "\\")
local elements, dependency = getelements(prj, action, fcfg.name)
if elements == "None" then

View File

@ -182,7 +182,7 @@
--
-- Compiler block for the PS3 platform, which uses GCC.
-- Compiler and linker blocks for the PS3 platform, which uses GCC.
--
function premake.vs200x_vcproj_VCCLCompilerTool_GCC(cfg)
@ -208,6 +208,80 @@
_p('\t\t\t/>')
end
function premake.vs200x_vcproj_VCLinkerTool_GCC(cfg)
_p('\t\t\t<Tool')
if cfg.kind ~= "StaticLib" then
_p('\t\t\t\tName="%s"', iif(cfg.platform ~= "Xbox360", "VCLinkerTool", "VCX360LinkerTool"))
if cfg.flags.NoImportLib then
_p('\t\t\t\tIgnoreImportLibrary="%s"', _VS.bool(true))
end
if #cfg.linkoptions > 0 then
_p('\t\t\t\tAdditionalOptions="%s"', table.concat(premake.esc(cfg.linkoptions), " "))
end
if #cfg.links > 0 then
_p('\t\t\t\tAdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " "))
end
_p('\t\t\t\tOutputFile="$(OutDir)\\%s"', cfg.buildtarget.name)
_p('\t\t\t\tLinkIncremental="%s"', iif(_VS.optimization(cfg) == 0, 2, 1))
_p('\t\t\t\tAdditionalLibraryDirectories="%s"', table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"))
local deffile = premake.findfile(cfg, ".def")
if deffile then
_p('\t\t\t\tModuleDefinitionFile="%s"', deffile)
end
if cfg.flags.NoManifest then
_p('\t\t\t\tGenerateManifest="%s"', _VS.bool(false))
end
_p('\t\t\t\tGenerateDebugInformation="%s"', _VS.bool(_VS.symbols(cfg) ~= 0))
if _VS.symbols(cfg) ~= 0 then
_p('\t\t\t\tProgramDatabaseFile="$(OutDir)\\$(ProjectName).pdb"')
end
_p('\t\t\t\tSubSystem="%s"', iif(cfg.kind == "ConsoleApp", 1, 2))
if _VS.optimization(cfg) ~= 0 then
_p('\t\t\t\tOptimizeReferences="2"')
_p('\t\t\t\tEnableCOMDATFolding="2"')
end
if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then
_p('\t\t\t\tEntryPointSymbol="mainCRTStartup"')
end
if cfg.kind == "SharedLib" then
local implibname = path.translate(premake.gettarget(cfg, "link", "windows").fullpath, "\\")
_p('\t\t\t\tImportLibrary="%s"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname))
end
_p('\t\t\t\tTargetMachine="1"')
else
_p('\t\t\t\tName="VCLibrarianTool"')
local buildoptions = table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)
if #buildoptions > 0 then
_p('\t\t\t\tAdditionalOptions="%s"', premake.esc(table.concat(buildoptions, " ")))
end
if #cfg.links > 0 then
_p('\t\t\t\tAdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " "))
end
_p('\t\t\t\tOutputFile="$(OutDir)\\%s"', cfg.buildtarget.name)
_p('\t\t\t\tAdditionalLibraryDirectories="%s"', premake.esc(path.translate(table.concat(cfg.libdirs, ";"))))
end
_p('\t\t\t/>')
end
--
-- Resource compiler block.
@ -331,7 +405,7 @@
"VCManagedResourceCompilerTool",
"VCResourceCompilerTool",
"VCPreLinkEventTool",
"VCLinkerTool",
"VCLinkerTool_GCC",
"VCALinkTool",
"VCManifestTool",
"VCXDCMakeTool",

View File

@ -85,7 +85,7 @@
value = "value",
description = "Choose a .NET compiler set",
allowed = {
{ "ms", "Microsoft .NET (csc)" },
{ "msnet", "Microsoft .NET (csc)" },
{ "mono", "Novell Mono (mcs)" },
{ "pnet", "Portable.NET (cscc)" },
}

View File

@ -268,13 +268,6 @@
-- set the project location, if not already set
cfg.location = cfg.location or cfg.basedir
-- deduce and store the applicable tool for this configuration
if cfg.language == "C" or cfg.language == "C++" then
if _OPTIONS.cc then cfg.tool = premake[_OPTIONS.cc] end
elseif cfg.language == "C#" then
if _OPTIONS.dotnet then cfg.tool = premake[_OPTIONS.dotnet] end
end
-- figure out the target system
local platform = premake.platforms[cfg.platform]
@ -394,28 +387,23 @@
-- Pre-computes the build and link targets for a configuration.
--
local function buildtargets(cfg)
function premake.configs_buildtargets()
for _, sln in ipairs(_SOLUTIONS) do
for _, prj in ipairs(sln.projects) do
for _, cfg in pairs(prj.__configs) do
local targetstyle = premake.gettool(cfg).targetstyle
-- deduce the target and path style from the current action/tool pairing
local action = premake.actions[_ACTION]
local targetstyle = action.targetstyle or "linux"
if (cfg.tool) then
targetstyle = cfg.tool.targetstyle or targetstyle
end
-- precompute the target names and paths
cfg.buildtarget = premake.gettarget(cfg, "build", targetstyle)
cfg.linktarget = premake.gettarget(cfg, "link", targetstyle)
-- translate the paths as appropriate
local pathstyle = action.pathstyle or targetstyle
if (pathstyle == "windows") then
cfg.buildtarget.directory = path.translate(cfg.buildtarget.directory, "\\")
cfg.buildtarget.fullpath = path.translate(cfg.buildtarget.fullpath, "\\")
cfg.linktarget.directory = path.translate(cfg.linktarget.directory, "\\")
cfg.linktarget.fullpath = path.translate(cfg.linktarget.fullpath, "\\")
cfg.objectsdir = path.translate(cfg.objectsdir, "\\")
end
cfg.buildtarget = premake.gettarget(cfg, "build", targetstyle)
cfg.linktarget = premake.gettarget(cfg, "link", targetstyle)
if (targetstyle == "windows") then
cfg.objectsdir = path.translate(cfg.objectsdir, "\\")
end
end
end
end
end
@ -455,12 +443,6 @@
builduniquedirs()
-- walk it again and build the targets and unique directories
for _, sln in ipairs(_SOLUTIONS) do
for _, prj in ipairs(sln.projects) do
for _, cfg in pairs(prj.__configs) do
buildtargets(cfg)
end
end
end
premake.configs_buildtargets(cfg)
end

View File

@ -59,11 +59,13 @@
cfgsuffix = "ps3",
iscrosscompiler = true,
nosharedlibs = true,
targetstyle = "ps3",
},
Xbox360 =
{
cfgsuffix = "xbox360",
iscrosscompiler = true,
targetstyle = "windows",
},
}

View File

@ -247,7 +247,7 @@
else
sep = "/"
end
end
end
local result = p:gsub("[/\\]", sep)
return result
end

View File

@ -338,30 +338,44 @@
--
-- Assembles a target file name for a configuration. Direction is one of
-- "build" (the build target name) or "link" (the name to use when trying
-- to link against this target). Style is one of "windows" or "linux".
-- Assembles a target for a particular tool/system/configuration.
--
-- @param cfg
-- The configuration to be targeted.
-- @param direction
-- One of 'build' for the build target, or 'link' for the linking target.
-- @param tool
-- The target toolset interface.
-- @param system
-- The target operating system; if nil will use current OS settings.
-- @returns
-- An object with these fields:
-- basename - the target with no directory or file extension
-- name - the target name and extension, with no directory
-- directory - relative path to the target, with no file name
-- fullpath - directory, name, and extension
--
function premake.gettarget(cfg, direction, style, os)
-- normalize the arguments
if not os then os = _G["os"].get() end
if (os == "bsd") then os = "linux" end
function premake.gettarget(cfg, direction, style, system)
if not system then system = os.get() end
if system == "bsd" then system = "linux" end
local kind = cfg.kind
if (cfg.language == "C" or cfg.language == "C++") then
local decorations = premake.platforms[cfg.platform].targetstyle or style
if premake.iscppproject(cfg) then
-- On Windows, shared libraries link against a static import library
if (style == "windows" or os == "windows") and kind == "SharedLib" and direction == "link" then
if (style == "windows" or system == "windows") and kind == "SharedLib" and direction == "link" then
kind = "StaticLib"
end
-- Linux name conventions only apply to static libs on windows (by user request)
if (style == "linux" and os == "windows" and kind ~= "StaticLib") then
style = "windows"
if style == "linux" and system == "windows" and kind ~= "StaticLib" then
decorations = "windows"
end
elseif (cfg.language == "C#") then
else
-- .NET always uses Windows naming conventions
style = "windows"
decorations = "windows"
end
-- Initialize the target components
@ -370,13 +384,8 @@
local dir = cfg[field.."dir"] or cfg.targetdir or path.getrelative(cfg.location, cfg.basedir)
local prefix = ""
local suffix = ""
-- If using an import library and "NoImportLib" flag is set, library will be in objdir
if cfg.kind == "SharedLib" and kind == "StaticLib" and cfg.flags.NoImportLib then
dir = cfg.objectsdir
end
if style == "windows" then
if decorations == "windows" then
if kind == "ConsoleApp" or kind == "WindowedApp" then
suffix = ".exe"
elseif kind == "SharedLib" then
@ -384,8 +393,8 @@
elseif kind == "StaticLib" then
suffix = ".lib"
end
elseif style == "linux" then
if (kind == "WindowedApp" and os == "macosx") then
elseif decorations == "linux" then
if kind == "WindowedApp" and system == "macosx" then
dir = path.join(dir, name .. ".app/Contents/MacOS")
elseif kind == "SharedLib" then
prefix = "lib"
@ -394,8 +403,15 @@
prefix = "lib"
suffix = ".a"
end
elseif decorations == "ps3" then
if kind == "ConsoleApp" or kind == "WindowedApp" then
suffix = ".elf"
elseif kind == "StaticLib" then
prefix = "lib"
suffix = ".a"
end
end
prefix = cfg[field.."prefix"] or cfg.targetprefix or prefix
suffix = cfg[field.."extension"] or cfg.targetextension or suffix
@ -404,11 +420,32 @@
result.name = prefix .. name .. suffix
result.directory = dir
result.fullpath = path.join(result.directory, result.name)
if style == "windows" then
result.directory = path.translate(result.directory, "\\")
result.fullpath = path.translate(result.fullpath, "\\")
end
return result
end
--
-- Return the appropriate tool interface, based on the target language and
-- any relevant command-line options.
--
function premake.gettool(cfg)
if premake.iscppproject(cfg) then
if not _OPTIONS.cc then _OPTIONS.cc = premake.actions[_ACTION].valid_tools.cc[1] end
return premake[_OPTIONS.cc]
else
return premake.dotnet
end
end
--
-- Returns true if the solution contains at least one C/C++ project.
--
@ -456,7 +493,7 @@
end
--
-- Walk the list of source code files, breaking them into "groups" based
-- on the directory hierarchy.

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,12 @@
--
-- csc.lua
-- dotnet.lua
-- Interface for the C# compilers, all of which are flag compatible.
-- Copyright (c) 2002-2008 Jason Perkins and the Premake project
--
premake.csc = { }
premake.dotnet = { }
premake.dotnet.targetstyle = "windows"
--
@ -27,7 +28,7 @@
-- Return the default build action for a given file, based on the file extension.
--
function premake.csc.getbuildaction(fcfg)
function premake.dotnet.getbuildaction(fcfg)
local ext = path.getextension(fcfg.name):lower()
if fcfg.buildaction == "Compile" or ext == ".cs" then
return "Compile"
@ -46,8 +47,8 @@
-- Returns the compiler filename (they all use the same arguments)
--
function premake.csc.getcompilervar(cfg)
if (_OPTIONS.dotnet == "ms") then
function premake.dotnet.getcompilervar(cfg)
if (_OPTIONS.dotnet == "msnet") then
return "csc"
elseif (_OPTIONS.dotnet == "mono") then
return "gmcs"
@ -62,7 +63,7 @@
-- Returns a list of compiler flags, based on the supplied configuration.
--
function premake.csc.getflags(cfg)
function premake.dotnet.getflags(cfg)
local result = table.translate(cfg.flags, flags)
return result
end
@ -73,7 +74,7 @@
-- Translates the Premake kind into the CSC kind string.
--
function premake.csc.getkind(cfg)
function premake.dotnet.getkind(cfg)
if (cfg.kind == "ConsoleApp") then
return "Exe"
elseif (cfg.kind == "WindowedApp") then

View File

@ -6,7 +6,7 @@
premake.gcc = { }
premake.targetstyle = "linux"
premake.gcc.targetstyle = "linux"
--

View File

@ -6,8 +6,10 @@
T.configs = { }
local prj
local prj, cfg
function T.configs.setup()
_ACTION = "gmake"
solution "MySolution"
configurations { "Debug", "Release" }
platforms { "x32", "ps3" }
@ -20,6 +22,7 @@
prj = project "MyProject"
language "C"
kind "SharedLib"
targetdir "../bin"
defines "PROJECT"
configuration "Debug"
@ -38,26 +41,24 @@
defines "X86_64"
premake.buildconfigs()
prj = premake.getconfig(prj)
cfg = premake.getconfig(prj, "Debug")
end
function T.configs.SolutionFields()
local cfg = premake.getconfig(prj)
test.isequal("Debug:Release", table.concat(cfg.configurations,":"))
end
function T.configs.ProjectFields()
local cfg = premake.getconfig(prj)
test.isequal("C", cfg.language)
end
function T.configs.ProjectWideSettings()
local cfg = premake.getconfig(prj)
test.isequal("SOLUTION:PROJECT:NATIVE", table.concat(cfg.defines,":"))
test.isequal("SOLUTION:PROJECT:NATIVE", table.concat(prj.defines,":"))
end
function T.configs.BuildCfgSettings()
local cfg = premake.getconfig(prj, "Debug")
test.isequal("SOLUTION:SOLUTION_DEBUG:PROJECT:DEBUG:NATIVE", table.concat(cfg.defines,":"))
end
@ -77,7 +78,6 @@
end
function T.configs.SetsPlatformNativeName()
local cfg = premake.getconfig(prj, "Debug")
test.isequal("Native", cfg.platform)
end
@ -87,7 +87,6 @@
end
function T.configs.SetsNativeShortName()
local cfg = premake.getconfig(prj, "Debug")
test.isequal("debug", cfg.shortname)
end
@ -97,21 +96,21 @@
end
function T.configs.SetsNativeLongName()
local cfg = premake.getconfig(prj, "Debug")
test.isequal("Debug", cfg.longname)
end
function T.configs.SetsProject()
local cfg = premake.getconfig(prj, "Debug", "x32")
test.istrue(prj == cfg.project)
test.istrue(prj.project == cfg.project)
end
--
-- Target system testing
--
function T.configs.SetsTargetSystem_OnNative()
local cfg = premake.getconfig(prj, "Debug")
test.isequal(os.get(), cfg.system)
end
@ -119,13 +118,14 @@
local cfg = premake.getconfig(prj, "Debug", "PS3")
test.isequal("PS3", cfg.system)
end
--
-- Platform kind translation
--
function T.configs.SetsTargetKind_OnSupportedKind()
local cfg = premake.getconfig(prj, "Debug")
test.isequal("SharedLib", cfg.kind)
end

View File

@ -12,16 +12,16 @@
local sln, prj
function T.gmake_cpp.setup()
_ACTION = "gmake"
_OPTIONS.os = "linux"
sln = solution "MySolution"
configurations { "Debug", "Release" }
platforms { "native" }
prj = project "MyProject"
language "C++"
kind "ConsoleApp"
_ACTION = "gmake"
_OPTIONS.os = "linux"
kind "ConsoleApp"
end
local function prepare()
@ -108,7 +108,7 @@ ifeq ($(config),debugps3)
CXX = ppu-lv2-g++
AR = ppu-lv2-ar
TARGETDIR = .
TARGET = $(TARGETDIR)/MyProject
TARGET = $(TARGETDIR)/MyProject.elf
OBJDIR = obj/PS3/Debug
DEFINES +=
INCLUDES +=

View File

@ -11,278 +11,382 @@
cfg = { }
cfg.basedir = "."
cfg.location = "."
cfg.targetdir = "../bin"
cfg.language = "C++"
cfg.project = { name = "MyProject" }
cfg.flags = { }
cfg.objectsdir = "obj"
cfg.platform = "Native"
end
--
-- C++ ConsoleApp naming conventions
-- Windows/C++/ConsoleApp tests
--
function T.targets.On_Console_Build_Windows_Windows()
function T.targets.ConsoleApp_Windows_Build_Windows()
cfg.kind = "ConsoleApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "windows", "windows").fullpath)
result = premake.gettarget(cfg, "build", "windows", "windows")
test.isequal([[..\bin\MyProject.exe]], result.fullpath)
end
function T.targets.On_Console_Build_Windows_Linux()
function T.targets.ConsoleApp_Windows_Build_Linux()
cfg.kind = "ConsoleApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "windows", "linux").fullpath)
result = premake.gettarget(cfg, "build", "windows", "linux")
test.isequal([[..\bin\MyProject.exe]], result.fullpath)
end
function T.targets.On_Console_Build_Windows_MacOSX()
function T.targets.ConsoleApp_Windows_Build_MacOSX()
cfg.kind = "ConsoleApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "windows", "macosx").fullpath)
result = premake.gettarget(cfg, "build", "windows", "macosx")
test.isequal([[..\bin\MyProject.exe]], result.fullpath)
end
function T.targets.On_Console_Build_Linux_Windows()
function T.targets.ConsoleApp_Windows_Build_PS3()
cfg.kind = "ConsoleApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "linux", "windows").fullpath)
cfg.platform = "PS3"
result = premake.gettarget(cfg, "build", "windows", "windows")
test.isequal([[..\bin\MyProject.elf]], result.fullpath)
end
function T.targets.On_Console_Build_Linux_Linux()
function T.targets.ConsoleApp_Windows_Build_Xbox360()
cfg.kind = "ConsoleApp"
test.isequal("MyProject", premake.gettarget(cfg, "build", "linux", "linux").fullpath)
cfg.platform = "Xbox360"
result = premake.gettarget(cfg, "build", "windows", "windows")
test.isequal([[..\bin\MyProject.exe]], result.fullpath)
end
function T.targets.On_Console_Build_Linux_MacOSX()
cfg.kind = "ConsoleApp"
test.isequal("MyProject", premake.gettarget(cfg, "build", "linux", "macosx").fullpath)
end
--
-- C++ WindowedApp naming conventions
-- Windows/C++/WindowedApp tests
--
function T.targets.On_Windowed_Build_Windows_Windows()
function T.targets.WindowedApp_Windows_Build_Windows()
cfg.kind = "WindowedApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "windows", "windows").fullpath)
result = premake.gettarget(cfg, "build", "windows", "windows")
test.isequal([[..\bin\MyProject.exe]], result.fullpath)
end
function T.targets.On_Windowed_Build_Windows_Linux()
function T.targets.WindowedApp_Windows_Build_Linux()
cfg.kind = "WindowedApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "windows", "windows").fullpath)
result = premake.gettarget(cfg, "build", "windows", "linux")
test.isequal([[..\bin\MyProject.exe]], result.fullpath)
end
function T.targets.On_Windowed_Build_Windows_MacOSX()
function T.targets.WindowedApp_Windows_Build_MacOSX()
cfg.kind = "WindowedApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "windows", "macosx").fullpath)
result = premake.gettarget(cfg, "build", "windows", "macosx")
test.isequal([[..\bin\MyProject.exe]], result.fullpath)
end
function T.targets.On_Windowed_Build_Linux_Windows()
function T.targets.WindowedApp_Windows_Build_PS3()
cfg.kind = "WindowedApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "linux", "windows").fullpath)
cfg.platform = "PS3"
result = premake.gettarget(cfg, "build", "windows", "windows")
test.isequal([[..\bin\MyProject.elf]], result.fullpath)
end
function T.targets.On_Windowed_Build_Linux_Linux()
function T.targets.WindowedApp_Windows_Build_Xbox360()
cfg.kind = "WindowedApp"
test.isequal("MyProject", premake.gettarget(cfg, "build", "linux", "linux").fullpath)
cfg.platform = "Xbox360"
result = premake.gettarget(cfg, "build", "windows", "windows")
test.isequal([[..\bin\MyProject.exe]], result.fullpath)
end
function T.targets.On_Windowed_Build_Linux_MacOSX()
cfg.kind = "WindowedApp"
test.isequal("MyProject.app/Contents/MacOS/MyProject", premake.gettarget(cfg, "build", "linux", "macosx").fullpath)
end
--
-- C++ SharedLib naming conventions
-- Windows/C++/SharedLib tests
--
function T.targets.On_Shared_Build_Windows_Windows()
function T.targets.SharedLib_Windows_Build_Windows()
cfg.kind = "SharedLib"
test.isequal("MyProject.dll", premake.gettarget(cfg, "build", "windows", "windows").fullpath)
result = premake.gettarget(cfg, "build", "windows", "windows")
test.isequal([[..\bin\MyProject.dll]], result.fullpath)
end
function T.targets.On_Shared_Build_Windows_Linux()
function T.targets.SharedLib_Windows_Build_Linux()
cfg.kind = "SharedLib"
test.isequal("MyProject.dll", premake.gettarget(cfg, "build", "windows", "windows").fullpath)
result = premake.gettarget(cfg, "build", "windows", "linux")
test.isequal([[..\bin\MyProject.dll]], result.fullpath)
end
function T.targets.On_Shared_Build_Windows_MacOSX()
function T.targets.SharedLib_Windows_Build_MacOSX()
cfg.kind = "SharedLib"
test.isequal("MyProject.dll", premake.gettarget(cfg, "build", "windows", "macosx").fullpath)
result = premake.gettarget(cfg, "build", "windows", "macosx")
test.isequal([[..\bin\MyProject.dll]], result.fullpath)
end
function T.targets.On_Shared_Build_Linux_Windows()
function T.targets.SharedLib_Windows_Build_Xbox360()
cfg.kind = "SharedLib"
test.isequal("MyProject.dll", premake.gettarget(cfg, "build", "linux", "windows").fullpath)
cfg.platform = "Xbox360"
result = premake.gettarget(cfg, "build", "windows", "linux")
test.isequal([[..\bin\MyProject.dll]], result.fullpath)
end
function T.targets.On_Shared_Build_Linux_Linux()
function T.targets.SharedLib_Windows_Link_Windows()
cfg.kind = "SharedLib"
test.isequal("libMyProject.so", premake.gettarget(cfg, "build", "linux", "linux").fullpath)
result = premake.gettarget(cfg, "link", "windows", "windows")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.On_Shared_Build_Linux_MacOSX()
function T.targets.SharedLib_Windows_Link_Linux()
cfg.kind = "SharedLib"
test.isequal("libMyProject.so", premake.gettarget(cfg, "build", "linux", "macosx").fullpath)
result = premake.gettarget(cfg, "link", "windows", "linux")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.On_Shared_Link_Windows_Windows()
function T.targets.SharedLib_Windows_Link_MacOSX()
cfg.kind = "SharedLib"
test.isequal("MyProject.lib", premake.gettarget(cfg, "link", "windows", "windows").fullpath)
result = premake.gettarget(cfg, "link", "windows", "macosx")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.On_Shared_Link_Windows_Linux()
function T.targets.SharedLib_Windows_Link_Xbox360()
cfg.kind = "SharedLib"
test.isequal("MyProject.lib", premake.gettarget(cfg, "link", "windows", "linux").fullpath)
end
function T.targets.On_Shared_Link_Windows_MacOSX()
cfg.kind = "SharedLib"
test.isequal("MyProject.lib", premake.gettarget(cfg, "link", "windows", "macosx").fullpath)
end
function T.targets.On_Shared_Link_Linux_Windows()
cfg.kind = "SharedLib"
test.isequal("libMyProject.a", premake.gettarget(cfg, "link", "linux", "windows").fullpath)
end
--
-- C++ StaticLib naming conventions
--
function T.targets.On_Static_Build_Windows_Windows()
cfg.kind = "StaticLib"
test.isequal("MyProject.lib", premake.gettarget(cfg, "build", "windows", "windows").fullpath)
end
function T.targets.On_Static_Build_Windows_Linux()
cfg.kind = "StaticLib"
test.isequal("MyProject.lib", premake.gettarget(cfg, "build", "windows", "windows").fullpath)
end
function T.targets.On_Static_Build_Windows_MacOSX()
cfg.kind = "StaticLib"
test.isequal("MyProject.lib", premake.gettarget(cfg, "build", "windows", "macosx").fullpath)
end
function T.targets.On_Static_Build_Linux_Windows()
cfg.kind = "StaticLib"
test.isequal("libMyProject.a", premake.gettarget(cfg, "build", "linux", "windows").fullpath)
end
function T.targets.On_Static_Build_Linux_Linux()
cfg.kind = "StaticLib"
test.isequal("libMyProject.a", premake.gettarget(cfg, "build", "linux", "linux").fullpath)
end
function T.targets.On_Static_Build_Linux_MacOSX()
cfg.kind = "StaticLib"
test.isequal("libMyProject.a", premake.gettarget(cfg, "build", "linux", "macosx").fullpath)
end
function T.targets.On_Static_Link_Windows_Windows()
cfg.kind = "StaticLib"
test.isequal("MyProject.lib", premake.gettarget(cfg, "link", "windows", "windows").fullpath)
end
function T.targets.On_Static_Link_Windows_Linux()
cfg.kind = "StaticLib"
test.isequal("MyProject.lib", premake.gettarget(cfg, "link", "windows", "windows").fullpath)
end
function T.targets.On_Static_Link_Windows_MacOSX()
cfg.kind = "StaticLib"
test.isequal("MyProject.lib", premake.gettarget(cfg, "link", "windows", "macosx").fullpath)
end
function T.targets.On_Static_Link_Linux_Windows()
cfg.kind = "StaticLib"
test.isequal("libMyProject.a", premake.gettarget(cfg, "link", "linux", "windows").fullpath)
end
function T.targets.On_Static_Link_Linux_Linux()
cfg.kind = "StaticLib"
test.isequal("libMyProject.a", premake.gettarget(cfg, "link", "linux", "linux").fullpath)
end
function T.targets.On_Static_Link_Linux_MacOSX()
cfg.kind = "StaticLib"
test.isequal("libMyProject.a", premake.gettarget(cfg, "link", "linux", "macosx").fullpath)
cfg.platform = "Xbox360"
result = premake.gettarget(cfg, "link", "windows", "macosx")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
--
-- C# naming conventions
-- Windows/C++/StaticLib tests
--
function T.targets.On_Cs_Console_Build_Linux_Linux()
cfg.language = "C#"
function T.targets.StaticLib_Windows_Build_Windows()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "build", "windows", "windows")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.StaticLib_Windows_Build_Linux()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "build", "windows", "linux")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.StaticLib_Windows_Build_MacOSX()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "build", "windows", "macosx")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.StaticLib_Windows_Build_PS3()
cfg.kind = "StaticLib"
cfg.platform = "PS3"
result = premake.gettarget(cfg, "build", "windows", "macosx")
test.isequal([[..\bin\libMyProject.a]], result.fullpath)
end
function T.targets.StaticLib_Windows_Build_Xbox360()
cfg.kind = "StaticLib"
cfg.platform = "Xbox360"
result = premake.gettarget(cfg, "build", "windows", "macosx")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.StaticLib_Windows_Link_Windows()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "link", "windows", "windows")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.StaticLib_Windows_Link_Linux()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "link", "windows", "linux")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.StaticLib_Windows_Link_MacOSX()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "link", "windows", "macosx")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
function T.targets.StaticLib_Windows_Link_PS3()
cfg.kind = "StaticLib"
cfg.platform = "PS3"
result = premake.gettarget(cfg, "link", "windows", "windows")
test.isequal([[..\bin\libMyProject.a]], result.fullpath)
end
function T.targets.StaticLib_Windows_Link_Xbox360()
cfg.kind = "StaticLib"
cfg.platform = "Xbox360"
result = premake.gettarget(cfg, "link", "windows", "windows")
test.isequal([[..\bin\MyProject.lib]], result.fullpath)
end
--
-- Linux/C++/ConsoleApp tests
--
function T.targets.ConsoleApp_Linux_Build_Windows()
cfg.kind = "ConsoleApp"
result = premake.gettarget(cfg, "build", "linux", "windows")
test.isequal([[../bin/MyProject.exe]], result.fullpath)
end
function T.targets.ConsoleApp_Linux_Build_Linux()
cfg.kind = "ConsoleApp"
result = premake.gettarget(cfg, "build", "linux", "linux")
test.isequal([[../bin/MyProject]], result.fullpath)
end
function T.targets.ConsoleApp_Linux_Build_MacOSX()
cfg.kind = "ConsoleApp"
result = premake.gettarget(cfg, "build", "linux", "macosx")
test.isequal([[../bin/MyProject]], result.fullpath)
end
function T.targets.ConsoleApp_Linux_Build_PS3()
cfg.kind = "ConsoleApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "linux", "linux").fullpath)
cfg.platform = "PS3"
result = premake.gettarget(cfg, "build", "linux", "linux")
test.isequal([[../bin/MyProject.elf]], result.fullpath)
end
function T.targets.On_Cs_Windowed_Build_Linux_Linux()
cfg.language = "C#"
function T.targets.ConsoleApp_Linux_Build_Xbox360()
cfg.kind = "ConsoleApp"
cfg.platform = "Xbox360"
result = premake.gettarget(cfg, "build", "linux", "linux")
test.isequal([[../bin/MyProject.exe]], result.fullpath)
end
--
-- Linux/C++/WindowedApp tests
--
function T.targets.WindowedApp_Linux_Build_Windows()
cfg.kind = "WindowedApp"
result = premake.gettarget(cfg, "build", "linux", "windows")
test.isequal([[../bin/MyProject.exe]], result.fullpath)
end
function T.targets.WindowedApp_Linux_Build_Linux()
cfg.kind = "WindowedApp"
result = premake.gettarget(cfg, "build", "linux", "linux")
test.isequal([[../bin/MyProject]], result.fullpath)
end
function T.targets.WindowedApp_Linux_Build_MacOSX()
cfg.kind = "WindowedApp"
result = premake.gettarget(cfg, "build", "linux", "macosx")
test.isequal([[../bin/MyProject.app/Contents/MacOS/MyProject]], result.fullpath)
end
function T.targets.WindowedApp_Linux_Build_PS3()
cfg.kind = "WindowedApp"
test.isequal("MyProject.exe", premake.gettarget(cfg, "build", "linux", "linux").fullpath)
cfg.platform = "PS3"
result = premake.gettarget(cfg, "build", "linux", "linux")
test.isequal([[../bin/MyProject.elf]], result.fullpath)
end
function T.targets.On_Cs_Shared_Build_Linux_Linux()
cfg.language = "C#"
cfg.kind = "SharedLib"
test.isequal("MyProject.dll", premake.gettarget(cfg, "build", "linux", "linux").fullpath)
function T.targets.WindowedApp_Linux_Build_Xbox360()
cfg.kind = "WindowedApp"
cfg.platform = "Xbox360"
result = premake.gettarget(cfg, "build", "linux", "linux")
test.isequal([[../bin/MyProject.exe]], result.fullpath)
end
--
-- Field handling tests
-- Linux/C++/SharedLib tests
--
function T.targets.TargetName_OverridesProjectName()
cfg.kind = "ConsoleApp"
cfg.targetname = "MyTarget"
test.isequal("MyTarget.exe", premake.gettarget(cfg, "build", "windows").fullpath)
function T.targets.SharedLib_Linux_Build_Windows()
cfg.kind = "SharedLib"
result = premake.gettarget(cfg, "build", "linux", "windows")
test.isequal([[../bin/MyProject.dll]], result.fullpath)
end
function T.targets.TargetDir_OverridesBaseDir()
cfg.kind = "ConsoleApp"
cfg.targetdir = "MyTarget"
test.isequal("MyTarget/MyProject.exe", premake.gettarget(cfg, "build", "windows").fullpath)
function T.targets.SharedLib_Linux_Build_Linux()
cfg.kind = "SharedLib"
result = premake.gettarget(cfg, "build", "linux", "linux")
test.isequal([[../bin/libMyProject.so]], result.fullpath)
end
function T.targets.TargetExtension_OverridesDefault()
cfg.kind = "ConsoleApp"
cfg.targetextension = ".zmf"
test.isequal("MyProject.zmf", premake.gettarget(cfg, "build", "windows").fullpath)
function T.targets.SharedLib_Linux_Build_MacOSX()
cfg.kind = "SharedLib"
result = premake.gettarget(cfg, "build", "linux", "macosx")
test.isequal([[../bin/libMyProject.so]], result.fullpath)
end
function T.targets.TargetPrefix_OverridesDefault()
cfg.kind = "ConsoleApp"
cfg.targetprefix = "zoo"
test.isequal("zooMyProject.exe", premake.gettarget(cfg, "build", "windows").fullpath)
function T.targets.SharedLib_Linux_Link_Windows()
cfg.kind = "SharedLib"
result = premake.gettarget(cfg, "link", "linux", "windows")
test.isequal([[../bin/libMyProject.a]], result.fullpath)
end
function T.targets.SharedLib_Linux_Link_Linux()
cfg.kind = "SharedLib"
result = premake.gettarget(cfg, "link", "linux", "linux")
test.isequal([[../bin/libMyProject.so]], result.fullpath)
end
function T.targets.SharedLib_Linux_Link_MacOSX()
cfg.kind = "SharedLib"
result = premake.gettarget(cfg, "link", "linux", "macosx")
test.isequal([[../bin/libMyProject.so]], result.fullpath)
end
function T.targets.ImpLibName_UsedOnSharedLinks()
cfg.kind = "SharedLib"
cfg.implibname = "MyImports"
test.isequal("MyImports.lib", premake.gettarget(cfg, "link", "windows").fullpath)
--
-- Linux/C++/StaticLib tests
--
function T.targets.StaticLib_Linux_Build_Windows()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "build", "linux", "windows")
test.isequal([[../bin/libMyProject.a]], result.fullpath)
end
function T.targets.ImpLibDir_UsedOnSharedLinks()
cfg.kind = "SharedLib"
cfg.implibdir = "MyTarget"
test.isequal("MyTarget/MyProject.lib", premake.gettarget(cfg, "link", "windows").fullpath)
function T.targets.StaticLib_Linux_Build_Linux()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "build", "linux", "linux")
test.isequal([[../bin/libMyProject.a]], result.fullpath)
end
function T.targets.ImpLibExtension_UsedOnSharedLinks()
cfg.kind = "SharedLib"
cfg.implibextension = ".zmf"
test.isequal("MyProject.zmf", premake.gettarget(cfg, "link", "windows").fullpath)
function T.targets.StaticLib_Linux_Build_MacOSX()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "build", "linux", "macosx")
test.isequal([[../bin/libMyProject.a]], result.fullpath)
end
function T.targets.ImpLibPrefix_UsedOnSharedLinks()
cfg.kind = "SharedLib"
cfg.implibprefix = "zoo"
test.isequal("zooMyProject.lib", premake.gettarget(cfg, "link", "windows").fullpath)
function T.targets.StaticLib_Linux_Build_PS3()
cfg.kind = "StaticLib"
cfg.platform = "PS3"
result = premake.gettarget(cfg, "build", "linux", "macosx")
test.isequal([[../bin/libMyProject.a]], result.fullpath)
end
function T.targets.StaticLib_Linux_Link_Windows()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "link", "linux", "windows")
test.isequal([[../bin/libMyProject.a]], result.fullpath)
end
function T.targets.StaticLib_Linux_Link_Linux()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "link", "linux", "linux")
test.isequal([[../bin/libMyProject.a]], result.fullpath)
end
function T.targets.StaticLib_Linux_Link_MacOSX()
cfg.kind = "StaticLib"
result = premake.gettarget(cfg, "link", "linux", "macosx")
test.isequal([[../bin/libMyProject.a]], result.fullpath)
end
function T.targets.StaticLib_Linux_Link_PS3()
cfg.kind = "StaticLib"
cfg.platform = "PS3"
result = premake.gettarget(cfg, "link", "linux", "macosx")
test.isequal([[../bin/libMyProject.a]], result.fullpath)
end

View File

@ -12,6 +12,8 @@
local sln
function T.vs2002_sln.setup()
_ACTION = 'vs2002'
sln = solution "MySolution"
configurations { "Debug", "Release" }
platforms {}
@ -22,7 +24,6 @@
uuid "AE61726D-187C-E440-BD07-2556188A6565"
premake.buildconfigs()
_ACTION = 'vs2002'
end

View File

@ -12,6 +12,8 @@
local sln
function T.vs2003_sln.setup()
_ACTION = "vs2003"
sln = solution "MySolution"
configurations { "Debug", "Release" }
platforms {}
@ -22,7 +24,6 @@
uuid "AE61726D-187C-E440-BD07-2556188A6565"
premake.buildconfigs()
_ACTION = 'vs2003'
end

View File

@ -12,6 +12,8 @@
local sln
function T.vs2008_sln.setup()
_ACTION = "vs2008"
sln = solution "MySolution"
configurations { "Debug", "Release" }
platforms {}
@ -22,7 +24,6 @@
uuid "AE61726D-187C-E440-BD07-2556188A6565"
premake.buildconfigs()
_ACTION = 'vs2008'
end

View File

@ -12,6 +12,8 @@
local sln, prj
function T.vs200x_vcproj.setup()
_ACTION = "vs2005"
sln = solution "MySolution"
configurations { "Debug", "Release" }
platforms {}
@ -23,9 +25,7 @@
prj = project "MyProject"
language "C++"
kind "ConsoleApp"
uuid "AE61726D-187C-E440-BD07-2556188A6565"
_ACTION = 'vs2005'
uuid "AE61726D-187C-E440-BD07-2556188A6565"
end
local function prepare()
@ -350,3 +350,17 @@
/>
]]
end
-- function T.vs200x_vcproj.LinkerBlock_OnPS3StaticLib()
-- platforms { "PS3" }
-- kind "StaticLib"
-- prepare()
-- premake.vs200x_vcproj_VCLinkerTool_GCC(premake.getconfig(prj, "Debug", "PS3"))
-- test.capture [[
-- <Tool
-- Name="VCLibrarianTool"
-- AdditionalOptions="-s"
-- OutputFile="$(OutDir)\libMyProject.a"
-- />
-- ]]
-- end