Skip to content

Commit 616414c

Browse files
committed
Fix build with engine included via add_subdirectory().
1 parent adbe637 commit 616414c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

CMakeLists.txt

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@ endif ()
1212
file (GLOB SOURCE_FILES *.h *.cpp)
1313
add_library(${PROJECT_NAME} ${SOURCE_FILES})
1414
setup_plugin_target (${PROJECT_NAME} "${PROJECT_NAME}")
15-
target_link_libraries (${PROJECT_NAME} PRIVATE Urho3D)
15+
target_link_libraries (${PROJECT_NAME} PUBLIC Urho3D)
1616

1717
if (URHO3D_CSHARP)
1818
set (DEST_BIN_DIR_CONFIG bin)
1919
set (DEST_LIBRARY_DIR_CONFIG bin)
2020
target_include_directories (${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
21-
include (${REBELFORK_SDK}/share/CMake/Modules/UrhoSWIG.cmake)
2221
csharp_bind_target(
2322
TARGET ${PROJECT_NAME}
24-
SWIG CSharp/Plugin.i
23+
SWIG ${CMAKE_CURRENT_SOURCE_DIR}/CSharp/Plugin.i
2524
CSPROJ ${CMAKE_CURRENT_SOURCE_DIR}/CSharp/Plugin.csproj
2625
NAMESPACE Urho3DNet
27-
INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR};${REBELFORK_SDK}/include;${REBELFORK_SDK}/include/Urho3D/CSharp/Swig"
2826
)
29-
target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}CSharp/PluginCSHARP_wrap.cxx)
3027
endif ()

CSharp/Plugin.csproj

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@
55
<LangVersion>9.0</LangVersion>
66
</PropertyGroup>
77
<ItemGroup>
8-
<BindingsSourceCode Include="$(Plugin_Core_SamplePlugin_BINARY_DIR)/Plugin.Core.SamplePluginCSharp/*.cs" />
8+
<BindingsSourceCode Include="$(Plugin_Core_SamplePlugin_BINARY_DIR)/Plugin.Core.SamplePluginCSharp_$(URHO3D_CSHARP_BIND_CONFIG)/*.cs" />
99
</ItemGroup>
1010
<Target Name="GatherBuildFiles" BeforeTargets="BeforeCompile">
11-
<CreateItem Include="$([System.IO.Directory]::GetFiles(&quot;$(Plugin_Core_SamplePlugin_BINARY_DIR)/Plugin.Core.SamplePluginCSharp&quot;, &quot;*.cs&quot;))">
11+
<CreateItem Include="$([System.IO.Directory]::GetFiles(&quot;$(Plugin_Core_SamplePlugin_BINARY_DIR)/Plugin.Core.SamplePluginCSharp_$(URHO3D_CSHARP_BIND_CONFIG)&quot;, &quot;*.cs&quot;))">
1212
<Output TaskParameter="Include" ItemName="Compile" />
1313
</CreateItem>
1414
</Target>
15-
<ItemGroup>
15+
<ItemGroup Condition=" '$(URHO3D_IS_SDK)' == 'ON' ">
1616
<Reference Include="Urho3DNet">
1717
<HintPath>$(URHO3D_SDK_PATH)/bin/$(Configuration)/Urho3DNet.dll</HintPath>
1818
</Reference>
1919
</ItemGroup>
20+
<ItemGroup Condition=" '$(URHO3D_IS_SDK)' != 'ON' ">
21+
<ProjectReference Include="$(Urho3D_SOURCE_DIR)/CSharp/Urho3DNet.csproj" />
22+
</ItemGroup>
2023
</Project>

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
<Import Project="$(CMAKE_BINARY_DIR)/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And '$(CMAKE_BINARY_DIR)' != '' And Exists('$(CMAKE_BINARY_DIR)/CMake.props') " />
88
<!-- Azure pipelines for some reason have SolutionDir undefined however -->
99
<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" />
10+
<Import Project="$(URHO3D_CSHARP_PROPS_FILE)" />
1111
</Project>

0 commit comments

Comments
 (0)