summaryrefslogtreecommitdiffstatshomepage
path: root/scripts
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
parent4e7f9e86e81af80de19f90b50632a1b579d9e4c3 (diff)
add TOOLCHAIN make flag for explicit toolchain prefix cross compiling (nw)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/genie.lua9
-rw-r--r--scripts/src/osd/sdl.lua2
-rw-r--r--scripts/toolchain.lua47
3 files changed, 37 insertions, 21 deletions
diff --git a/scripts/genie.lua b/scripts/genie.lua
index 4384b9f379b..8d52dc75391 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -198,6 +198,11 @@ newoption {
}
newoption {
+ trigger = "TOOLCHAIN",
+ description = "Toolchain prefix"
+}
+
+newoption {
trigger = "PROFILE",
description = "Enable profiling.",
}
@@ -427,6 +432,10 @@ if(_OPTIONS["USE_BGFX"]~=nil) then
USE_BGFX = tonumber(_OPTIONS["USE_BGFX"])
end
+if(_OPTIONS["TOOLCHAIN"] == nil) then
+ _OPTIONS['TOOLCHAIN'] = ""
+end
+
GEN_DIR = MAME_BUILD_DIR .. "generated/"
if (_OPTIONS["target"] == nil) then return false end
diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua
index fd8cf22b026..6a63e7caf91 100644
--- a/scripts/src/osd/sdl.lua
+++ b/scripts/src/osd/sdl.lua
@@ -106,7 +106,7 @@ end
function sdlconfigcmd()
if not _OPTIONS["SDL_INSTALL_ROOT"] then
- return _OPTIONS["SDL_LIBVER"] .. "-config"
+ return _OPTIONS['TOOLCHAIN'] .. "pkg-config " .. _OPTIONS["SDL_LIBVER"]
else
return path.join(_OPTIONS["SDL_INSTALL_ROOT"],"bin",_OPTIONS["SDL_LIBVER"]) .. "-config"
end
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" }