summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/toolchain.lua
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-02-21 11:48:45 +0100
committer ImJezze <jezze@gmx.net>2016-02-21 11:48:45 +0100
commitcc24a339d8c0517259084b5c178d784626ba965c (patch)
tree9868e9687b5802ae0a3733712a3bbeb3bc75c953 /scripts/toolchain.lua
parentb5daabda5495dea5c50e17961ecfed2ea8619d76 (diff)
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Second attempt
Diffstat (limited to 'scripts/toolchain.lua')
-rw-r--r--scripts/toolchain.lua59
1 files changed, 39 insertions, 20 deletions
diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua
index 7fad61ce928..137a873ae09 100644
--- a/scripts/toolchain.lua
+++ b/scripts/toolchain.lua
@@ -4,6 +4,11 @@
--
local naclToolchain = ""
+local toolchainPrefix = ""
+
+if _OPTIONS['TOOLCHAIN'] then
+ toolchainPrefix = _OPTIONS["TOOLCHAIN"]
+end
newoption {
trigger = "gcc",
@@ -204,15 +209,18 @@ function toolchain(_buildDir, _subDir)
if not os.getenv("MINGW32") then
print("Set MINGW32 envrionment variable.")
end
- premake.gcc.cc = "$(MINGW32)/bin/i686-w64-mingw32-gcc"
- premake.gcc.cxx = "$(MINGW32)/bin/i686-w64-mingw32-g++"
+ if not toolchainPrefix then
+ toolchainPrefix = "$(MINGW32)/bin/i686-w64-mingw32-"
+ end
+ premake.gcc.cc = toolchainPrefix .. "gcc"
+ premake.gcc.cxx = toolchainPrefix .. "g++"
-- work around GCC 4.9.2 not having proper linker for LTO=1 usage
local version_4_ar = str_to_version(_OPTIONS["gcc_version"])
if (version_4_ar < 50000) then
- premake.gcc.ar = "$(MINGW32)/bin/ar"
+ premake.gcc.ar = toolchainPrefix .. "ar"
end
if (version_4_ar >= 50000) then
- premake.gcc.ar = "$(MINGW32)/bin/gcc-ar"
+ premake.gcc.ar = toolchainPrefix .. "gcc-ar"
end
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw32-gcc")
end
@@ -221,20 +229,22 @@ function toolchain(_buildDir, _subDir)
if not os.getenv("MINGW64") then
print("Set MINGW64 envrionment variable.")
end
- premake.gcc.cc = "$(MINGW64)/bin/x86_64-w64-mingw32-gcc"
- premake.gcc.cxx = "$(MINGW64)/bin/x86_64-w64-mingw32-g++"
+ if not toolchainPrefix then
+ toolchainPrefix = "$(MINGW64)/bin/x86_64-w64-mingw32-"
+ end
+ premake.gcc.cc = toolchainPrefix .. "gcc"
+ premake.gcc.cxx = toolchainPrefix .. "g++"
-- work around GCC 4.9.2 not having proper linker for LTO=1 usage
local version_4_ar = str_to_version(_OPTIONS["gcc_version"])
if (version_4_ar < 50000) then
- premake.gcc.ar = "$(MINGW64)/bin/ar"
+ premake.gcc.ar = toolchainPrefix .. "ar"
end
if (version_4_ar >= 50000) then
- premake.gcc.ar = "$(MINGW64)/bin/gcc-ar"
+ premake.gcc.ar = toolchainPrefix .. "gcc-ar"
end
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw64-gcc")
end
-
if "mingw-clang" == _OPTIONS["gcc"] then
premake.gcc.cc = "clang"
premake.gcc.cxx = "clang++"
@@ -283,18 +293,17 @@ function toolchain(_buildDir, _subDir)
if "osx" == _OPTIONS["gcc"] then
if os.is("linux") then
- local osxToolchain = "x86_64-apple-darwin13-"
- premake.gcc.cc = osxToolchain .. "clang"
- premake.gcc.cxx = osxToolchain .. "clang++"
- premake.gcc.ar = osxToolchain .. "ar"
+ premake.gcc.cc = toolchainPrefix .. "clang"
+ premake.gcc.cxx = toolchainPrefix .. "clang++"
+ premake.gcc.ar = toolchainPrefix .. "ar"
end
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx")
end
if "osx-clang" == _OPTIONS["gcc"] then
- premake.gcc.cc = "clang"
- premake.gcc.cxx = "clang++"
- premake.gcc.ar = "ar"
+ premake.gcc.cc = toolchainPrefix .. "clang"
+ premake.gcc.cxx = toolchainPrefix .. "clang++"
+ premake.gcc.ar = toolchainPrefix .. "ar"
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx-clang")
end
@@ -496,7 +505,9 @@ function toolchain(_buildDir, _subDir)
configuration { "steamlink" }
objdir ( _buildDir .. "steamlink/obj")
-
+ defines {
+ "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it.
+ }
buildoptions {
"-marm",
"-mfloat-abi=hard",
@@ -909,6 +920,15 @@ function toolchain(_buildDir, _subDir)
end
function strip()
+ if _OPTIONS["STRIP_SYMBOLS"]~="1" then
+ return true
+ end
+
+ configuration { "osx-*", "Release" }
+ postbuildcommands {
+ "$(SILENT) echo Stripping symbols.",
+ "$(SILENT) " .. (_OPTIONS['TOOLCHAIN'] and toolchainPrefix) .. "strip \"$(TARGET)\"",
+ }
configuration { "android-arm", "Release" }
postbuildcommands {
@@ -937,13 +957,12 @@ function strip()
configuration { "mingw*", "x64", "Release" }
postbuildcommands {
"$(SILENT) echo Stripping symbols.",
- "$(SILENT) $(MINGW64)/bin/strip -s \"$(TARGET)\"",
+ "$(SILENT) " .. (_OPTIONS['TOOLCHAIN'] and toolchainPrefix or "$(MINGW64)/bin/") .. "strip -s \"$(TARGET)\"",
}
-
configuration { "mingw*", "x32", "Release" }
postbuildcommands {
"$(SILENT) echo Stripping symbols.",
- "$(SILENT) $(MINGW32)/bin/strip -s \"$(TARGET)\""
+ "$(SILENT) " .. (_OPTIONS['TOOLCHAIN'] and toolchainPrefix or "$(MINGW32)/bin/") .. "strip -s \"$(TARGET)\"",
}
configuration { "pnacl" }