diff --git a/Documentation/building/unix/dependencies.md b/Documentation/building/unix/dependencies.md index f2a16e09953..652135f8d8f 100644 --- a/Documentation/building/unix/dependencies.md +++ b/Documentation/building/unix/dependencies.md @@ -135,8 +135,7 @@ and to enable it again, issue the following command: ## macOS Dependencies -The [`android-toolchain.projitems`](../../../build-tools/android-toolchain/android-toolchain.projitems), and -[`monodroid.projitems`](../../../src/monodroid/monodroid.projitems) project files, among +The [`android-toolchain.projitems`](../../../build-tools/android-toolchain/android-toolchain.projitems), among others, use the `@(RequiredProgram)` build action to check for the existence of a program within `$PATH` during the build. If a required program doesn't exist, then the build will fail and a suggested `brew install` command line diff --git a/build-tools/scripts/BuildEverything.mk b/build-tools/scripts/BuildEverything.mk index 776e6f90b96..1798b26ea42 100644 --- a/build-tools/scripts/BuildEverything.mk +++ b/build-tools/scripts/BuildEverything.mk @@ -29,4 +29,3 @@ leeroy: leeroy-all framework-assemblies leeroy-all: $(call DOTNET_BINLOG,leeroy-all) $(SOLUTION) $(_MSBUILD_ARGS) $(call DOTNET_BINLOG,setup-workload) -t:ConfigureLocalWorkload build-tools/create-packs/Microsoft.Android.Sdk.proj - $(call MSBUILD_BINLOG,leeroy-all,$(_SLN_BUILD)) /restore tools/xabuild/xabuild.csproj /p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS) diff --git a/build-tools/scripts/build-monodroid b/build-tools/scripts/build-monodroid deleted file mode 100755 index 726f646af09..00000000000 --- a/build-tools/scripts/build-monodroid +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -e -MY_NAME="$(basename $0)" -MY_DIR="$(dirname $0)" -HOST="$(uname | tr A-Z a-z)" - -function die() -{ - echo $* - exit 1 -} - -function usage() -{ - local retcode="$1" - - if [ -z "$retcode" ]; then - retcode=0 - fi - - cat < [ ...] - -where OPTIONS is one or more of: - - -o|--output=DIR set output directory instead of the default monodroid 'obj' one - -r|--rebuild rebuild from scratch (this involves removing the output directory, - after prompting for confirmation) - -f|--force skip directory deletion prompt on rebuilds - -h|--help show this help screen - -Each is a name of the monodroid runtime configuration to build. Format: - - {ARCH}-[CHECKER-]{CONFIGURATION} - -where strings in upper case (e.g. 'ARCH') are placeholders as defined below -(alternative forms for each value are specified in parentheses). -All values are case-insensitive: - - ARCH is one of: armeabi-v7a (arm32, armv7), arm64-v8a (arm64, armv8), x86, x86_64 (x64), host, win32, win64, android-arm, android-arm64, android-x86, android-x64 - CHECKER is one of: asan, ubsan - CONFIGURATION is one of: release, debug - -Examples: - - ${MY_NAME} arm64-release - ${MY_NAME} android-x86-release host-debug - ${MY_NAME} x64-ubsan-release x86-net6-asan-debug - -EOF - - exit $retcode -} - -function unalias_target() -{ - local source="$(echo $1 | tr A-Z a-z)" - - echo $source | sed -e 's/arm32\|armv7/armeabi-v7a/g' \ - -e 's/arm64\|armv8/arm64-v8a/g' \ - -e 's/x64/x86_64/g' \ - -e "s/host/host-${HOST}/g" \ - -e 's/win32/host-mxe-win32/g' \ - -e 's/win64/host-mxe-win64/g' -} - -function assert_function_exists() -{ - local func_name="$1" - local target="$2" - - if [ "$(builtin type -type ${func_name})" != "function" ]; then - die "Target ${target} is unknown" - fi -} - -# Called by the generated script -function cleanup_build_dir() -{ - if [ "${__REBUILD}" != "yes" -o -z "${__BUILD_DIR}" ]; then - return - fi - - if [ ! -d "${__BUILD_DIR}" ]; then - return - fi - - local remove="no" - if [ "${__FORCE}" != "yes" ]; then - echo Build directory exists: ${__BUILD_DIR} - read -p "Are you sure you want to delete it? [y/N] " YESNO - if [ "${YESNO}" == "y" -o "${YESNO}" == "Y" ]; then - remove="yes" - fi - else - remove="yes" - fi - - if [ "${remove}" = "yes" ]; then - rm -rf "${__BUILD_DIR}" - fi -} - -source ${MY_DIR}/../../bin/configuration.mk -source ${MY_DIR}/../../bin/Build${CONFIGURATION}/cmake-config.sh - -TEMP=$(getopt -o hb:rfvj: --longoptions help,build-dir,rebuild,force,verbose,jobs -n "${MY_NAME}" -- "$@") - -if [ $? != 0 ] ; then - die "Terminating..." >&2 -fi -eval set -- "$TEMP" - -BUILD_DIR="" -REBUILD="no" -FORCE="no" -VERBOSE="" -JOBS="" - -while true; do - case "$1" in - -h|--help) usage ;; - -b|--build_dir) BUILD_DIR="$2" ; shift 2 ;; - -r|--rebuild) REBUILD="yes" ; shift ;; - -f|--force) FORCE="yes" ; shift ;; - -v|--verbose) VERBOSE="-v" ; shift ;; - -j|--jobs) JOBS="-j $2" ; shift 2 ;; - --) shift ; break ;; - esac -done - -if [ $# -eq 0 ]; then - usage 1 -fi - -for t in "$@"; do - TARGET=$(unalias_target "${t}") - FUNC_BASE_NAME="$(echo ${TARGET} | tr '-' '_')" - CONFIGURE_FUNC_NAME="_configure_${FUNC_BASE_NAME}" - BUILD_FUNC_NAME="_build_${FUNC_BASE_NAME}" - - assert_function_exists "${CONFIGURE_FUNC_NAME}" "${t}" - assert_function_exists "${BUILD_FUNC_NAME}" "${t}" - - ${CONFIGURE_FUNC_NAME} "${BUILD_DIR}" "${REBUILD}" "${FORCE}" - ${BUILD_FUNC_NAME} "${BUILD_DIR}" ${VERBOSE} ${JOBS} -done diff --git a/build-tools/xaprepare/xaprepare/Application/GeneratedMonodroidCmakeFiles.cs b/build-tools/xaprepare/xaprepare/Application/GeneratedMonodroidCmakeFiles.cs deleted file mode 100644 index 746f3f50d89..00000000000 --- a/build-tools/xaprepare/xaprepare/Application/GeneratedMonodroidCmakeFiles.cs +++ /dev/null @@ -1,543 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -namespace Xamarin.Android.Prepare -{ - partial class GeneratedMonodroidCmakeFiles : GeneratedFile - { - string outputPath; - - public GeneratedMonodroidCmakeFiles (string outputPath) - : base (MakeOutputPath (outputPath)) - { - this.outputPath = outputPath; - } - - static string MakeOutputPath (string outputPath) - { - return Path.Combine (outputPath, $"{{{Configurables.Paths.CmakeMSBuildPropsName},{Configurables.Paths.CmakeShellScriptsPropsName},{Configurables.Paths.CmakeMonodroidTargets}}}"); - } - - public override void Generate (Context context) - { - using (StreamWriter sw = Utilities.OpenStreamWriter (Path.Combine (outputPath, Configurables.Paths.CmakeMSBuildPropsName))) { - GenerateMSBuildProps (context, sw); - sw.Flush (); - } - - using (StreamWriter sw = Utilities.OpenStreamWriter (Path.Combine (outputPath, Configurables.Paths.CmakeMonodroidTargets))) { - GenerateMonodroidTargets (context, sw); - sw.Flush (); - } - - using (StreamWriter sw = Utilities.OpenStreamWriter (Path.Combine (outputPath, Configurables.Paths.CmakeShellScriptsPropsName))) { - GenerateShellConfig (context, sw); - sw.Flush (); - } - } - - static readonly string[] JitAbis = new [] { - AbiNames.TargetJit.AndroidArmV7a, - AbiNames.TargetJit.AndroidArmV8a, - AbiNames.TargetJit.AndroidX86, - AbiNames.TargetJit.AndroidX86_64, - }; - - static readonly string[] HostAbis = new [] { - Context.Instance.OS.Type, - AbiNames.HostJit.Win32, - AbiNames.HostJit.Win64, - }; - - void GenerateShellConfig (Context context, StreamWriter sw) - { - var commonReplacements = new Dictionary (StringComparer.Ordinal) { - { "@BUILD_TYPE@", "${__BUILD_TYPE}" }, - { "@CONFIGURATION@", "${__CONFIGURATION}" }, - { "@XA_BUILD_CONFIGURATION@", "${XA_BUILD_CONFIGURATION}" }, - { "@XA_LIB_TOP_DIR@", Configurables.Paths.InstallMSBuildDir.Replace (Path.DirectorySeparatorChar, '/') }, - { "@JdkIncludePath@", "${JDK_INCLUDE_PATH}" }, - { "@MonoSourceFullPath@", "${MONO_SOURCE_PATH}" }, - { "@NinjaPath@", "${NINJA}" }, - { "@OUTPUT_DIRECTORY@", "${__OUTPUT_DIR}" }, - { "@SOURCE_DIRECTORY@", "${MONODROID_SOURCE_DIR}" }, - }; - - var androidRuntimeReplacements = new Dictionary (StringComparer.Ordinal) { - { "@CmakeAndroidFlags@", "" }, - { "@NATIVE_API_LEVEL@", "${__NATIVE_API_LEVEL}" }, - { "@ABI@", "${__NATIVE_ABI}" }, - { "@AndroidNdkDirectory@", "${NDK_DIRECTORY}" }, - { "@AndroidToolchainPath@", GetRelativeToolchainDefinitionPath () }, - }; - - var hostRuntimeReplacements = new Dictionary (StringComparer.Ordinal) { - { "@CmakeHostFlags@", "" }, - { "@MingwDependenciesRootDirectory@", CmakeBuilds.MingwDependenciesRootDirectory }, - { "@MxeToolchainBasePath@", "${MXE_TOOLCHAIN_BASE_PATH}" }, - { "@BITNESS@", "" }, - }; - - AddReplacements (commonReplacements, androidRuntimeReplacements); - AddReplacements (commonReplacements, hostRuntimeReplacements); - - string monodroidObjDir = Path.Combine (Configurables.Paths.MonodroidSourceDir, "obj", context.Configuration); - string jdkInfoPropsPath = Path.Combine (Configurables.Paths.ExternalJavaInteropDir, "bin", $"Build{context.Configuration}", "JdkInfo.props"); - - sw.WriteLine ("# This is a bash(1) script"); - sw.WriteLine (); - sw.WriteLine ($"CMAKE=\"{context.Properties.GetRequiredValue(KnownProperties.CMakePath)}\""); - sw.WriteLine ($"JDK_INCLUDE_PATH=\"$(grep JdkIncludePath {jdkInfoPropsPath} | cut -d '\"' -f 2 | tr '\\n' ' ')\""); - sw.WriteLine ($"MONO_SOURCE_PATH=\"{Configurables.Paths.MonoSourceFullPath}\""); - sw.WriteLine ($"MONODROID_OBJ_DIR=\"{monodroidObjDir}\""); - sw.WriteLine ($"MONODROID_SOURCE_DIR=\"{Configurables.Paths.MonodroidSourceDir}\""); - sw.WriteLine ($"MXE_TOOLCHAIN_BASE_PATH=\"{CmakeBuilds.MxeToolchainBasePath}\""); - sw.WriteLine ($"NDK_DIRECTORY=\"{Configurables.Paths.AndroidNdkDirectory}\""); - sw.WriteLine ($"NINJA=\"{context.Properties.GetRequiredValue(KnownProperties.NinjaPath)}\""); - sw.WriteLine ($"XA_BUILD_CONFIGURATION={context.Configuration}"); - sw.WriteLine ($"XA_INSTALL_DIR=\"{Configurables.Paths.InstallMSBuildDir}/lib\""); - sw.WriteLine (); - - string indent = "\t"; - sw.WriteLine ("function __xa_build()"); - sw.WriteLine ("{"); - - WriteVariableValidationCode ("__BUILD_DIR"); - - sw.WriteLine ($"{indent}\"${{NINJA}}\" -C \"${{__BUILD_DIR}}\" \"$@\""); - sw.WriteLine ("}"); - sw.WriteLine (); - - sw.WriteLine ("function __xa_configure_android_runtime()"); - sw.WriteLine ("{"); - - WriteVariableValidationCode ("__BUILD_DIR"); - WriteVariableValidationCode ("__CONFIGURATION"); - WriteVariableValidationCode ("__BUILD_TYPE"); - WriteVariableValidationCode ("__NATIVE_API_LEVEL"); - WriteVariableValidationCode ("__NATIVE_ABI"); - WriteVariableValidationCode ("__OUTPUT_DIR"); - - sw.WriteLine ($"{indent}cleanup_build_dir"); - sw.WriteLine (); - - indent = "\t\t"; - var flags = new StringBuilder (); - AppendFlags (flags, CmakeBuilds.CommonFlags, indent); - AppendFlags (flags, CmakeBuilds.MonodroidCommonDefines, indent); - AppendFlags (flags, CmakeBuilds.AndroidFlags, indent); - AppendFlags (flags, CmakeBuilds.ConfigureAndroidRuntimeCommandsCommonFlags, indent); - indent = "\t"; - - WriteCmakeCall (flags, androidRuntimeReplacements); - - sw.WriteLine ("}"); - sw.WriteLine (); - - sw.WriteLine ("function __xa_configure_host_runtime()"); - sw.WriteLine ("{"); - sw.WriteLine ($"{indent}local is_mxe=$1"); - sw.WriteLine (); - - WriteVariableValidationCode ("__BUILD_DIR"); - WriteVariableValidationCode ("__CONFIGURATION"); - WriteVariableValidationCode ("__BUILD_TYPE"); - WriteVariableValidationCode ("__OUTPUT_DIR"); - - sw.WriteLine ($"{indent}cleanup_build_dir"); - sw.WriteLine (); - - sw.WriteLine ($"{indent}shift"); - sw.WriteLine (); - sw.WriteLine ($"{indent}if [ \"${{is_mxe}}\" = \"yes\" ]; then"); - indent = "\t\t"; - - // Windows cross builds - flags.Clear (); - indent = "\t\t\t"; - AppendFlags (flags, CmakeBuilds.CommonFlags, indent); - AppendFlags (flags, CmakeBuilds.MonodroidCommonDefines, indent); - AppendFlags (flags, CmakeBuilds.MonodroidMxeCommonFlags, indent); - AppendFlags (flags, CmakeBuilds.ConfigureHostRuntimeCommandsCommonFlags, indent); - indent = "\t\t"; - WriteCmakeCall (flags, hostRuntimeReplacements); - - // Host build - sw.WriteLine ($"\telse"); - indent = "\t\t\t"; - flags.Clear (); - AppendFlags (flags, CmakeBuilds.CommonFlags, indent); - AppendFlags (flags, CmakeBuilds.MonodroidCommonDefines, indent); - AppendFlags (flags, CmakeBuilds.ConfigureHostRuntimeCommandsCommonFlags, indent); - indent = "\t\t"; - WriteCmakeCall (flags, hostRuntimeReplacements); - - indent = "\t"; - sw.WriteLine ($"{indent}fi"); - - sw.WriteLine ("}"); - sw.WriteLine (); - - foreach (CmakeBuilds.RuntimeCommand rc in CmakeBuilds.AndroidRuntimeCommands) { - WriteShellRuntimeCommand (sw, JitAbis, rc, androidRuntimeReplacements); - } - - foreach (CmakeBuilds.RuntimeCommand rc in CmakeBuilds.HostRuntimeCommands) { - WriteShellRuntimeCommand (sw, HostAbis, rc, hostRuntimeReplacements); - } - - void WriteCmakeCall (StringBuilder args, Dictionary replacements) - { - sw.WriteLine ($"{indent}\"${{CMAKE}}\" \\"); - sw.WriteLine ($"{indent}\t-B \"${{__BUILD_DIR}}\" \\"); - sw.Write (ApplyReplacements (args, replacements).ToString ()); - sw.WriteLine (" \"$@\""); - } - - void AppendFlags (StringBuilder sb, List flags, string indent) - { - if (sb.Length > 0) { - sb.Append ($" \\\n{indent}"); - } else { - sb.Append (indent); - } - - sb.Append (String.Join ($" \\\n{indent}", flags)); - } - - void WriteVariableValidationCode (string varName) - { - sw.WriteLine ($"{indent}if [ -z \"${{{varName}}}\" ]; then"); - sw.WriteLine ($"{indent}\tdie \"Variable '{varName}' is empty\""); - sw.WriteLine ($"{indent}fi"); - sw.WriteLine (); - } - } - - void WriteShellRuntimeCommand (StreamWriter sw, IEnumerable abis, CmakeBuilds.RuntimeCommand command, Dictionary replacements) - { - var funcName = new StringBuilder (); - string indent = "\t"; - - foreach (var a in abis) { - string abi = a; - uint minApiLevel = command.IsDotNet ? BuildAndroidPlatforms.NdkMinimumAPI : !command.IsHost ? BuildAndroidPlatforms.NdkMinimumAPIMap [abi] : 0; - string outputDirName = command.IsDotNet ? AbiNames.AbiToRuntimeIdentifier (abi) : abi; - string isMxe = "no"; - string mxeBitness = String.Empty; - bool forMxe = false; - - if (command.IsHost) { - if (String.Compare (abi, AbiNames.HostJit.Win32, StringComparison.OrdinalIgnoreCase) == 0) { - mxeBitness = "32"; - } else if (String.Compare (abi, AbiNames.HostJit.Win64, StringComparison.OrdinalIgnoreCase) == 0) { - mxeBitness = "64"; - } - - if (mxeBitness.Length > 0) { - isMxe = "yes"; - forMxe = true; - } - } - - if (command.IsHost) { - outputDirName = $"host-{outputDirName}"; - abi = $"host-{abi}"; - } - - funcName.Clear (); - funcName.Append (abi.ToLowerInvariant ()); - funcName.Append ('_'); - funcName.Append (command.Suffix.ToLowerInvariant ()); - funcName.Replace ('-', '_'); - - sw.WriteLine (); - sw.WriteLine ($"function _configure_{funcName}()"); - sw.WriteLine ("{"); - sw.WriteLine ($"{indent}local build_directory=\"$1\""); - sw.WriteLine ($"{indent}local rebuild=\"$2\""); - sw.WriteLine ($"{indent}local force=\"$3\""); - sw.WriteLine (); - sw.WriteLine ($"{indent}if [ -z \"${{build_directory}}\" ]; then"); - sw.WriteLine ($"{indent}\tbuild_directory=\"${{MONODROID_OBJ_DIR}}\""); - sw.WriteLine ($"{indent}fi"); - sw.WriteLine ($"{indent}__BUILD_DIR=\"${{build_directory}}/{outputDirName}-{command.Suffix}\""); - sw.WriteLine ($"{indent}__OUTPUT_DIR=\"${{XA_INSTALL_DIR}}/{outputDirName}\""); - sw.WriteLine ($"{indent}__CONFIGURATION={command.Configuration}"); - sw.WriteLine ($"{indent}__BUILD_TYPE={command.BuildType}"); - sw.WriteLine ($"{indent}__REBUILD=\"${{rebuild}}\""); - sw.WriteLine ($"{indent}__FORCE=\"${{force}}\""); - if (!command.IsHost) { - sw.WriteLine ($"{indent}__NATIVE_ABI={abi}"); - sw.WriteLine ($"{indent}__NATIVE_API_LEVEL=${{{minApiLevel}}}"); - } - sw.WriteLine (); - if (!command.IsHost) { - sw.Write ($"{indent}__xa_configure_android_runtime"); - } else { - sw.Write ($"{indent}__xa_configure_host_runtime {isMxe}"); - } - - StringBuilder? flags = null; - if (forMxe) { - flags = new StringBuilder (String.Join (" ", CmakeBuilds.MonodroidMxeCommonFlagsBitness)); - replacements["@BITNESS@"] = mxeBitness; - } - - if (command.ExtraOptions != null && command.ExtraOptions.Count > 0) { - if (flags == null) { - flags = new StringBuilder (); - } else { - flags.Append (" "); - } - flags.Append (String.Join (" ", command.ExtraOptions)); - } - - if (flags != null && flags.Length > 0) { - sw.Write (" "); - sw.Write (ApplyReplacements (flags, replacements)); - } - - sw.WriteLine (); - sw.WriteLine (); - sw.WriteLine ("}"); - - indent = "\t"; - sw.WriteLine (); - sw.WriteLine ($"function _build_{funcName}()"); - sw.WriteLine ("{"); - sw.WriteLine ($"{indent}local build_directory=\"$1\""); - sw.WriteLine (); - sw.WriteLine ($"{indent}shift"); - sw.WriteLine ($"{indent}if [ -z \"${{build_directory}}\" ]; then"); - sw.WriteLine ($"{indent}\tbuild_directory=\"${{MONODROID_OBJ_DIR}}\""); - sw.WriteLine ($"{indent}fi"); - sw.WriteLine ($"{indent}__BUILD_DIR=\"${{build_directory}}/{abi}-{command.Suffix}\""); - sw.WriteLine (); - sw.WriteLine ($"{indent}__xa_build \"$@\""); - sw.WriteLine ("}"); - }; - } - - void GenerateMonodroidTargets (Context context, StreamWriter sw) - { - string sourceDir = Utilities.GetRelativePath (Configurables.Paths.BuildBinDir, Configurables.Paths.MonodroidSourceDir); - - var commonReplacements = new Dictionary (StringComparer.Ordinal) { - { "@BUILD_TYPE@", "" }, - { "@CONFIGURATION@", "" }, - { "@SOURCE_DIRECTORY@", $"$(MSBuildThisFileDirectory){sourceDir}" }, - }; - - var androidRuntimeReplacements = new Dictionary (StringComparer.Ordinal) { - { "@CmakeAndroidFlags@", "$(_CmakeAndroidFlags)" }, - { "@NATIVE_API_LEVEL@", "" }, - { "@ABI@", "%(AndroidSupportedTargetJitAbi.Identity)" }, - { "@RID@", "%(AndroidSupportedTargetJitAbi.AndroidRID)" }, - { "@OUTPUT_DIRECTORY@", "" }, - }; - - var hostRuntimeReplacements = new Dictionary (StringComparer.Ordinal) { - { "@CmakeHostFlags@", "%(_HostRuntime.CmakeFlags)" }, - { "@JdkIncludePath@", "@(JdkIncludePath->'%(Identity)', ' ')" }, - { "@OUTPUT_DIRECTORY@", "" }, - }; - - AddReplacements (commonReplacements, androidRuntimeReplacements); - AddReplacements (commonReplacements, hostRuntimeReplacements); - - WriteMSBuildProjectStart (sw); - sw.WriteLine (" "); - - string indent = " "; - foreach (CmakeBuilds.RuntimeCommand rc in CmakeBuilds.AndroidRuntimeCommands) { - WriteMSBuildConfigureAndroidRuntimeCommands (sw, indent, rc, androidRuntimeReplacements); - } - - foreach (CmakeBuilds.RuntimeCommand rc in CmakeBuilds.HostRuntimeCommands) { - WriteMSBuildConfigureHostRuntimeCommands (sw, indent, rc, hostRuntimeReplacements); - }; - - sw.WriteLine (" "); - WriteMSBuildProjectEnd (sw); - } - - void WriteMSBuildConfigureRuntimeCommands (StreamWriter sw, string indent, string workingDirectory, string outputDirectory, string itemName, List commonFlags, CmakeBuilds.RuntimeCommand command, Dictionary replacements, bool needsApiLevel) - { - replacements["@CONFIGURATION@"] = EnsureRequired ("Configuration", command.Configuration); - replacements["@BUILD_TYPE@"] = EnsureRequired ("BuildType", command.BuildType); - replacements["@NATIVE_API_LEVEL@"] = needsApiLevel ? EnsureRequired ("MSBuildApiLevel", command.MSBuildApiLevel) : String.Empty; - replacements["@OUTPUT_DIRECTORY@"] = outputDirectory; - - var flags = new StringBuilder (); - flags.Append (String.Join (" ", commonFlags)); - - if (command.ExtraOptions != null && command.ExtraOptions.Count > 0) { - flags.Append (" "); - flags.Append (String.Join (" ", command.ExtraOptions)); - } - - var conditionString = (workingDirectory.IndexOf ("-asan", StringComparison.OrdinalIgnoreCase) >= 0 - || workingDirectory.IndexOf ("-ubsan", StringComparison.OrdinalIgnoreCase) >= 0) - ? " Condition=\"'$(EnableNativeAnalyzers)' == 'true'\" " : string.Empty; - - sw.WriteLine ($"{indent}"); - sw.WriteLine ($"{indent}"); - sw.WriteLine ($"{indent} <_ConfigureRuntimeCommands Include=\"{itemName}\">"); - sw.WriteLine ($"{indent} $(CmakePath)"); - WriteProperty (sw, $"{indent} ", "Arguments", flags, replacements); - sw.WriteLine ($"{indent} {workingDirectory}"); - sw.WriteLine ($"{indent} "); - sw.WriteLine ($"{indent}"); - sw.WriteLine (); - - string EnsureRequired (string name, string v) - { - if (v.Length > 0) { - return v; - } - - throw new InvalidOperationException ($"RuntimeCommand.{name} must not be an empty string"); - } - } - - void WriteMSBuildConfigureAndroidRuntimeCommands (StreamWriter sw, string indent, CmakeBuilds.RuntimeCommand command, Dictionary replacements) - { - const string LegacyOutputDirectory = "%(AndroidSupportedTargetJitAbi.Identity)"; - const string OutputDirectory = "%(AndroidSupportedTargetJitAbi.AndroidRID)"; - - WriteMSBuildConfigureRuntimeCommands ( - sw, - indent, - command.IsDotNet ? $"$(IntermediateOutputPath){OutputDirectory}-{command.Suffix}" : $"$(IntermediateOutputPath){LegacyOutputDirectory}-{command.Suffix}", - command.IsDotNet ? $"$(OutputPath){OutputDirectory}" : $"$(OutputPath){LegacyOutputDirectory}", - "@(AndroidSupportedTargetJitAbi)", - CmakeBuilds.ConfigureAndroidRuntimeCommandsCommonFlags, - command, - replacements, - true - ); - } - - void WriteMSBuildConfigureHostRuntimeCommands (StreamWriter sw, string indent, CmakeBuilds.RuntimeCommand command, Dictionary replacements) - { - WriteMSBuildConfigureRuntimeCommands ( - sw, - indent, - $"$(IntermediateOutputPath)%(_HostRuntime.OutputDirectory)-{command.Suffix}", - "$(OutputPath)/%(_HostRuntime.OutputDirectory)", - "@(_HostRuntime)", - CmakeBuilds.ConfigureHostRuntimeCommandsCommonFlags, - command, - replacements, - false - ); - } - - void GenerateMSBuildProps (Context context, StreamWriter sw) - { - var MSBuildReplacements = new Dictionary (StringComparer.Ordinal) { - { "@NinjaPath@", "$(NinjaPath)" }, - { "@XA_BUILD_CONFIGURATION@", "$(Configuration)" }, - { "@XA_LIB_TOP_DIR@", "$(MicrosoftAndroidSdkOutDir)" }, - { "@AndroidNdkDirectory@", "$(AndroidNdkDirectory)" }, - { "@MonoSourceFullPath@", "$(MonoSourceFullPath)" }, - { "@AndroidToolchainPath@", GetRelativeToolchainDefinitionPath () }, - }; - - var MSBuildMingwReplacements = new Dictionary (StringComparer.Ordinal) { - { "@MingwDependenciesRootDirectory@", CmakeBuilds.MingwDependenciesRootDirectory }, - { "@MxeToolchainBasePath@", CmakeBuilds.MxeToolchainBasePath }, - { "@BITNESS@", "" }, - }; - - WriteMSBuildProjectStart (sw); - - var sharedByAll = new StringBuilder ("--debug-output "); - sharedByAll.Append (String.Join (" ", CmakeBuilds.CommonFlags)); - sharedByAll.Append (" "); - sharedByAll.Append (String.Join (" ", CmakeBuilds.MonodroidCommonDefines)); - - var flags = new StringBuilder (); - flags.Append (sharedByAll); - flags.Append (" "); - flags.Append (String.Join (" ", CmakeBuilds.AndroidFlags)); - - string propertyIndent = " "; - sw.WriteLine (" "); - WriteProperty (sw, propertyIndent, "_CmakeAndroidFlags", flags, MSBuildReplacements); - WriteProperty (sw, propertyIndent, "_CmakeCommonHostFlags", sharedByAll, MSBuildReplacements); - sw.WriteLine (" "); - - if (CmakeBuilds.MxeToolchainBasePath.Length > 0 && CmakeBuilds.MingwDependenciesRootDirectory.Length > 0) { - AddReplacements (MSBuildReplacements, MSBuildMingwReplacements); - - sw.WriteLine (); - sw.WriteLine (" "); - - flags.Clear (); - flags.Append (sharedByAll); - flags.Append (" "); - flags.Append (String.Join (" ", CmakeBuilds.MonodroidMxeCommonFlags)); - flags.Append (" "); - flags.Append (String.Join (" ", CmakeBuilds.MonodroidMxeCommonFlagsBitness)); - - MSBuildMingwReplacements["@BITNESS@"] = "32"; - WriteProperty (sw, propertyIndent, "_CmakeMxeCommonFlags32", flags, MSBuildMingwReplacements); - - MSBuildMingwReplacements["@BITNESS@"] = "64"; - WriteProperty (sw, propertyIndent, "_CmakeMxeCommonFlags64", flags, MSBuildMingwReplacements); - - sw.WriteLine (" "); - } - - WriteMSBuildProjectEnd (sw); - } - - StringBuilder ApplyReplacements (StringBuilder value, Dictionary replacements) - { - var text = new StringBuilder (); - text.Append (value); - - foreach (var kvp in replacements) { - string placeholder = kvp.Key; - string replacement = kvp.Value; - - text.Replace (placeholder, replacement); - } - - return text; - } - - void WriteProperty (StreamWriter sw, string indent, string name, StringBuilder value, Dictionary replacements) - { - var text = ApplyReplacements (value, replacements); - sw.WriteLine ($"{indent}<{name}>{text}"); - } - - void WriteMSBuildProjectStart (StreamWriter sw) - { - sw.WriteLine (""); - sw.WriteLine (""); - } - - void WriteMSBuildProjectEnd (StreamWriter sw) - { - sw.WriteLine (""); - } - - string GetRelativeToolchainDefinitionPath () - { - return Path.DirectorySeparatorChar + Path.Combine ("build", "cmake", "android.toolchain.cmake"); - } - - void AddReplacements (Dictionary source, Dictionary target) - { - foreach (var kvp in source) { - target.Add (kvp.Key, kvp.Value); - } - } - } -} diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/CmakeBuilds.Unix.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/CmakeBuilds.Unix.cs deleted file mode 100644 index e0205f9fe51..00000000000 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/CmakeBuilds.Unix.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.IO; - -namespace Xamarin.Android.Prepare -{ - static partial class CmakeBuilds - { - static CmakeBuilds () - { - MxeToolchainBasePath = Path.Combine (Configurables.Paths.BuildBinDir, "mingw"); - MingwDependenciesRootDirectory = Path.Combine (Configurables.Paths.BuildBinDir, "mingw-deps"); - } - } -} diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/CmakeBuilds.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/CmakeBuilds.cs deleted file mode 100644 index 6763232c0e8..00000000000 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/CmakeBuilds.cs +++ /dev/null @@ -1,232 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Xamarin.Android.Prepare -{ - // - // Templates for various cmake builds (sqlite and monodroid currently). - // Generator code is in ../Application/GeneratedMonodroidCmakeFiles.cs - // - // This is all a bit convoluted, but the single set of CMake defines below needs to serve the purpose of building - // several different flavors our our runtime (52 in total, right now) and is used to generate both MSBuild and Unix - // bash code. - // - static partial class CmakeBuilds - { - public sealed class RuntimeCommand - { - public string Configuration = String.Empty; - public string BuildType = String.Empty; - public string Suffix = String.Empty; - public string MSBuildApiLevel = String.Empty; - public List? ExtraOptions = null; - public bool IsDotNet = false; - public bool IsHost = false; - }; - - const string msbuildApiLevelLegacy = "%(AndroidSupportedTargetJitAbi.ApiLevel)"; - const string msbuildApiLevel = "%(AndroidSupportedTargetJitAbi.ApiLevelNET)"; - - // These two are configured in CmakeBuilds.Unix.cs, Windows doesn't use them - public static readonly string MxeToolchainBasePath = String.Empty; - public static readonly string MingwDependenciesRootDirectory = String.Empty; - - public static readonly List CommonFlags = new List { - "-GNinja", - "-DCMAKE_MAKE_PROGRAM=\"@NinjaPath@\"", - "-DXA_BUILD_CONFIGURATION=@XA_BUILD_CONFIGURATION@", - "-DXA_LIB_TOP_DIR=@XA_LIB_TOP_DIR@", - }; - - public static readonly List AndroidFlags = new List { - "-DANDROID_STL=\"none\"", - "-DANDROID_CPP_FEATURES=\"no-rtti no-exceptions\"", - "-DANDROID_TOOLCHAIN=clang", - "-DCMAKE_TOOLCHAIN_FILE=\"@AndroidNdkDirectory@@AndroidToolchainPath@\"", - "-DANDROID_NDK=@AndroidNdkDirectory@" - }; - - public static readonly List MonodroidCommonDefines = new List { - "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON", - "-DMONO_PATH=\"@MonoSourceFullPath@\"", - }; - - public static readonly List MonodroidMxeCommonFlags = new List { - "-DMINGW_DEPENDENCIES_ROOT_DIR=\"@MingwDependenciesRootDirectory@\"", - }; - - public static readonly List MonodroidMxeCommonFlagsBitness = new List { - "-DCMAKE_TOOLCHAIN_FILE=\"@MxeToolchainBasePath@-@BITNESS@.cmake\"", - "-DMINGW_TARGET_@BITNESS@=1", - }; - - public static readonly List ConfigureHostRuntimeCommandsCommonFlags = new List { - "@CmakeHostFlags@", - "-DCONFIGURATION=@CONFIGURATION@", - "-DCMAKE_BUILD_TYPE=@BUILD_TYPE@", - "-DJDK_INCLUDE=\"@JdkIncludePath@\"", - "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=\"@OUTPUT_DIRECTORY@\"", - "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=\"@OUTPUT_DIRECTORY@\"", - "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=\"@OUTPUT_DIRECTORY@\"", - "\"@SOURCE_DIRECTORY@\"", - }; - - public static readonly List ConfigureAndroidRuntimeCommandsCommonFlags = new List { - "@CmakeAndroidFlags@", - "-DCONFIGURATION=@CONFIGURATION@", - "-DCMAKE_BUILD_TYPE=@BUILD_TYPE@", - "-DANDROID_NATIVE_API_LEVEL=@NATIVE_API_LEVEL@", - "-DANDROID_PLATFORM=android-@NATIVE_API_LEVEL@", - "-DANDROID_ABI=@ABI@", - "-DANDROID_RID=@RID@", - "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=\"@OUTPUT_DIRECTORY@\"", - "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=\"@OUTPUT_DIRECTORY@\"", - "\"@SOURCE_DIRECTORY@\"", - }; - - public static readonly List AsanExtraOptions = new List { - "-DENABLE_CLANG_ASAN=ON", - "-DANDROID_STL=\"c++_static\"", - }; - - public static readonly List UbsanExtraOptions = new List { - "-DENABLE_CLANG_UBSAN=ON", - "-DANDROID_STL=\"c++_static\"", - "-DANDROID_CPP_FEATURES=\"rtti exceptions\"", - }; - - const string enableNet = "-DENABLE_NET=ON"; - public static readonly List NetExtraOptions = new List { - enableNet, - }; - - public static readonly List NetAsanExtraOptions = new List (AsanExtraOptions) { - enableNet, - }; - - public static readonly List NetUbsanExtraOptions = new List (UbsanExtraOptions) { - enableNet, - }; - - public static readonly List AndroidRuntimeCommands = new List { - // Debug builds - new RuntimeCommand { - Suffix = "Debug", - Configuration = "Release", - BuildType = "Debug", - MSBuildApiLevel = msbuildApiLevelLegacy, - }, - - new RuntimeCommand { - Suffix = "asan-Debug", - Configuration = "Release", - BuildType = "Debug", - MSBuildApiLevel = msbuildApiLevelLegacy, - ExtraOptions = AsanExtraOptions, - }, - - new RuntimeCommand { - Suffix = "ubsan-Debug", - Configuration = "Release", - BuildType = "Debug", - MSBuildApiLevel = msbuildApiLevelLegacy, - ExtraOptions = UbsanExtraOptions, - }, - - new RuntimeCommand { - Suffix = "Debug", - Configuration = "Release", - BuildType = "Debug", - MSBuildApiLevel = msbuildApiLevel, - ExtraOptions = NetExtraOptions, - IsDotNet = true, - }, - - new RuntimeCommand { - Suffix = "asan-Debug", - Configuration = "Release", - BuildType = "Debug", - MSBuildApiLevel = msbuildApiLevel, - ExtraOptions = NetAsanExtraOptions, - IsDotNet = true, - }, - - new RuntimeCommand { - Suffix = "ubsan-Debug", - Configuration = "Release", - BuildType = "Debug", - MSBuildApiLevel = msbuildApiLevel, - ExtraOptions = NetUbsanExtraOptions, - IsDotNet = true, - }, - - // Release builds - - new RuntimeCommand { - Suffix = "Release", - Configuration = "Debug", - BuildType = "Release", - MSBuildApiLevel = msbuildApiLevelLegacy, - }, - - new RuntimeCommand { - Suffix = "asan-Release", - Configuration = "Debug", - BuildType = "Release", - MSBuildApiLevel = msbuildApiLevelLegacy, - ExtraOptions = AsanExtraOptions, - }, - - new RuntimeCommand { - Suffix = "ubsan-Release", - Configuration = "Debug", - BuildType = "Release", - MSBuildApiLevel = msbuildApiLevelLegacy, - ExtraOptions = UbsanExtraOptions, - }, - - new RuntimeCommand { - Suffix = "Release", - Configuration = "Debug", - BuildType = "Release", - MSBuildApiLevel = msbuildApiLevel, - ExtraOptions = NetExtraOptions, - IsDotNet = true, - }, - - new RuntimeCommand { - Suffix = "asan-Release", - Configuration = "Debug", - BuildType = "Release", - MSBuildApiLevel = msbuildApiLevel, - ExtraOptions = NetAsanExtraOptions, - IsDotNet = true, - }, - - new RuntimeCommand { - Suffix = "ubsan-Release", - Configuration = "Debug", - BuildType = "Release", - MSBuildApiLevel = msbuildApiLevel, - ExtraOptions = NetUbsanExtraOptions, - IsDotNet = true, - }, - }; - - public static readonly List HostRuntimeCommands = new List { - new RuntimeCommand { - Suffix = "Debug", - Configuration = "Release", - BuildType = "Debug", - IsHost = true, - }, - - new RuntimeCommand { - Suffix = "Release", - Configuration = "Debug", - BuildType = "Release", - IsHost = true, - }, - }; - } -} diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs index 7cc03163c24..03b42412a70 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs @@ -347,12 +347,6 @@ public static partial class Paths public static string DotNetPreviewTool => Path.Combine (DotNetPreviewPath, "dotnet"); - // CMake - public static string CmakeMSBuildPropsName = "cmake-config.props"; - public static string CmakeShellScriptsPropsName = "cmake-config.sh"; - public static string CmakeMonodroidTargets = "cmake-monodroid.targets"; - public static string MonodroidSourceDir => GetCachedPath (ref monodroidSourceDir, () => Path.Combine (BuildPaths.XamarinAndroidSourceRoot, "src", "monodroid")); - // Other public static string AndroidNdkDirectory => ctx.Properties.GetRequiredValue (KnownProperties.AndroidNdkDirectory); public static string AndroidToolchainRootDirectory => GetCachedPath (ref androidToolchainRootDirectory, () => Path.Combine (AndroidNdkDirectory, "toolchains", "llvm", "prebuilt", NdkToolchainOSTag)); @@ -464,7 +458,6 @@ static string GetCachedPath (ref string? variable, Func creator) static string? netcoreAppRuntimeAndroidARM64; static string? netcoreAppRuntimeAndroidX86; static string? netcoreAppRuntimeAndroidX86_64; - static string? monodroidSourceDir; } } } diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs b/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs index 6fe698f44ea..2a29cfa14fd 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs @@ -58,7 +58,6 @@ protected override async Task Execute (Context context) Get_MonoGitHash_props (context), Get_Configuration_Generated_Props (context), Get_Cmake_XA_Build_Configuration (context), - new GeneratedMonodroidCmakeFiles (Configurables.Paths.BuildBinDir), }; } else { return new List { @@ -66,7 +65,6 @@ protected override async Task Execute (Context context) Get_Configuration_OperatingSystem_props (context), Get_Configuration_Generated_Props (context), Get_Cmake_XA_Build_Configuration (context), - new GeneratedMonodroidCmakeFiles (Configurables.Paths.BuildBinDir), Get_Ndk_projitems (context), Get_XABuildConfig_cs (context), Get_mingw_32_cmake (context), diff --git a/src/monodroid/CMakeLists.txt b/src/monodroid/CMakeLists.txt index 0269473f337..61c2f414ed9 100644 --- a/src/monodroid/CMakeLists.txt +++ b/src/monodroid/CMakeLists.txt @@ -46,7 +46,6 @@ else() set(ANALYZERS_ENABLED OFF) endif() -option(ENABLE_NET "Enable compilation for .NET 6+" OFF) option(ENABLE_TIMING "Build with timing support" OFF) option(STRIP_DEBUG "Strip debugging information when linking" ${STRIP_DEBUG_DEFAULT}) option(DISABLE_DEBUG "Disable the built-in debugging code" OFF) @@ -184,18 +183,16 @@ endif() include("${XA_BUILD_DIR}/xa_build_configuration.cmake") -if(ENABLE_NET) - if(ANDROID_ABI MATCHES "^arm64-v8a") - set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_ARM64}") - elseif(ANDROID_ABI MATCHES "^armeabi-v7a") - set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_ARM}") - elseif(ANDROID_ABI MATCHES "^x86_64") - set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_X86_64}") - elseif(ANDROID_ABI MATCHES "^x86") - set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_X86}") - else() - message(FATAL "${ANDROID_ABI} is not supported for .NET 6+ builds") - endif() +if(ANDROID_ABI MATCHES "^arm64-v8a") + set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_ARM64}") +elseif(ANDROID_ABI MATCHES "^armeabi-v7a") + set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_ARM}") +elseif(ANDROID_ABI MATCHES "^x86_64") + set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_X86_64}") +elseif(ANDROID_ABI MATCHES "^x86") + set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_X86}") +else() + message(FATAL "${ANDROID_ABI} is not supported for .NET 6+ builds") endif() set(LZ4_SOURCES @@ -245,12 +242,7 @@ if (WIN32) include_directories(BEFORE "jni/win32") endif() -if(ENABLE_NET) - include_directories("${NET_RUNTIME_DIR}/native/include/mono-2.0") -else() - include_directories("${XA_BIN_DIR}/include/mono-2.0") -endif() - +include_directories("${NET_RUNTIME_DIR}/native/include/mono-2.0") include_directories("jni") include_directories("${XA_BIN_DIR}/include") include_directories("${XA_BIN_DIR}/include/${ANDROID_ABI}/eglib") @@ -276,11 +268,8 @@ add_compile_definitions(HAVE_CONFIG_H) add_compile_definitions(_REENTRANT) add_compile_definitions(JI_DLL_EXPORT) add_compile_definitions(MONO_DLL_EXPORT) - -if(ENABLE_NET) - add_compile_definitions(NET) - add_compile_definitions(JI_NO_VISIBILITY) -endif() +add_compile_definitions(NET) +add_compile_definitions(JI_NO_VISIBILITY) if(DEBUG_BUILD AND NOT DISABLE_DEBUG) add_compile_definitions(DEBUG) @@ -427,14 +416,9 @@ endif() # Library directories if(ANDROID) - if(ENABLE_NET) - set(XA_LIBRARY_OUTPUT_DIRECTORY "${XA_LIB_TOP_DIR}/lib/${ANDROID_RID}") - set(XA_LIBRARY_STUBS_OUTPUT_DIRECTORY "${XA_LIB_TOP_DIR}/libstubs/${ANDROID_RID}") - link_directories("${NET_RUNTIME_DIR}/native") - else() - set(XA_LIBRARY_OUTPUT_DIRECTORY "${XA_LIB_TOP_DIR}/lib/${ANDROID_ABI}") - link_directories("${XA_LIBRARY_OUTPUT_DIRECTORY}") - endif() + set(XA_LIBRARY_OUTPUT_DIRECTORY "${XA_LIB_TOP_DIR}/lib/${ANDROID_RID}") + set(XA_LIBRARY_STUBS_OUTPUT_DIRECTORY "${XA_LIB_TOP_DIR}/libstubs/${ANDROID_RID}") + link_directories("${NET_RUNTIME_DIR}/native") endif() if(WIN32 OR MINGW) @@ -510,7 +494,7 @@ if(ANDROID) ${LZ4_SOURCES} ) - if(NOT DEBUG_BUILD AND ENABLE_NET) + if(NOT DEBUG_BUILD) list(APPEND XAMARIN_MONODROID_SOURCES ${SOURCES_DIR}/xamarin-android-app-context.cc ) @@ -540,7 +524,7 @@ if(UNIX) ) endif() -if(ANDROID AND ENABLE_NET) +if(ANDROID) list(APPEND XAMARIN_MONODROID_SOURCES ${SOURCES_DIR}/monovm-properties.cc ${SOURCES_DIR}/pinvoke-override-api.cc @@ -584,7 +568,7 @@ else() list(APPEND MONOSGEN_LIB_LINK -lmonosgen-2.0) endif() -if(NOT (ANDROID AND ENABLE_NET)) +if(NOT (ANDROID)) add_library( ${XAMARIN_INTERNAL_API_LIB} SHARED @@ -722,7 +706,7 @@ target_link_libraries( ${LINK_LIBS} xamarin-app ) -if(ANDROID AND ENABLE_NET AND (NOT ANALYZERS_ENABLED)) +if(ANDROID AND (NOT ANALYZERS_ENABLED)) macro(xa_add_stub_library _libname) add_library( ${_libname} diff --git a/src/monodroid/monodroid.projitems b/src/monodroid/monodroid.projitems deleted file mode 100644 index c97c230eac8..00000000000 --- a/src/monodroid/monodroid.projitems +++ /dev/null @@ -1,28 +0,0 @@ - - - - <_HostRuntime Include="host-Darwin" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Darwin:'))"> - $(_CmakeCommonHostFlags) - host-Darwin - dylib - - - <_HostRuntime Include="host-Linux" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Linux:'))"> - $(_CmakeCommonHostFlags) - host-Linux - so - - - <_HostRuntime Include="host-mxe-Win64" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win64:')) Or $(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':linux-Win64:'))"> - $(_CmakeMxeCommonFlags64) - host-mxe-Win64 - dll - - - <_HostRuntime Include="host-mxe-Win32" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':linux-Win32:'))"> - $(_CmakeMxeCommonFlags32) - host-mxe-Win32 - dll - - - diff --git a/src/monodroid/monodroid.targets b/src/monodroid/monodroid.targets index 08a94631e20..35624c65c0e 100644 --- a/src/monodroid/monodroid.targets +++ b/src/monodroid/monodroid.targets @@ -1,8 +1,6 @@ - - @@ -19,7 +17,7 @@ + DependsOnTargets="_GenerateIncludeFiles;_ConfigureRuntimes;_BuildAndroidRuntimes;_BuildAndroidAnalyzerRuntimes;_CopyToPackDirs"> - - - - <_ConfigureRuntimesInputs Include="CMakeLists.txt" /> <_ConfigureRuntimesInputs Include="..\..\build-tools\scripts\Ndk.targets" /> - <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(Identity)-Debug\CMakeCache.txt')" /> <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-Debug\CMakeCache.txt')" /> - <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(Identity)-Release\CMakeCache.txt')" /> <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-Release\CMakeCache.txt')" /> - <_ConfigureRuntimesOutputs Include="@(_HostRuntime->'$(IntermediateOutputPath)%(OutputDirectory)-Debug\CMakeCache.txt')" /> - <_ConfigureRuntimesOutputs Include="@(_HostRuntime->'$(IntermediateOutputPath)%(OutputDirectory)-Release\CMakeCache.txt')" /> + <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Debug" /> + <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Release" /> + <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Debug" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Debug" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Release" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Release" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + + <_CmakeAndroidFlags>--debug-output -GNinja -DCMAKE_MAKE_PROGRAM="$(NinjaPath)" -DXA_BUILD_CONFIGURATION=$(Configuration) -DXA_LIB_TOP_DIR=$(MicrosoftAndroidSdkOutDir) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DMONO_PATH="$(MonoSourceFullPath)" -DANDROID_STL="none" -DANDROID_CPP_FEATURES="no-rtti no-exceptions" -DANDROID_TOOLCHAIN=clang -DCMAKE_TOOLCHAIN_FILE="$(AndroidNdkDirectory)/build/cmake/android.toolchain.cmake" -DANDROID_NDK=$(AndroidNdkDirectory) + + + + <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> + $(CmakePath) + $(_CmakeAndroidFlags) -DCONFIGURATION=Release -DCMAKE_BUILD_TYPE=Debug -DANDROID_NATIVE_API_LEVEL=%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_PLATFORM=android-%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_ABI=%(AndroidSupportedTargetJitAbi.Identity) -DANDROID_RID=%(AndroidSupportedTargetJitAbi.AndroidRID) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" "$(MSBuildThisFileDirectory)" + $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Debug + + <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> + $(CmakePath) + $(_CmakeAndroidFlags) -DCONFIGURATION=Debug -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_PLATFORM=android-%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_ABI=%(AndroidSupportedTargetJitAbi.Identity) -DANDROID_RID=%(AndroidSupportedTargetJitAbi.AndroidRID) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" "$(MSBuildThisFileDirectory)" + $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Release + + + + <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> + $(CmakePath) + $(_CmakeAndroidFlags) -DCONFIGURATION=Release -DCMAKE_BUILD_TYPE=Debug -DENABLE_CLANG_ASAN=ON -DANDROID_STL="c++_static" -DANDROID_NATIVE_API_LEVEL=%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_PLATFORM=android-%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_ABI=%(AndroidSupportedTargetJitAbi.Identity) -DANDROID_RID=%(AndroidSupportedTargetJitAbi.AndroidRID) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" "$(MSBuildThisFileDirectory)" + $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Debug + + <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> + $(CmakePath) + $(_CmakeAndroidFlags) -DCONFIGURATION=Release -DCMAKE_BUILD_TYPE=Debug -DENABLE_CLANG_UBSAN=ON -DANDROID_STL="c++_static" -DANDROID_CPP_FEATURES="rtti exceptions" -DANDROID_NATIVE_API_LEVEL=%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_PLATFORM=android-%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_ABI=%(AndroidSupportedTargetJitAbi.Identity) -DANDROID_RID=%(AndroidSupportedTargetJitAbi.AndroidRID) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" "$(MSBuildThisFileDirectory)" + $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Debug + + <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> + $(CmakePath) + $(_CmakeAndroidFlags) -DCONFIGURATION=Debug -DCMAKE_BUILD_TYPE=Release -DENABLE_CLANG_ASAN=ON -DANDROID_STL="c++_static" -DANDROID_NATIVE_API_LEVEL=%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_PLATFORM=android-%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_ABI=%(AndroidSupportedTargetJitAbi.Identity) -DANDROID_RID=%(AndroidSupportedTargetJitAbi.AndroidRID) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" "$(MSBuildThisFileDirectory)" + $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Release + + <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> + $(CmakePath) + $(_CmakeAndroidFlags) -DCONFIGURATION=Debug -DCMAKE_BUILD_TYPE=Release -DENABLE_CLANG_UBSAN=ON -DANDROID_STL="c++_static" -DANDROID_CPP_FEATURES="rtti exceptions" -DANDROID_NATIVE_API_LEVEL=%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_PLATFORM=android-%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_ABI=%(AndroidSupportedTargetJitAbi.Identity) -DANDROID_RID=%(AndroidSupportedTargetJitAbi.AndroidRID) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" "$(MSBuildThisFileDirectory)" + $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Release + + @@ -91,29 +125,19 @@ - <_BuildAndroidRuntimesInputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(Identity)-Debug\CMakeCache.txt')" /> <_BuildAndroidRuntimesInputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-Debug\CMakeCache.txt')" /> - <_BuildAndroidRuntimesInputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(Identity)-Release\CMakeCache.txt')" /> <_BuildAndroidRuntimesInputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-Release\CMakeCache.txt')" /> <_BuildAndroidRuntimesInputs Include="@(_MonoDroidSources)" /> <_BuildAndroidRuntimesInputs Include="..\..\build-tools\scripts\Ndk.targets" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.debug.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android.debug.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android.release.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android.release.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\Debug\libxamarin-app.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\Debug\libxamarin-app.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\Release\libxamarin-app.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\Release\libxamarin-app.so')" /> - <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+ubsan.debug.so')" /> <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android-checked+ubsan.debug.so')" /> - <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+asan.debug.so')" /> <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android-checked+asan.debug.so')" /> - <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+asan.release.so')" /> <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android-checked+asan.release.so')" /> - <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(Identity)\libmono-android-checked+ubsan.release.so')" /> <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android-checked+ubsan.release.so')" /> @@ -122,21 +146,11 @@ DependsOnTargets="_BuildAndroidRuntimesInputs" Inputs="@(_BuildAndroidRuntimesInputs)" Outputs="@(_BuildAndroidRuntimesOutputs)"> - - - - - - - <_BuildHostRuntimesInputs Include="@(_HostRuntime->'$(IntermediateOutputPath)%(OutputDirectory)-Debug\CMakeCache.txt')" /> - <_BuildHostRuntimesInputs Include="@(_HostRuntime->'$(IntermediateOutputPath)%(OutputDirectory)-Release\CMakeCache.txt')" /> - <_BuildHostRuntimesInputs Include="@(_MonoDroidSources)" /> - <_BuildHostRuntimesOutputs Include="@(_HostRuntime->'$(OutputPath)%(OutputDirectory)\libmono-android.debug.%(NativeLibraryExtension)')" /> - <_BuildHostRuntimesOutputs Include="@(_HostRuntime->'$(OutputPath)%(OutputDirectory)\libmono-android.release.%(NativeLibraryExtension)')" /> - <_BuildHostRuntimesOutputs Include="@(_HostRuntime->'$(OutputPath)%(OutputDirectory)\libxamarin-app.%(NativeLibraryExtension)')" /> - - - - - - - - - - - - - - - - - - - - <_OutputDebugPath Include="$(OutputPath)%(_HostRuntime.OutputDirectory)\libmono-android.debug.d.%(_HostRuntime.NativeLibraryExtension)" /> - <_OutputDebugStripPath Include="$(OutputPath)%(_HostRuntime.OutputDirectory)\libmono-android.debug.%(_HostRuntime.NativeLibraryExtension)" /> - <_OutputReleasePath Include="$(OutputPath)%(_HostRuntime.OutputDirectory)\libmono-android.release.d.%(_HostRuntime.NativeLibraryExtension)" /> - <_OutputReleaseStripPath Include="$(OutputPath)%(_HostRuntime.OutputDirectory)\libmono-android.release.%(_HostRuntime.NativeLibraryExtension)" /> - + + DependsOnTargets="_BuildAndroidRuntimes"> <_CompileCommandsDir Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.Identity)-Debug"> %(AndroidSupportedTargetJitAbi.Identity)-Debug @@ -278,14 +242,6 @@ <_CompileCommandsDir Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.Identity)-Release"> %(AndroidSupportedTargetJitAbi.Identity)-Release - - - <_CompileCommandsDir Include="$(IntermediateOutputPath)%(_HostRuntime.OutputDirectory)-Debug" Condition=" '%(_HostRuntime.Identity)' != 'host-mxe-Win64' And '%(_HostRuntime.Identity)' != 'host-mxe-Win32' "> - %(_HostRuntime.OutputDirectory)-Debug - - <_CompileCommandsDir Include="$(IntermediateOutputPath)%(_HostRuntime.OutputDirectory)-Release" Condition=" '%(_HostRuntime.Identity)' != 'host-mxe-Win64' And '%(_HostRuntime.Identity)' != 'host-mxe-Win32' "> - %(_HostRuntime.OutputDirectory)-Release -