diff --git a/.github/actions/compile_gdextension/action.yml b/.github/actions/compile_gdextension/action.yml index b60da4b6..ddbdf9b4 100644 --- a/.github/actions/compile_gdextension/action.yml +++ b/.github/actions/compile_gdextension/action.yml @@ -68,6 +68,7 @@ runs: run: | echo "::group::🛠️ GDExtesion Compilation 🛠️" cd godot-cpp + git apply --ignore-space-change --ignore-whitespace ../patches/visibilty_hidden.patch git apply --ignore-space-change --ignore-whitespace ../patches/godot_cpp_exclude_unused_classes.patch git apply --ignore-space-change --ignore-whitespace ../patches/unity_build.patch cd .. diff --git a/.github/workflows/gdextension_build.yml b/.github/workflows/gdextension_build.yml index 6e65766c..9c44dc18 100644 --- a/.github/workflows/gdextension_build.yml +++ b/.github/workflows/gdextension_build.yml @@ -122,15 +122,37 @@ jobs: lfs: true submodules: recursive + - name: Install Android NDK r23 + uses: nttld/setup-ndk@v1.4.1 + id: setup-ndk + with: + ndk-version: r23 + add-to-path: true + local-cache: true + + # TODO revisit after some updates of nttld/setup-ndk + - name: Restore Android Symlinks + run: | + directory="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin" + + find "$directory" -type l | while read link; do + current_target=$(readlink "$link") + new_target="$directory/$(basename "$current_target")" + ln -sf "$new_target" "$link" + echo "Changed $(basename "$link") from $current_target to $new_target" + done + - name: Compile GDExtension uses: ./.github/actions/compile_gdextension + env: + ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} with: platform: android target: ${{matrix.target}} arch: ${{matrix.arch}} output_libs_path: ${{env.OUTPUT_LIBS_PATH}} artifact: android - additional: lto=yes + additional: lto=yes ANDROID_HOME="" # ============================================ diff --git a/dev_build_godot_cpp.bat b/dev_build_godot_cpp.bat index 89eee7fd..a98cf202 100644 --- a/dev_build_godot_cpp.bat +++ b/dev_build_godot_cpp.bat @@ -2,6 +2,7 @@ cd godot-cpp ::set api=custom_api_file="../api.json" set api= +git apply --ignore-space-change --ignore-whitespace ../patches/visibilty_hidden.patch git apply --ignore-space-change --ignore-whitespace ../patches/godot_cpp_exclude_unused_classes.patch git apply --ignore-space-change --ignore-whitespace ../patches/unity_build.patch ::git apply --ignore-space-change --ignore-whitespace ../patches/debug_string.patch diff --git a/patches/visibilty_hidden.patch b/patches/visibilty_hidden.patch new file mode 100644 index 00000000..72fc3f34 --- /dev/null +++ b/patches/visibilty_hidden.patch @@ -0,0 +1,35 @@ +diff --git a/tools/godotcpp.py b/tools/godotcpp.py +index efe632a..46d64fb 100644 +--- a/tools/godotcpp.py ++++ b/tools/godotcpp.py +@@ -183,6 +183,15 @@ def options(opts, env): + ) + ) + ++ opts.Add( ++ EnumVariable( ++ key="symbols_visibility", ++ help="Symbols visibility on GNU platforms. Use 'auto' to apply the default values.", ++ default=env.get("symbols_visibility", "hidden"), ++ allowed_values=["auto", "visible", "hidden"], ++ ) ++ ) ++ + # Add platform options + for pl in platforms: + tool = Tool(pl, toolpath=["tools"]) +@@ -258,6 +267,14 @@ def generate(env): + elif env.get("is_msvc", False): + env.Append(CXXFLAGS=["/EHsc"]) + ++ if not env.get("is_msvc", False): ++ if env["symbols_visibility"] == "visible": ++ env.Append(CCFLAGS=["-fvisibility=default"]) ++ env.Append(LINKFLAGS=["-fvisibility=default"]) ++ elif env["symbols_visibility"] == "hidden": ++ env.Append(CCFLAGS=["-fvisibility=hidden"]) ++ env.Append(LINKFLAGS=["-fvisibility=hidden"]) ++ + # Require C++17 + if env.get("is_msvc", False): + env.Append(CXXFLAGS=["/std:c++17"])