diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/SConstruct | 22 | ||||
-rw-r--r-- | test/src/example.cpp | 2 |
2 files changed, 18 insertions, 6 deletions
diff --git a/test/SConstruct b/test/SConstruct index c03138c..61a5a86 100644 --- a/test/SConstruct +++ b/test/SConstruct @@ -38,12 +38,13 @@ opts.Add( host_platform, # We'll need to support these in due times # allowed_values=("linux", "freebsd", "osx", "windows", "android", "ios", "javascript"), - allowed_values=("linux", "windows"), + allowed_values=("linux", "windows", "osx"), ignorecase=2, ) ) opts.Add(EnumVariable("bits", "Target platform bits", "64", ("32", "64"))) opts.Add(BoolVariable("use_llvm", "Use the LLVM / Clang compiler", "no")) +opts.Add(EnumVariable("macos_arch", "Target macOS architecture", "universal", ["universal", "x86_64", "arm64"])) opts.Add(PathVariable("target_path", "The path where the lib is installed.", default_target_path, PathVariable.PathAccept)) opts.Add(PathVariable("target_name", "The library name.", default_library_name, PathVariable.PathAccept)) @@ -90,14 +91,25 @@ if env["target"] == "debug": if env["platform"] == "osx": env["target_path"] += "osx/" cpp_library += ".osx" - env.Append(CCFLAGS=["-arch", "x86_64"]) + + if env["bits"] == "32": + raise ValueError("Only 64-bit builds are supported for the macOS target.") + + if env["macos_arch"] == "universal": + env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"]) + env.Append(CCFLAGS=["-arch", "x86_64", "-arch", "arm64"]) + else: + env.Append(LINKFLAGS=["-arch", env["macos_arch"]]) + env.Append(CCFLAGS=["-arch", env["macos_arch"]]) + env.Append(CXXFLAGS=["-std=c++17"]) - env.Append(LINKFLAGS=["-arch", "x86_64"]) if env["target"] == "debug": env.Append(CCFLAGS=["-g", "-O2"]) else: env.Append(CCFLAGS=["-g", "-O3"]) + arch_suffix = env["macos_arch"] + elif env["platform"] in ("x11", "linux"): cpp_library += ".linux" env.Append(CCFLAGS=["-fPIC"]) @@ -107,6 +119,7 @@ elif env["platform"] in ("x11", "linux"): else: env.Append(CCFLAGS=["-g", "-O3"]) + arch_suffix = str(bits) elif env["platform"] == "windows": cpp_library += ".windows" # This makes sure to keep the session environment variables on windows, @@ -127,8 +140,7 @@ elif env["platform"] == "windows": if not(env["use_llvm"]): env.Append(CPPDEFINES=["TYPED_METHOD_BIND"]) -# determine our architecture suffix -arch_suffix = str(bits) + arch_suffix = str(bits) # suffix our godot-cpp library cpp_library += "." + env["target"] + "." + arch_suffix diff --git a/test/src/example.cpp b/test/src/example.cpp index 4d34d4c..54cd1ae 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -118,7 +118,7 @@ Ref<ExampleRef> Example::extended_ref_checks(Ref<ExampleRef> p_ref) const { } Variant Example::varargs_func(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error) { - UtilityFunctions::print("Varargs called with ", String::num(arg_count), " arguments"); + UtilityFunctions::print("Varargs called with ", String::num((double)arg_count), " arguments"); return arg_count; } |