Add deps for arm64 mac

This commit is contained in:
Wojtek Figat
2023-02-27 23:00:04 +01:00
parent 3be4e50b78
commit ad4c2484f3
28 changed files with 175 additions and 68 deletions

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libGenericCodeGen.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libHLSL.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libIrrXML.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libMachineIndependent.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libOGLCompiler.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libOSDependent.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libSPIRV-Tools-opt.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libSPIRV-Tools.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libSPIRV.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libassimp.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libcurl.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libfreetype.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libglslang.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libogg.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libopenal.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libvorbis.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libvorbisenc.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libvorbisfile.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@@ -128,11 +128,14 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Mac: case TargetPlatform.Mac:
{ {
// Build for Mac // Build for Mac
RunCmake(root, platform, TargetArchitecture.x64, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + globalConfig); foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError); {
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64); RunCmake(root, platform, architecture, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + globalConfig);
Utilities.FileCopy(Path.Combine(root, "lib", "libassimp.a"), Path.Combine(depsFolder, "libassimp.a")); Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError);
Utilities.FileCopy(Path.Combine(root, "lib", "libIrrXML.a"), Path.Combine(depsFolder, "libIrrXML.a")); var depsFolder = GetThirdPartyFolder(options, platform, architecture);
Utilities.FileCopy(Path.Combine(root, "lib", "libassimp.a"), Path.Combine(depsFolder, "libassimp.a"));
Utilities.FileCopy(Path.Combine(root, "lib", "libIrrXML.a"), Path.Combine(depsFolder, "libIrrXML.a"));
}
break; break;
} }
} }

View File

@@ -169,14 +169,17 @@ namespace Flax.Deps.Dependencies
// Use separate build directory // Use separate build directory
root = Path.Combine(root, "openal-soft-" + version); root = Path.Combine(root, "openal-soft-" + version);
var buildDir = Path.Combine(root, "build"); var buildDir = Path.Combine(root, "build");
SetupDirectory(buildDir, true);
// Build for Mac // Build for Mac
RunCmake(buildDir, platform, TargetArchitecture.x64, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=Release " + config); foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None); {
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64); SetupDirectory(buildDir, true);
foreach (var file in binariesToCopy) RunCmake(buildDir, platform, architecture, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=Release " + config);
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file)); Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
foreach (var file in binariesToCopy)
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
}
break; break;
} }
} }

View File

