summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bx/scripts/toolchain.lua
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bx/scripts/toolchain.lua')
-rw-r--r--3rdparty/bx/scripts/toolchain.lua250
1 files changed, 207 insertions, 43 deletions
diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua
index 0422db1105b..3f62914a71f 100644
--- a/3rdparty/bx/scripts/toolchain.lua
+++ b/3rdparty/bx/scripts/toolchain.lua
@@ -13,24 +13,29 @@ function toolchain(_buildDir, _libDir)
value = "GCC",
description = "Choose GCC flavor",
allowed = {
- { "android-arm", "Android - ARM" },
- { "android-mips", "Android - MIPS" },
- { "android-x86", "Android - x86" },
- { "asmjs", "Emscripten/asm.js" },
- { "freebsd", "FreeBSD" },
- { "linux-gcc", "Linux (GCC compiler)" },
- { "linux-gcc-5", "Linux (GCC-5 compiler)" },
- { "linux-clang", "Linux (Clang compiler)" },
- { "ios-arm", "iOS - ARM" },
- { "ios-simulator", "iOS - Simulator" },
- { "mingw-gcc", "MinGW" },
- { "mingw-clang", "MinGW (clang compiler)" },
- { "nacl", "Native Client" },
- { "nacl-arm", "Native Client - ARM" },
- { "osx", "OSX" },
- { "pnacl", "Native Client - PNaCl" },
- { "qnx-arm", "QNX/Blackberry - ARM" },
- { "rpi", "RaspberryPi" },
+ { "android-arm", "Android - ARM" },
+ { "android-mips", "Android - MIPS" },
+ { "android-x86", "Android - x86" },
+ { "asmjs", "Emscripten/asm.js" },
+ { "freebsd", "FreeBSD" },
+ { "linux-gcc", "Linux (GCC compiler)" },
+ { "linux-gcc-5", "Linux (GCC-5 compiler)" },
+ { "linux-clang", "Linux (Clang compiler)" },
+ { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" },
+ { "linux-arm-gcc", "Linux (ARM, GCC compiler)" },
+ { "ios-arm", "iOS - ARM" },
+ { "ios-simulator", "iOS - Simulator" },
+ { "tvos-arm64", "tvOS - ARM64" },
+ { "tvos-simulator", "tvOS - Simulator" },
+ { "mingw-gcc", "MinGW" },
+ { "mingw-clang", "MinGW (clang compiler)" },
+ { "nacl", "Native Client" },
+ { "nacl-arm", "Native Client - ARM" },
+ { "osx", "OSX" },
+ { "pnacl", "Native Client - PNaCl" },
+ { "ps4", "PS4" },
+ { "qnx-arm", "QNX/Blackberry - ARM" },
+ { "rpi", "RaspberryPi" },
},
}
@@ -39,15 +44,15 @@ function toolchain(_buildDir, _libDir)
value = "toolset",
description = "Choose VS toolset",
allowed = {
- { "vs2012-clang", "Clang 3.6" },
- { "vs2013-clang", "Clang 3.6" },
+ { "vs2012-clang", "Clang 3.6" },
+ { "vs2013-clang", "Clang 3.6" },
{ "vs2012-xp", "Visual Studio 2012 targeting XP" },
{ "vs2013-xp", "Visual Studio 2013 targeting XP" },
{ "vs2015-xp", "Visual Studio 2015 targeting XP" },
- { "winphone8", "Windows Phone 8.0" },
- { "winphone81", "Windows Phone 8.1" },
- { "winstore81", "Windows Store 8.1" },
- { "winstore82", "Universal Windows App" }
+ { "winphone8", "Windows Phone 8.0" },
+ { "winphone81", "Windows Phone 8.1" },
+ { "winstore81", "Windows Store 8.1" },
+ { "winstore82", "Universal Windows App" },
},
}
@@ -59,6 +64,7 @@ function toolchain(_buildDir, _libDir)
allowed = {
{ "osx", "OSX" },
{ "ios", "iOS" },
+ { "tvos", "tvOS" },
}
}
@@ -74,6 +80,12 @@ function toolchain(_buildDir, _libDir)
description = "Set iOS target version (default: 8.0).",
}
+ newoption {
+ trigger = "with-tvos",
+ value = "#",
+ description = "Set tvOS target version (default: 9.0).",
+ }
+
-- Avoid error when invoking genie --help.
if (_ACTION == nil) then return false end
@@ -93,6 +105,11 @@ function toolchain(_buildDir, _libDir)
iosPlatform = _OPTIONS["with-ios"]
end
+ local tvosPlatform = ""
+ if _OPTIONS["with-tvos"] then
+ tvosPlatform = _OPTIONS["with-tvos"]
+ end
+
if _ACTION == "gmake" then
if nil == _OPTIONS["gcc"] then
@@ -153,17 +170,29 @@ function toolchain(_buildDir, _libDir)
location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
elseif "ios-arm" == _OPTIONS["gcc"] then
- premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
- premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
+ premake.gcc.cc = "clang"
+ premake.gcc.cxx = "clang++"
premake.gcc.ar = "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm"))
elseif "ios-simulator" == _OPTIONS["gcc"] then
- premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
- premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
+ premake.gcc.cc = "clang"
+ premake.gcc.cxx = "clang++"
premake.gcc.ar = "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
+ elseif "tvos-arm64" == _OPTIONS["gcc"] then
+ premake.gcc.cc = "clang"
+ premake.gcc.cxx = "clang++"
+ premake.gcc.ar = "ar"
+ location (path.join(_buildDir, "projects", _ACTION .. "-tvos-arm64"))
+
+ elseif "tvos-simulator" == _OPTIONS["gcc"] then
+ premake.gcc.cc = "clang"
+ premake.gcc.cxx = "clang++"
+ premake.gcc.ar = "ar"
+ location (path.join(_buildDir, "projects", _ACTION .. "-tvos-simulator"))
+
elseif "linux-gcc" == _OPTIONS["gcc"] then
location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
@@ -179,6 +208,12 @@ function toolchain(_buildDir, _libDir)
premake.gcc.ar = "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
+ elseif "linux-mips-gcc" == _OPTIONS["gcc"] then
+ location (path.join(_buildDir, "projects", _ACTION .. "-linux-mips-gcc"))
+
+ elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
+ location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
+
elseif "mingw-gcc" == _OPTIONS["gcc"] then
premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
@@ -257,6 +292,19 @@ function toolchain(_buildDir, _libDir)
premake.gcc.ar = naclToolchain .. "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-pnacl"))
+ elseif "ps4" == _OPTIONS["gcc"] then
+
+ if not os.getenv("PS4_SDK_ROOT") then
+ print("Set PS4_SDK_ROOT enviroment variables.")
+ end
+
+ ps4Toolchain = "$(PS4_SDK_ROOT)/host_tools/bin/orbis-"
+
+ premake.gcc.cc = ps4Toolchain .. "clang"
+ premake.gcc.cxx = ps4Toolchain .. "clang++"
+ premake.gcc.ar = ps4Toolchain .. "ar"
+ location (path.join(_buildDir, "projects", _ACTION .. "-ps4"))
+
elseif "qnx-arm" == _OPTIONS["gcc"] then
if not os.getenv("QNX_HOST") then
@@ -321,6 +369,10 @@ function toolchain(_buildDir, _libDir)
elseif "ios" == _OPTIONS["xcode"] then
premake.xcode.toolset = "iphoneos"
location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
+
+ elseif "tvos" == _OPTIONS["xcode"] then
+ premake.xcode.toolset = "appletvos"
+ location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
end
end
@@ -383,7 +435,6 @@ function toolchain(_buildDir, _libDir)
objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
libdirs {
path.join(_libDir, "lib/win32_" .. _ACTION),
- "$(DXSDK_DIR)/lib/x86",
}
configuration { "x64", "vs*" }
@@ -392,7 +443,6 @@ function toolchain(_buildDir, _libDir)
objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
libdirs {
path.join(_libDir, "lib/win64_" .. _ACTION),
- "$(DXSDK_DIR)/lib/x64",
}
configuration { "ARM", "vs*" }
@@ -448,7 +498,6 @@ function toolchain(_buildDir, _libDir)
objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
libdirs {
path.join(_libDir, "lib/win32_mingw-gcc"),
- "$(DXSDK_DIR)/lib/x86",
}
buildoptions { "-m32" }
@@ -457,8 +506,6 @@ function toolchain(_buildDir, _libDir)
objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
libdirs {
path.join(_libDir, "lib/win64_mingw-gcc"),
- "$(DXSDK_DIR)/lib/x64",
- "$(GLES_X64_DIR)",
}
buildoptions { "-m64" }
@@ -478,7 +525,6 @@ function toolchain(_buildDir, _libDir)
objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
libdirs {
path.join(_libDir, "lib/win32_mingw-clang"),
- "$(DXSDK_DIR)/lib/x86",
}
buildoptions { "-m32" }
@@ -487,8 +533,6 @@ function toolchain(_buildDir, _libDir)
objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
libdirs {
path.join(_libDir, "lib/win64_mingw-clang"),
- "$(DXSDK_DIR)/lib/x64",
- "$(GLES_X64_DIR)",
}
buildoptions { "-m64" }
@@ -507,12 +551,12 @@ function toolchain(_buildDir, _libDir)
-- "ubsan",
}
- configuration { "linux-g*" }
+ configuration { "linux-gcc" }
buildoptions {
- "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
+ "-mfpmath=sse",
}
- configuration { "linux-*" }
+ configuration { "linux-gcc or linux-clang" }
buildoptions {
"-msse2",
"-Wunused-value",
@@ -529,7 +573,7 @@ function toolchain(_buildDir, _libDir)
"-Wl,--gc-sections",
}
- configuration { "linux-g*", "x32" }
+ configuration { "linux-gcc*", "x32" }
targetdir (path.join(_buildDir, "linux32_gcc/bin"))
objdir (path.join(_buildDir, "linux32_gcc/obj"))
libdirs { path.join(_libDir, "lib/linux32_gcc") }
@@ -537,7 +581,7 @@ function toolchain(_buildDir, _libDir)
"-m32",
}
- configuration { "linux-g*", "x64" }
+ configuration { "linux-gcc*", "x64" }
targetdir (path.join(_buildDir, "linux64_gcc/bin"))
objdir (path.join(_buildDir, "linux64_gcc/obj"))
libdirs { path.join(_libDir, "lib/linux64_gcc") }
@@ -561,6 +605,44 @@ function toolchain(_buildDir, _libDir)
"-m64",
}
+ configuration { "linux-mips-gcc" }
+ targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
+ objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
+ libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
+ buildoptions {
+ "-Wunused-value",
+ "-Wundef",
+ }
+ buildoptions_cpp {
+ "-std=c++0x",
+ }
+ links {
+ "rt",
+ "dl",
+ }
+ linkoptions {
+ "-Wl,--gc-sections",
+ }
+
+ configuration { "linux-arm-gcc" }
+ targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
+ objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
+ libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
+ buildoptions {
+ "-Wunused-value",
+ "-Wundef",
+ }
+ buildoptions_cpp {
+ "-std=c++0x",
+ }
+ links {
+ "rt",
+ "dl",
+ }
+ linkoptions {
+ "-Wl,--gc-sections",
+ }
+
configuration { "android-*" }
flags {
"NoImportLib",
@@ -799,6 +881,10 @@ function toolchain(_buildDir, _libDir)
"-m64",
}
+ configuration { "osx", "Universal" }
+ targetdir (path.join(_buildDir, "osx_universal/bin"))
+ objdir (path.join(_buildDir, "osx_universal/bin"))
+
configuration { "osx" }
buildoptions {
"-Wfatal-errors",
@@ -819,6 +905,10 @@ function toolchain(_buildDir, _libDir)
}
includedirs { path.join(bxDir, "include/compat/ios") }
+ configuration { "xcode4", "ios*" }
+ targetdir (path.join(_buildDir, "ios-arm/bin"))
+ objdir (path.join(_buildDir, "ios-arm/obj"))
+
configuration { "ios-arm" }
targetdir (path.join(_buildDir, "ios-arm/bin"))
objdir (path.join(_buildDir, "ios-arm/obj"))
@@ -855,6 +945,74 @@ function toolchain(_buildDir, _libDir)
"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
}
+ configuration { "tvos*" }
+ linkoptions {
+ "-lc++",
+ }
+ buildoptions {
+ "-Wfatal-errors",
+ "-Wunused-value",
+ "-Wundef",
+ }
+ includedirs { path.join(bxDir, "include/compat/ios") }
+
+ configuration { "xcode4", "tvos*" }
+ targetdir (path.join(_buildDir, "tvos-arm64/bin"))
+ objdir (path.join(_buildDir, "tvos-arm64/obj"))
+
+ configuration { "tvos-arm64" }
+ targetdir (path.join(_buildDir, "tvos-arm64/bin"))
+ objdir (path.join(_buildDir, "tvos-arm64/obj"))
+ libdirs { path.join(_libDir, "lib/tvos-arm64") }
+ linkoptions {
+ "-mtvos-version-min=9.0",
+ "-arch arm64",
+ "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
+ "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
+ "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
+ "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
+ }
+ buildoptions {
+ "-mtvos-version-min=9.0",
+ "-arch arm64",
+ "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
+ }
+
+ configuration { "tvos-simulator" }
+ targetdir (path.join(_buildDir, "tvos-simulator/bin"))
+ objdir (path.join(_buildDir, "tvos-simulator/obj"))
+ libdirs { path.join(_libDir, "lib/tvos-simulator") }
+ linkoptions {
+ "-mtvos-simulator-version-min=9.0",
+ "-arch i386",
+ "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
+ "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
+ "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
+ "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
+ }
+ buildoptions {
+ "-mtvos-simulator-version-min=9.0",
+ "-arch i386",
+ "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
+ }
+
+ configuration { "ps4" }
+ targetdir (path.join(_buildDir, "ps4/bin"))
+ objdir (path.join(_buildDir, "ps4/obj"))
+ libdirs { path.join(_libDir, "lib/ps4") }
+ includedirs {
+ path.join(bxDir, "include/compat/freebsd"),
+ "$(PS4_SDK_ROOT)/target/include",
+ "$(PS4_SDK_ROOT)/target/include_common",
+ }
+ buildoptions {
+ }
+ buildoptions_cpp {
+ "-std=c++0x",
+ }
+ linkoptions {
+ }
+
configuration { "qnx-arm" }
targetdir (path.join(_buildDir, "qnx-arm/bin"))
objdir (path.join(_buildDir, "qnx-arm/obj"))
@@ -951,8 +1109,14 @@ function strip()
configuration { "asmjs" }
postbuildcommands {
"$(SILENT) echo Running asmjs finalize.",
- "$(SILENT) $(EMSCRIPTEN)/emcc -O2 -s TOTAL_MEMORY=268435456 \"$(TARGET)\" -o \"$(TARGET)\".html"
- -- ALLOW_MEMORY_GROWTH
+ "$(SILENT) $(EMSCRIPTEN)/emcc -O2 "
+-- .. "-s EMTERPRETIFY=1 "
+-- .. "-s EMTERPRETIFY_ASYNC=1 "
+ .. "-s TOTAL_MEMORY=268435456 "
+-- .. "-s ALLOW_MEMORY_GROWTH=1 "
+ .. "--memory-init-file 1 "
+ .. "\"$(TARGET)\" -o \"$(TARGET)\".html "
+-- .. "--preload-file ../../../examples/runtime@/"
}
configuration {} -- reset configuration