Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ jobs:
- name: Setup python and scons
uses: ./.github/actions/godot-deps

- name: Compilation (armv7)
- name: Compilation (arm32)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} android_arch=armv7
sconsflags: ${{ env.SCONSFLAGS }} arch=arm32
platform: android
target: release
tools: false
tests: false

- name: Compilation (arm64v8)
- name: Compilation (arm64)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} android_arch=arm64v8
sconsflags: ${{ env.SCONSFLAGS }} arch=arm64
platform: android
target: release
tools: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup python and scons
uses: ./.github/actions/godot-deps

- name: Compilation (arm64v8)
- name: Compilation (arm64)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
tests: false # Disabled due freeze caused by mix Mono build and CI
sconsflags: module_mono_enabled=yes
doc-test: true
bin: "./bin/godot.linuxbsd.opt.tools.64.mono"
bin: "./bin/godot.linuxbsd.opt.tools.x86_64.mono"
build-mono: true
proj-conv: true
artifact: true
Expand All @@ -43,7 +43,7 @@ jobs:
# Can be turned off for PRs that intentionally break compat with godot-cpp,
# until both the upstream PR and the matching godot-cpp changes are merged.
godot-cpp-test: true
bin: "./bin/godot.linuxbsd.double.tools.64.san"
bin: "./bin/godot.linuxbsd.double.tools.x86_64.san"
build-mono: false
# Skip 2GiB artifact speeding up action.
artifact: false
Expand All @@ -54,7 +54,7 @@ jobs:
tools: true
tests: true
sconsflags: use_asan=yes use_ubsan=yes use_llvm=yes linker=lld
bin: "./bin/godot.linuxbsd.tools.64.llvm.san"
bin: "./bin/godot.linuxbsd.tools.x86_64.llvm.san"
build-mono: false
# Skip 2GiB artifact speeding up action.
artifact: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
target: release_debug
tools: true
tests: true
bin: "./bin/godot.macos.opt.tools.64"
bin: "./bin/godot.macos.opt.tools.x86_64"

- name: Template (target=release, tools=no)
cache-name: macos-template
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
tests: true
# Skip debug symbols, they're way too big with MSVC.
sconsflags: debug_symbols=no
bin: "./bin/godot.windows.opt.tools.64.exe"
bin: "./bin/godot.windows.opt.tools.x86_64.exe"

- name: Template (target=release, tools=no)
cache-name: windows-template
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Godot runs on a large variety of platforms and operating systems and devices.

For bugs that are likely OS-specific and/or graphics-related, please also specify:

- Device (CPU model including architecture, e.g. x86, x86_64, ARM, etc.)
- Device (CPU model including architecture, e.g. x86_64, arm64, etc.)
- GPU model (and the driver version in use if you know it)

**Bug reports not including the required information may be closed at the
Expand Down
21 changes: 10 additions & 11 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ _helper_module("modules.modules_builders", "modules/modules_builders.py")
import methods
import glsl_builders
import gles3_builders
from platform_methods import architectures, architecture_aliases

if methods.get_cmdline_bool("tools", True):
_helper_module("editor.editor_builders", "editor/editor_builders.py")
Expand Down Expand Up @@ -161,12 +162,11 @@ if profile:
opts = Variables(customs, ARGUMENTS)

