2008-12-05 21:18:47 +00:00
|
|
|
--
|
|
|
|
-- tests/test_targets.lua
|
|
|
|
-- Automated test suite for premake.gettarget()
|
2009-06-02 19:40:59 +00:00
|
|
|
-- Copyright (c) 2008, 2009 Jason Perkins and the Premake project
|
2008-12-05 21:18:47 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
T.targets = { }
|
|
|
|
|
|
|
|
local cfg
|
|
|
|
function T.targets.setup()
|
|
|
|
cfg = { }
|
|
|
|
cfg.basedir = "."
|
|
|
|
cfg.location = "."
|
2009-05-08 20:18:47 +00:00
|
|
|
cfg.targetdir = "../bin"
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.language = "C++"
|
|
|
|
cfg.project = { name = "MyProject" }
|
2009-01-12 19:42:49 +00:00
|
|
|
cfg.flags = { }
|
2009-05-08 20:18:47 +00:00
|
|
|
cfg.objectsdir = "obj"
|
|
|
|
cfg.platform = "Native"
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2009-06-02 19:40:59 +00:00
|
|
|
-- Path Style Name Style Example Environment
|
|
|
|
-- ---------- ---------- -------------------
|
|
|
|
-- windows windows VStudio with MSC
|
|
|
|
-- posix posix GMake with GCC
|
|
|
|
-- windows posix VStudio for PS3
|
|
|
|
-- posix windows GMake for .NET
|
2008-12-05 21:18:47 +00:00
|
|
|
--
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- ConsoleApp tests
|
|
|
|
--
|
|
|
|
|
|
|
|
function T.targets.ConsoleApp_Build_WindowsNames()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "ConsoleApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "windows", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject.exe]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.ConsoleApp_Build_PosixNames_OnWindows()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "ConsoleApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "windows")
|
|
|
|
test.isequal([[../bin/MyProject.exe]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.ConsoleApp_Build_PosixNames_OnLinux()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "ConsoleApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "linux")
|
|
|
|
test.isequal([[../bin/MyProject]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.ConsoleApp_Build_PosixNames_OnMacOSX()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "ConsoleApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.ConsoleApp_Build_PS3Names()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "ConsoleApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "PS3", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject.elf]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
|
2008-12-05 21:18:47 +00:00
|
|
|
--
|
2009-06-02 19:40:59 +00:00
|
|
|
-- WindowedApp tests
|
2008-12-05 21:18:47 +00:00
|
|
|
--
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.WindowedApp_Build_WindowsNames()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "WindowedApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "windows", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject.exe]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.WindowedApp_Build_PosixNames_OnWindows()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "WindowedApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "windows")
|
|
|
|
test.isequal([[../bin/MyProject.exe]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.WindowedApp_Build_PosixNames_OnLinux()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "WindowedApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "linux")
|
|
|
|
test.isequal([[../bin/MyProject]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
2009-05-08 20:18:47 +00:00
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.WindowedApp_Build_PosixNames_OnMacOSX()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "WindowedApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject.app/Contents/MacOS/MyProject]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
2009-06-02 19:40:59 +00:00
|
|
|
|
|
|
|
function T.targets.WindowedApp_Build_PS3Names()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "WindowedApp"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "PS3", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject.elf]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
2009-06-02 19:40:59 +00:00
|
|
|
|
2008-12-05 21:18:47 +00:00
|
|
|
|
|
|
|
--
|
2009-06-02 19:40:59 +00:00
|
|
|
-- SharedLib tests
|
2008-12-05 21:18:47 +00:00
|
|
|
--
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.SharedLib_Build_WindowsNames()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "SharedLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "windows", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject.dll]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.SharedLib_Link_WindowsNames()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "SharedLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "link", "posix", "windows", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject.lib]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.SharedLib_Build_PosixNames_OnWindows()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "SharedLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "windows")
|
|
|
|
test.isequal([[../bin/MyProject.dll]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
2009-05-08 20:18:47 +00:00
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.SharedLib_Link_PosixNames_OnWindows()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "SharedLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "link", "posix", "posix", "windows")
|
|
|
|
test.isequal([[../bin/libMyProject.a]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.SharedLib_Build_PosixNames_OnLinux()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "SharedLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "linux")
|
|
|
|
test.isequal([[../bin/libMyProject.so]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.SharedLib_Link_PosixNames_OnLinux()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "SharedLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "link", "posix", "posix", "linux")
|
|
|
|
test.isequal([[../bin/libMyProject.so]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.SharedLib_Build_PosixNames_OnMacOSX()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "SharedLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "macosx")
|
|
|
|
test.isequal([[../bin/libMyProject.dylib]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
2009-05-08 20:18:47 +00:00
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.SharedLib_Link_PosixNames_OnMacOSX()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "SharedLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "link", "posix", "posix", "macosx")
|
|
|
|
test.isequal([[../bin/libMyProject.dylib]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2009-05-08 20:18:47 +00:00
|
|
|
|
2008-12-05 21:18:47 +00:00
|
|
|
--
|
2009-06-02 19:40:59 +00:00
|
|
|
-- StaticLib tests
|
2008-12-05 21:18:47 +00:00
|
|
|
--
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Build_WindowsNames()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "windows", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject.lib]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Link_WindowsNames()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "link", "posix", "windows", "macosx")
|
|
|
|
test.isequal([[../bin/MyProject.lib]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Build_PosixNames_OnWindows()
|
2008-12-05 21:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "windows")
|
2009-05-08 20:18:47 +00:00
|
|
|
test.isequal([[../bin/libMyProject.a]], result.fullpath)
|
2008-12-05 21:18:47 +00:00
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Link_PosixNames_OnWindows()
|
2009-05-08 20:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "link", "posix", "posix", "windows")
|
2009-05-08 20:18:47 +00:00
|
|
|
test.isequal([[../bin/libMyProject.a]], result.fullpath)
|
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Build_PosixNames_OnLinux()
|
2009-05-08 20:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "linux")
|
2009-05-08 20:18:47 +00:00
|
|
|
test.isequal([[../bin/libMyProject.a]], result.fullpath)
|
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Link_PosixNames_OnLinux()
|
2009-05-08 20:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "link", "posix", "posix", "linux")
|
2009-05-08 20:18:47 +00:00
|
|
|
test.isequal([[../bin/libMyProject.a]], result.fullpath)
|
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Build_PosixNames_OnMacOSX()
|
2009-05-08 20:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "posix", "macosx")
|
2009-05-08 20:18:47 +00:00
|
|
|
test.isequal([[../bin/libMyProject.a]], result.fullpath)
|
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Link_PosixNames_OnMacOSX()
|
2009-05-08 20:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "link", "posix", "posix", "macosx")
|
2009-05-08 20:18:47 +00:00
|
|
|
test.isequal([[../bin/libMyProject.a]], result.fullpath)
|
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Build_PosixNames_OnPS3()
|
2009-05-08 20:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "build", "posix", "PS3", "macosx")
|
2009-05-08 20:18:47 +00:00
|
|
|
test.isequal([[../bin/libMyProject.a]], result.fullpath)
|
|
|
|
end
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
function T.targets.StaticLib_Link_PosixNames_OnPS3()
|
2009-05-08 20:18:47 +00:00
|
|
|
cfg.kind = "StaticLib"
|
2009-06-02 19:40:59 +00:00
|
|
|
result = premake.gettarget(cfg, "link", "posix", "PS3", "macosx")
|
2009-05-08 20:18:47 +00:00
|
|
|
test.isequal([[../bin/libMyProject.a]], result.fullpath)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2009-06-02 19:40:59 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Windows path tests
|
|
|
|
--
|
|
|
|
|
|
|
|
function T.targets.WindowsPaths()
|
|
|
|
cfg.kind = "ConsoleApp"
|
|
|
|
result = premake.gettarget(cfg, "build", "windows", "windows", "linux")
|
|
|
|
test.isequal([[..\bin]], result.directory)
|
|
|
|
test.isequal([[..\bin\MyProject.exe]], result.fullpath)
|
|
|
|
end
|