From 87f6beb69c1a0e1d93b8f845829575c5d02ee6db Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Sun, 22 Nov 2026 16:04:34 +0200 Subject: [PATCH] Use C# bindings from csharp-swig The plugin builds its C# bindings against the C# SDK. CI downloads the engine SDK from vars.RBFX_REPOSITORY. The default is rbfx/rbfx. --- .github/workflows/build.yml | 14 +++++++------- CMakeLists.txt | 15 ++++++++------- CSharp/Plugin.csproj | 8 ++++---- CSharp/Plugin.i | 2 +- ci_build.sh | 1 + 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45c415c..fefb5eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,13 +9,11 @@ on: pull_request: # Build manually workflow_dispatch: - # Build on a schedule to keep up with the engine changes. - schedule: - - cron: '0 0 * * 0' env: # Common settings. - CMAKE_VERSION: 3.21.x + CMAKE_VERSION: 3.24.x + RBFX_REPOSITORY: ${{ vars.RBFX_REPOSITORY || 'rbfx/rbfx' }} # Common paths. ci_source_dir: ${{ github.workspace }}/source-code ci_build_script: ./source-code/ci_build.sh @@ -47,7 +45,7 @@ jobs: env: ci_platform: windows - ci_target_sdk_name: rebelfork-sdk-windows-msvc-x64-lib-latest + ci_target_sdk_name: rebelfork-sdk-windows-msvc-x64-dll-latest ci_upload_release: ${{ (github.repository == 'rbfx/Core.SamplePlugin') && (github.ref == 'refs/heads/master') @@ -64,11 +62,13 @@ jobs: - name: Download target SDK uses: robinraju/release-downloader@v1.8 with: - repository: rbfx/rbfx + repository: ${{ env.RBFX_REPOSITORY }} tag: latest fileName: ${{ env.ci_target_sdk_name }}.7z - - name: Unzip target SDK + - name: Extract target SDK + shell: bash + working-directory: ${{ github.workspace }} run: | cd '${{ github.workspace }}' 7z x '${{ env.ci_target_sdk_name }}.7z' '-o${{ github.workspace }}' -y diff --git a/CMakeLists.txt b/CMakeLists.txt index ca3771e..fce438f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,18 @@ -cmake_minimum_required(VERSION 3.21) +cmake_minimum_required(VERSION 3.24) project (Plugin.Core.SamplePlugin) -# Top-level plugin build is not supported yet. -# If the plugin is only built as subdirectory, this snippet is not needed and may be discarded. +# Top-level plugin build. If the plugin is only built as subdirectory, this snippet is not needed and may be discarded. if (PROJECT_IS_TOP_LEVEL) set (CMAKE_CXX_STANDARD 17) find_package (Urho3D REQUIRED) + # C# bindings are optional. They are in the rbfx-csharp repository. + find_package (Urho3DNet QUIET) endif () file (GLOB SOURCE_FILES *.h *.cpp) add_plugin (${PROJECT_NAME} "${SOURCE_FILES}") -if (URHO3D_CSHARP) +if (Urho3DNet_FOUND) set (DEST_BIN_DIR_CONFIG bin) set (DEST_LIBRARY_DIR_CONFIG bin) target_include_directories (${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) @@ -21,7 +22,7 @@ if (URHO3D_CSHARP) CSPROJ ${CMAKE_CURRENT_SOURCE_DIR}/CSharp/Plugin.csproj NAMESPACE Urho3DNet ) -endif () -# Generate Visual Studio props file for csproj. -rbfx_configure_cmake_props() + # Generate Visual Studio props file for csproj. + rbfx_configure_cmake_props() +endif () diff --git a/CSharp/Plugin.csproj b/CSharp/Plugin.csproj index f8b9aa2..b29b11a 100644 --- a/CSharp/Plugin.csproj +++ b/CSharp/Plugin.csproj @@ -12,12 +12,12 @@ - + - $(Urho3D_PACKAGE_ROOT)/bin/$(Configuration)/Urho3DNet.dll + $(Urho3DNet_PACKAGE_ROOT)/bin/$(Configuration)/Urho3DNet.dll - - + + diff --git a/CSharp/Plugin.i b/CSharp/Plugin.i index bc02a48..2d0c244 100644 --- a/CSharp/Plugin.i +++ b/CSharp/Plugin.i @@ -3,7 +3,7 @@ #include "SampleComponent.h" using namespace Urho3D; -#include +#include %} #define PLUGIN_CORE_SAMPLEPLUGIN_API %import "Urho3D.i" diff --git a/ci_build.sh b/ci_build.sh index b24e436..6ad5921 100644 --- a/ci_build.sh +++ b/ci_build.sh @@ -42,6 +42,7 @@ function action-generate() { "-A" "x64" "-DCMAKE_BUILD_TYPE=${build_config[$ci_platform]}" + "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_PREFIX_PATH=$ci_target_sdk_dir/share" ) else