# Target build options
opts.Add("p", "Platform (alias for 'platform')", "")
opts.Add("platform", "Target platform (%s)" % ("|".join(platform_list),), "")
opts.Add("p", "Platform (alias for 'platform')", "")
opts.Add(BoolVariable("tools", "Build the tools (a.k.a. the Godot editor)", True))
opts.Add(EnumVariable("target", "Compilation target", "debug", ("debug", "release_debug", "release")))
opts.Add("arch", "Platform-dependent architecture (arm/arm64/x86/x64/mips/...)", "")
opts.Add(EnumVariable("bits", "Target platform bits", "default", ("default", "32", "64")))
opts.Add(EnumVariable("arch", "CPU architecture", "auto", ["auto"] + architectures, architecture_aliases))
opts.Add(EnumVariable("float", "Floating-point precision", "default", ("default", "32", "64")))
opts.Add(EnumVariable("optimize", "Optimization type", "speed", ("speed", "size", "none")))
opts.Add(BoolVariable("production", "Set defaults to build Godot for use in production", False))
Expand Down Expand Up @@ -502,12 +502,17 @@ if selected_platform in platform_list:
# Platform specific flags
flag_list = platform_flags[selected_platform]
for f in flag_list:
if not (f[0] in ARGUMENTS): # allow command line to override platform flags
if not (f[0] in ARGUMENTS) or ARGUMENTS[f[0]] == "auto": # Allow command line to override platform flags
env[f[0]] = f[1]

# Must happen after the flags' definition, so that they can be used by platform detect
detect.configure(env)

print(
'Building for platform "%s", architecture "%s", %s, target "%s".'
% (selected_platform, env["arch"], "editor" if env["tools"] else "template", env["target"])
)

# Set our C and C++ standard requirements.
# C++17 is required as we need guaranteed copy elision as per GH-36436.
# Prepending to make it possible to override.
Expand Down Expand Up @@ -693,13 +698,7 @@ if selected_platform in platform_list:
)
suffix += ".debug"

if env["arch"] != "":
suffix += "." + env["arch"]
elif env["bits"] == "32":
suffix += ".32"
elif env["bits"] == "64":
suffix += ".64"

suffix += "." + env["arch"]
suffix += env.extra_suffix

sys.path.remove(tmppath)
Expand Down
2 changes: 1 addition & 1 deletion drivers/png/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if env["builtin_libpng"]:
import os

# Enable ARM NEON instructions on 32-bit Android to compile more optimized code.
use_neon = "android_arch" in env and env["android_arch"] == "armv7" and os.name != "nt"
use_neon = env["platform"] == "android" and env["arch"] == "arm32" and os.name != "nt"
if use_neon:
env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 2)])
else:
Expand Down
2 changes: 1 addition & 1 deletion methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def detect_visual_c_compiler_version(tools_env):
# and not scons setup environment (env)... so make sure you call the right environment on it or it will fail to detect
# the proper vc version that will be called

# There is no flag to give to visual c compilers to set the architecture, i.e. scons bits argument (32,64,ARM etc)
# There is no flag to give to visual c compilers to set the architecture, i.e. scons arch argument (x86_32, x86_64, arm64, etc.).
# There are many different cl.exe files that are run, and each one compiles & links to a different architecture
# As far as I know, the only way to figure out what compiler will be run when Scons calls cl.exe via Program()
# is to check the PATH variable and figure out which one will be called first. Code below does that and returns:
Expand Down
9 changes: 1 addition & 8 deletions modules/denoise/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ def can_build(env, platform):
# as doing lightmap generation and denoising on Android or HTML5
# would be a bit far-fetched.
desktop_platforms = ["linuxbsd", "macos", "windows"]
supported_arch = env["bits"] == "64"
if env["arch"] == "arm64":
supported_arch = False
if env["arch"].startswith("ppc"):
supported_arch = False
if env["arch"].startswith("rv"):
supported_arch = False
return env["tools"] and platform in desktop_platforms and supported_arch
return env["tools"] and platform in desktop_platforms and env["arch"] == "x86_64"


def configure(env):
Expand Down
24 changes: 10 additions & 14 deletions modules/mono/build_scripts/mono_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def configure(env, env_mono):
# is_android = env["platform"] == "android"
# is_javascript = env["platform"] == "javascript"
# is_ios = env["platform"] == "ios"
# is_ios_sim = is_ios and env["arch"] in ["x86", "x86_64"]
# is_ios_sim = is_ios and env["arch"] in ["x86_32", "x86_64"]

tools_enabled = env["tools"]

Expand Down Expand Up @@ -128,26 +128,22 @@ def get_runtime_path():


