Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions modules/xcode/tests/test_xcode_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@
end


function suite.PBXFileReference_ListsTVOSWindowedTarget()
_TARGET_OS = "tvos"
kind "WindowedApp"
prepare()
xcode.PBXFileReference(tr)
test.capture [[
/* Begin PBXFileReference section */
E5FB9875FD0E33A7ED2A2EB5 /* MyProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = MyProject.app; path = MyProject.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
]]
end


function suite.PBXFileReference_ListsStaticLibTarget()
kind "StaticLib"
prepare()
Expand All @@ -281,6 +294,19 @@
end


function suite.PBXFileReference_ListsTVOSStaticLibTarget()
_TARGET_OS = "tvos"
kind "StaticLib"
prepare()
xcode.PBXFileReference(tr)
test.capture [[
/* Begin PBXFileReference section */
FDCF31ACF735331EEAD08FEC /* libMyProject.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libMyProject.a; path = libMyProject.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
]]
end


function suite.PBXFileReference_ListsSharedLibTarget()
kind "SharedLib"
prepare()
Expand All @@ -306,6 +332,19 @@
end


function suite.PBXFileReference_ListsTVOSSharedLibTarget()
_TARGET_OS = "tvos"
kind "SharedLib"
prepare()
xcode.PBXFileReference(tr)
test.capture [[
/* Begin PBXFileReference section */
2781AF7F7E0F19F156882DBF /* libMyProject.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; name = libMyProject.dylib; path = libMyProject.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
]]
end


function suite.PBXFileReference_ListsOSXBundleTarget()
kind "SharedLib"
sharedlibtype "OSXBundle"
Expand All @@ -332,6 +371,19 @@
]]
end

function suite.PBXFileReference_ListsTVOSOSXBundleTarget()
_TARGET_OS = "tvos"
kind "SharedLib"
sharedlibtype "OSXBundle"
prepare()
xcode.PBXFileReference(tr)
test.capture [[
/* Begin PBXFileReference section */
8AD066EE75BC8CE0BDA2552E /* MyProject.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = MyProject.bundle; path = MyProject.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
]]
end

function suite.PBXFileReference_ListsXCTestTarget()
kind "SharedLib"
sharedlibtype "XCTest"
Expand All @@ -357,6 +409,19 @@
]]
end

function suite.PBXFileReference_ListsTVOSXCTestTarget()
_TARGET_OS = "tvos"
kind "SharedLib"
sharedlibtype "XCTest"
prepare()
xcode.PBXFileReference(tr)
test.capture [[
/* Begin PBXFileReference section */
F573990FE05FBF012845874F /* MyProject.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = MyProject.xctest; path = MyProject.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
]]
end

function suite.PBXFileReference_ListsOSXFrameworkTarget()
kind "SharedLib"
sharedlibtype "OSXFramework"
Expand Down Expand Up @@ -384,6 +449,19 @@
end


function suite.PBXFileReference_ListsTVOSOSXFrameworkTarget()
_TARGET_OS = "tvos"
kind "SharedLib"
sharedlibtype "OSXFramework"
prepare()
xcode.PBXFileReference(tr)
test.capture [[
/* Begin PBXFileReference section */
2D914F2255CC07D43D679562 /* MyProject.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = MyProject.framework; path = MyProject.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
]]
end


function suite.PBXFileReference_ListsSourceFiles()
files { "source.c" }
Expand Down Expand Up @@ -2238,6 +2316,99 @@
]]
end

function suite.XCBuildConfigurationTarget_OnTVOS()
_TARGET_OS = "tvos"
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
FDC4CBFB4635B02D8AD4823B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "Apple Developer";
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = MyProject;
SDKROOT = appletvos;
};
name = Debug;
};
]]
end

function suite.XCBuildConfigurationTarget_OnTVOSMinVersion()
_TARGET_OS = "tvos"
systemversion "8.3"
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
FDC4CBFB4635B02D8AD4823B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "Apple Developer";
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = MyProject;
SDKROOT = appletvos;
TVOS_DEPLOYMENT_TARGET = 8.3;
};
name = Debug;
};
]]
end

function suite.XCBuildConfigurationTarget_OnTVOSMinMaxVersion()
_TARGET_OS = "tvos"
systemversion "8.3:9.1"
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
FDC4CBFB4635B02D8AD4823B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "Apple Developer";
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = MyProject;
SDKROOT = appletvos;
TVOS_DEPLOYMENT_TARGET = 8.3;
};
name = Debug;
};
]]
end

function suite.XCBuildConfigurationTarget_OnTVOSCodeSigningIdentity()
_TARGET_OS = "tvos"
xcodecodesigningidentity "Premake Developers"
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
FDC4CBFB4635B02D8AD4823B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "Premake Developers";
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = MyProject;
SDKROOT = appletvos;
};
name = Debug;
};
]]
end


---------------------------------------------------------------------------
-- XCBuildConfiguration_Project tests
Expand Down
9 changes: 9 additions & 0 deletions modules/xcode/xcode_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,15 @@
if family then
settings['TARGETED_DEVICE_FAMILY'] = family
end
elseif os.istarget(p.TVOS) then
settings['SDKROOT'] = 'appletvos'

settings['CODE_SIGN_IDENTITY[sdk=appletvos*]'] = cfg.xcodecodesigningidentity or 'Apple Developer'

local minOSVersion = project.systemversion(cfg)
if minOSVersion ~= nil then
settings['TVOS_DEPLOYMENT_TARGET'] = minOSVersion
end
else
local minOSVersion = project.systemversion(cfg)
if minOSVersion ~= nil then
Expand Down
2 changes: 2 additions & 0 deletions src/_premake_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@
"linux",
"macosx",
"solaris",
"tvos",
"uwp",
"wii",
"windows",
Expand Down Expand Up @@ -1306,6 +1307,7 @@
{ "linux", "Linux" },
{ "macosx", "Apple Mac OS X" },
{ "solaris", "Solaris" },
{ "tvos", "tvOS" },
{ "uwp", "Microsoft Universal Windows Platform"},
{ "windows", "Microsoft Windows" },
}
Expand Down
1 change: 1 addition & 0 deletions src/base/_foundation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
premake.ANDROID = "android"
premake.EMSCRIPTEN = "emscripten"
premake.IOS = "ios"
premake.TVOS = "tvos"
premake.LINUX = "linux"
premake.MACOSX = "macosx"
premake.MAKEFILE = "Makefile"
Expand Down
1 change: 1 addition & 0 deletions src/base/os.lua
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@
["linux"] = { "linux", "posix", "desktop" },
["macosx"] = { "macosx", "darwin", "posix", "desktop" },
["solaris"] = { "solaris", "posix", "desktop" },
["tvos"] = { "tvos", "darwin", "posix", "mobile" },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I'm not quite sure on, what tags should tvOS have?

An Apple TV isn't a desktop device and it isn't a mobile device, but an Apple TV's internals are very similar to an iPhone, and iOS and tvOS share a lot of common history and functionality. So because of the familiarity to iOS I tagged it as mobile but I'm open to other suggestions

["uwp"] = { "uwp", "windows", "desktop" },
["windows"] = { "windows", "win32", "desktop" },
}
Expand Down
9 changes: 7 additions & 2 deletions src/tools/clang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,15 @@
function clang.getsystemversionflags(cfg)
local flags = {}

if cfg.system == p.MACOSX or cfg.system == p.IOS then
if cfg.system == p.MACOSX or cfg.system == p.IOS or cfg.system == p.TVOS then
local minVersion = p.project.systemversion(cfg)
if minVersion ~= nil then
local name = iif(cfg.system == p.MACOSX, "macosx", "iphoneos")
local name = "macosx"
if cfg.system == p.IOS then
name = "iphoneos"
elseif cfg.system == p.TVOS then
name = "appletvos"
end
Comment on lines -101 to +106
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly

Suggested change
local name = iif(cfg.system == p.MACOSX, "macosx", "iphoneos")
local name = "macosx"
if cfg.system == p.IOS then
name = "iphoneos"
elseif cfg.system == p.TVOS then
name = "appletvos"
end
local names = {
p.MACOSX = "macosx",
p.IOS = "iphoneos",
p.TVOS = "appletvos"
}
local name = names[cfg.system]

table.insert (flags, "-m" .. name .. "-version-min=" .. p.project.systemversion(cfg))
end
end
Expand Down
6 changes: 3 additions & 3 deletions tests/config/test_targetinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@


--
-- Bundle path should be set for macOS/iOS cocoa bundle.
-- Bundle path should be set for macOS/iOS/tvOS cocoa bundle.
--

function suite.bundlepathSet_onMacSharedLibOSXBundle()
Expand All @@ -232,7 +232,7 @@
end

--
-- Bundle path should be set for macOS/iOS cocoa unit test bundle.
-- Bundle path should be set for macOS/iOS/tvOS cocoa unit test bundle.
--

function suite.bundlepathSet_onMacSharedLibXCTest()
Expand All @@ -245,7 +245,7 @@


--
-- Bundle path should be set for macOS/iOS framework.
-- Bundle path should be set for macOS/iOS/tvOS framework.
--

function suite.bundlepathSet_onMacSharedLibOSXFramework()
Expand Down
18 changes: 18 additions & 0 deletions tests/tools/test_clang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@
test.contains({ "-miphoneos-version-min=5.0" }, clang.getcxxflags(cfg))
end

--
-- Check tvOS deployment target flags
--

function suite.cflags_tvos_systemversion()
system "tvOS"
systemversion "12.1"
prepare()
test.contains({ "-mappletvos-version-min=12.1" }, clang.getcflags(cfg))
end

function suite.cxxflags_tvos_systemversion()
system "tvOS"
systemversion "5.0"
prepare()
test.contains({ "-mappletvos-version-min=5.0" }, clang.getcxxflags(cfg))
end

--
-- Check handling of openmp.
--
Expand Down
7 changes: 7 additions & 0 deletions tests/tools/test_gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,13 @@
test.contains("-F/Library/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
end

function suite.includeDirs_tvos_onFrameworkDirs()
system "tvOS"
frameworkdirs { "/Library/Frameworks" }
prepare()
test.contains("-F/Library/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
end


--
-- Check handling of linker flag.
Expand Down
1 change: 1 addition & 0 deletions website/docs/os/os.getSystemTags.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and meta tags like `posix`, `darwin`, `desktop` and `mobile` tags.
| linux | linux, posix, desktop |
| macosx | macosx, darwin, posix, desktop |
| solaris | solaris, posix, desktop |
| tvos | tvos, darwin, posix, mobile |
| uwp | uwp, windows, desktop |
| windows | windows, win32, desktop |

Expand Down
1 change: 1 addition & 0 deletions website/docs/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ If no system is specified, Premake will identify and target the current operatin
* linux
* macosx
* solaris
* tvos
* uwp
* wii
* windows
Expand Down
Loading
Loading