Skip to content

Commit

Permalink
Fix build on X11 following 64-bit detection changes
Browse files Browse the repository at this point in the history
This also ports over the cross-compilation logic to the `server`
platform, and allows Embree to be used in server tools builds on aarch64.
  • Loading branch information
Calinou authored and Relintai committed Feb 8, 2024
1 parent 6fa76ac commit 19be158
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions platform/server/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,17 @@ def configure(env):

## Architecture

is64 = sys.maxsize > 2 ** 32
# Cross-compilation
# TODO: Support cross-compilation on architectures other than x86.
host_is_64_bit = sys.maxsize > 2**32
if env["bits"] == "default":
env["bits"] = "64" if is64 else "32"
env["bits"] = "64" if host_is_64_bit else "32"
if host_is_64_bit and (env["bits"] == "32" or env["arch"] == "x86"):
env.Append(CCFLAGS=["-m32"])
env.Append(LINKFLAGS=["-m32"])
elif not host_is_64_bit and (env["bits"] == "64" or env["arch"] == "x86_64"):
env.Append(CCFLAGS=["-m64"])
env.Append(LINKFLAGS=["-m64"])

if env["arch"] == "" and platform.machine() == "riscv64":
env["arch"] = "rv64"
Expand Down

0 comments on commit 19be158

Please sign in to comment.