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:
{
// Build for Mac
RunCmake(root, platform, TargetArchitecture.x64, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + globalConfig);
Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
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"));
foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
RunCmake(root, platform, architecture, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + globalConfig);
Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError);
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;
}
}

View File

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

View File

@@ -63,9 +63,10 @@ namespace Flax.Deps.Dependencies
Downloader.DownloadFileFromUrlToPath("https://curl.haxx.se/download/curl-7.64.1.zip", packagePath);
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);
root = Path.Combine(root, archive.Entries.First().FullName);
root = newRoot;
}
foreach (var platform in options.Platforms)
@@ -114,7 +115,7 @@ namespace Flax.Deps.Dependencies
var buildDir = Path.Combine(root, "build");
SetupDirectory(buildDir, true);
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", "install", null, root, Utilities.RunOptions.ThrowExceptionOnError);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
@@ -136,28 +137,35 @@ namespace Flax.Deps.Dependencies
"--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",
};
var arch = "x86_64";
var archName = arch + "-apple-darwin18";
var compilerFlags = string.Format("-mmacosx-version-min={0} -arch {1}", Configuration.MacOSXMinVer, arch);
var envVars = new Dictionary<string, string>
foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
{ "CFLAGS", compilerFlags },
{ "CXXFLAGS", compilerFlags },
{ "CPPFLAGS", compilerFlags },
{ "ARCH", arch },
{ "SDK", "macosx" },
{ "DEPLOYMENT_TARGET", Configuration.MacOSXMinVer },
};
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.None, envVars);
Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError);
Utilities.Run("make", "install", null, root, Utilities.RunOptions.ThrowExceptionOnError);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
var filename = "libcurl.a";
Utilities.FileCopy(Path.Combine(buildDir, "lib", filename), Path.Combine(depsFolder, filename));
var arch = GetAppleArchName(architecture);
var archName = arch + "-apple-darwin19";
if (architecture == TargetArchitecture.ARM64)
archName = "arm-apple-darwin19"; // for configure
var compilerFlags = string.Format("-mmacosx-version-min={0} -arch {1}", Configuration.MacOSXMinVer, arch);
var envVars = new Dictionary<string, string>
{
{ "CC", "clang" },
{ "CXX", "clang" },
{ "CFLAGS", compilerFlags },
{ "CXXFLAGS", compilerFlags },
{ "CPPFLAGS", compilerFlags },
{ "ARCH", arch },
{ "SDK", "macosx" },
{ "DEPLOYMENT_TARGET", Configuration.MacOSXMinVer },
};
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;
}
}

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);
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);
root = Path.Combine(root, archive.Entries.First().FullName);
root = newRoot;
}
var configurationMsvc = "Release Static";
@@ -249,11 +250,14 @@ namespace Flax.Deps.Dependencies
{
// Build for Mac
var buildDir = Path.Combine(root, "build");
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, TargetArchitecture.x64, ".. -DCMAKE_BUILD_TYPE=Release");
Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release");
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;
}
}

View File

@@ -130,15 +130,18 @@ namespace Flax.Deps.Dependencies
};
// Build for Mac
RunCmake(root, platform, TargetArchitecture.x64, cmakeArgs);
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)
foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
var dst = Path.Combine(depsFolder, Path.GetFileName(file));
Utilities.FileCopy(file, dst);
Utilities.Run("strip", string.Format("\"{0}\"", dst), null, null, Utilities.RunOptions.None);
RunCmake(root, platform, architecture, cmakeArgs);
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, 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;
}

View File

@@ -758,7 +758,7 @@ namespace Flax.Deps.Dependencies
// Build mono
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("make", null, 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");
// Build for Mac
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, TargetArchitecture.x64, ".. -DCMAKE_BUILD_TYPE=Release");
Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release");
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;
}
}

View File

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

View File

@@ -270,7 +270,8 @@ namespace Flax.Deps
}
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;
}
default: throw new InvalidPlatformException(platform);
@@ -282,6 +283,31 @@ namespace Flax.Deps
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>
/// Runs the bash script via Cygwin tool (native bash on platforms other than Windows).
/// </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" );
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))
File.Delete(path);
if (url.StartsWith(GoogleDriveDomain) || url.StartsWith(GoogleDriveDomain2))