Skip to content

Commit

Permalink
make ue4 official FASTBuild.cs happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicent Chen committed Apr 29, 2021
1 parent 98a7f04 commit 2252692
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Code/Core/Core.bff
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

// Library
//--------------------------------------------------------------------------
ObjectList( '$ProjectName$-Lib-$Platform$-$BuildConfigName$' )
ObjectList( '$ProjectName$-CPP-$Platform$-$BuildConfigName$' )
{
// Input
.CompilerInputUnity = '$ProjectName$-Unity-$Platform$-$BuildConfigName$'
Expand All @@ -37,6 +37,10 @@
// Output
.CompilerOutputPath = '$OutputBase$/$ProjectPath$/'
}
Alias( '$ProjectName$-Lib-$Platform$-$BuildConfigName$' )
{
.Targets = { '$ProjectName$-CPP-$Platform$-$BuildConfigName$' }
}
Alias( '$ProjectName$-$Platform$-$BuildConfigName$' ) { .Targets = '$ProjectName$-Lib-$Platform$-$BuildConfigName$' }
^'Targets_$Platform$_$BuildConfigName$' + { '$ProjectName$-$Platform$-$BuildConfigName$' }

Expand Down
1 change: 1 addition & 0 deletions Code/Tools/FBuild/FBuildCore/Graph/CompilerNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class CompilerNode : public Node
CompilerFamily GetCompilerFamily() const { return static_cast<CompilerFamily>( m_CompilerFamilyEnum ); }

const AString & GetExecutable() const { return m_StaticDependencies[ 0 ].GetNode()->GetName(); }
const AString & GetExtraFile( size_t index ) const { return m_StaticDependencies[ index + 1 ].GetNode()->GetName(); }
const char * GetEnvironmentString() const;
const AString & GetSourceMapping() const { return m_SourceMapping; }

Expand Down
36 changes: 36 additions & 0 deletions Code/Tools/FBuild/FBuildCore/Graph/ObjectNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ ObjectNode::~ObjectNode()
bool useDist = GetFlag( FLAG_CAN_BE_DISTRIBUTED ) && m_AllowDistribution && FBuild::Get().GetOptions().m_AllowDistributed;
bool useSimpleDist = GetCompiler()->SimpleDistributionMode();
bool usePreProcessor = !useSimpleDist && ( useCache || useDist || GetFlag( FLAG_GCC ) || GetFlag( FLAG_SNC ) || GetFlag( FLAG_CLANG ) || GetFlag( FLAG_CLANG_CL ) || GetFlag( CODEWARRIOR_WII ) || GetFlag( GREENHILLS_WIIU ) || GetFlag( ObjectNode::FLAG_VBCC ) || GetFlag( FLAG_ORBIS_WAVE_PSSLC ) );
// bool usePreProcessor = !useSimpleDist && ( useCache || useDist || GetFlag( FLAG_GCC ) || GetFlag( FLAG_SNC ) || ( GetFlag( FLAG_CLANG ) && useDist ) || GetFlag( CODEWARRIOR_WII ) || GetFlag( GREENHILLS_WIIU ) || GetFlag( ObjectNode::FLAG_VBCC ) || GetFlag( FLAG_ORBIS_WAVE_PSSLC ) );
if ( GetDedicatedPreprocessor() )
{
usePreProcessor = true;
Expand Down Expand Up @@ -1985,6 +1986,41 @@ bool ObjectNode::BuildArgs( const Job * job, Args & fullArgs, Pass pass, bool us
}
}

// %5 -> FirstExtraFile
found = token.Find( "%5" );
if ( found )
{
AStackString<> extraFile;
if ( job->IsLocal() == false )
{
job->GetToolManifest()->GetRemoteFilePath( 1, extraFile );
}

fullArgs += AStackString<>( token.Get(), found );
fullArgs += job->IsLocal() ? GetCompiler()->GetExtraFile( 0 ) : extraFile;
fullArgs += AStackString<>( found + 2, token.GetEnd() );
fullArgs.AddDelimiter();
continue;
}

// %CLFilterDependenciesOutput -> file name Unreal Engine's cl-filter -dependencies param
// MSVC's /showIncludes option doesn't output anything when compiling a preprocessed file,
// so in that case we change the file name so that it doesn't override the file generated
// during preprocessing pass.
found = token.Find( "%CLFilterDependenciesOutput" );
if ( found )
{
AString nameWithoutExtension( m_Name );
PathUtils::StripFileExtension( nameWithoutExtension );

fullArgs += AStackString<>( token.Get(), found );
fullArgs += nameWithoutExtension;
fullArgs += pass == PASS_COMPILE_PREPROCESSED ? ".empty" : ".txt";
fullArgs += AStackString<>( found + 27, token.GetEnd() );
fullArgs.AddDelimiter();
continue;
}

// cl.exe treats \" as an escaped quote
// It's a common user error to terminate things (like include paths) with a quote
// this way, messing up the rest of the args and causing bizarre failures.
Expand Down

0 comments on commit 2252692

Please sign in to comment.