def determine_runtime_identifier(env):
# The keys are Godot's names, the values are the Microsoft's names.
# List: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
names_map = {
"windows": "win",
"macos": "osx",
"linuxbsd": "linux",
}

# .NET RID architectures: x86, x64, arm, or arm64

arch_map = {
"x86_64": "x64",
"x86_32": "x86",
"arm64": "arm64",
"arm32": "arm",
}
platform = env["platform"]

if is_desktop(platform):
if env["arch"] in ["arm", "arm32"]:
rid = "arm"
elif env["arch"] == "arm64":
rid = "arm64"
else:
bits = env["bits"]
bit_arch_map = {"64": "x64", "32": "x86"}
rid = bit_arch_map[bits]
return "%s-%s" % (names_map[platform], rid)
return "%s-%s" % (names_map[platform], arch_map[env["arch"]])
else:
raise NotImplementedError()

Expand Down
44 changes: 24 additions & 20 deletions modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,17 @@ public static void CompileAssemblies(ExportPlugin exporter, AotOptions aotOpts,
}
else
{
string bits = features.Contains("64") ? "64" : features.Contains("32") ? "32" : null;
CompileAssembliesForDesktop(exporter, platform, isDebug, bits, aotOpts, aotTempDir, outputDataDir, assembliesPrepared, bclDir);
string arch = "";
if (features.Contains("x86_64")) {
arch = "x86_64";
} else if (features.Contains("x86_32")) {
arch = "x86_32";
} else if (features.Contains("arm64")) {
arch = "arm64";
} else if (features.Contains("arm32")) {
arch = "arm32";
}
CompileAssembliesForDesktop(exporter, platform, isDebug, arch, aotOpts, aotTempDir, outputDataDir, assembliesPrepared, bclDir);
}
}

Expand Down Expand Up @@ -112,7 +121,7 @@ public static void CompileAssembliesForAndroid(ExportPlugin exporter, bool isDeb
}
}

