Build msdfgen for Web and Consoles

This commit is contained in:
Wojtek Figat
2026-03-13 09:55:49 +01:00
parent 45a8d82a83
commit c91c209974
4 changed files with 32 additions and 8 deletions

Binary file not shown.

View File

@@ -7,7 +7,7 @@ using Flax.Build.NativeCpp;
/// <summary>
/// https://github.com/Chlumsky/msdfgen
/// </summary>
public class msdfgen : DepsModule
public class msdfgen : EngineDepsModule
{
/// <inheritdoc />
public override void Init()
@@ -16,9 +16,6 @@ public class msdfgen : DepsModule
LicenseType = LicenseTypes.MIT;
LicenseFilePath = "LICENSE.txt";
// Merge third-party modules into engine binary
BinaryModuleName = "FlaxEngine";
}
/// <inheritdoc />
@@ -30,12 +27,18 @@ public class msdfgen : DepsModule
switch (options.Platform.Target)
{
case TargetPlatform.Windows:
case TargetPlatform.XboxOne:
case TargetPlatform.XboxScarlett:
options.OutputFiles.Add(Path.Combine(depsRoot, "msdfgen-core.lib"));
break;
case TargetPlatform.Linux:
case TargetPlatform.Mac:
case TargetPlatform.iOS:
case TargetPlatform.Android:
case TargetPlatform.Switch:
case TargetPlatform.PS4:
case TargetPlatform.PS5:
case TargetPlatform.Web:
options.OutputFiles.Add(Path.Combine(depsRoot, "libmsdfgen-core.a"));
break;
default: throw new InvalidPlatformException(options.Platform.Target);

View File

@@ -24,6 +24,12 @@ namespace Flax.Deps.Dependencies
{
TargetPlatform.Windows,
TargetPlatform.Android,
TargetPlatform.XboxOne,
TargetPlatform.XboxScarlett,
TargetPlatform.Switch,
TargetPlatform.PS4,
TargetPlatform.PS5,
TargetPlatform.Web,
};
case TargetPlatform.Linux:
return new[]
@@ -51,6 +57,7 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Windows:
return new[]
{
TargetArchitecture.x86,
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
@@ -83,12 +90,17 @@ namespace Flax.Deps.Dependencies
};
var args = new string[]
{
"-DMSDFGEN_BUILD_STANDALONE=OFF",
"-DMSDFGEN_USE_VCPKG=OFF",
"-DMSDFGEN_CORE_ONLY=ON",
"-DMSDFGEN_DYNAMIC_RUNTIME=ON",
"-DMSDFGEN_USE_SKIA=OFF",
"-DMSDFGEN_INSTALL=ON",
"-DMSDFGEN_USE_SKIA=OFF",
"-DMSDFGEN_DISABLE_SVG=ON",
"-DMSDFGEN_DISABLE_PNG=ON",
"-DMSDFGEN_DYNAMIC_RUNTIME=ON",
"-DBUILD_SHARED_LIBS=OFF",
"-DMSDFGEN_INSTALL=ON"
};
// Get the source
@@ -130,7 +142,7 @@ namespace Flax.Deps.Dependencies
break;
}
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" " + cmakeArgs, envVars);
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -Wno-dev " + cmakeArgs, envVars);
BuildCmake(buildDir);
Utilities.Run("cmake", $"--install {buildDir} --prefix {installDir} --config {configuration}", null, root, Utilities.RunOptions.DefaultTool);
Utilities.FileCopy(Path.Combine(installDir, "lib", libName), Path.Combine(depsFolder, libName));

View File

@@ -519,10 +519,16 @@ namespace Flax.Deps
break;
}
case TargetPlatform.PS4:
cmdLine = "CMakeLists.txt -DCMAKE_GENERATOR_PLATFORM=ORBIS -G \"Visual Studio 15 2017\"";
if (VisualStudioInstance.HasIDE(VisualStudioVersion.VisualStudio2017))
cmdLine = "CMakeLists.txt -DCMAKE_GENERATOR_PLATFORM=ORBIS -G \"Visual Studio 15 2017\"";
else
cmdLine = string.Format("CMakeLists.txt -G \"Ninja\" -DCMAKE_TOOLCHAIN_FILE=\"{0}/Source/Platforms/PS4/Binaries/Data/nethost/src/ps4/PS4Toolchain.txt\"", Globals.EngineRoot);
break;
case TargetPlatform.PS5:
cmdLine = "CMakeLists.txt -DCMAKE_GENERATOR_PLATFORM=PROSPERO -G \"Visual Studio 16 2019\"";
if (VisualStudioInstance.HasIDE(VisualStudioVersion.VisualStudio2019))
cmdLine = "CMakeLists.txt -DCMAKE_GENERATOR_PLATFORM=PROSPERO -G \"Visual Studio 16 2019\"";
else
cmdLine = string.Format("CMakeLists.txt -G \"Ninja\" -DCMAKE_TOOLCHAIN_FILE=\"{0}/Source/Platforms/PS5/Binaries/Data/nethost/src/ps5/PS5Toolchain.txt\"", Globals.EngineRoot);
break;
case TargetPlatform.Linux:
cmdLine = "CMakeLists.txt";