2019-12-26 23:01:54 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2019-10-04 13:11:45 -04:00
using UnrealBuildTool ;
2020-09-01 14:07:48 -04:00
[SupportedPlatforms("Win64")]
2019-10-04 13:11:45 -04:00
public abstract class DatasmithMaxBaseTarget : TargetRules
{
public DatasmithMaxBaseTarget ( TargetInfo Target )
: base ( Target )
{
Type = TargetType . Program ;
2022-03-30 10:12:09 -04:00
IncludeOrderVersion = EngineIncludeOrderVersion . Latest ;
2019-11-14 17:19:25 -05:00
SolutionDirectory = "Programs/Datasmith" ;
2019-12-19 12:34:35 -05:00
bBuildInSolutionByDefault = false ;
2019-10-04 13:11:45 -04:00
bLegalToDistributeBinary = true ;
bShouldCompileAsDLL = true ;
LinkType = TargetLinkType . Monolithic ;
2021-11-18 14:37:34 -05:00
WindowsPlatform . ModuleDefinitionFile = "Programs/Enterprise/Datasmith/DatasmithMaxExporter/DatasmithMaxExporterWithDirectLink.def" ;
2021-09-22 10:22:19 -04:00
2020-09-03 09:21:40 -04:00
WindowsPlatform . bStrictConformanceMode = false ;
2019-10-04 13:11:45 -04:00
bBuildDeveloperTools = false ;
bBuildWithEditorOnlyData = true ;
bCompileAgainstEngine = false ;
bCompileAgainstCoreUObject = true ;
bCompileICU = false ;
bUsesSlate = false ;
bHasExports = true ;
bForceEnableExceptions = true ;
2021-09-22 10:22:19 -04:00
2021-11-18 14:37:34 -05:00
GlobalDefinitions . Add ( "UE_EXTERNAL_PROFILING_ENABLED=0" ) ; // For DirectLinkUI (see FDatasmithExporterManager::FInitOptions)
2021-09-22 10:22:19 -04:00
2023-06-13 10:53:29 -04:00
// Setting CppStandard to Cpp17 as new CppStandardVersion.Default is Cpp20 and this implies "/permissive-" for MSVC which
// doesn't work well with 3ds Max includes(lots of non-conformance like const to non-const string conversion, temp to &, etc)
//
// For some reason, adding following doesn't help 100%. Even though docs says that should override "/permissive-"'s settings like C2102:
// AdditionalCompilerArguments = " /Zc:referenceBinding- /Zc:strictStrings- /Zc:rvalueCast- ";
//
// 3dsMax uses MSVC extension which allows taking address of a class rvalue returned from a function:
// class V
// {
// int dummy;
// };
//
// class C {
// public:
// V get() const { return V(); }
// };
// void f(V* ){}
// int main() {
// C c;
// f(&(c.get()));// In conformance mode C2102 '&' requires l-value, but MSVC allows this by default
// }
// This behavior is disabled when c++20 enabled and is not repaired with any /Zc option. Seems like it only works with "/permissive" enabled. But...
// Reverting permissive breaks Engine compilation because of operator resolution ambiguity(which doesn't happen with stricter checks) and other issues:
// AdditionalCompilerArguments = " /permissive ";
CppStandard = CppStandardVersion . Cpp17 ;
2021-09-22 10:22:19 -04:00
// todo: remove?
// bSupportEditAndContinue = true;
2019-10-04 13:11:45 -04:00
}
protected void AddCopyPostBuildStep ( TargetInfo Target )
{
// Add a post-build step that copies the output to a file with the .dle extension
string OutputName = "$(TargetName)" ;
if ( Target . Configuration ! = UnrealTargetConfiguration . Development )
{
OutputName = string . Format ( "{0}-{1}-{2}" , OutputName , Target . Platform , Target . Configuration ) ;
}
string SrcOutputFileName = string . Format ( @"$(EngineDir)\Binaries\Win64\{0}\{1}.dll" , ExeBinariesSubFolder , OutputName ) ;
2021-09-22 10:22:19 -04:00
string DstOutputFileName ;
2021-11-18 14:37:34 -05:00
DstOutputFileName = string . Format ( @"$(EngineDir)\Binaries\Win64\{0}\{1}.gup" , ExeBinariesSubFolder , OutputName ) ;
2019-10-04 13:11:45 -04:00
PostBuildSteps . Add ( string . Format ( "echo Copying {0} to {1}..." , SrcOutputFileName , DstOutputFileName ) ) ;
PostBuildSteps . Add ( string . Format ( "copy /Y \"{0}\" \"{1}\" 1>nul" , SrcOutputFileName , DstOutputFileName ) ) ;
}
}
public class DatasmithMax2017Target : DatasmithMaxBaseTarget
{
public DatasmithMax2017Target ( TargetInfo Target )
: base ( Target )
{
LaunchModuleName = "DatasmithMax2017" ;
ExeBinariesSubFolder = @"3DSMax\2017" ;
AddCopyPostBuildStep ( Target ) ;
}
}