Skip to content

Commit 1a5093b

Browse files
committed
Use MonoVM, not mono
1 parent 724f1f3 commit 1a5093b

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

src/java-interop/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ if(ENABLE_MONO_INTEGRATION)
4444
include_directories(${dir})
4545
endforeach()
4646
list(APPEND LINK_FLAGS ${MONO_LINK_FLAGS})
47-
list(APPEND LINK_FLAGS "-Wl,-undefined -Wl,suppress -Wl,-flat_namespace")
4847
set(JAVA_INTEROP_SOURCES ${JAVA_INTEROP_CORE_SOURCES} ${JAVA_INTEROP_MONO_SOURCES})
4948
else()
5049
set(JAVA_INTEROP_SOURCES ${JAVA_INTEROP_CORE_SOURCES})

src/java-interop/java-interop-mono.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "java-interop.h"
55

66
#include <mono/metadata/assembly.h>
7+
#include <mono/metadata/appdomain.h>
78
#include <mono/metadata/class.h>
89
#include <mono/metadata/object.h>
910
#include <mono/metadata/sgen-bridge.h>

src/java-interop/java-interop.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@
2828

2929
<ItemGroup>
3030
<ProjectReference Include="..\..\build-tools\jnienv-gen\jnienv-gen.csproj" ReferenceOutputAssembly="false" />
31-
</ItemGroup>
31+
</ItemGroup>
32+
33+
<PropertyGroup>
34+
<DotNetRuntimePacksVersion>8.0.13</DotNetRuntimePacksVersion>
35+
</PropertyGroup>
36+
37+
<ItemGroup Condition=" '$(RuntimeIdentifier)' != '' ">
38+
<PackageDownload Include="Microsoft.NETCore.App.Runtime.Mono.$(RuntimeIdentifier)" Version="[$(DotNetRuntimePacksVersion)]" />
39+
</ItemGroup>
3240

3341
<Import Project="java-interop.targets" />
3442

src/java-interop/java-interop.targets

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
<Project>
22

33
<Import Project="..\..\build-tools\scripts\NativeToolchain.targets" />
4+
<Import Project="obj\java-interop.csproj.nuget.g.props" />
5+
6+
<PropertyGroup>
7+
<RuntimeIdentifier Condition=" '$(RuntimeIdentifier)' == '' ">osx-x64</RuntimeIdentifier>
8+
</PropertyGroup>
9+
10+
<PropertyGroup Condition=" '$(RuntimeIdentifier)' != '' ">
11+
<_MonoNativePath>$(NuGetPackageRoot)/microsoft.netcore.app.runtime.mono.$(RuntimeIdentifier)/$(DotNetRuntimePacksVersion)/runtimes/$(RuntimeIdentifier)/native/</_MonoNativePath>
12+
<_MonoIncludePath>$(_MonoNativePath)include/mono-2.0</_MonoIncludePath>
13+
<_MonoLib>-L $(_MonoNativePath) -lcoreclr</_MonoLib>
14+
<_EnableMono>-DENABLE_MONO_INTEGRATION=ON</_EnableMono>
15+
</PropertyGroup>
416

517
<PropertyGroup>
618
<_JavaInteropLibName Condition=" $([MSBuild]::IsOSPlatform ('osx')) ">libjava-interop.dylib</_JavaInteropLibName>
@@ -47,15 +59,12 @@
4759
</Target>
4860

4961
<Target Name="_GetCmakeOptions">
50-
<PropertyGroup Condition=" '@(MonoIncludePath->Count())' != '0' ">
51-
<_MonoDirs>"-DMONO_INCLUDE_LIST=@(MonoIncludePath, ';')"</_MonoDirs>
52-
<_MonoLib>"-DMONO_LINK_FLAGS=$(MonoLibs)"</_MonoLib>
53-
<_EnableMono>-DENABLE_MONO_INTEGRATION=ON</_EnableMono>
54-
</PropertyGroup>
5562
<PropertyGroup>
63+
<_DMonoDirs>"-DMONO_INCLUDE_LIST=$(_MonoIncludePath)"</_DMonoDirs>
64+
<_DMonoLinkFlags>"-DMONO_LINK_FLAGS=$(_MonoLib)"</_DMonoLinkFlags>
5665
<_JdkDirs>"-DJDK_INCLUDE_LIST=@(JdkIncludePath, ';')"</_JdkDirs>
5766
<_Jni_c>"-DJNI_C_PATH=$(MSBuildThisFileDirectory)$(IntermediateOutputPath)jni.c"</_Jni_c>
58-
<_ExtraArgs>$([MSBuild]::Escape('$(_JdkDirs) $(_Jni_c) $(_EnableMono) $(_MonoDirs) $(_MonoLib)'))</_ExtraArgs>
67+
<_ExtraArgs>$([MSBuild]::Escape('$(_JdkDirs) $(_Jni_c) $(_EnableMono) $(_DMonoDirs) $(_DMonoLinkFlags)'))</_ExtraArgs>
5968
</PropertyGroup>
6069
</Target>
6170

0 commit comments

Comments
 (0)