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.lua64
1 files changed, 57 insertions, 7 deletions
diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua
index 6a01c92422c..0152ce79c32 100644
--- a/3rdparty/bx/scripts/toolchain.lua
+++ b/3rdparty/bx/scripts/toolchain.lua
@@ -6,6 +6,43 @@
local bxDir = path.getabsolute("..")
local naclToolchain = ""
+local function crtNone()
+
+ defines {
+ "BX_CRT_NONE=1",
+ }
+
+ buildoptions {
+ "-nostdlib",
+ "-nodefaultlibs",
+ "-nostartfiles",
+ "-Wa,--noexecstack",
+ "-ffreestanding",
+ }
+
+ linkoptions {
+ "-nostdlib",
+ "-nodefaultlibs",
+ "-nostartfiles",
+ "-Wa,--noexecstack",
+ "-ffreestanding",
+ }
+
+ configuration { "linux-*" }
+
+ buildoptions {
+ "-mpreferred-stack-boundary=4",
+ "-mstackrealign",
+ }
+
+ linkoptions {
+ "-mpreferred-stack-boundary=4",
+ "-mstackrealign",
+ }
+
+ configuration {}
+end
+
function toolchain(_buildDir, _libDir)
newoption {
@@ -152,6 +189,10 @@ function toolchain(_buildDir, _libDir)
compiler32bit = true
end
+ flags {
+ "ExtraWarnings",
+ }
+
if _ACTION == "gmake" or _ACTION == "ninja" then
if nil == _OPTIONS["gcc"] then
@@ -159,20 +200,18 @@ function toolchain(_buildDir, _libDir)
os.exit(1)
end
- flags {
- "ExtraWarnings",
- }
-
if "android-arm" == _OPTIONS["gcc"] then
if not os.getenv("ANDROID_NDK_ARM")
or not os.getenv("ANDROID_NDK_CLANG")
or not os.getenv("ANDROID_NDK_ROOT") then
- print("Set ANDROID_NDK_CLANG and ANDROID_NDK_ROOT envrionment variables.")
+ print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT envrionment variables.")
end
premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
+ premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
+
premake.gcc.llvm = true
location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
@@ -181,7 +220,7 @@ function toolchain(_buildDir, _libDir)
if not os.getenv("ANDROID_NDK_MIPS")
or not os.getenv("ANDROID_NDK_CLANG")
or not os.getenv("ANDROID_NDK_ROOT") then
- print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.")
+ print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT envrionment variables.")
end
premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
@@ -194,7 +233,7 @@ function toolchain(_buildDir, _libDir)
if not os.getenv("ANDROID_NDK_X86")
or not os.getenv("ANDROID_NDK_CLANG")
or not os.getenv("ANDROID_NDK_ROOT") then
- print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.")
+ print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT envrionment variables.")
end
premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
@@ -516,6 +555,10 @@ function toolchain(_buildDir, _libDir)
flags { "EnableAVX" }
end
+ if _OPTIONS["with-crtnone"] then
+ crtNone()
+ end
+
flags {
"NoPCH",
"NativeWChar",
@@ -1306,6 +1349,7 @@ function toolchain(_buildDir, _libDir)
}
links {
"rt",
+ "dl",
}
linkoptions {
"-Wl,--gc-sections",
@@ -1400,5 +1444,11 @@ function strip()
-- .. "--preload-file ../../../examples/runtime@/"
}
+ configuration { "riscv" }
+ postbuildcommands {
+ "$(SILENT) echo Stripping symbols.",
+ "$(SILENT) $(FREEDOM_E_SDK)/toolchain/bin/riscv32-unknown-elf-strip -s \"$(TARGET)\""
+ }
+
configuration {} -- reset configuration
end