forked from dotnet/android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonodroid.targets
147 lines (146 loc) · 8.16 KB
/
monodroid.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(JavaInteropFullPath)\bin\BuildDebug\JdkInfo.props" />
<Import Project="monodroid.props" />
<Import Project="monodroid.projitems" />
<Import Project="..\..\build-tools\scripts\RequiredPrograms.targets" />
<PropertyGroup>
<_Conf>$(Configuration.ToLowerInvariant())</_Conf>
</PropertyGroup>
<ItemGroup>
<_CFile Include="$(MonoSourceFullPath)\support\zlib-helper.c" />
<_CFile Include="jni\cpu-arch-detect.c" />
<_CFile Include="jni\dylib-mono.c" />
<_CFile Include="jni\embedded-assemblies.c" />
<_CFile Include="jni\jni.c" />
<_CFile Include="jni\logger.c" />
<_CFile Include="jni\monodroid-glue.c" />
<_CFile Include="jni\timezones.c" />
<_CFile Include="jni\util.c" />
<_CFile Include="jni\zip\ioapi.c" />
<_CFile Include="jni\zip\unzip.c" />
</ItemGroup>
<!-- These are referenced in %(_HostRuntime.ExtraSource) -->
<ItemGroup>
<_UnixCFile Include="$(MonoSourceFullPath)\support\nl.c" />
<_UnixCFile Include="jni\debug.c" />
<_UnixCFile Include="jni\monodroid-networkinfo.c" />
<_UnixCFile Include="jni\xamarin_getifaddrs.c" />
</ItemGroup>
<ItemGroup>
<_EmbeddedBlob Include="config.xml">
<Config>monodroid.config</Config>
<Include>config.include</Include>
</_EmbeddedBlob>
<_EmbeddedBlob Include="machine.config.xml">
<Config>monodroid.machine.config</Config>
<Include>machine.config.include</Include>
</_EmbeddedBlob>
</ItemGroup>
<Target Name="_BuildRuntimes"
DependsOnTargets="_GenerateIncludeFiles;_BuildAndroidRuntimes;_BuildHostRuntimes">
</Target>
<Target Name="_GenerateIncludeFiles"
Inputs="@(_EmbeddedBlob);jni/config.h"
Outputs="@(_EmbeddedBlob->'jni\%(Include)');$(OutputPath)\..\..\..\..\..\include\config.h">
<Copy SourceFiles="jni/config.h" DestinationFiles="$(OutputPath)\..\..\..\..\..\include\config.h" />
<Exec Command="(cat "@(_EmbeddedBlob)" ; dd if=/dev/zero bs=1 count=1 2>/dev/null) > %(_EmbeddedBlob.Config)" />
<Exec Command="xxd -i %(_EmbeddedBlob.Config) | sed 's/^unsigned /static const unsigned /g' > jni/%(_EmbeddedBlob.Include)" />
<Exec Command="rm %(_EmbeddedBlob.Config)" />
</Target>
<Target Name="_BuildAndroidRuntimes"
Inputs="@(_CFile);jni\Android.mk"
Outputs="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.debug.so');@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.release.so')">
<PropertyGroup>
<_AppAbi>@(AndroidSupportedTargetJitAbi->'%(Identity)', ' ')</_AppAbi>
<_NdkBuildArgs>CONFIGURATION=$(Configuration) SGEN_BRIDGE_VERSION=$(MonoSgenBridgeVersion) MONO_PATH="$(MonoSourceFullPath)"</_NdkBuildArgs>
</PropertyGroup>
<WriteLinesToFile
File="jni\Application.mk"
Lines="APP_ABI := $(_AppAbi)"
Overwrite="True"
/>
<Exec
Command="$(AndroidToolchainDirectory)\ndk\ndk-build $(_NdkBuildArgs) NDK_LIBS_OUT=./libs/Debug NDK_OUT=./obj/Debug V=1"
/>
<Copy
SourceFiles="@(AndroidSupportedTargetJitAbi->'obj\Debug\local\%(Identity)\libmonodroid.so')"
DestinationFiles="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.debug.d.so')"
/>
<Copy
SourceFiles="@(AndroidSupportedTargetJitAbi->'libs\Debug\%(Identity)\libmonodroid.so')"
DestinationFiles="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.debug.so')"
/>
<WriteLinesToFile
File="jni\Application.mk"
Lines="APP_ABI := $(_AppAbi); APP_CFLAGS+=-DRELEASE=1"
Overwrite="True"
/>
<Exec
Command="$(AndroidToolchainDirectory)\ndk\ndk-build $(_NdkBuildArgs) NDK_LIBS_OUT=./libs/Release NDK_OUT=./obj/Release V=1"
/>
<Copy
SourceFiles="@(AndroidSupportedTargetJitAbi->'obj\Release\local\%(Identity)\libmonodroid.so')"
DestinationFiles="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.release.d.so')"
/>
<Copy
SourceFiles="@(AndroidSupportedTargetJitAbi->'libs\Release\%(Identity)\libmonodroid.so')"
DestinationFiles="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.release.so')"
/>
</Target>
<Target Name="_CleanRuntimes"
DependsOnTargets="_GetBuildHostRuntimes"
AfterTargets="Clean">
<Exec
Command="$(AndroidToolchainDirectory)\ndk\ndk-build $(_NdkBuildArgs) NDK_LIBS_OUT=./libs/Debug NDK_OUT=./obj/Debug V=1 clean"
/>
<Exec
Command="$(AndroidToolchainDirectory)\ndk\ndk-build $(_NdkBuildArgs) NDK_LIBS_OUT=./libs/Release NDK_OUT=./obj/Release V=1 clean"
/>
<RemoveDir Directories="obj\local;libs" />
<Delete Files="jni\config.include;jni\machine.config.include;jni\Application.mk" />
<Delete Files="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.debug.so')" />
<Delete Files="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.debug.d.so')" />
<Delete Files="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.release.so')" />
<Delete Files="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.release.d.so')" />
<Delete Files="%(_EmbeddedBlob.Include)" />
<Delete
Files="@(_OutputDebugPath);@(_OutputDebugStripPath);@(_OutputReleasePath);@(_OutputReleaseStripPath)"
/>
</Target>
<Target Name="_GetBuildHostRuntimes">
<ItemGroup>
<_OutputDebugPath Include="$(OutputPath)%(_HostRuntime.OutputDirectory)\%(_HostRuntime.OutputBasename).debug.d.%(_HostRuntime.NativeLibraryExtension)" />
<_OutputDebugStripPath Include="$(OutputPath)%(_HostRuntime.OutputDirectory)\%(_HostRuntime.OutputBasename).debug.%(_HostRuntime.NativeLibraryExtension)" />
<_OutputReleasePath Include="$(OutputPath)%(_HostRuntime.OutputDirectory)\%(_HostRuntime.OutputBasename).release.d.%(_HostRuntime.NativeLibraryExtension)" />
<_OutputReleaseStripPath Include="$(OutputPath)%(_HostRuntime.OutputDirectory)\%(_HostRuntime.OutputBasename).release.%(_HostRuntime.NativeLibraryExtension)" />
</ItemGroup>
</Target>
<Target Name="_BuildHostRuntimes"
DependsOnTargets="_GetBuildHostRuntimes"
Inputs="@(_CFile);@(_UnixCFile)"
Outputs="@(_HostRuntime->'$(OutputPath)%(OutputDirectory)\libmono-android.debug.%(NativeLibraryExtension)')">
<Message Text="Building host runtime %(_HostRuntime.Identity) in $(OutputPath)%(_HostRuntime.OutputDirectory)"/>
<MakeDir Directories="$(OutputPath)%(_HostRuntime.OutputDirectory)" />
<Exec
Command="%(_HostRuntime.Cc) -o "$(OutputPath)%(_HostRuntime.OutputDirectory)\libmono-android.debug.%(_HostRuntime.NativeLibraryExtension)" $(_DebugCFlags) %(_HostRuntime.CFlags) @(_CFile->'%(Identity)', ' ') %(_HostRuntime.ExtraSource) %(_HostRuntime.LdFlags)"
/>
<Copy
SourceFiles="@(_HostRuntime->'$(OutputPath)%(OutputDirectory)\libmono-android.debug.%(NativeLibraryExtension)')"
DestinationFiles="@(_HostRuntime->'$(OutputPath)%(OutputDirectory)\libmono-android.debug.d.%(NativeLibraryExtension)')"
/>
<Exec
Command="%(_HostRuntime.Strip) %(_HostRuntime.StripFlags) "$(OutputPath)%(_HostRuntime.OutputDirectory)\libmono-android.debug.%(_HostRuntime.NativeLibraryExtension)""
/>
<Exec
Command="%(_HostRuntime.Cc) -o "$(OutputPath)%(_HostRuntime.OutputDirectory)\libmono-android.release.%(_HostRuntime.NativeLibraryExtension)" $(_ReleaseCFlags) %(_HostRuntime.CFlags) @(_CFile->'%(Identity)', ' ') %(_HostRuntime.ExtraSource) %(_HostRuntime.LdFlags)"
/>
<Copy
SourceFiles="@(_HostRuntime->'$(OutputPath)%(OutputDirectory)\libmono-android.release.%(NativeLibraryExtension)')"
DestinationFiles="@(_HostRuntime->'$(OutputPath)%(OutputDirectory)\libmono-android.release.d.%(NativeLibraryExtension)')"
/>
<Exec
Command="%(_HostRuntime.Strip) %(_HostRuntime.StripFlags) "$(OutputPath)%(_HostRuntime.OutputDirectory)\libmono-android.release.%(_HostRuntime.NativeLibraryExtension)""
/>
</Target>
</Project>