// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. using System.IO; using Flax.Build; namespace Flax.Deps.Dependencies { /// /// DirectXMesh geometry processing library https://walbourn.github.io/directxmesh/ /// /// class DirectXMesh : Dependency { /// public override TargetPlatform[] Platforms { get { switch (BuildPlatform) { case TargetPlatform.Windows: return new[] { TargetPlatform.Windows, }; default: return new TargetPlatform[0]; } } } /// public override void Build(BuildOptions options) { var root = options.IntermediateFolder; var solutionPath = Path.Combine(root, "DirectXMesh_Desktop_2015.sln"); var configuration = "Release"; var outputFileNames = new[] { "DirectXMesh.lib", "DirectXMesh.pdb", }; var binFolder = Path.Combine(root, "DirectXMesh", "Bin", "Desktop_2015"); // Get the source CloneGitRepoFast(root, "https://github.com/Microsoft/DirectXMesh.git"); foreach (var platform in options.Platforms) { switch (platform) { case TargetPlatform.Windows: { // Build for Win64 Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64"); var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Windows, TargetArchitecture.x64); foreach (var file in outputFileNames) { Utilities.FileCopy(Path.Combine(binFolder, "x64", "Release", file), Path.Combine(depsFolder, file)); } break; } } } // Deploy header files and license file var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "DirectXMesh"); foreach (var file in new[] { "DirectXMesh/DirectXMesh.h", "DirectXMesh/DirectXMesh.inl", "LICENSE", }) { Utilities.FileCopy(Path.Combine(root, file), Path.Combine(dstIncludePath, Path.GetFileName(file))); } } } }