diff options
author | Spartan322 <Megacake1234@gmail.com> | 2023-07-25 02:24:01 +0200 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2023-07-26 23:54:58 +0200 |
commit | be1d0545c2f7a85a63d05b4bdc1020ee284e72cb (patch) | |
tree | 09cb0fa0a1dbe83d4833bcd62dc8832161e4329b /tools/linux.py | |
parent | 65443efcc2f4c7d687b2bd9c631f6bb426688bbf (diff) |
Initial structural commit
Diffstat (limited to 'tools/linux.py')
-rw-r--r-- | tools/linux.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/linux.py b/tools/linux.py new file mode 100644 index 0000000..0a2c35c --- /dev/null +++ b/tools/linux.py @@ -0,0 +1,35 @@ +# Copied from https://github.com/godotengine/godot-cpp/blob/2bf983e6382f5236948f7740faf130a3568f9dd0/tools/linux.py +from SCons.Variables import * +from SCons.Tool import clang, clangxx + + +def options(opts): + opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler - only effective when targeting Linux", False)) + + +def exists(env): + return True + + +def generate(env): + if env["use_llvm"]: + clang.generate(env) + clangxx.generate(env) + + env.Append(CCFLAGS=["-fPIC", "-Wwrite-strings"]) + env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"]) + + if env["arch"] == "x86_64": + # -m64 and -m32 are x86-specific already, but it doesn't hurt to + # be clear and also specify -march=x86-64. Similar with 32-bit. + env.Append(CCFLAGS=["-m64", "-march=x86-64"]) + env.Append(LINKFLAGS=["-m64", "-march=x86-64"]) + elif env["arch"] == "x86_32": + env.Append(CCFLAGS=["-m32", "-march=i686"]) + env.Append(LINKFLAGS=["-m32", "-march=i686"]) + elif env["arch"] == "arm64": + env.Append(CCFLAGS=["-march=armv8-a"]) + env.Append(LINKFLAGS=["-march=armv8-a"]) + elif env["arch"] == "rv64": + env.Append(CCFLAGS=["-march=rv64gc"]) + env.Append(LINKFLAGS=["-march=rv64gc"]) |