本文整理汇总了C++中Args::GetFinalArgs方法的典型用法代码示例。如果您正苦于以下问题:C++ Args::GetFinalArgs方法的具体用法?C++ Args::GetFinalArgs怎么用?C++ Args::GetFinalArgs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Args
的用法示例。
在下文中一共展示了Args::GetFinalArgs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetName
// DoBuild
//------------------------------------------------------------------------------
/*virtual*/ Node::BuildResult LibraryNode::DoBuild( Job * UNUSED( job ) )
{
// delete library before creation (so ar.exe will not merge old symbols)
if ( FileIO::FileExists( GetName().Get() ) )
{
FileIO::FileDelete( GetName().Get() );
}
// Format compiler args string
Args fullArgs;
if ( !BuildArgs( fullArgs ) )
{
return NODE_RESULT_FAILED; // BuildArgs will have emitted an error
}
// use the exe launch dir as the working dir
const char * workingDir = nullptr;
const char * environment = FBuild::Get().GetEnvironmentString();
EmitCompilationMessage( fullArgs );
// spawn the process
Process p;
bool spawnOK = p.Spawn( m_LibrarianPath.Get(),
fullArgs.GetFinalArgs().Get(),
workingDir,
environment );
if ( !spawnOK )
{
FLOG_ERROR( "Failed to spawn process for Library creation for '%s'", GetName().Get() );
return NODE_RESULT_FAILED;
}
// capture all of the stdout and stderr
AutoPtr< char > memOut;
AutoPtr< char > memErr;
uint32_t memOutSize = 0;
uint32_t memErrSize = 0;
p.ReadAllData( memOut, &memOutSize, memErr, &memErrSize );
ASSERT( !p.IsRunning() );
// Get result
int result = p.WaitForExit();
if ( result != 0 )
{
if ( memOut.Get() ) { FLOG_ERROR_DIRECT( memOut.Get() ); }
if ( memErr.Get() ) { FLOG_ERROR_DIRECT( memErr.Get() ); }
}
// did the executable fail?
if ( result != 0 )
{
FLOG_ERROR( "Failed to build Library (error %i) '%s'", result, GetName().Get() );
return NODE_RESULT_FAILED;
}
// record time stamp for next time
m_Stamp = FileIO::GetFileLastWriteTime( m_Name );
ASSERT( m_Stamp );
return NODE_RESULT_OK;
}
示例2: attempt
// DoBuild
//------------------------------------------------------------------------------
/*virtual*/ Node::BuildResult LinkerNode::DoBuild( Job * UNUSED( job ) )
{
DoPreLinkCleanup();
// Make sure the implib output directory exists
if (m_ImportLibName.IsEmpty() == false)
{
AStackString<> cleanPath;
NodeGraph::CleanPath(m_ImportLibName, cleanPath);
if (EnsurePathExistsForFile(cleanPath) == false)
{
// EnsurePathExistsForFile will have emitted error
return NODE_RESULT_FAILED;
}
}
// Format compiler args string
Args fullArgs;
if ( !BuildArgs( fullArgs ) )
{
return NODE_RESULT_FAILED; // BuildArgs will have emitted an error
}
// use the exe launch dir as the working dir
const char * workingDir = nullptr;
const char * environment = FBuild::Get().GetEnvironmentString();
EmitCompilationMessage( fullArgs );
// we retry if linker crashes
uint32_t attempt( 0 );
for (;;)
{
++attempt;
// spawn the process
Process p;
bool spawnOK = p.Spawn( m_Linker.Get(),
fullArgs.GetFinalArgs().Get(),
workingDir,
environment );
if ( !spawnOK )
{
FLOG_ERROR( "Failed to spawn process '%s' for %s creation for '%s'", m_Linker.Get(), GetDLLOrExe(), GetName().Get() );
return NODE_RESULT_FAILED;
}
// capture all of the stdout and stderr
AutoPtr< char > memOut;
AutoPtr< char > memErr;
uint32_t memOutSize = 0;
uint32_t memErrSize = 0;
p.ReadAllData( memOut, &memOutSize, memErr, &memErrSize );
ASSERT( !p.IsRunning() );
// Get result
int result = p.WaitForExit();
// did the executable fail?
if ( result != 0 )
{
// did the linker have an ICE (LNK1000)?
if ( GetFlag( LINK_FLAG_MSVC ) && ( result == 1000 ) && ( attempt == 1 ) )
{
FLOG_WARN( "FBuild: Warning: Linker crashed (LNK1000), retrying '%s'", GetName().Get() );
continue; // try again
}
if ( memOut.Get() )
{
m_BuildOutputMessages.Append( memOut.Get(), memOutSize );
FLOG_ERROR_DIRECT( memOut.Get() );
}
if ( memErr.Get() )
{
m_BuildOutputMessages.Append( memErr.Get(), memErrSize );
FLOG_ERROR_DIRECT( memErr.Get() );
}
// some other (genuine) linker failure
FLOG_ERROR( "Failed to build %s (error %i) '%s'", GetDLLOrExe(), result, GetName().Get() );
return NODE_RESULT_FAILED;
}
else
{
break; // success!
}
}
// post-link stamp step
if ( m_LinkerStampExe )
{
EmitStampMessage();
//.........这里部分代码省略.........
示例3: attempt
// DoBuild
//------------------------------------------------------------------------------
/*virtual*/ Node::BuildResult LinkerNode::DoBuild( Job * job )
{
DoPreLinkCleanup();
// Make sure the implib output directory exists
if (m_ImportLibName.IsEmpty() == false)
{
AStackString<> cleanPath;
NodeGraph::CleanPath(m_ImportLibName, cleanPath);
if (EnsurePathExistsForFile(cleanPath) == false)
{
// EnsurePathExistsForFile will have emitted error
return NODE_RESULT_FAILED;
}
}
// Format compiler args string
Args fullArgs;
if ( !BuildArgs( fullArgs ) )
{
return NODE_RESULT_FAILED; // BuildArgs will have emitted an error
}
// use the exe launch dir as the working dir
const char * workingDir = nullptr;
const char * environment = FBuild::Get().GetEnvironmentString();
EmitCompilationMessage( fullArgs );
// we retry if linker crashes
uint32_t attempt( 0 );
for (;;)
{
++attempt;
// spawn the process
Process p( FBuild::Get().GetAbortBuildPointer() );
bool spawnOK = p.Spawn( m_Linker.Get(),
fullArgs.GetFinalArgs().Get(),
workingDir,
environment );
if ( !spawnOK )
{
if ( p.HasAborted() )
{
return NODE_RESULT_FAILED;
}
FLOG_ERROR( "Failed to spawn process '%s' for %s creation for '%s'", m_Linker.Get(), GetDLLOrExe(), GetName().Get() );
return NODE_RESULT_FAILED;
}
// capture all of the stdout and stderr
AutoPtr< char > memOut;
AutoPtr< char > memErr;
uint32_t memOutSize = 0;
uint32_t memErrSize = 0;
p.ReadAllData( memOut, &memOutSize, memErr, &memErrSize );
ASSERT( !p.IsRunning() );
// Get result
int result = p.WaitForExit();
if ( p.HasAborted() )
{
return NODE_RESULT_FAILED;
}
// did the executable fail?
if ( result != 0 )
{
// Handle bugs in the MSVC linker
if ( GetFlag( LINK_FLAG_MSVC ) && ( attempt == 1 ) )
{
// Did the linker have an ICE (crash) (LNK1000)?
if ( result == 1000 )
{
FLOG_WARN( "FBuild: Warning: Linker crashed (LNK1000), retrying '%s'", GetName().Get() );
continue; // try again
}
// Did the linker have an "unexpected PDB error" (LNK1318)?
// Example: "fatal error LNK1318: Unexpected PDB error; CORRUPT (13)"
// (The linker or mspdbsrv.exe (as of VS2017) seems to have bugs which cause the PDB
// to sometimes be corrupted when doing very large links, possibly because the linker
// is running out of memory)
if ( result == 1318 )
{
FLOG_WARN( "FBuild: Warning: Linker corrupted the PDB (LNK1318), retrying '%s'", GetName().Get() );
continue; // try again
}
}
if ( memOut.Get() )
{
//.........这里部分代码省略.........
示例4: GetName
// DoBuild
//------------------------------------------------------------------------------
/*virtual*/ Node::BuildResult CSNode::DoBuild( Job * job )
{
// Format compiler args string
Args fullArgs;
if ( !BuildArgs( fullArgs ) )
{
return NODE_RESULT_FAILED; // BuildArgs will have emitted an error
}
// use the exe launch dir as the working dir
const char * workingDir = nullptr;
const char * environment = FBuild::Get().GetEnvironmentString();
EmitCompilationMessage( fullArgs );
// spawn the process
Process p;
if ( p.Spawn( m_CompilerPath.Get(), fullArgs.GetFinalArgs().Get(),
workingDir, environment ) == false )
{
FLOG_ERROR( "Failed to spawn process to build '%s'", GetName().Get() );
return NODE_RESULT_FAILED;
}
// capture all of the stdout and stderr
AutoPtr< char > memOut;
AutoPtr< char > memErr;
uint32_t memOutSize = 0;
uint32_t memErrSize = 0;
p.ReadAllData( memOut, &memOutSize, memErr, &memErrSize );
// Get result
ASSERT( !p.IsRunning() );
int result = p.WaitForExit();
bool ok = ( result == 0 );
if ( !ok )
{
// something went wrong, print details
Node::DumpOutput( job, memOut.Get(), memOutSize );
Node::DumpOutput( job, memErr.Get(), memErrSize );
goto failed;
}
if ( !FileIO::FileExists( m_Name.Get() ) )
{
FLOG_ERROR( "Object missing despite success for '%s'", GetName().Get() );
return NODE_RESULT_FAILED;
}
// record new file time
m_Stamp = FileIO::GetFileLastWriteTime( m_Name );
return NODE_RESULT_OK;
failed:
FLOG_ERROR( "Failed to build Object (error %i) '%s'", result, GetName().Get() );
return NODE_RESULT_FAILED;
}