@@ -63,9 +63,10 @@ namespace Flax.Deps.Dependencies
Downloader.DownloadFileFromUrlToPath("https://curl.haxx.se/download/curl-7.64.1.zip", packagePath); Downloader.DownloadFileFromUrlToPath("https://curl.haxx.se/download/curl-7.64.1.zip", packagePath);
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read)) using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
{ {
if (!Directory.Exists(root)) var newRoot = Path.Combine(root, archive.Entries.First().FullName);
if (!Directory.Exists(newRoot))
archive.ExtractToDirectory(root); archive.ExtractToDirectory(root);
root = Path.Combine(root, archive.Entries.First().FullName); root = newRoot;
} }
foreach (var platform in options.Platforms) foreach (var platform in options.Platforms)
@@ -114,7 +115,7 @@ namespace Flax.Deps.Dependencies
var buildDir = Path.Combine(root, "build"); var buildDir = Path.Combine(root, "build");
SetupDirectory(buildDir, true); SetupDirectory(buildDir, true);
Utilities.Run("chmod", "+x configure", null, root, Utilities.RunOptions.ThrowExceptionOnError); Utilities.Run("chmod", "+x configure", null, root, Utilities.RunOptions.ThrowExceptionOnError);
Utilities.Run(Path.Combine(root, "configure"), string.Join(" ", settings) + " --prefix=\"" + buildDir + "\"", null, root, Utilities.RunOptions.None, envVars); Utilities.Run(Path.Combine(root, "configure"), string.Join(" ", settings) + " --prefix=\"" + buildDir + "\"", null, root, Utilities.RunOptions.ThrowExceptionOnError, envVars);
Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError); Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError);
Utilities.Run("make", "install", null, root, Utilities.RunOptions.ThrowExceptionOnError); Utilities.Run("make", "install", null, root, Utilities.RunOptions.ThrowExceptionOnError);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64); var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
@@ -136,28 +137,35 @@ namespace Flax.Deps.Dependencies
"--enable-static", "--enable-static",
"-disable-ldap --disable-sspi --disable-ftp --disable-file --disable-dict --disable-telnet --disable-tftp --disable-rtsp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-smb", "-disable-ldap --disable-sspi --disable-ftp --disable-file --disable-dict --disable-telnet --disable-tftp --disable-rtsp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-smb",
}; };
var arch = "x86_64"; foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
var archName = arch + "-apple-darwin18";
var compilerFlags = string.Format("-mmacosx-version-min={0} -arch {1}", Configuration.MacOSXMinVer, arch);
var envVars = new Dictionary<string, string>
{ {
{ "CFLAGS", compilerFlags }, var arch = GetAppleArchName(architecture);
{ "CXXFLAGS", compilerFlags }, var archName = arch + "-apple-darwin19";
{ "CPPFLAGS", compilerFlags }, if (architecture == TargetArchitecture.ARM64)
{ "ARCH", arch }, archName = "arm-apple-darwin19"; // for configure
{ "SDK", "macosx" }, var compilerFlags = string.Format("-mmacosx-version-min={0} -arch {1}", Configuration.MacOSXMinVer, arch);
{ "DEPLOYMENT_TARGET", Configuration.MacOSXMinVer }, var envVars = new Dictionary<string, string>
}; {
var buildDir = Path.Combine(root, "build"); { "CC", "clang" },
SetupDirectory(buildDir, true); { "CXX", "clang" },
Utilities.Run("chmod", "+x configure", null, root, Utilities.RunOptions.ThrowExceptionOnError); { "CFLAGS", compilerFlags },
Utilities.Run("chmod", "+x install-sh", null, root, Utilities.RunOptions.ThrowExceptionOnError); { "CXXFLAGS", compilerFlags },
Utilities.Run(Path.Combine(root, "configure"), string.Join(" ", settings) + " --host=" + archName + " --prefix=\"" + buildDir + "\"", null, root, Utilities.RunOptions.None, envVars); { "CPPFLAGS", compilerFlags },
Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError); { "ARCH", arch },
Utilities.Run("make", "install", null, root, Utilities.RunOptions.ThrowExceptionOnError); { "SDK", "macosx" },
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64); { "DEPLOYMENT_TARGET", Configuration.MacOSXMinVer },
var filename = "libcurl.a"; };
Utilities.FileCopy(Path.Combine(buildDir, "lib", filename), Path.Combine(depsFolder, filename)); var buildDir = Path.Combine(root, "build");
SetupDirectory(buildDir, true);
Utilities.Run("chmod", "+x configure", null, root, Utilities.RunOptions.ThrowExceptionOnError);
Utilities.Run("chmod", "+x install-sh", null, root, Utilities.RunOptions.ThrowExceptionOnError);
Utilities.Run(Path.Combine(root, "configure"), string.Join(" ", settings) + " --host=" + archName + " --prefix=\"" + buildDir + "\"", null, root, Utilities.RunOptions.ThrowExceptionOnError, envVars);
Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError);
Utilities.Run("make", "install", null, root, Utilities.RunOptions.ThrowExceptionOnError);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
var filename = "libcurl.a";
Utilities.FileCopy(Path.Combine(buildDir, "lib", filename), Path.Combine(depsFolder, filename));
}
break; break;
} }
} }

View File

