Fix building SDL dependencies
This commit is contained in:
@@ -95,12 +95,12 @@ namespace Flax.Deps.Dependencies
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
BuildStarted(platform);
|
||||
switch (platform)
|
||||
foreach (var architecture in options.Architectures)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
foreach (var architecture in new TargetArchitecture[] { TargetArchitecture.x64/*, TargetArchitecture.ARM64*/ })
|
||||
BuildStarted(platform, architecture);
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Flax.Deps.Dependencies
|
||||
else
|
||||
binariesToCopy = new[] { "SDL3.dll", "SDL3.lib", };
|
||||
directoriesToCopy.Add(Path.Combine(buildDir, "include", "SDL3"));
|
||||
|
||||
|
||||
var solutionPath = Path.Combine(buildDir, "SDL3.sln");
|
||||
|
||||
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DCMAKE_INSTALL_PREFIX=\"{buildDir}\" -DSDL_SHARED={(!buildStatic ? "ON" : "OFF")} -DSDL_STATIC={(buildStatic ? "ON" : "OFF")} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL " + string.Join(" ", configs));
|
||||
@@ -121,16 +121,13 @@ namespace Flax.Deps.Dependencies
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in binariesToCopy)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, configuration, file), Path.Combine(depsFolder, file == "SDL3-static.lib" ? "SDL3.lib" : file));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Linux:
|
||||
case TargetPlatform.Mac:
|
||||
{
|
||||
foreach (var architecture in new [] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
case TargetPlatform.Linux:
|
||||
case TargetPlatform.Mac:
|
||||
{
|
||||
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||
|
||||
|
||||
string[] binariesToCopy;
|
||||
if (buildStatic)
|
||||
binariesToCopy = new[] { "libSDL3.a" };
|
||||
@@ -140,16 +137,17 @@ namespace Flax.Deps.Dependencies
|
||||
|
||||
int concurrency = Math.Min(Math.Max(1, (int)(Environment.ProcessorCount * Configuration.ConcurrencyProcessorScale)), Configuration.MaxConcurrency);
|
||||
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DCMAKE_BUILD_TYPE={configuration} -DCMAKE_INSTALL_PREFIX=\"{buildDir}\" -DSDL_SHARED={(!buildStatic ? "ON" : "OFF")} -DSDL_STATIC={(buildStatic ? "ON" : "OFF")} -DCMAKE_POSITION_INDEPENDENT_CODE=ON " + string.Join(" ", configs));
|
||||
BuildCmake(buildDir, configuration, new Dictionary<string, string>() { {"CMAKE_BUILD_PARALLEL_LEVEL", concurrency.ToString()} });
|
||||
BuildCmake(buildDir, configuration, new Dictionary<string, string>() { { "CMAKE_BUILD_PARALLEL_LEVEL", concurrency.ToString() } });
|
||||
Utilities.Run("cmake", $"--build . --target install --config {configuration}", null, buildDir, Utilities.RunOptions.DefaultTool);
|
||||
|
||||
// Copy binaries
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in binariesToCopy)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,22 +38,27 @@ namespace Flax.Deps.Dependencies
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
BuildStarted(platform);
|
||||
switch (platform)
|
||||
foreach (var architecture in options.Architectures)
|
||||
{
|
||||
case TargetPlatform.Linux:
|
||||
if (!Directory.Exists(Path.Combine(includePath, "wayland")))
|
||||
Directory.CreateDirectory(Path.Combine(includePath, "wayland"));
|
||||
|
||||
string[] protocolFiles = Directory.GetFiles(protocolsPath, "*.xml", SearchOption.TopDirectoryOnly);
|
||||
foreach (var protocolPath in protocolFiles)
|
||||
BuildStarted(platform, architecture);
|
||||
switch (platform)
|
||||
{
|
||||
var headerFile = Path.ChangeExtension(Path.GetFileName(protocolPath), "h");
|
||||
var glueFile = Path.ChangeExtension(Path.GetFileName(protocolPath), "c");
|
||||
Utilities.Run("wayland-scanner", $"client-header {protocolPath} include/wayland/{headerFile}", null, dstPath, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("wayland-scanner", $"private-code {protocolPath} {glueFile}", null, dstPath, Utilities.RunOptions.DefaultTool);
|
||||
case TargetPlatform.Linux:
|
||||
{
|
||||
if (!Directory.Exists(Path.Combine(includePath, "wayland")))
|
||||
Directory.CreateDirectory(Path.Combine(includePath, "wayland"));
|
||||
|
||||
string[] protocolFiles = Directory.GetFiles(protocolsPath, "*.xml", SearchOption.TopDirectoryOnly);
|
||||
foreach (var protocolPath in protocolFiles)
|
||||
{
|
||||
var headerFile = Path.ChangeExtension(Path.GetFileName(protocolPath), "h");
|
||||
var glueFile = Path.ChangeExtension(Path.GetFileName(protocolPath), "c");
|
||||
Utilities.Run("wayland-scanner", $"client-header {protocolPath} include/wayland/{headerFile}", null, dstPath, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("wayland-scanner", $"private-code {protocolPath} {glueFile}", null, dstPath, Utilities.RunOptions.DefaultTool);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,12 +56,12 @@ class libportal : Dependency
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
BuildStarted(platform);
|
||||
switch (platform)
|
||||
foreach (var architecture in options.Architectures)
|
||||
{
|
||||
case TargetPlatform.Linux:
|
||||
{
|
||||
foreach (var architecture in new TargetArchitecture[] { TargetArchitecture.x64 /*, TargetArchitecture.ARM64*/ })
|
||||
BuildStarted(platform, architecture);
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Linux:
|
||||
{
|
||||
var buildDir = $"build_{architecture}";
|
||||
Utilities.Run("meson", $"{buildDir} {string.Join(" ", configs)}", null, root, Utilities.RunOptions.DefaultTool);
|
||||
@@ -71,19 +71,19 @@ class libportal : Dependency
|
||||
Utilities.FileCopy(Path.Combine(root, buildDir, "libportal", "libportal.a"), Path.Combine(depsFolder, "libportal.a"));
|
||||
Utilities.FileCopy(Path.Combine(root, buildDir, "libportal", "portal-enums.h"), Path.Combine(includePath, "portal-enums.h"));
|
||||
Utilities.FileCopy(Path.Combine(root, buildDir, "libportal", "portal-enums.c"), Path.Combine(dstPath, "portal-enums.c"));
|
||||
|
||||
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstPath, "LICENSE.txt"));
|
||||
|
||||
if (!Directory.Exists(includePath))
|
||||
Directory.CreateDirectory(includePath);
|
||||
if (!Directory.Exists(Path.Combine(includePath, "libportal")))
|
||||
Directory.CreateDirectory(Path.Combine(includePath, "libportal"));
|
||||
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(root, "libportal"), "*.h"))
|
||||
Utilities.FileCopy(file, Path.Combine(includePath, "libportal", Path.GetFileName(file)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstPath, "LICENSE.txt"));
|
||||
|
||||
if (!Directory.Exists(includePath))
|
||||
Directory.CreateDirectory(includePath);
|
||||
if (!Directory.Exists(Path.Combine(includePath, "libportal")))
|
||||
Directory.CreateDirectory(Path.Combine(includePath, "libportal"));
|
||||
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(root, "libportal"), "*.h"))
|
||||
Utilities.FileCopy(file, Path.Combine(includePath, "libportal", Path.GetFileName(file)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user