Use OpenAL Git repository as source with all platforms
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
#define USE_GIT_REPOSITORY
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -84,38 +84,39 @@ namespace Flax.Deps.Dependencies
|
|||||||
var cmakeArgs = "-DCMAKE_POLICY_VERSION_MINIMUM=3.5";
|
var cmakeArgs = "-DCMAKE_POLICY_VERSION_MINIMUM=3.5";
|
||||||
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "OpenAL");
|
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "OpenAL");
|
||||||
|
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
if (options.Platforms.Contains(TargetPlatform.Windows))
|
if (options.Platforms.Contains(TargetPlatform.Windows))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// Get the source
|
// Get the source
|
||||||
CloneGitRepo(root, "https://github.com/kcat/openal-soft.git");
|
CloneGitRepo(root, "https://github.com/kcat/openal-soft.git");
|
||||||
GitCheckout(root, "master", "d3875f333fb6abe2f39d82caca329414871ae53b"); // 1.23.1
|
GitCheckout(root, "master", "dc7d7054a5b4f3bec1dc23a42fd616a0847af948"); // 1.24.3
|
||||||
}
|
}
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get the source
|
// Get the source
|
||||||
var packagePath = Path.Combine(root, $"package-{version}.zip");
|
var packagePath = Path.Combine(root, $"package-{version}.zip");
|
||||||
if (!File.Exists(packagePath))
|
if (!File.Exists(packagePath))
|
||||||
{
|
{
|
||||||
Downloader.DownloadFileFromUrlToPath("https://openal-soft.org/openal-releases/openal-soft-" + version + ".tar.bz2", packagePath);
|
// The certificate was expired, use alternative source
|
||||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
//Downloader.DownloadFileFromUrlToPath($"https://openal-soft.org/openal-releases/openal-soft-{version}.tar.bz2", packagePath);
|
||||||
|
Downloader.DownloadFileFromUrlToPath($"https://github.com/kcat/openal-soft/releases/download/{version}/openal-soft-{version}.tar.bz2", packagePath);
|
||||||
|
|
||||||
|
if (Platform.BuildTargetPlatform == TargetPlatform.Windows)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(root))
|
// TODO: Maybe use PowerShell Expand-Archive instead?
|
||||||
archive.ExtractToDirectory(root);
|
var sevenZip = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "7-Zip", "7z.exe");
|
||||||
root = Path.Combine(root, archive.Entries.First().FullName);
|
Utilities.Run(sevenZip, "x package.zip", null, root);
|
||||||
|
Utilities.Run(sevenZip, "x package", null, root);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Utilities.Run("tar", "xjf " + packagePath.Replace('\\', '/'), null, root, Utilities.RunOptions.ConsoleLogOutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*if (Platform.BuildTargetPlatform == TargetPlatform.Windows)
|
|
||||||
{
|
|
||||||
// TODO: Maybe use PowerShell Expand-Archive instead?
|
|
||||||
var sevenZip = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "7-Zip", "7z.exe");
|
|
||||||
Utilities.Run(sevenZip, "x package.zip", null, root);
|
|
||||||
Utilities.Run(sevenZip, "x package", null, root);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utilities.Run("tar", "xjf " + packagePath.Replace('\\', '/'), null, root, Utilities.RunOptions.ConsoleLogOutput);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
foreach (var platform in options.Platforms)
|
foreach (var platform in options.Platforms)
|
||||||
{
|
{
|
||||||
@@ -135,40 +136,12 @@ namespace Flax.Deps.Dependencies
|
|||||||
// Build for Windows
|
// Build for Windows
|
||||||
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||||
var solutionPath = Path.Combine(buildDir, "OpenAL.sln");
|
var solutionPath = Path.Combine(buildDir, "OpenAL.sln");
|
||||||
|
SetupDirectory(buildDir, true);
|
||||||
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=\"/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR /EHsc\" -DCMAKE_CXX_FLAGS=\"/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR /EHsc\" " + cmakeArgs);
|
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=\"/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR /EHsc\" -DCMAKE_CXX_FLAGS=\"/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR /EHsc\" " + cmakeArgs);
|
||||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
|
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||||
foreach (var file in binariesToCopy)
|
foreach (var file in binariesToCopy)
|
||||||
Utilities.FileCopy(Path.Combine(buildDir, configuration, file), Path.Combine(depsFolder, Path.GetFileName(file)));
|
Utilities.FileCopy(Path.Combine(buildDir, configuration, file), Path.Combine(depsFolder, Path.GetFileName(file)));
|
||||||
|
|
||||||
#if false
|
|
||||||
// Get the binaries
|
|
||||||
var packagePath = Path.Combine(root, "package.zip");
|
|
||||||
if (!File.Exists(packagePath))
|
|
||||||
Downloader.DownloadFileFromUrlToPath("https://openal-soft.org/openal-binaries/openal-soft-" + version + "-bin.zip", packagePath);
|
|
||||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
|
||||||
{
|
|
||||||
if (!Directory.Exists(root))
|
|
||||||
archive.ExtractToDirectory(root);
|
|
||||||
root = Path.Combine(root, archive.Entries.First().FullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deploy Win64 binaries
|
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
|
||||||
Utilities.FileCopy(Path.Combine(root, "bin", "Win64", "soft_oal.dll"), Path.Combine(depsFolder, "OpenAL32.dll"));
|
|
||||||
Utilities.FileCopy(Path.Combine(root, "libs", "Win64", "OpenAL32.lib"), Path.Combine(depsFolder, "OpenAL32.lib"));
|
|
||||||
|
|
||||||
// Deploy license
|
|
||||||
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstIncludePath, "COPYING"), true);
|
|
||||||
|
|
||||||
// Deploy header files
|
|
||||||
var files = Directory.GetFiles(Path.Combine(root, "include", "AL"));
|
|
||||||
foreach (var file in files)
|
|
||||||
{
|
|
||||||
Utilities.FileCopy(file, Path.Combine(dstIncludePath, Path.GetFileName(file)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TargetPlatform.Linux:
|
case TargetPlatform.Linux:
|
||||||
@@ -193,14 +166,16 @@ namespace Flax.Deps.Dependencies
|
|||||||
+ cmakeArgs;
|
+ cmakeArgs;
|
||||||
|
|
||||||
// Use separate build directory
|
// Use separate build directory
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
root = Path.Combine(root, "openal-soft-" + version);
|
root = Path.Combine(root, "openal-soft-" + version);
|
||||||
var buildDir = Path.Combine(root, "build");
|
#endif
|
||||||
|
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||||
SetupDirectory(buildDir, true);
|
SetupDirectory(buildDir, true);
|
||||||
|
|
||||||
// Build for Linux
|
// Build for Linux
|
||||||
Utilities.Run("cmake", $"-G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE={configuration} -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DLIBTYPE=STATIC {config} ..", null, buildDir, Utilities.RunOptions.ConsoleLogOutput, envVars);
|
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DLIBTYPE=STATIC -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
||||||
BuildCmake(buildDir, configuration, envVars);
|
BuildCmake(buildDir, configuration, envVars);
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||||
foreach (var file in binariesToCopy)
|
foreach (var file in binariesToCopy)
|
||||||
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
|
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
|
||||||
break;
|
break;
|
||||||
@@ -218,12 +193,14 @@ namespace Flax.Deps.Dependencies
|
|||||||
var config = "-DALSOFT_REQUIRE_OBOE=OFF -DALSOFT_REQUIRE_OPENSL=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
|
var config = "-DALSOFT_REQUIRE_OBOE=OFF -DALSOFT_REQUIRE_OPENSL=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
|
||||||
|
|
||||||
// Use separate build directory
|
// Use separate build directory
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
root = Path.Combine(root, "openal-soft-" + version);
|
root = Path.Combine(root, "openal-soft-" + version);
|
||||||
var buildDir = Path.Combine(root, "build");
|
#endif
|
||||||
|
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||||
SetupDirectory(buildDir, true);
|
SetupDirectory(buildDir, true);
|
||||||
|
|
||||||
// Build
|
// Build
|
||||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
RunCmake(root, platform, TargetArchitecture.ARM64, $"-B\"{buildDir}\" -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
||||||
BuildCmake(buildDir, envVars);
|
BuildCmake(buildDir, envVars);
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||||
foreach (var file in binariesToCopy)
|
foreach (var file in binariesToCopy)
|
||||||
@@ -243,12 +220,14 @@ namespace Flax.Deps.Dependencies
|
|||||||
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
|
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
|
||||||
|
|
||||||
// Use separate build directory
|
// Use separate build directory
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
root = Path.Combine(root, "openal-soft-" + version);
|
root = Path.Combine(root, "openal-soft-" + version);
|
||||||
var buildDir = Path.Combine(root, "build");
|
#endif
|
||||||
|
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||||
|
SetupDirectory(buildDir, true);
|
||||||
|
|
||||||
// Build for Mac
|
// Build for Mac
|
||||||
SetupDirectory(buildDir, true);
|
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
||||||
RunCmake(buildDir, platform, architecture, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
|
||||||
BuildCmake(buildDir, envVars);
|
BuildCmake(buildDir, envVars);
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||||
foreach (var file in binariesToCopy)
|
foreach (var file in binariesToCopy)
|
||||||
@@ -268,12 +247,14 @@ namespace Flax.Deps.Dependencies
|
|||||||
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
|
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
|
||||||
|
|
||||||
// Use separate build directory
|
// Use separate build directory
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
root = Path.Combine(root, "openal-soft-" + version);
|
root = Path.Combine(root, "openal-soft-" + version);
|
||||||
var buildDir = Path.Combine(root, "build");
|
#endif
|
||||||
|
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||||
|
SetupDirectory(buildDir, true);
|
||||||
|
|
||||||
// Build for iOS
|
// Build for iOS
|
||||||
SetupDirectory(buildDir, true);
|
RunCmake(root, platform, TargetArchitecture.ARM64, $"-B\"{buildDir}\" -DCMAKE_SYSTEM_NAME=iOS -DALSOFT_OSX_FRAMEWORK=ON -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
||||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_SYSTEM_NAME=iOS -DALSOFT_OSX_FRAMEWORK=ON -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
|
||||||
BuildCmake(buildDir, envVars);
|
BuildCmake(buildDir, envVars);
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||||
foreach (var file in binariesToCopy)
|
foreach (var file in binariesToCopy)
|
||||||
@@ -283,6 +264,16 @@ namespace Flax.Deps.Dependencies
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deploy license
|
||||||
|
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstIncludePath, "COPYING"), true);
|
||||||
|
|
||||||
|
// Deploy header files
|
||||||
|
var files = Directory.GetFiles(Path.Combine(root, "include", "AL"));
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
Utilities.FileCopy(file, Path.Combine(dstIncludePath, Path.GetFileName(file)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user