summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/toolchain.lua
diff options
context:
space:
mode:
author Jeffrey Clark <dude@zaplabs.com>2015-11-02 21:05:34 -0600
committer Jeffrey Clark <dude@zaplabs.com>2016-02-15 12:09:35 -0600
commit36df7413dce0897215d3e01e54ac5334bb65d965 (patch)
treecd39de38a12b851bafcf992aec2d488ab80f8247 /scripts/toolchain.lua
parent4e7f9e86e81af80de19f90b50632a1b579d9e4c3 (diff)
add TOOLCHAIN make flag for explicit toolchain prefix cross compiling (nw)
Diffstat (limited to 'scripts/toolchain.lua')
-rw-r--r--scripts/toolchain.lua47
1 files changed, 27 insertions, 20 deletions
diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua
index 27b571e18d0..aaf8811fed1 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
@@ -911,7 +920,6 @@ function toolchain(_buildDir, _subDir)
end
function strip()
-
configuration { "android-arm", "Release" }
postbuildcommands {
"$(SILENT) echo Stripping symbols.",
@@ -939,13 +947,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" }