Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Apple Silicon (arm64) build support #1361

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions HSTracker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3924,7 +3924,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# exit 0\n\n# Version\nMONO_VERSION=6.0.8\nNET_VERSION=net7.0\nASSEMBLIES=\"mscorlib.dll netstandard.dll System.dll System.Collections.dll System.Collections.Concurrent.dll System.Collections.NonGeneric.dll System.Collections.Specialized.dll System.Configuration.dll System.Core.dll System.Diagnostics.TraceSource.dll System.Diagnostics.Tracing.dll System.Linq.dll System.Linq.Expressions.dll System.Memory.dll System.Numerics.Vectors.dll System.ObjectModel.dll System.Private.Uri.dll System.Private.Xml.dll System.Reflection.Emit.dll System.Reflection.Emit.ILGeneration.dll System.Reflection.Emit.Lightweight.dll System.Reflection.Primitives.dll System.Runtime.dll System.Runtime.CompilerServices.Unsafe.dll System.Runtime.InteropServices.dll System.Runtime.Loader.dll System.Text.Encoding.Extensions.dll System.Text.RegularExpressions.dll System.Threading.dll System.Threading.Tasks.Parallel.dll System.Threading.Thread.dll System.Xml.dll System.Xml.ReaderWriter.dll System.Xml.XmlSerializer.dll\"\n\n# Locations\nMONO_LOCATION=$SRCROOT/downloaded-frameworks/mono/runtimes/osx-x64/lib/${NET_VERSION}\nMONO_NATIVE=$SRCROOT/downloaded-frameworks/mono/runtimes/osx-x64/native\n\nLOCATION=\"${BUILT_PRODUCTS_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\nBIN_LOCATION=\"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}\"\nRES_LOCATION=\"${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Resources/Resources/Managed\"\n\nmkdir -p \"${LOCATION}\"\n\nset -x\nset -e\n\n# Copy needed files\ncp $MONO_NATIVE/libcoreclr.dylib \"${LOCATION}\"\ncp $MONO_NATIVE/libSystem.Native.dylib \"${LOCATION}\"\n\ncp $MONO_NATIVE/System.Private.CoreLib.dll \"${RES_LOCATION}\"\n\n# Copy system assemblies needed\nfor assembly in $ASSEMBLIES; do cp ${MONO_LOCATION}/$assembly \"${RES_LOCATION}\"; done\n\n# Change runtime paths\n#install_name_tool -change /Library/Frameworks/Mono.framework/Versions/$MONO_VERSION/lib/libmonosgen-2.0.1.dylib @rpath/libmonosgen-2.0.1.dylib \"${BIN_LOCATION}/${EXECUTABLE_NAME}\"\n#install_name_tool -change /Library/Frameworks/Mono.framework/Versions/$MONO_VERSION/lib/libsqlite3.0.dylib @rpath/libsqlite3.0.dylib \"${BIN_LOCATION}/${EXECUTABLE_NAME}\"\n";
shellScript = "# Version\nMONO_VERSION=6.0.8\nNET_VERSION=net7.0\nASSEMBLIES=\"mscorlib.dll netstandard.dll System.dll System.Collections.dll System.Collections.Concurrent.dll System.Collections.NonGeneric.dll System.Collections.Specialized.dll System.Configuration.dll System.Core.dll System.Diagnostics.TraceSource.dll System.Diagnostics.Tracing.dll System.Linq.dll System.Linq.Expressions.dll System.Memory.dll System.Numerics.Vectors.dll System.ObjectModel.dll System.Private.Uri.dll System.Private.Xml.dll System.Reflection.Emit.dll System.Reflection.Emit.ILGeneration.dll System.Reflection.Emit.Lightweight.dll System.Reflection.Primitives.dll System.Runtime.dll System.Runtime.CompilerServices.Unsafe.dll System.Runtime.InteropServices.dll System.Runtime.Loader.dll System.Text.Encoding.Extensions.dll System.Text.RegularExpressions.dll System.Threading.dll System.Threading.Tasks.Parallel.dll System.Threading.Thread.dll System.Xml.dll System.Xml.ReaderWriter.dll System.Xml.XmlSerializer.dll\"\n\n# Use universal binaries if building for all architectures\nif [ \"$ONLY_ACTIVE_ARCH\" = \"NO\" ]; then\n # Use universal binaries\n MONO_LOCATION=$SRCROOT/downloaded-frameworks/mono/universal/runtimes/osx-universal/lib/${NET_VERSION}\n MONO_NATIVE=$SRCROOT/downloaded-frameworks/mono/universal/runtimes/osx-universal/native\nelse\n # Use architecture-specific binaries\n if [ \"${NATIVE_ARCH}\" = \"arm64\" ]; then\n ARCH_DIR=\"arm64\"\n RUNTIME_ARCH=\"osx-arm64\"\n else\n ARCH_DIR=\"x64\"\n RUNTIME_ARCH=\"osx-x64\"\n fi\n MONO_LOCATION=$SRCROOT/downloaded-frameworks/mono/$ARCH_DIR/runtimes/$RUNTIME_ARCH/lib/${NET_VERSION}\n MONO_NATIVE=$SRCROOT/downloaded-frameworks/mono/$ARCH_DIR/runtimes/$RUNTIME_ARCH/native\nfi\n\nLOCATION=\"${BUILT_PRODUCTS_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\nBIN_LOCATION=\"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}\"\nRES_LOCATION=\"${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Resources/Resources/Managed\"\n\nmkdir -p \"${LOCATION}\"\nmkdir -p \"${RES_LOCATION}\"\n\nset -x\nset -e\n\n# Copy needed files\ncp $MONO_NATIVE/libcoreclr.dylib \"${LOCATION}\"\ncp $MONO_NATIVE/libSystem.Native.dylib \"${LOCATION}\"\n\ncp $MONO_NATIVE/System.Private.CoreLib.dll \"${RES_LOCATION}\"\n\n# Copy system assemblies needed\nfor assembly in $ASSEMBLIES; do cp ${MONO_LOCATION}/$assembly \"${RES_LOCATION}\"; done\n";
};
B849674128A57C7300D90B30 /* Download Mono */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -3944,7 +3944,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nMONO_VERSION=$(cat $SRCROOT/HSTracker/mono-version.txt)\n\nDIR=\"$SRCROOT/downloaded-frameworks/mono\"\nmkdir -p $DIR\n\nwget \"https://www.nuget.org/api/v2/package/Microsoft.NETCore.App.Runtime.Mono.osx-x64/${MONO_VERSION}\" -P \"$DIR\" -O \"$DIR/mono-${MONO_VERSION}.zip\"\nunzip -n \"$DIR/mono-${MONO_VERSION}.zip\" -d \"$DIR\"\n";
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nMONO_VERSION=$(cat $SRCROOT/HSTracker/mono-version.txt)\n\nDIR=\"$SRCROOT/downloaded-frameworks/mono\"\nmkdir -p $DIR/x64\nmkdir -p $DIR/arm64\nmkdir -p $DIR/universal/runtimes/osx-universal/native\n\n# Download x64 version\nwget \"https://www.nuget.org/api/v2/package/Microsoft.NETCore.App.Runtime.Mono.osx-x64/${MONO_VERSION}\" -P \"$DIR\" -O \"$DIR/mono-x64-${MONO_VERSION}.zip\"\nunzip -n \"$DIR/mono-x64-${MONO_VERSION}.zip\" -d \"$DIR/x64\"\n\n# Download arm64 version\nwget \"https://www.nuget.org/api/v2/package/Microsoft.NETCore.App.Runtime.Mono.osx-arm64/${MONO_VERSION}\" -P \"$DIR\" -O \"$DIR/mono-arm64-${MONO_VERSION}.zip\"\nunzip -n \"$DIR/mono-arm64-${MONO_VERSION}.zip\" -d \"$DIR/arm64\"\n\n# Create universal binaries\nlipo -create \\\n \"$DIR/x64/runtimes/osx-x64/native/libcoreclr.dylib\" \\\n \"$DIR/arm64/runtimes/osx-arm64/native/libcoreclr.dylib\" \\\n -output \"$DIR/universal/runtimes/osx-universal/native/libcoreclr.dylib\"\n\nlipo -create \\\n \"$DIR/x64/runtimes/osx-x64/native/libSystem.Native.dylib\" \\\n \"$DIR/arm64/runtimes/osx-arm64/native/libSystem.Native.dylib\" \\\n -output \"$DIR/universal/runtimes/osx-universal/native/libSystem.Native.dylib\"\n\n# Copy header files (they're the same for both architectures)\nmkdir -p \"$DIR/universal/runtimes/osx-universal/native/include\"\ncp -R \"$DIR/x64/runtimes/osx-x64/native/include/\" \"$DIR/universal/runtimes/osx-universal/native/include/\"\n\n# Copy .NET assemblies and System.Private.CoreLib.dll\nmkdir -p \"$DIR/universal/runtimes/osx-universal/lib/net7.0\"\ncp -R \"$DIR/x64/runtimes/osx-x64/lib/\" \"$DIR/universal/runtimes/osx-universal/lib/\"\ncp \"$DIR/x64/runtimes/osx-x64/native/System.Private.CoreLib.dll\" \"$DIR/universal/runtimes/osx-universal/native/\"\n";
showEnvVarsInLog = 0;
};
B8643D122759872D00B2D708 /* Download enUS cards */ = {
Expand Down Expand Up @@ -5499,7 +5499,7 @@
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
ENABLE_HARDENED_RUNTIME = YES;
EXCLUDED_ARCHS = arm64;
EXCLUDED_ARCHS = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/HSTracker",
Expand All @@ -5508,7 +5508,7 @@
);
HEADER_SEARCH_PATHS = (
"$(SDKROOT)/usr/include/libxml2",
"$(PROJECT_DIR)/downloaded-frameworks/mono/runtimes/osx-x64/native/include/mono-2.0",
"$(PROJECT_DIR)/downloaded-frameworks/mono/universal/runtimes/osx-universal/native/include/mono-2.0",
);
INFOPLIST_FILE = HSTracker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -5517,7 +5517,7 @@
"$(FRAMEWORK_SEARCH_PATHS)",
);
LIBRARY_SEARCH_PATHS = (
"$(PROJECT_DIR)/downloaded-frameworks/mono/runtimes/osx-x64/native",
"$(PROJECT_DIR)/downloaded-frameworks/mono/universal/runtimes/osx-universal/native",
"$(SDKROOT)/usr/lib/swift",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
Expand Down Expand Up @@ -5550,7 +5550,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_HARDENED_RUNTIME = YES;
EXCLUDED_ARCHS = arm64;
EXCLUDED_ARCHS = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/HSTracker",
Expand All @@ -5559,7 +5559,7 @@
);
HEADER_SEARCH_PATHS = (
"$(SDKROOT)/usr/include/libxml2",
"$(PROJECT_DIR)/downloaded-frameworks/mono/runtimes/osx-x64/native/include/mono-2.0",
"$(PROJECT_DIR)/downloaded-frameworks/mono/universal/runtimes/osx-universal/native/include/mono-2.0",
);
INFOPLIST_FILE = HSTracker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -5568,7 +5568,7 @@
"$(FRAMEWORK_SEARCH_PATHS)",
);
LIBRARY_SEARCH_PATHS = (
"$(PROJECT_DIR)/downloaded-frameworks/mono/runtimes/osx-x64/native",
"$(PROJECT_DIR)/downloaded-frameworks/mono/universal/runtimes/osx-universal/native",
"$(SDKROOT)/usr/lib/swift",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
Expand Down