public static void CompileAssembliesForDesktop(ExportPlugin exporter, string platform, bool isDebug, string bits, AotOptions aotOpts, string aotTempDir, string outputDataDir, IDictionary<string, string> assemblies, string bclDir)
public static void CompileAssembliesForDesktop(ExportPlugin exporter, string platform, bool isDebug, string arch, AotOptions aotOpts, string aotTempDir, string outputDataDir, IDictionary<string, string> assemblies, string bclDir)
{
foreach (var assembly in assemblies)
{
Expand All @@ -126,9 +135,9 @@ public static void CompileAssembliesForDesktop(ExportPlugin exporter, string pla
string outputFileName = assemblyName + ".dll" + outputFileExtension;
string tempOutputFilePath = Path.Combine(aotTempDir, outputFileName);

var compilerArgs = GetAotCompilerArgs(platform, isDebug, bits, aotOpts, assemblyPath, tempOutputFilePath);
var compilerArgs = GetAotCompilerArgs(platform, isDebug, arch, aotOpts, assemblyPath, tempOutputFilePath);

string compilerDirPath = GetMonoCrossDesktopDirName(platform, bits);
string compilerDirPath = GetMonoCrossDesktopDirName(platform, arch);

ExecuteCompiler(FindCrossCompiler(compilerDirPath), compilerArgs, bclDir);

Expand Down Expand Up @@ -432,9 +441,9 @@ private static IEnumerable<string> GetAotCompilerArgs(string platform, bool isDe

var androidToolPrefixes = new Dictionary<string, string>
{
["armeabi-v7a"] = "arm-linux-androideabi-",
["arm64-v8a"] = "aarch64-linux-android-",
["x86"] = "i686-linux-android-",
["arm32"] = "arm-linux-androideabi-",
["arm64"] = "aarch64-linux-android-",
["x86_32"] = "i686-linux-android-",
["x86_64"] = "x86_64-linux-android-"
};

Expand Down Expand Up @@ -547,9 +556,9 @@ private static IEnumerable<string> GetEnabledAndroidAbis(string[] features)
{
var androidAbis = new[]
{
"armeabi-v7a",
"arm64-v8a",
"x86",
"arm32",
"arm64",
"x86_32",
Comment on lines -550 to +561
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably wrong. It doesn't match the changes you made in mono_configure.py, as you can see those were the values from the dict, not the keys.

"x86_64"
};

Expand All @@ -560,9 +569,9 @@ private static string GetAndroidTriple(string abi)
{
var abiArchs = new Dictionary<string, string>
{
["armeabi-v7a"] = "armv7",
["arm64-v8a"] = "aarch64-v8a",
["x86"] = "i686",
["arm32"] = "armv7",
["arm64"] = "aarch64-v8a",
["x86_32"] = "i686",
["x86_64"] = "x86_64"
};

Expand All @@ -571,30 +580,25 @@ private static string GetAndroidTriple(string abi)
return $"{arch}-linux-android";
}

private static string GetMonoCrossDesktopDirName(string platform, string bits)
private static string GetMonoCrossDesktopDirName(string platform, string arch)
{
switch (platform)
{
case OS.Platforms.Windows:
case OS.Platforms.UWP:
{
string arch = bits == "64" ? "x86_64" : "i686";
return $"windows-{arch}";
}
case OS.Platforms.MacOS:
{
Debug.Assert(bits == null || bits == "64");
string arch = "x86_64";
return $"{platform}-{arch}";
}
case OS.Platforms.LinuxBSD:
{
string arch = bits == "64" ? "x86_64" : "i686";
return $"linux-{arch}";
}
case OS.Platforms.Haiku:
{
string arch = bits == "64" ? "x86_64" : "i686";
return $"{platform}-{arch}";
}
default:
Expand Down
4 changes: 2 additions & 2 deletions modules/raycast/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if env["builtin_embree"]:
env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_SSE2", "EMBREE_LOWEST_ISA", "TASKING_INTERNAL", "NDEBUG"])

if not env.msvc:
if env["arch"] in ["x86", "x86_64"]:
if env["arch"] == "x86_64":
env_raycast.Append(CPPFLAGS=["-msse2", "-mxsave"])

if env["platform"] == "windows":
Expand All @@ -83,7 +83,7 @@ if env["builtin_embree"]:
env_thirdparty.disable_warnings()
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)

if not env["arch"] in ["x86", "x86_64"] or env.msvc:
if env["arch"] == "arm64" or env.msvc:
# Embree needs those, it will automatically use SSE2NEON in ARM
env_thirdparty.Append(CPPDEFINES=["__SSE2__", "__SSE__"])

Expand Down
16 changes: 2 additions & 14 deletions modules/raycast/config.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
def can_build(env, platform):
# Depends on Embree library, which only supports x86_64 and aarch64.
if env["arch"].startswith("rv") or env["arch"].startswith("ppc"):
return False

if platform == "android":
return env["android_arch"] in ["arm64v8", "x86_64"]

if platform == "javascript":
return False # No SIMD support yet

if env["bits"] == "32":
return False

return True
# Depends on Embree library, which only supports x86_64 and arm64.
return env["arch"] in ["x86_64", "arm64"]


def configure(env):
Expand Down
8 changes: 4 additions & 4 deletions platform/android/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSU
env.Depends(lib, thirdparty_obj)

lib_arch_dir = ""
if env["android_arch"] == "armv7":
if env["arch"] == "arm32":
lib_arch_dir = "armeabi-v7a"
elif env["android_arch"] == "arm64v8":
elif env["arch"] == "arm64":
lib_arch_dir = "arm64-v8a"
elif env["android_arch"] == "x86":
elif env["arch"] == "x86_32":
lib_arch_dir = "x86"
elif env["android_arch"] == "x86_64":
elif env["arch"] == "x86_64":
lib_arch_dir = "x86_64"
else:
print("WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin")
Expand Down
Loading