@@ -72,9 +72,10 @@ namespace Flax.Deps.Dependencies
Downloader.DownloadFileFromUrlToPath("https://sourceforge.net/projects/freetype/files/freetype2/2.10.0/ft2100.zip/download", packagePath); Downloader.DownloadFileFromUrlToPath("https://sourceforge.net/projects/freetype/files/freetype2/2.10.0/ft2100.zip/download", packagePath);
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read)) using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
{ {
if (!Directory.Exists(root)) var newRoot = Path.Combine(root, archive.Entries.First().FullName);
if (!Directory.Exists(newRoot))
archive.ExtractToDirectory(root); archive.ExtractToDirectory(root);
root = Path.Combine(root, archive.Entries.First().FullName); root = newRoot;
} }
var configurationMsvc = "Release Static"; var configurationMsvc = "Release Static";
@@ -249,11 +250,14 @@ namespace Flax.Deps.Dependencies
{ {
// Build for Mac // Build for Mac
var buildDir = Path.Combine(root, "build"); var buildDir = Path.Combine(root, "build");
SetupDirectory(buildDir, true); foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
RunCmake(buildDir, platform, TargetArchitecture.x64, ".. -DCMAKE_BUILD_TYPE=Release"); {
Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None); SetupDirectory(buildDir, true);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64); RunCmake(buildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release");
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName)); Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
}
break; break;
} }
} }

View File

@@ -130,15 +130,18 @@ namespace Flax.Deps.Dependencies
}; };
// Build for Mac // Build for Mac
RunCmake(root, platform, TargetArchitecture.x64, cmakeArgs); foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
Utilities.Run("cmake", string.Format("--build . --config {0} --target install", configuration), null, buildDir, Utilities.RunOptions.None);
Utilities.Run("make", null, null, root, Utilities.RunOptions.None);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
foreach (var file in outputFiles)
{ {
var dst = Path.Combine(depsFolder, Path.GetFileName(file)); RunCmake(root, platform, architecture, cmakeArgs);
Utilities.FileCopy(file, dst); Utilities.Run("cmake", string.Format("--build . --config {0} --target install", configuration), null, buildDir, Utilities.RunOptions.None);
Utilities.Run("strip", string.Format("\"{0}\"", dst), null, null, Utilities.RunOptions.None); Utilities.Run("make", null, null, root, Utilities.RunOptions.None);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
foreach (var file in outputFiles)
{
var dst = Path.Combine(depsFolder, Path.GetFileName(file));
Utilities.FileCopy(file, dst);
Utilities.Run("strip", string.Format("\"{0}\"", dst), null, null, Utilities.RunOptions.None);
}
} }
break; break;
} }

View File

@@ -758,7 +758,7 @@ namespace Flax.Deps.Dependencies
// Build mono // Build mono
SetupDirectory(buildDir, true); SetupDirectory(buildDir, true);
var archName = "x86_64-apple-darwin18"; var archName = "x86_64-apple-darwin19";
Utilities.Run(Path.Combine(root, "autogen.sh"), string.Format("--host={0} --prefix={1} {2}", archName, buildDir, string.Join(" ", monoOptions)), null, root, Utilities.RunOptions.None, envVars); Utilities.Run(Path.Combine(root, "autogen.sh"), string.Format("--host={0} --prefix={1} {2}", archName, buildDir, string.Join(" ", monoOptions)), null, root, Utilities.RunOptions.None, envVars);
Utilities.Run("make", null, null, root, Utilities.RunOptions.None, envVars); Utilities.Run("make", null, null, root, Utilities.RunOptions.None, envVars);
Utilities.Run("make", "install", null, root, Utilities.RunOptions.None, envVars); Utilities.Run("make", "install", null, root, Utilities.RunOptions.None, envVars);

View File

@@ -221,11 +221,14 @@ namespace Flax.Deps.Dependencies
var buildDir = Path.Combine(root, "build"); var buildDir = Path.Combine(root, "build");
// Build for Mac // Build for Mac
SetupDirectory(buildDir, true); foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
RunCmake(buildDir, platform, TargetArchitecture.x64, ".. -DCMAKE_BUILD_TYPE=Release"); {
Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None); SetupDirectory(buildDir, true);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64); RunCmake(buildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release");
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName)); Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
}
break; break;
} }
} }

View File

