From e689306018219cc4078fa6eee609c888ddf37e3e Mon Sep 17 00:00:00 2001 From: DmitriySalnikov Date: Fri, 23 Aug 2024 21:39:24 +0300 Subject: [PATCH] Updated build script --- .gitignore | 1 + SConstruct | 10 +++++++++- lib_utils_external.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4628dae6..10b2096b 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ used_classes.json .mono/ obj/ bin/ +cmake_build_out/* src/gen/* src/editor/my_telemetry_modules addons/debug_draw_3d/libs/~* diff --git a/SConstruct b/SConstruct index a149d7bf..b61b80d8 100644 --- a/SConstruct +++ b/SConstruct @@ -4,7 +4,7 @@ from SCons.Script import SConscript from SCons.Script.SConscript import SConsEnvironment import SCons, SCons.Script -import os, platform +import sys, os, platform import lib_utils, lib_utils_external # Fixing the encoding of the console @@ -131,11 +131,19 @@ def apply_patches(target, source, env: SConsEnvironment): return lib_utils_external.apply_git_patches(env, patches_to_apply, "godot-cpp") +def get_android_toolchain() -> str: + sys.path.insert(0, "godot-cpp/tools") + import android + sys.path.pop(0) + return os.path.join(android.get_android_ndk_root(env), "build/cmake/android.toolchain.cmake") + # Additional build of the projects via CMake # def build_cmake(target, source, env: SConsEnvironment): # extra_flags = [] # if env["platform"] in ["macos", "ios"]: # extra_flags += ["-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64", "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14"] +# if env["platform"] in ["android"]: +# extra_flags += [f"-DCMAKE_TOOLCHAIN_FILE={get_android_toolchain()}"] # return lib_utils_external.cmake_build_project(env, "project", extra_flags) env: SConsEnvironment = SConscript("godot-cpp/SConstruct") diff --git a/lib_utils_external.py b/lib_utils_external.py index 421e9f2b..b0255138 100644 --- a/lib_utils_external.py +++ b/lib_utils_external.py @@ -11,7 +11,7 @@ def get_cmake_build_dir_name(env: SConsEnvironment) -> str: if env.get("threads", True) and env["platform"] == "web": return f"{env["platform"]}_{env["arch"]}_threads" - return f"{env["platform"]}_{env["arch"]}" + return f"cmake_build_out/{env["platform"]}_{env["arch"]}" # Get a path to the build folder of the cmake library