private static string GetMsBuildExe(TargetPlatformData TargetData) { switch (TargetData.Platform) { case UnrealTargetPlatform.Win32: case UnrealTargetPlatform.Win64: case UnrealTargetPlatform.XboxOne: return MsBuildExe.ToString(); default: throw new AutomationException(String.Format("Non-MSBuild or unsupported platform '{0}' supplied to GetMsBuildExe", TargetData.ToString())); } }
private static void SetupBuildForTargetLibAndPlatform(PhysXTargetLib TargetLib, TargetPlatformData TargetData, List<string> TargetConfigurations, List<WindowsCompiler> TargetWindowsCompilers, bool bCleanOnly) { // make sure we set up the environment variable specifying where the root of the PhysX SDK is Environment.SetEnvironmentVariable("GW_DEPS_ROOT", PhysXSourceRootDirectory.ToString()); Log("set {0}={1}", "GW_DEPS_ROOT", Environment.GetEnvironmentVariable("GW_DEPS_ROOT")); Environment.SetEnvironmentVariable("CMAKE_MODULE_PATH", DirectoryReference.Combine(PhysXSourceRootDirectory, "Externals", "CMakeModules").ToString()); Log("set {0}={1}", "CMAKE_MODULE_PATH", Environment.GetEnvironmentVariable("CMAKE_MODULE_PATH")); string CMakeName = GetCMakeNameAndSetupEnv(TargetData); switch (TargetData.Platform) { case UnrealTargetPlatform.Win32: case UnrealTargetPlatform.Win64: // for windows platforms we support building against multiple compilers foreach(WindowsCompiler TargetWindowsCompiler in TargetWindowsCompilers) { UnrealBuildTool.DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetLib, TargetData, TargetWindowsCompiler); MakeFreshDirectoryIfRequired(CMakeTargetDirectory); if(!bCleanOnly) { Log("Generating projects for lib " + TargetLib.ToString() + ", " + TargetData.ToString()); ProcessStartInfo StartInfo = new ProcessStartInfo(); StartInfo.FileName = CMakeName; StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString(); StartInfo.Arguments = GetCMakeArguments(TargetLib, TargetData, "", TargetWindowsCompiler); RunLocalProcessAndLogOutput(StartInfo); } } break; case UnrealTargetPlatform.PS4: case UnrealTargetPlatform.Android: case UnrealTargetPlatform.Linux: foreach(string BuildConfig in TargetConfigurations) { UnrealBuildTool.DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetLib, TargetData); CMakeTargetDirectory = UnrealBuildTool.DirectoryReference.Combine(CMakeTargetDirectory, BuildConfig); MakeFreshDirectoryIfRequired(CMakeTargetDirectory); if (!bCleanOnly) { Log("Generating projects for lib " + TargetLib.ToString() + ", " + TargetData.ToString()); ProcessStartInfo StartInfo = new ProcessStartInfo(); StartInfo.FileName = CMakeName; StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString(); StartInfo.Arguments = GetCMakeArguments(TargetLib, TargetData, BuildConfig); System.Console.WriteLine("Working in '{0}'", StartInfo.WorkingDirectory); Log("Working in '{0}'", StartInfo.WorkingDirectory); System.Console.WriteLine("{0} {1}", StartInfo.FileName, StartInfo.Arguments); Log("{0} {1}", StartInfo.FileName, StartInfo.Arguments); if (RunLocalProcessAndLogOutput(StartInfo) != 0) { throw new AutomationException(String.Format("Unable to generate projects for {0}.", TargetLib.ToString() + ", " + TargetData.ToString())); } } } break; case UnrealTargetPlatform.Mac: case UnrealTargetPlatform.IOS: case UnrealTargetPlatform.TVOS: { UnrealBuildTool.DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetLib, TargetData); MakeFreshDirectoryIfRequired(CMakeTargetDirectory); if (!bCleanOnly) { Log("Generating projects for lib " + TargetLib.ToString() + ", " + TargetData.ToString()); ProcessStartInfo StartInfo = new ProcessStartInfo(); StartInfo.FileName = CMakeName; StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString(); StartInfo.Arguments = GetCMakeArguments(TargetLib, TargetData); RunLocalProcessAndLogOutput(StartInfo); } } break; case UnrealTargetPlatform.HTML5: // NOTE: HTML5 does not do "debug" - the full text blows out memory // instead, HTML5 builds have 4 levels of optimizations // so, MAP BuildConfig to HTML5 optimization levels Dictionary<string, string> BuildMap = new Dictionary<string, string>() { {"debug", "-O0"}, {"checked", "-O2"}, {"profile", "-Oz"}, {"release", "-O3"} }; Dictionary<string, string> BuildSuffix = new Dictionary<string, string>() { {"debug", ""}, {"checked", "_O2"}, {"profile", "_Oz"}, {"release", "_O3"} }; UnrealBuildTool.DirectoryReference HTML5CMakeModules = DirectoryReference.Combine(PhysXSourceRootDirectory, "Externals", "CMakeModules", "HTML5"); string CmakeToolchainFile = FileReference.Combine(HTML5CMakeModules, "Emscripten.cmake").ToString(); foreach(string BuildConfig in TargetConfigurations) { UnrealBuildTool.DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetLib, TargetData); CMakeTargetDirectory = UnrealBuildTool.DirectoryReference.Combine(CMakeTargetDirectory, "BUILD" + BuildMap[BuildConfig]); MakeFreshDirectoryIfRequired(CMakeTargetDirectory); if (!bCleanOnly) { Log("Generating projects for lib " + TargetLib.ToString() + ", " + TargetData.ToString()); // CMAKE_TOOLCHAIN_FILE MakeFreshDirectoryIfRequired(HTML5CMakeModules); Environment.SetEnvironmentVariable("LIB_SUFFIX", BuildSuffix[BuildConfig]); string orig = File.ReadAllText(HTML5SDKInfo.EmscriptenCMakeToolChainFile); string txt = Regex.Replace(orig, "(EPIC_BUILD_FLAGS}) .*-O2" , "$1 " + BuildMap["release"] ); File.WriteAllText(CmakeToolchainFile, txt); // ---------------------------------------- // CMAKE ProcessStartInfo StartInfo = new ProcessStartInfo(); StartInfo.FileName = "cmake"; StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString(); StartInfo.Arguments = GetCMakeArguments(TargetLib, TargetData, BuildConfig); Log("Working in: {0}", StartInfo.WorkingDirectory); Log("{0} {1}", StartInfo.FileName, StartInfo.Arguments); if (RunLocalProcessAndLogOutput(StartInfo) != 0) { throw new AutomationException(String.Format("Unabled to generate projects for {0}.", TargetLib.ToString() + ", " + TargetData.ToString())); } } } break; default: { UnrealBuildTool.DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetLib, TargetData); MakeFreshDirectoryIfRequired(CMakeTargetDirectory); if (!bCleanOnly) { Log("Generating projects for lib " + TargetLib.ToString() + ", " + TargetData.ToString()); ProcessStartInfo StartInfo = new ProcessStartInfo(); StartInfo.FileName = CMakeName; StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString(); StartInfo.Arguments = GetCMakeArguments(TargetLib, TargetData); RunLocalProcessAndLogOutput(StartInfo); } } break; } }
private static DirectoryReference GetPlatformLibDirectory(TargetPlatformData TargetData, WindowsCompiler TargetWindowsCompiler) { string VisualStudioName = string.Empty; string ArchName = string.Empty; if (DoesPlatformUseMSBuild(TargetData)) { switch (TargetWindowsCompiler) { case WindowsCompiler.VisualStudio2013: VisualStudioName = "VS2013"; break; case WindowsCompiler.VisualStudio2015: VisualStudioName = "VS2015"; break; default: throw new AutomationException(String.Format("Unsupported visual studio compiler '{0}' supplied to GetOutputLibDirectory", TargetWindowsCompiler)); } } switch (TargetData.Platform) { case UnrealTargetPlatform.Win32: ArchName = "Win32"; break; case UnrealTargetPlatform.Win64: ArchName = "Win64"; break; case UnrealTargetPlatform.XboxOne: ArchName = "XboxOne"; break; case UnrealTargetPlatform.PS4: ArchName = "PS4"; break; case UnrealTargetPlatform.Android: switch (TargetData.Architecture) { default: case "arm7": ArchName = "Android/ARMv7"; break; case "arm64": ArchName = "Android/ARM64"; break; case "x86": ArchName = "Android/x86"; break; case "x64": ArchName = "Android/x64"; break; } break; case UnrealTargetPlatform.Linux: ArchName = "Linux/" + TargetData.Architecture; break; case UnrealTargetPlatform.Mac: ArchName = "Mac"; break; case UnrealTargetPlatform.HTML5: ArchName = "HTML5"; break; case UnrealTargetPlatform.IOS: ArchName = "IOS"; break; case UnrealTargetPlatform.TVOS: ArchName = "TVOS"; break; default: throw new AutomationException(String.Format("Unsupported platform '{0}' supplied to GetOutputLibDirectory", TargetData.ToString())); } return UnrealBuildTool.DirectoryReference.Combine(RootOutputLibDirectory, ArchName, VisualStudioName); }
private static string GetCMakeArguments(PhysXTargetLib TargetLib, TargetPlatformData TargetData, string BuildConfig = "", WindowsCompiler TargetWindowsCompiler = WindowsCompiler.VisualStudio2015) { string VisualStudioName; switch(TargetWindowsCompiler) { case WindowsCompiler.VisualStudio2013: VisualStudioName = "Visual Studio 12 2013"; break; case WindowsCompiler.VisualStudio2015: VisualStudioName = "Visual Studio 14 2015"; break; default: throw new AutomationException(String.Format("Non-CMake or unsupported platform '{0}' supplied to GetCMakeArguments", TargetData.ToString())); } string OutputFlags = " -DPX_OUTPUT_LIB_DIR=" + GetPlatformLibDirectory(TargetData, TargetWindowsCompiler); if(PlatformHasBinaries(TargetData)) { OutputFlags += " -DPX_OUTPUT_DLL_DIR=" + GetPlatformBinaryDirectory(TargetData, TargetWindowsCompiler) + " -DPX_OUTPUT_EXE_DIR=" + GetPlatformBinaryDirectory(TargetData, TargetWindowsCompiler); } // Enable response files for platforms that require them. // Response files are used for include paths etc, to fix max command line length issues. switch (TargetData.Platform) { case UnrealTargetPlatform.PS4: case UnrealTargetPlatform.Linux: OutputFlags += " -DUSE_RESPONSE_FILES=1"; break; } string CustomFlags = " -DAPEX_ENABLE_UE4=1"; switch (TargetLib) { case PhysXTargetLib.PhysX: DirectoryReference PhysXCMakeFiles = DirectoryReference.Combine(PhysX34SourceRootDirectory, "Source", "compiler", "cmake"); switch (TargetData.Platform) { case UnrealTargetPlatform.Win32: return DirectoryReference.Combine(PhysXCMakeFiles, "Windows").ToString() + " -G \"" + VisualStudioName + "\" -AWin32 -DTARGET_BUILD_PLATFORM=Windows" + OutputFlags; case UnrealTargetPlatform.Win64: return DirectoryReference.Combine(PhysXCMakeFiles, "Windows").ToString() + " -G \"" + VisualStudioName + "\" -Ax64 -DTARGET_BUILD_PLATFORM=Windows" + OutputFlags; case UnrealTargetPlatform.PS4: return DirectoryReference.Combine(PhysXCMakeFiles, "PS4").ToString() + " -G \"Unix Makefiles\" -DTARGET_BUILD_PLATFORM=PS4 -DCMAKE_BUILD_TYPE=" + BuildConfig + " -DCMAKE_TOOLCHAIN_FILE=\"" + PhysXSourceRootDirectory + "\\Externals\\CMakeModules\\PS4\\PS4Toolchain.txt\"" + OutputFlags; case UnrealTargetPlatform.XboxOne: return DirectoryReference.Combine(PhysXCMakeFiles, "XboxOne").ToString() + " -G \"Visual Studio 14 2015\" -DTARGET_BUILD_PLATFORM=XboxOne -DCMAKE_TOOLCHAIN_FILE=\"" + PhysXSourceRootDirectory + "\\Externals\\CMakeModules\\XboxOne\\XboxOneToolchain.txt\" -DCMAKE_GENERATOR_PLATFORM=DURANGO" + OutputFlags; case UnrealTargetPlatform.Android: string NDKDirectory = Environment.GetEnvironmentVariable("NDKROOT"); // don't register if we don't have an NDKROOT specified if (String.IsNullOrEmpty(NDKDirectory)) { throw new BuildException("NDKROOT is not specified; cannot build Android."); } NDKDirectory = NDKDirectory.Replace("\"", ""); string AndroidAPILevel = "android-19"; string AndroidABI = "armeabi-v7a"; switch (TargetData.Architecture) { case "armv7": AndroidAPILevel = "android-19"; AndroidABI = "armeabi-v7a"; break; case "arm64": AndroidAPILevel = "android-21"; AndroidABI = "arm64-v8a"; break; case "x86": AndroidAPILevel = "android-19"; AndroidABI = "x86"; break; case "x64": AndroidAPILevel = "android-21"; AndroidABI = "x86_64"; break; } return DirectoryReference.Combine(PhysXCMakeFiles, "Android").ToString() + " -G \"MinGW Makefiles\" -DTARGET_BUILD_PLATFORM=Android -DCMAKE_BUILD_TYPE=" + BuildConfig + " -DCMAKE_TOOLCHAIN_FILE=\"" + PhysXSourceRootDirectory + "\\Externals\\CMakeModules\\Android\\android.toolchain.cmake\" -DANDROID_NDK=\"" + NDKDirectory + "\" -DCMAKE_MAKE_PROGRAM=\"" + NDKDirectory + "\\prebuilt\\windows-x86_64\\bin\\make.exe\" -DANDROID_NATIVE_API_LEVEL=\"" + AndroidAPILevel + "\" -DANDROID_ABI=\"" + AndroidABI + "\" -DANDROID_STL=gnustl_shared" + OutputFlags; case UnrealTargetPlatform.Linux: return DirectoryReference.Combine(PhysXCMakeFiles, "Linux").ToString() + " -G \"Unix Makefiles\" -DTARGET_BUILD_PLATFORM=Linux -DCMAKE_BUILD_TYPE=" + BuildConfig + GetLinuxToolchainSettings(TargetData) + OutputFlags; case UnrealTargetPlatform.Mac: return DirectoryReference.Combine(PhysXCMakeFiles, "Mac").ToString() + " -G \"Xcode\" -DTARGET_BUILD_PLATFORM=Mac" + OutputFlags; case UnrealTargetPlatform.IOS: return DirectoryReference.Combine(PhysXCMakeFiles, "IOS").ToString() + " -G \"Xcode\" -DTARGET_BUILD_PLATFORM=IOS" + OutputFlags; case UnrealTargetPlatform.TVOS: return DirectoryReference.Combine(PhysXCMakeFiles, "TVOS").ToString() + " -G \"Xcode\" -DTARGET_BUILD_PLATFORM=TVOS" + OutputFlags; case UnrealTargetPlatform.HTML5: string CmakeToolchainFile = FileReference.Combine(PhysXSourceRootDirectory, "Externals", "CMakeModules", "HTML5", "Emscripten.cmake").ToString(); return DirectoryReference.Combine(PhysXCMakeFiles, "HTML5").ToString() + " -G \"Unix Makefiles\" -DTARGET_BUILD_PLATFORM=HTML5" + " -DPXSHARED_ROOT_DIR=\"" + SharedSourceRootDirectory.ToString() + "\"" + " -DNVSIMD_INCLUDE_DIR=\"" + SharedSourceRootDirectory.ToString() + "/src/NvSimd\"" + " -DNVTOOLSEXT_INCLUDE_DIRS=\"" + PhysX34SourceRootDirectory + "/externals/nvToolsExt/include\"" + " -DCMAKE_BUILD_TYPE=\"Release\" -DCMAKE_TOOLCHAIN_FILE=\"" + CmakeToolchainFile + "\"" + OutputFlags; default: throw new AutomationException(String.Format("Non-CMake or unsupported platform '{0}' supplied to GetCMakeArguments", TargetData.ToString())); } case PhysXTargetLib.APEX: DirectoryReference ApexCMakeFiles = DirectoryReference.Combine(APEX14SourceRootDirectory, "compiler", "cmake"); switch (TargetData.Platform) { case UnrealTargetPlatform.Win32: return DirectoryReference.Combine(ApexCMakeFiles, "Windows").ToString() + " -G \"" + VisualStudioName + "\" -AWin32 -DTARGET_BUILD_PLATFORM=Windows" + OutputFlags + CustomFlags; case UnrealTargetPlatform.Win64: return DirectoryReference.Combine(ApexCMakeFiles, "Windows").ToString() + " -G \"" + VisualStudioName + "\" -Ax64 -DTARGET_BUILD_PLATFORM=Windows" + OutputFlags + CustomFlags; case UnrealTargetPlatform.PS4: return DirectoryReference.Combine(ApexCMakeFiles, "PS4").ToString() + " -G \"Unix Makefiles\" -DTARGET_BUILD_PLATFORM=PS4 -DCMAKE_BUILD_TYPE=" + BuildConfig + " -DCMAKE_TOOLCHAIN_FILE=\"" + PhysXSourceRootDirectory + "\\Externals\\CMakeModules\\PS4\\PS4Toolchain.txt\"" + OutputFlags + CustomFlags; case UnrealTargetPlatform.XboxOne: return DirectoryReference.Combine(ApexCMakeFiles, "XboxOne").ToString() + " -G \"Visual Studio 14 2015\" -DTARGET_BUILD_PLATFORM=XboxOne -DCMAKE_TOOLCHAIN_FILE=\"" + PhysXSourceRootDirectory + "\\Externals\\CMakeModules\\XboxOne\\XboxOneToolchain.txt\" -DCMAKE_GENERATOR_PLATFORM=DURANGO" + OutputFlags + CustomFlags; case UnrealTargetPlatform.Linux: return DirectoryReference.Combine(ApexCMakeFiles, "Linux").ToString() + " -G \"Unix Makefiles\" -DTARGET_BUILD_PLATFORM=Linux -DCMAKE_BUILD_TYPE=" + BuildConfig + GetLinuxToolchainSettings(TargetData) + OutputFlags + CustomFlags; case UnrealTargetPlatform.Mac: return DirectoryReference.Combine(ApexCMakeFiles, "Mac").ToString() + " -G \"Xcode\" -DTARGET_BUILD_PLATFORM=Mac" + OutputFlags + CustomFlags; case UnrealTargetPlatform.HTML5: string CmakeToolchainFile = FileReference.Combine(PhysXSourceRootDirectory, "Externals", "CMakeModules", "HTML5", "Emscripten.cmake").ToString(); return DirectoryReference.Combine(ApexCMakeFiles, "HTML5").ToString() + " -G \"Unix Makefiles\" -DTARGET_BUILD_PLATFORM=HTML5" + " -DPHYSX_ROOT_DIR=\"" + PhysX34SourceRootDirectory.ToString() + "\"" + " -DPXSHARED_ROOT_DIR=\"" + SharedSourceRootDirectory.ToString() + "\"" + " -DNVSIMD_INCLUDE_DIR=\"" + SharedSourceRootDirectory.ToString() + "/src/NvSimd\"" + " -DNVTOOLSEXT_INCLUDE_DIRS=\"" + PhysX34SourceRootDirectory + "/externals/nvToolsExt/include\"" + " -DCMAKE_BUILD_TYPE=\"Release\" -DCMAKE_TOOLCHAIN_FILE=\"" + CmakeToolchainFile + "\"" + OutputFlags + CustomFlags; default: throw new AutomationException(String.Format("Non-CMake or unsupported platform '{0}' supplied to GetCMakeArguments", TargetData.ToString())); } default: throw new AutomationException(String.Format("Non-CMake or unsupported lib '{0}' supplied to GetCMakeArguments", TargetLib)); } }
private static DirectoryReference GetPlatformBinaryDirectory(TargetPlatformData TargetData, WindowsCompiler TargetWindowsCompiler) { string VisualStudioName = string.Empty; string ArchName = string.Empty; if (DoesPlatformUseMSBuild(TargetData)) { switch (TargetWindowsCompiler) { case WindowsCompiler.VisualStudio2013: VisualStudioName = "VS2013"; break; case WindowsCompiler.VisualStudio2015: VisualStudioName = "VS2015"; break; default: throw new AutomationException(String.Format("Unsupported visual studio compiler '{0}' supplied to GetOutputBinaryDirectory", TargetWindowsCompiler)); } } switch (TargetData.Platform) { case UnrealTargetPlatform.Win32: ArchName = "Win32"; break; case UnrealTargetPlatform.Win64: ArchName = "Win64"; break; case UnrealTargetPlatform.Mac: ArchName = "Mac"; break; default: throw new AutomationException(String.Format("Unsupported platform '{0}' supplied to GetOutputBinaryDirectory", TargetData.ToString())); } return UnrealBuildTool.DirectoryReference.Combine(RootOutputBinaryDirectory, ArchName, VisualStudioName); }
private static DirectoryReference GetPlatformLibDirectory(TargetPlatformData TargetData, WindowsCompiler TargetWindowsCompiler) { string VisualStudioName = string.Empty; string ArchName = string.Empty; if (DoesPlatformUseMSBuild(TargetData)) { switch (TargetWindowsCompiler) { case WindowsCompiler.VisualStudio2015_DEPRECATED: VisualStudioName = "VS2015"; break; default: throw new AutomationException(String.Format("Unsupported visual studio compiler '{0}' supplied to GetOutputLibDirectory", TargetWindowsCompiler)); } } if (TargetData.Platform == UnrealTargetPlatform.Win64) { ArchName = "Win64"; } else if (TargetData.Platform == UnrealTargetPlatform.Linux) { ArchName = "Linux/" + TargetData.Architecture; } else if (TargetData.Platform == UnrealTargetPlatform.Mac) { ArchName = "Mac"; } else { throw new AutomationException(String.Format("Unsupported platform '{0}' supplied to GetOutputLibDirectory", TargetData.ToString())); } return(DirectoryReference.Combine(RootOutputLibDirectory, ArchName, VisualStudioName)); }
private static void SetupBuildForTargetLibAndPlatform(TargetPlatformData TargetData, List <string> TargetConfigurations, List <WindowsCompiler> TargetWindowsCompilers, bool bCleanOnly) { string CMakeName = GetCMakeNameAndSetupEnv(TargetData); if (TargetData.Platform == UnrealTargetPlatform.Win64) { // for windows platforms we support building against multiple compilers foreach (WindowsCompiler TargetWindowsCompiler in TargetWindowsCompilers) { DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetData, TargetWindowsCompiler); MakeFreshDirectoryIfRequired(CMakeTargetDirectory); if (!bCleanOnly) { LogInformation("Generating projects for lib " + TargetData.ToString()); ProcessStartInfo StartInfo = new ProcessStartInfo(); StartInfo.FileName = CMakeName; StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString(); StartInfo.Arguments = GetCMakeArguments(TargetData, "", TargetWindowsCompiler); if (RunLocalProcessAndLogOutput(StartInfo) != 0) { throw new AutomationException(String.Format("Unable to generate projects for {0}.", TargetData.ToString())); } } } } else if (TargetData.Platform == UnrealTargetPlatform.Linux) { foreach (string BuildConfig in TargetConfigurations) { DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetData); CMakeTargetDirectory = DirectoryReference.Combine(CMakeTargetDirectory, BuildConfig); MakeFreshDirectoryIfRequired(CMakeTargetDirectory); if (!bCleanOnly) { LogInformation("Generating projects for lib " + TargetData.ToString()); ProcessStartInfo StartInfo = new ProcessStartInfo(); StartInfo.FileName = CMakeName; StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString(); StartInfo.Arguments = GetCMakeArguments(TargetData, BuildConfig); System.Console.WriteLine("Working in '{0}'", StartInfo.WorkingDirectory); LogInformation("Working in '{0}'", StartInfo.WorkingDirectory); System.Console.WriteLine("{0} {1}", StartInfo.FileName, StartInfo.Arguments); LogInformation("{0} {1}", StartInfo.FileName, StartInfo.Arguments); if (RunLocalProcessAndLogOutput(StartInfo) != 0) { throw new AutomationException(String.Format("Unable to generate projects for {0}.", TargetData.ToString())); } } } } else if (TargetData.Platform == UnrealTargetPlatform.Mac) { DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetData); MakeFreshDirectoryIfRequired(CMakeTargetDirectory); if (!bCleanOnly) { LogInformation("Generating projects for lib " + TargetData.ToString()); ProcessStartInfo StartInfo = new ProcessStartInfo(); StartInfo.FileName = CMakeName; StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString(); StartInfo.Arguments = GetCMakeArguments(TargetData); if (RunLocalProcessAndLogOutput(StartInfo) != 0) { throw new AutomationException(String.Format("Unable to generate projects for {0}.", TargetData.ToString())); } } } else { throw new AutomationException(String.Format("Unable to generate projects for {0}.", TargetData.ToString())); } }
private static string GetMsBuildExe(TargetPlatformData TargetData) { if (TargetData.Platform == UnrealTargetPlatform.Win64) { return(MsBuildExe.ToString()); } throw new AutomationException(String.Format("Non-MSBuild or unsupported platform '{0}' supplied to GetMsBuildExe", TargetData.ToString())); }
private static string GetCMakeArguments(TargetPlatformData TargetData, string BuildConfig = "", WindowsCompiler TargetWindowsCompiler = WindowsCompiler.VisualStudio2015_DEPRECATED) { string VisualStudioName; switch (TargetWindowsCompiler) { case WindowsCompiler.VisualStudio2015_DEPRECATED: VisualStudioName = "Visual Studio 14 2015"; break; default: throw new AutomationException(String.Format("Non-CMake or unsupported platform '{0}' supplied to GetCMakeArguments", TargetData.ToString())); } string OutputFlags = ""; // Enable response files for platforms that require them. // Response files are used for include paths etc, to fix max command line length issues. if (TargetData.Platform == UnrealTargetPlatform.Linux) { OutputFlags += " -DUSE_RESPONSE_FILES=1"; } DirectoryReference CMakeFilePath = DirectoryReference.Combine(SourceRootDirectory, "projects"); if (TargetData.Platform == UnrealTargetPlatform.Win64) { return(CMakeFilePath.ToString() + " -G \"" + VisualStudioName + "\" -Ax64 -DTARGET_BUILD_PLATFORM=windows" + OutputFlags); } else if (TargetData.Platform == UnrealTargetPlatform.Linux) { return(CMakeFilePath.ToString() + " --no-warn-unused-cli -G \"Unix Makefiles\" -DTARGET_BUILD_PLATFORM=linux " + " -DCMAKE_BUILD_TYPE=" + BuildConfig + GetLinuxToolchainSettings(TargetData) + OutputFlags); } else if (TargetData.Platform == UnrealTargetPlatform.Mac) { return(CMakeFilePath.ToString() + " -G \"Xcode\" -DTARGET_BUILD_PLATFORM=mac" + OutputFlags); } else { throw new AutomationException(String.Format("Non-CMake or unsupported platform '{0}' supplied to GetCMakeArguments", TargetData.ToString())); } }