Skip to content

Commit d9b8cd0

Browse files
committed
TEMP: C# Support continued
1 parent 1ad6bf4 commit d9b8cd0

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ target_link_libraries (${PROJECT_NAME} PRIVATE Urho3D)
1717
if (PROJECT_IS_TOP_LEVEL AND URHO3D_CSHARP)
1818
set (DEST_BIN_DIR_CONFIG bin)
1919
set (DEST_LIBRARY_DIR_CONFIG bin)
20-
set (SWIG_DIR "${REBELFORK_SDK}/include/Urho3D/ThirdParty/swig/Lib")
2120
target_include_directories (${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
2221
include (${REBELFORK_SDK}/share/CMake/Modules/UrhoSWIG.cmake)
2322
csharp_bind_target(

CSharp/Plugin.csproj

+9-22
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<AssemblyName>Plugin.Core.SamplePlugin</AssemblyName>
3+
<AssemblyName>Plugin.Core.SamplePlugin.Net</AssemblyName>
44
<OutputType>Library</OutputType>
55
<LangVersion>9.0</LangVersion>
66
</PropertyGroup>
7-
<PropertyGroup>
8-
<GeneratedCodePath>$(RBFX_BINARY_DIR)Source/Urho3D/</GeneratedCodePath>
9-
</PropertyGroup>
107
<ItemGroup>
11-
<BindingsSourceCodeUrho3D Include="$(GeneratedCodePath)Urho3DCSharp/*.cs" />
12-
<BindingsSourceCodeImGui Include="$(GeneratedCodePath)ImGuiCSharp/*.cs" />
13-
<Compile Include="Managed/**/*.cs" />
14-
<Compile Include="$(RBFX_BINARY_DIR)Source/Urho3D/Urho3DCSharp/Managed/*.cs" />
8+
<BindingsSourceCode Include="$(CMAKE_BINARY_DIR)Plugin.Core.SamplePluginCSharp/*.cs" />
159
</ItemGroup>
16-
<Choose>
17-
<When Condition="$(TargetFramework) == 'netstandard2.0'">
18-
<ItemGroup>
19-
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
20-
</ItemGroup>
21-
</When>
22-
</Choose>
23-
<Target Name="GatherBuildFilesUrho3D" BeforeTargets="BeforeCompile">
24-
<CreateItem Include="$([System.IO.Directory]::GetFiles(&quot;$(GeneratedCodePath)Urho3DCSharp&quot;, &quot;*.cs&quot;))">
25-
<Output TaskParameter="Include" ItemName="Compile" />
26-
</CreateItem>
27-
</Target>
28-
<Target Name="GatherBuildFilesImGui" BeforeTargets="BeforeCompile" Condition="Exists('$(GeneratedCodePath)ImGuiCSharp')">
29-
<CreateItem Include="$([System.IO.Directory]::GetFiles(&quot;$(GeneratedCodePath)ImGuiCSharp&quot;, &quot;*.cs&quot;))">
10+
<Target Name="GatherBuildFiles" BeforeTargets="BeforeCompile">
11+
<CreateItem Include="$([System.IO.Directory]::GetFiles(&quot;$(CMAKE_BINARY_DIR)Plugin.Core.SamplePluginCSharp&quot;, &quot;*.cs&quot;))">
3012
<Output TaskParameter="Include" ItemName="Compile" />
3113
</CreateItem>
3214
</Target>
15+
<ItemGroup>
16+
<Reference Include="Urho3DNet">
17+
<HintPath>$(URHO3D_SDK_PATH)/bin/Debug/Urho3DNet.dll</HintPath>
18+
</Reference>
19+
</ItemGroup>
3320
</Project>

CSharp/Plugin.i

+3
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ using namespace Urho3D;
77
%}
88
#define PLUGIN_CORE_SAMPLEPLUGIN_API
99
%import "Urho3D.i"
10+
%{
11+
#include "SampleComponent.h"
12+
%}
1013
%include "SampleComponent.h"

Directory.Build.props

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project>
2+
<!-- Works when building on windows using cmake-generated VS solution -->
3+
<Import Project="$(SolutionDir)/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And '$(SolutionDir)' != '' And Exists('$(SolutionDir)/CMake.props')" />
4+
<!-- Works when building with VSCode, however cmake cache directory should be ./cmake-build -->
5+
<Import Project="./cmake-build/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And Exists('./cmake-build/CMake.props')" />
6+
<!-- When separate .csproj projects are built by make/ninja -->
7+
<Import Project="$(CMAKE_BINARY_DIR)/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And '$(CMAKE_BINARY_DIR)' != '' And Exists('$(CMAKE_BINARY_DIR)/CMake.props') " />
8+
<!-- Azure pipelines for some reason have SolutionDir undefined however -->
9+
<Import Project="$(MSBuildStartupDirectory)/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And '$(SolutionDir)' == '' And Exists('$(MSBuildStartupDirectory)/CMake.props') " />
10+
<Import Project="$(URHO3D_SDK_PATH)/share/CMake/Directory.Build.props" />
11+
</Project>

0 commit comments

Comments
 (0)