Skip to content

Commit

Permalink
Adopt suffix environment variable again (with some minor changes, e.g…
Browse files Browse the repository at this point in the history
…. exclude .dev as we want to test both dev and release builds in the editor.

This separates template_debug from template_release, as is customary in GDExtension. I might change this back in the future, but only after being sure that it won't break anything.
Add template_debug builds to the github runner.
  • Loading branch information
Ivorforce committed Nov 8, 2024
1 parent 1d0ebf2 commit 90ec091
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 64 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ jobs:
strategy:
fail-fast: false
matrix:
# Double float precision builds are not needed by default;
# whoever needs them can recompile, but it would blow up our release zip to include them.
float-precision: [single]
build-target-type: [template_debug, template_release]
include:
- platform: linux
arch: x86_64
Expand Down Expand Up @@ -51,8 +55,8 @@ jobs:
with:
platform: ${{ matrix.platform }}
arch: ${{ matrix.arch }}
float-precision: single
build-target-type: template_release
float-precision: ${{ matrix.float-precision }}
build-target-type: ${{ matrix.build-target-type }}
gdextension-directory: ''
em_version: '3.1.55' # FIXME Doesn't compile on the newest, xtensor has problems
- name: Mac Sign
Expand Down
48 changes: 20 additions & 28 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ else:
if ARGUMENTS.get("platform", None) == "web":
ARGUMENTS.setdefault("threads", "no")
if _text2bool(ARGUMENTS.get("threads", "yes")):
# TODO Figure out why that is.
# TODO Figure out why that is. Does godot default to no threads exports?
raise ValueError("NumDot does not currently support compiling web with threads.")

optimize_for_arch = env["optimize_for_arch"]
Expand All @@ -87,27 +87,18 @@ if ARGUMENTS.get("disable_exceptions", None):
raise ValueError("NumDot does not currently support compiling without exceptions.")
ARGUMENTS["disable_exceptions"] = False

target = ARGUMENTS.get("target", "template_debug")
is_release = target == "template_release"
# Clarification: template_debug and template_release are, from our perspective, both releases.
# template_debug is just for in-editor
is_release = not _text2bool(ARGUMENTS.get("dev_build", "no"))

if ARGUMENTS.get("optimize", None) is None:
# The default godot-cpp optimizes for speed
if not is_release:
# In dev, prioritize fast builds.
# Godot-cpp defaults to optimizing speed (wat?).
ARGUMENTS["optimize"] = "none"
if ARGUMENTS.get("optimize", None) is None and is_release:
# The default godot-cpp optimizes for speed for release builds.
if ARGUMENTS["platform"] == "web":
# For web, optimize binary size, can shrink by ~30%.
ARGUMENTS["optimize"] = "size"
else:
# On release, optimize by default.
if ARGUMENTS["platform"] == "web":
# For web, optimize binary size, can shrink by ~30%.
ARGUMENTS["optimize"] = "size"
else:
# For download, optimize performance, can increase by 2% to 30%.
ARGUMENTS["optimize"] = "speed"

# env["debug_symbols"] == False will strip debug symbols.
# It is False by default, unless dev_build is True.
# dev_build is a flag that should only be used by engine developers (supposedly).
# For pc, optimize performance, can increase by 2% to 30%.
ARGUMENTS["optimize"] = "speed"

if optimize_for_arch:
# Yo-march improves performance, makes the build incompatible with most other machines.
Expand Down Expand Up @@ -187,23 +178,24 @@ env.Append(CPPPATH=["xtl/include", "xsimd/include", "xtensor/include", "xtensor-
env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp") + Glob("src/*/*.cpp")

if env["target"] in ["editor", "template_debug", "template_release"]:
try:
doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
sources.append(doc_data)
except AttributeError:
print("Not including class reference as we're targeting a pre-4.3 baseline.")
if env["target"] in ["editor", "template_debug"]:
doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
sources.append(doc_data)

# .dev doesn't inhibit compatibility, so we don't need to key it.
# .universal just means "compatible with all relevant arches" so we don't need to key it.
suffix = env['suffix'].replace(".dev", "").replace(".universal", "")

# Filename of the library.
lib_filename = f"{env.subst('$SHLIBPREFIX')}{libname}.{env['platform']}.{env['arch']}{env.subst('$SHLIBSUFFIX')}"
lib_filename = f"{env.subst('$SHLIBPREFIX')}{libname}{suffix}{env.subst('$SHLIBSUFFIX')}"
# Build releases into build/, and debug into demo/.
lib_filepath = ""

if env["platform"] == "macos" or env["platform"] == "ios":
# The above defaults to creating a .dylib.
# These are not supported on the iOS app store.
# To make it consistent, we'll just use frameworks on both macOS and iOS.
framework_name = "{}.{}.{}".format(libname, env["platform"], env["arch"])
framework_name = f"{libname}{suffix}"
lib_filename = framework_name
lib_filepath = "{}.framework/".format(framework_name)

Expand Down
66 changes: 50 additions & 16 deletions build/addons/numdot/numdot.gdextension
Original file line number Diff line number Diff line change
@@ -1,23 +1,57 @@
[configuration]

entry_symbol = "numdot_library_init"
compatibility_minimum = "4.1"
compatibility_minimum = "4.3"
reloadable = true

[libraries]

macos = "macos/numdot.macos.universal.framework/numdot.macos.universal"

ios = "macos/numdot.ios.arm64.framework/numdot.ios.arm64"

windows.x86_32 = "windows/numdot.windows.x86_32.dll"
windows.x86_64 = "windows/numdot.windows.x86_64.dll"

linux.x86_64 = "linux/libnumdot.linux.x86_64.so"
linux.arm64 = "linux/libnumdot.linux.arm64.so"
linux.rv64 = "linux/libnumdot.linux.rv64.so"

android.x86_64 = "android/libnumdot.android.x86_64.so"
android.arm64 = "android/libnumdot.android.arm64.so"

web.wasm32 = "web/libnumdot.web.wasm32.wasm"
macos.single.debug = "macos/numdot.macos.template_debug.framework/numdot.macos.template_debug"
macos.double.debug = "macos/numdot.macos.template_debug.double.framework/numdot.macos.template_debug.double"
macos.single.release = "macos/numdot.macos.template_release.framework/numdot.macos.template_release"
macos.double.release = "macos/numdot.macos.template_debug.double.framework/numdot.macos.template_release.double"

ios.arm64.single.debug = "macos/numdot.ios.template_debug.arm64.framework/numdot.ios.template_debug.arm64"
ios.arm64.double.debug = "macos/numdot.ios.template_debug.arm64.double.framework/numdot.ios.template_debug.arm64.double"
ios.arm64.single.release = "macos/numdot.ios.template_release.arm64.framework/numdot.ios.template_release.arm64"
ios.arm64.double.release = "macos/numdot.ios.template_release.arm64.double.framework/numdot.ios.template_release.arm64.double"

windows.x86_32.single.debug = "windows/numdot.windows.template_debug.x86_32.dll"
windows.x86_32.double.debug = "windows/numdot.windows.template_debug.x86_32.double.dll"
windows.x86_32.single.release = "windows/numdot.windows.template_release.x86_32.dll"
windows.x86_32.double.release = "windows/numdot.windows.template_release.x86_32.double.dll"

windows.x86_64.single.debug = "windows/numdot.windows.template_debug.x86_64.dll"
windows.x86_64.double.debug = "windows/numdot.windows.template_debug.x86_64.double.dll"
windows.x86_64.single.release = "windows/numdot.windows.template_release.x86_64.dll"
windows.x86_64.double.release = "windows/numdot.windows.template_release.x86_64.double.dll"

linux.x86_64.single.debug = "linux/libnumdot.linux.template_debug.x86_64.so"
linux.x86_64.double.debug = "linux/libnumdot.linux.template_debug.x86_64.double.so"
linux.x86_64.single.release = "linux/libnumdot.linux.template_release.x86_64.so"
linux.x86_64.double.release = "linux/libnumdot.linux.template_release.x86_64.double.so"

linux.arm64.single.debug = "linux/libnumdot.linux.template_debug.arm64.so"
linux.arm64.double.debug = "linux/libnumdot.linux.template_debug.arm64.double.so"
linux.arm64.single.release = "linux/libnumdot.linux.template_release.arm64.so"
linux.arm64.double.release = "linux/libnumdot.linux.template_release.arm64.double.so"

linux.rv64.single.debug = "linux/libnumdot.linux.template_debug.rv64.so"
linux.rv64.double.debug = "linux/libnumdot.linux.template_debug.rv64.double.so"
linux.rv64.single.release = "linux/libnumdot.linux.template_release.rv64.so"
linux.rv64.double.release = "linux/libnumdot.linux.template_release.rv64.double.so"

android.x86_64.single.debug = "android/libnumdot.android.template_debug.x86_64.so"
android.x86_64.double.debug = "android/libnumdot.android.template_debug.x86_64.double.so"
android.x86_64.single.release = "android/libnumdot.android.template_release.x86_64.so"
android.x86_64.double.release = "android/libnumdot.android.template_release.x86_64.double.so"

android.arm64.single.debug = "android/libnumdot.android.template_debug.arm64.so"
android.arm64.double.debug = "android/libnumdot.android.template_debug.arm64.double.so"
android.arm64.single.release = "android/libnumdot.android.template_release.arm64.so"
android.arm64.double.release = "android/libnumdot.android.template_release.arm64.double.so"

web.wasm32.single.debug = "web/libnumdot.web.template_debug.wasm32.nothreads.wasm"
web.wasm32.double.debug = "web/libnumdot.web.template_release.wasm32.double.nothreads.wasm"
web.wasm32.single.release = "web/libnumdot.web.template_release.wasm32.nothreads.wasm"
web.wasm32.double.release = "web/libnumdot.web.template_release.wasm32.double.nothreads.wasm"
73 changes: 55 additions & 18 deletions demo/addons/numdot/numdot.gdextension
Original file line number Diff line number Diff line change
@@ -1,25 +1,62 @@
[configuration]

entry_symbol = "numdot_library_init"
compatibility_minimum = "4.1"
compatibility_minimum = "4.3"
reloadable = true

[libraries]

macos.x86_64 = "macos/numdot.macos.x86_64.framework/numdot.macos.x86_64"
macos.arm64 = "macos/numdot.macos.arm64.framework/numdot.macos.arm64"

ios.x86_64 = "ios/numdot.ios.x86_64.framework/numdot.ios.x86_64"
ios.arm64 = "ios/numdot.ios.arm64.framework/numdot.ios.arm64"

windows.x86_32 = "windows/numdot.windows.x86_32.dll"
windows.x86_64 = "windows/numdot.windows.x86_64.dll"

linux.x86_64 = "linux/libnumdot.linux.x86_64.so"
linux.arm64 = "linux/libnumdot.linux.arm64.so"
linux.rv64 = "linux/libnumdot.linux.rv64.so"

android.x86_64 = "android/libnumdot.android.x86_64.so"
android.arm64 = "android/libnumdot.android.arm64.so"

web.wasm32 = "web/libnumdot.web.wasm32.wasm"
macos.x86_64.single.debug = "macos/numdot.macos.template_debug.x86_64.framework/numdot.macos.template_debug.x86_64"
macos.x86_64.double.debug = "macos/numdot.macos.template_debug.x86_64.double.framework/numdot.macos.template_debug.x86_64.double"
macos.x86_64.single.release = "macos/numdot.macos.template_release.x86_64.framework/numdot.macos.template_release.x86_64"
macos.x86_64.double.release = "macos/numdot.macos.template_debug.x86_64.double.framework/numdot.macos.template_release.x86_64.double"

macos.arm64.single.debug = "macos/numdot.macos.template_debug.arm64.framework/numdot.macos.template_debug.arm64"
macos.arm64.double.debug = "macos/numdot.macos.template_debug.arm64.double.framework/numdot.macos.template_debug.arm64.double"
macos.arm64.single.release = "macos/numdot.macos.template_release.arm64.framework/numdot.macos.template_release.arm64"
macos.arm64.double.release = "macos/numdot.macos.template_debug.arm64.double.framework/numdot.macos.template_release.arm64.double"

ios.arm64.single.debug = "macos/numdot.ios.template_debug.arm64.framework/numdot.ios.template_debug.arm64"
ios.arm64.double.debug = "macos/numdot.ios.template_debug.arm64.double.framework/numdot.ios.template_debug.arm64.double"
ios.arm64.single.release = "macos/numdot.ios.template_release.arm64.framework/numdot.ios.template_release.arm64"
ios.arm64.double.release = "macos/numdot.ios.template_release.arm64.double.framework/numdot.ios.template_release.arm64.double"

windows.x86_32.single.debug = "windows/numdot.windows.template_debug.x86_32.dll"
windows.x86_32.double.debug = "windows/numdot.windows.template_debug.x86_32.double.dll"
windows.x86_32.single.release = "windows/numdot.windows.template_release.x86_32.dll"
windows.x86_32.double.release = "windows/numdot.windows.template_release.x86_32.double.dll"

windows.x86_64.single.debug = "windows/numdot.windows.template_debug.x86_64.dll"
windows.x86_64.double.debug = "windows/numdot.windows.template_debug.x86_64.double.dll"
windows.x86_64.single.release = "windows/numdot.windows.template_release.x86_64.dll"
windows.x86_64.double.release = "windows/numdot.windows.template_release.x86_64.double.dll"

linux.x86_64.single.debug = "linux/libnumdot.linux.template_debug.x86_64.so"
linux.x86_64.double.debug = "linux/libnumdot.linux.template_debug.x86_64.double.so"
linux.x86_64.single.release = "linux/libnumdot.linux.template_release.x86_64.so"
linux.x86_64.double.release = "linux/libnumdot.linux.template_release.x86_64.double.so"

linux.arm64.single.debug = "linux/libnumdot.linux.template_debug.arm64.so"
linux.arm64.double.debug = "linux/libnumdot.linux.template_debug.arm64.double.so"
linux.arm64.single.release = "linux/libnumdot.linux.template_release.arm64.so"
linux.arm64.double.release = "linux/libnumdot.linux.template_release.arm64.double.so"

linux.rv64.single.debug = "linux/libnumdot.linux.template_debug.rv64.so"
linux.rv64.double.debug = "linux/libnumdot.linux.template_debug.rv64.double.so"
linux.rv64.single.release = "linux/libnumdot.linux.template_release.rv64.so"
linux.rv64.double.release = "linux/libnumdot.linux.template_release.rv64.double.so"

android.x86_64.single.debug = "android/libnumdot.android.template_debug.x86_64.so"
android.x86_64.double.debug = "android/libnumdot.android.template_debug.x86_64.double.so"
android.x86_64.single.release = "android/libnumdot.android.template_release.x86_64.so"
android.x86_64.double.release = "android/libnumdot.android.template_release.x86_64.double.so"

android.arm64.single.debug = "android/libnumdot.android.template_debug.arm64.so"
android.arm64.double.debug = "android/libnumdot.android.template_debug.arm64.double.so"
android.arm64.single.release = "android/libnumdot.android.template_release.arm64.so"
android.arm64.double.release = "android/libnumdot.android.template_release.arm64.double.so"

web.wasm32.single.debug = "web/libnumdot.web.template_debug.wasm32.nothreads.wasm"
web.wasm32.double.debug = "web/libnumdot.web.template_release.wasm32.double.nothreads.wasm"
web.wasm32.single.release = "web/libnumdot.web.template_release.wasm32.nothreads.wasm"
web.wasm32.double.release = "web/libnumdot.web.template_release.wasm32.double.nothreads.wasm"

0 comments on commit 90ec091

Please sign in to comment.