Skip to content

Commit

Permalink
Fix build with engine included via add_subdirectory().
Browse files Browse the repository at this point in the history
  • Loading branch information
rokups committed Mar 10, 2024
1 parent adbe637 commit 616414c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,16 @@ endif ()
file (GLOB SOURCE_FILES *.h *.cpp)
add_library(${PROJECT_NAME} ${SOURCE_FILES})
setup_plugin_target (${PROJECT_NAME} "${PROJECT_NAME}")
target_link_libraries (${PROJECT_NAME} PRIVATE Urho3D)
target_link_libraries (${PROJECT_NAME} PUBLIC Urho3D)

if (URHO3D_CSHARP)
set (DEST_BIN_DIR_CONFIG bin)
set (DEST_LIBRARY_DIR_CONFIG bin)
target_include_directories (${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
include (${REBELFORK_SDK}/share/CMake/Modules/UrhoSWIG.cmake)
csharp_bind_target(
TARGET ${PROJECT_NAME}
SWIG CSharp/Plugin.i
SWIG ${CMAKE_CURRENT_SOURCE_DIR}/CSharp/Plugin.i
CSPROJ ${CMAKE_CURRENT_SOURCE_DIR}/CSharp/Plugin.csproj
NAMESPACE Urho3DNet
INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR};${REBELFORK_SDK}/include;${REBELFORK_SDK}/include/Urho3D/CSharp/Swig"
)
target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}CSharp/PluginCSHARP_wrap.cxx)
endif ()
9 changes: 6 additions & 3 deletions CSharp/Plugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<BindingsSourceCode Include="$(Plugin_Core_SamplePlugin_BINARY_DIR)/Plugin.Core.SamplePluginCSharp/*.cs" />
<BindingsSourceCode Include="$(Plugin_Core_SamplePlugin_BINARY_DIR)/Plugin.Core.SamplePluginCSharp_$(URHO3D_CSHARP_BIND_CONFIG)/*.cs" />
</ItemGroup>
<Target Name="GatherBuildFiles" BeforeTargets="BeforeCompile">
<CreateItem Include="$([System.IO.Directory]::GetFiles(&quot;$(Plugin_Core_SamplePlugin_BINARY_DIR)/Plugin.Core.SamplePluginCSharp&quot;, &quot;*.cs&quot;))">
<CreateItem Include="$([System.IO.Directory]::GetFiles(&quot;$(Plugin_Core_SamplePlugin_BINARY_DIR)/Plugin.Core.SamplePluginCSharp_$(URHO3D_CSHARP_BIND_CONFIG)&quot;, &quot;*.cs&quot;))">
<Output TaskParameter="Include" ItemName="Compile" />
</CreateItem>
</Target>
<ItemGroup>
<ItemGroup Condition=" '$(URHO3D_IS_SDK)' == 'ON' ">
<Reference Include="Urho3DNet">
<HintPath>$(URHO3D_SDK_PATH)/bin/$(Configuration)/Urho3DNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition=" '$(URHO3D_IS_SDK)' != 'ON' ">
<ProjectReference Include="$(Urho3D_SOURCE_DIR)/CSharp/Urho3DNet.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<Import Project="$(CMAKE_BINARY_DIR)/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And '$(CMAKE_BINARY_DIR)' != '' And Exists('$(CMAKE_BINARY_DIR)/CMake.props') " />
<!-- Azure pipelines for some reason have SolutionDir undefined however -->
<Import Project="$(MSBuildStartupDirectory)/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And '$(SolutionDir)' == '' And Exists('$(MSBuildStartupDirectory)/CMake.props') " />
<Import Project="$(URHO3D_SDK_PATH)/share/CMake/Directory.Build.props" />
<Import Project="$(URHO3D_CSHARP_PROPS_FILE)" />
</Project>

0 comments on commit 616414c

Please sign in to comment.