// Copyright (c) 2012-2023 Flax Engine. All rights reserved. using System; using System.IO; using Flax.Build; namespace Flax.Deploy { /// /// Flax.Build environment and tools. /// class FlaxBuild { public static void Build(string root, string target, TargetPlatform platform, TargetArchitecture architecture, TargetConfiguration configuration) { var buildPlatform = Platform.BuildPlatform.Target; var flaxBuildTool = Path.Combine(Globals.EngineRoot, buildPlatform == TargetPlatform.Windows ? "Binaries/Tools/Flax.Build.exe" : "Binaries/Tools/Flax.Build"); var format = "-build -buildtargets={0} -log -logfile= -perf -platform={1} -arch={2} -configuration={3}"; var cmdLine = string.Format(format, target, platform, architecture, configuration); if (!string.IsNullOrEmpty(Configuration.Compiler)) cmdLine += " -compiler=" + Configuration.Compiler; int result = Utilities.Run(flaxBuildTool, cmdLine, null, root); if (result != 0) { throw new Exception(string.Format("Unable to build target {0}. Flax.Build failed. See log to learn more.", target)); } } } }