@@ -374,16 +374,19 @@ namespace Flax.Deps.Dependencies
CloneGitRepo(oggRoot, "https://github.com/xiph/ogg.git"); CloneGitRepo(oggRoot, "https://github.com/xiph/ogg.git");
GitCheckout(oggRoot, "master", "4380566a44b8d5e85ad511c9c17eb04197863ec5"); GitCheckout(oggRoot, "master", "4380566a44b8d5e85ad511c9c17eb04197863ec5");
// Build for Android // Build for Mac
SetupDirectory(oggBuildDir, true); foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
RunCmake(oggBuildDir, platform, TargetArchitecture.x64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\""); {
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.None); SetupDirectory(oggBuildDir, true);
SetupDirectory(buildDir, true); RunCmake(oggBuildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
RunCmake(buildDir, platform, TargetArchitecture.x64, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot)); Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.None);
Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None); SetupDirectory(buildDir, true);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64); RunCmake(buildDir, platform, architecture, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
foreach (var file in binariesToCopyUnix) Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None);
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename)); var depsFolder = GetThirdPartyFolder(options, platform, architecture);
foreach (var file in binariesToCopyUnix)
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename));
}
break; break;
} }
} }

View File

@@ -270,7 +270,8 @@ namespace Flax.Deps
} }
case TargetPlatform.Mac: case TargetPlatform.Mac:
{ {
cmdLine = string.Format("CMakeLists.txt -DCMAKE_OSX_DEPLOYMENT_TARGET=\"{0}\"", Configuration.MacOSXMinVer); var arch = GetAppleArchName(architecture);
cmdLine = string.Format("CMakeLists.txt -DCMAKE_OSX_DEPLOYMENT_TARGET=\"{0}\" -DCMAKE_OSX_ARCHITECTURES={1}", Configuration.MacOSXMinVer, arch);
break; break;
} }
default: throw new InvalidPlatformException(platform); default: throw new InvalidPlatformException(platform);
@@ -282,6 +283,31 @@ namespace Flax.Deps
Utilities.Run("cmake", cmdLine, null, path, Utilities.RunOptions.None, envVars); Utilities.Run("cmake", cmdLine, null, path, Utilities.RunOptions.None, envVars);
} }
/// <summary>
/// Gets the Apple architecture name (for toolchain).
/// </summary>
public static string GetAppleArchName(TargetArchitecture architecture)
{
string arch;
switch (architecture)
{
case TargetArchitecture.x86:
arch = "i386";
break;
case TargetArchitecture.x64:
arch = "x86_64";
break;
case TargetArchitecture.ARM:
arch = "arm";
break;
case TargetArchitecture.ARM64:
arch = "arm64";
break;
default: throw new InvalidArchitectureException(architecture);
}
return arch;
}
/// <summary> /// <summary>
/// Runs the bash script via Cygwin tool (native bash on platforms other than Windows). /// Runs the bash script via Cygwin tool (native bash on platforms other than Windows).
/// </summary> /// </summary>

View File

@@ -21,7 +21,7 @@ namespace Flax.Deps
// Drive example: FileDownloader.DownloadFileFromURLToPath( "http://drive.google.com/file/d/FILEID/view?usp=sharing", @"C:\file.txt" ); // Drive example: FileDownloader.DownloadFileFromURLToPath( "http://drive.google.com/file/d/FILEID/view?usp=sharing", @"C:\file.txt" );
public static FileInfo DownloadFileFromUrlToPath(string url, string path) public static FileInfo DownloadFileFromUrlToPath(string url, string path)
{ {
Log.Verbose(string.Format("Downloading {0} to {1}", url, path)); Log.Info(string.Format("Downloading {0} to {1}", url, path));
if (File.Exists(path)) if (File.Exists(path))
File.Delete(path); File.Delete(path);
if (url.StartsWith(GoogleDriveDomain) || url.StartsWith(GoogleDriveDomain2)) if (url.StartsWith(GoogleDriveDomain) || url.StartsWith(GoogleDriveDomain2))