Skip to content

Commit

Permalink
android
Browse files Browse the repository at this point in the history
  • Loading branch information
Faless committed Jan 8, 2025
1 parent e32d9d0 commit c119e00
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import os, sys, platform, json, subprocess
import SCons


# This must be kept in sync with the value in https://github.com/godotengine/godot/blob/master/platform/android/detect.py#L58.
def get_ndk_version():
return "23.2.8568313"


def add_sources(sources, dirpath, extension):
for f in os.listdir(dirpath):
if f.endswith("." + extension):
Expand Down
10 changes: 7 additions & 3 deletions tools/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import SCons.Action


# This must be kept in sync with the value in https://github.com/godotengine/godot/blob/master/platform/android/detect.py#L58.
def get_ndk_version():
return "23.2.8568313"


def cmake_default_flags(env):
if env.get("cmake_default_flags", ""):
return SCons.Util.CLVar(env["cmake_default_flags"])
Expand All @@ -28,9 +33,8 @@ def cmake_default_flags(env):
config["CMAKE_SYSTEM_VERSION"] = api
config["CMAKE_ANDROID_ARCH_ABI"] = abi
config["ANDROID_ABI"] = abi
config["CMAKE_TOOLCHAIN_FILE"] = "%s/build/cmake/android.toolchain.cmake" % env.get(
"ANDROID_NDK_ROOT", os.environ.get("ANDROID_NDK_ROOT", "")
)
ndk_root = os.environ.get("ANDROID_NDK_ROOT", env.get("ANDROID_HOME", "") + "/ndk/" + get_ndk_version())
config["CMAKE_TOOLCHAIN_FILE"] = "%s/build/cmake/android.toolchain.cmake" % ndk_root
config["CMAKE_ANDROID_STL_TYPE"] = "c++_static"

elif env["platform"] == "linux":
Expand Down
10 changes: 7 additions & 3 deletions tools/openssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
from SCons.Variables import PathVariable, BoolVariable


# This must be kept in sync with the value in https://github.com/godotengine/godot/blob/master/platform/android/detect.py#L58.
def get_ndk_version():
return "23.2.8568313"


def ssl_platform_target(env):
targets = {}
platform = env["platform"]
Expand Down Expand Up @@ -76,8 +81,6 @@ def ssl_platform_options(env):
def ssl_platform_flags(env):
args = []
if env["platform"] == "android":
for k in ["CC", "CXX", "AR", "AS", "RANLIB"]:
args.append("%s=%s" % (k, env[k]))
if env.get("android_api_level", ""):
api = int(env["android_api_level"])
args.append("-D__ANDROID_API__=%s" % api)
Expand Down Expand Up @@ -266,7 +269,8 @@ def generate(env):
if cc_path and cc_path not in env["ENV"]:
env.PrependENVPath("PATH", cc_path)
if "ANDROID_NDK_ROOT" not in env["ENV"]:
env["ENV"]["ANDROID_NDK_ROOT"] = env.get("ANDROID_NDK_ROOT", os.environ.get("ANDROID_NDK_ROOT", ""))
ndk_root = os.environ.get("ANDROID_NDK_ROOT", env.get("ANDROID_HOME", "") + "/ndk/" + get_ndk_version())
env["ENV"]["ANDROID_NDK_ROOT"] = ndk_root

env["SSL_SOURCE"] = env.Dir(env["openssl_source"]).abspath
env["SSL_BUILD"] = env.Dir(env["openssl_build"] + "/{}/{}".format(env["platform"], env["arch"])).abspath
Expand Down

0 comments on commit c119e00

Please sign in to comment.