This commit is contained in:
FluorescentCIAAfricanAmerican
2020-04-22 12:56:21 -04:00
commit 3bf9df6b27
15370 changed files with 5489726 additions and 0 deletions

298
external/vpc/utils/vpc/Makefile vendored Normal file
View File

@@ -0,0 +1,298 @@
# Make command to use for dependencies
SHELL=/bin/sh
RM:=rm
MKDIR:=mkdir
OS:=$(shell uname)
EXE_POSTFIX:=""
# ---------------------------------------------------------------- #
# Figure out if we're building in the Steam tree or not.
# ---------------------------------------------------------------- #
SRCROOT:=../..
-include $(SRCROOT)/devtools/steam_def.mak
# ---------------------------------------------------------------- #
# Set paths to gcc.
# ---------------------------------------------------------------- #
CC:=gcc
CXX:=g++
ifeq ($(OS),Darwin)
SDKROOT:=$(shell xcodebuild -sdk macosx -version Path)
CC:=clang -m32
CXX:=clang++ -m32
EXE_POSTFIX:=_osx
endif
ifeq ($(OS),Linux)
ifeq ($(wildcard /valve/bin/gcc),)
CC:=gcc
CXX:=g++
else
CC:=/valve/bin/gcc-4.7
CXX:=/valve/bin/g++-4.7
endif
EXE_POSTFIX:=_linux
endif
ifneq ($(CC_OVERRIDE),)
CC:=$(CC_OVERRIDE)
CXX:=$(CPP_OVERRIDE)
endif
# ---------------------------------------------------------------- #
# Lists of files.
# ---------------------------------------------------------------- #
VPC_SRC:= \
exprsimplifier.cpp \
groupscript.cpp \
conditionals.cpp \
macros.cpp \
projectscript.cpp \
scriptsource.cpp \
baseprojectdatacollector.cpp \
configuration.cpp \
dependencies.cpp \
main.cpp \
projectgenerator_makefile.cpp \
solutiongenerator_makefile.cpp \
solutiongenerator_xcode.cpp \
sys_utils.cpp \
../vpccrccheck/crccheck_shared.cpp \
projectgenerator_codelite.cpp \
solutiongenerator_codelite.cpp \
TIER0_SRC:= \
../../tier0/assert_dialog.cpp \
../../tier0/cpu_posix.cpp \
../../tier0/cpu.cpp \
../../tier0/dbg.cpp \
../../tier0/fasttimer.cpp \
../../tier0/mem.cpp \
../../tier0/mem_helpers.cpp \
../../tier0/memdbg.cpp \
../../tier0/memstd.cpp \
../../tier0/memvalidate.cpp \
../../tier0/minidump.cpp \
../../tier0/pch_tier0.cpp \
../../tier0/threadtools.cpp \
../../tier0/valobject.cpp \
../../tier0/vprof.cpp
TIER1_SRC:= \
../../tier1/keyvalues.cpp \
../../tier1/checksum_crc.cpp \
../../tier1/checksum_md5.cpp \
../../tier1/convar.cpp \
../../tier1/generichash.cpp \
../../tier1/interface.cpp \
../../tier1/mempool.cpp \
../../tier1/memstack.cpp \
../../tier1/stringpool.cpp \
../../tier1/utlbuffer.cpp \
../../tier1/utlsymbol.cpp
VSTDLIB_SRC:= \
../../vstdlib/cvar.cpp \
../../vstdlib/vstrtools.cpp \
../../vstdlib/random.cpp
ifeq "$(STEAM_BRANCH)" "1"
TIER0_SRC+= \
../../tier0/tier0.cpp \
../../tier0/platform_posix.cpp \
../../tier0/validator.cpp \
../../tier0/thread.cpp \
../../tier0/pmelib.cpp \
../../tier0/pme_posix.cpp \
../../tier0/testthread.cpp \
../../tier0/cpu_posix.cpp \
../../tier0/memblockhdr.cpp
VSTDLIB_SRC+= \
../../vstdlib/keyvaluessystem.cpp \
../../vstdlib/qsort_s.cpp \
../../vstdlib/strtools.cpp \
../../vstdlib/stringnormalize.cpp \
../../vstdlib/splitstring.cpp \
../../vstdlib/commandline.cpp
INTERFACES_SRC=
BINLAUNCH_SRC =
else
TIER0_SRC+= \
../../tier0/platform_posix.cpp \
../../tier0/pme_posix.cpp \
../../tier0/commandline.cpp \
../../tier0/win32consoleio.cpp \
../../tier0/logging.cpp \
../../tier0/tier0_strtools.cpp
TIER1_SRC+= \
../../tier1/utlstring.cpp \
../../tier1/tier1.cpp \
../../tier1/characterset.cpp \
../../tier1/splitstring.cpp \
../../tier1/strtools.cpp \
../../tier1/exprevaluator.cpp \
VSTDLIB_SRC+= \
../../vstdlib/keyvaluessystem.cpp
INTERFACES_SRC= \
../../interfaces/interfaces.cpp
BINLAUNCH_SRC = \
endif
SRC:=$(VPC_SRC) $(TIER0_SRC) $(TIER1_SRC) $(VSTDLIB_SRC) $(INTERFACES_SRC) $(BINLAUNCH_SRC)
# -----Begin user-editable area-----
# -----End user-editable area-----
# If no configuration is specified, "Debug" will be used
ifndef "CFG"
CFG:=Release
endif
#
# Configuration: Debug
#
ifeq "$(CFG)" "Debug"
OUTDIR:=obj/$(OS)/debug
CONFIG_DEPENDENT_FLAGS:=-O0 -g3 -ggdb
else
OUTDIR:=obj/$(OS)/release
CONFIG_DEPENDENT_FLAGS:=-O3 -g1 -ggdb
endif
OBJS:=$(addprefix $(OUTDIR)/, $(subst ../../, ,$(SRC:.cpp=.o)))
OUTFILE:=$(OUTDIR)/vpc
CFG_INC:=-I../../public -I../../common -I../../public/tier0 \
-I../../public/tier1 -I../../public/tier2 -I../../public/vstdlib
CFLAGS=-D_POSIX -DPOSIX -DGNUC -DNDEBUG $(CONFIG_DEPENDENT_FLAGS) -msse -mmmx -pipe -w -fpermissive -fPIC $(CFG_INC)
ifeq "$(STEAM_BRANCH)" "1"
CFLAGS+= -DSTEAM
endif
ifeq "$(OS)" "Darwin"
CFLAGS+=-I$(SDKROOT)/usr/include/malloc
CFLAGS+= -DOSX -D_OSX
CFLAGS+= -arch i386 -fasm-blocks
endif
ifeq "$(OS)" "Linux"
CFLAGS+= -DPLATFORM_LINUX -D_LINUX -DLINUX
endif
ifeq ($(CYGWIN),1)
CFLAGS+=-D_CYGWIN -DCYGWIN -D_CYGWIN_WINDOWS_TARGET
endif
CFLAGS+= -DCOMPILER_GCC
# the sed magic here adds the dependency file to the list of things that depend on the computed dependency
# set, so if any of them change, the dependencies are re-made
MAKEDEPEND=$(CXX) -M -MT $@ -MM $(CFLAGS) $< | sed -e 's@^\(.*\)\.o:@\1.d \1.o:@' > $(@:.o=.d)
COMPILE=$(CXX) -c $(CFLAGS) -o $@ $<
LINK=$(CXX) $(CONFIG_DEPENDENT_FLAGS) -o "$(OUTFILE)" $(OBJS) -ldl -lpthread
ifeq "$(OS)" "Darwin"
LINK+=-liconv -framework Foundation
endif
ifeq "$(OS)" "Darwin"
LINK+= -arch i386
endif
# Build rules
all: $(OUTFILE) ../../../../devtools/bin/vpc$(EXE_POSTFIX)
../../../../devtools/bin/vpc$(EXE_POSTFIX) : $(OUTFILE)
cp "$(OUTFILE)" ../../../../devtools/bin/vpc$(EXE_POSTFIX)
$(OUTFILE): Makefile $(OBJS)
$(LINK)
# Rebuild this project
rebuild: cleanall all
# Clean this project
clean:
$(RM) -f $(OUTFILE)
$(RM) -f $(OBJS)
$(RM) -f $(OBJS:.o=.d)
$(RM) -f ../../../../devtools/bin/vpc$(EXE_POSTFIX)
# Clean this project and all dependencies
cleanall: clean
# magic rules - tread with caution
-include $(OBJS:.o=.d)
# Pattern rules
$(OUTDIR)/%.o : %.cpp
-$(MKDIR) -p $(@D)
@$(MAKEDEPEND);
$(COMPILE)
$(OUTDIR)/tier0/%.o : ../../tier0/%.cpp
-$(MKDIR) -p $(@D)
@$(MAKEDEPEND);
$(COMPILE)
$(OUTDIR)/tier1/%.o : ../../tier1/%.cpp
-$(MKDIR) -p $(@D)
@$(MAKEDEPEND);
$(COMPILE)
$(OUTDIR)/vstdlib/%.o : ../../vstdlib/%.cpp
-$(MKDIR) -p $(@D)
@$(MAKEDEPEND);
$(COMPILE)
$(OUTDIR)/interfaces/%.o : ../../interfaces/%.cpp
if [ ! -d $(@D) ]; then $(MKDIR) $(@D); fi
@$(MAKEDEPEND);
$(COMPILE)
$(OUTDIR)/utils/binlaunch/%.o : ../binlaunch/%.cpp
if [ ! -d $(@D) ]; then $(MKDIR) $(@D); fi
@$(MAKEDEPEND);
$(COMPILE)
# the tags file) seems like more work than it's worth. feel free to fix that up
# if it bugs you.
TAGS:
@find . -name '*.cpp' -print0 | xargs -0 etags --declarations --ignore-indentation
@find . -name '*.h' -print0 | xargs -0 etags --language=c++ --declarations --ignore-indentation --append
@find . -name '*.c' -print0 | xargs -0 etags --declarations --ignore-indentation --append

View File

@@ -0,0 +1,381 @@
//====== Copyright (c) 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#include "vpc.h"
#include "baseprojectdatacollector.h"
#include "tier1/utlstack.h"
#include "p4lib/ip4.h"
static const char * const s_rgsAmbiguousPropertyNames[] =
{
"$CommandLine",
};
// ------------------------------------------------------------------------------------------------ //
// CSpecificConfig implementation.
// ------------------------------------------------------------------------------------------------ //
CSpecificConfig::CSpecificConfig( CSpecificConfig *pParentConfig )
: m_pParentConfig( pParentConfig )
{
m_pKV = new KeyValues( "" );
m_bFileExcluded = false;
m_bIsSchema = false;
m_bIsDynamic = false;
}
CSpecificConfig::~CSpecificConfig()
{
m_pKV->deleteThis();
}
const char* CSpecificConfig::GetConfigName()
{
return m_pKV->GetName();
}
const char* CSpecificConfig::GetOption( const char *pOptionName )
{
const char *pRet = m_pKV->GetString( pOptionName, NULL );
if ( pRet )
return pRet;
if ( m_pParentConfig )
return m_pParentConfig->m_pKV->GetString( pOptionName, NULL );
return NULL;
}
// ------------------------------------------------------------------------------------------------ //
// CFileConfig implementation.
// ------------------------------------------------------------------------------------------------ //
CFileConfig::~CFileConfig()
{
Term();
}
void CFileConfig::Term()
{
m_Configurations.PurgeAndDeleteElements();
}
const char* CFileConfig::GetName()
{
return m_Filename.String();
}
CSpecificConfig* CFileConfig::GetConfig( const char *pConfigName )
{
int i = m_Configurations.Find( pConfigName );
if ( i == m_Configurations.InvalidIndex() )
return NULL;
else
return m_Configurations[i];
}
CSpecificConfig* CFileConfig::GetOrCreateConfig( const char *pConfigName, CSpecificConfig *pParentConfig )
{
int i = m_Configurations.Find( pConfigName );
if ( i == m_Configurations.InvalidIndex() )
{
CSpecificConfig *pConfig = new CSpecificConfig( pParentConfig );
i = m_Configurations.Insert( pConfigName, pConfig );
}
return m_Configurations[i];
}
bool CFileConfig::IsExcludedFrom( const char *pConfigName )
{
CSpecificConfig *pSpecificConfig = GetConfig( pConfigName );
if ( pSpecificConfig )
return pSpecificConfig->m_bFileExcluded;
else
return false;
}
bool CFileConfig::IsDynamicFile( const char *pConfigName )
{
CSpecificConfig *pSpecificConfig = GetConfig( pConfigName );
if ( pSpecificConfig )
return pSpecificConfig->m_bIsDynamic;
else
return false;
}
// ------------------------------------------------------------------------------------------------ //
// CBaseProjectDataCollector implementation.
// ------------------------------------------------------------------------------------------------ //
CBaseProjectDataCollector::CBaseProjectDataCollector( CRelevantPropertyNames *pNames ) : m_Files( k_eDictCompareTypeFilenames )
{
m_RelevantPropertyNames.m_nNames = 0;
m_RelevantPropertyNames.m_pNames = NULL;
if ( pNames )
{
m_RelevantPropertyNames = *pNames;
}
}
CBaseProjectDataCollector::~CBaseProjectDataCollector()
{
Term();
}
void CBaseProjectDataCollector::StartProject()
{
for (int i = 0; i < m_RelevantPropertyNames.m_nNames; i++)
{
for (int j = 0; j < V_ARRAYSIZE(s_rgsAmbiguousPropertyNames); j++ )
{
if ( V_stricmp( m_RelevantPropertyNames.m_pNames[i], s_rgsAmbiguousPropertyNames[j] ) == 0 )
g_pVPC->VPCWarning( "Property name %s may occur in multiple contexts and should be fully qualified", m_RelevantPropertyNames.m_pNames[i] );
}
}
m_ProjectName = "UNNAMED";
m_CurFileConfig.Push( &m_BaseConfigData );
m_CurSpecificConfig.Push( NULL );
}
void CBaseProjectDataCollector::EndProject()
{
}
void CBaseProjectDataCollector::Term()
{
m_BaseConfigData.Term();
m_Files.PurgeAndDeleteElements();
m_CurFileConfig.Purge();
m_CurSpecificConfig.Purge();
}
CUtlString CBaseProjectDataCollector::GetProjectName()
{
return m_ProjectName;
}
void CBaseProjectDataCollector::SetProjectName( const char *pProjectName )
{
char tmpBuf[MAX_PATH];
V_strncpy( tmpBuf, pProjectName, sizeof( tmpBuf ) );
V_strlower( tmpBuf );
m_ProjectName = tmpBuf;
}
// Get a list of all configurations.
void CBaseProjectDataCollector::GetAllConfigurationNames( CUtlVector< CUtlString > &configurationNames )
{
configurationNames.Purge();
for ( int i=m_BaseConfigData.m_Configurations.First(); i != m_BaseConfigData.m_Configurations.InvalidIndex(); i=m_BaseConfigData.m_Configurations.Next(i) )
{
configurationNames.AddToTail( m_BaseConfigData.m_Configurations.GetElementName(i) );
}
}
void CBaseProjectDataCollector::StartConfigurationBlock( const char *pConfigName, bool bFileSpecific )
{
CFileConfig *pFileConfig = m_CurFileConfig.Top();
// Find or add a new config block.
char sLowerCaseConfigName[MAX_PATH];
V_strncpy( sLowerCaseConfigName, pConfigName, sizeof( sLowerCaseConfigName ) );
V_strlower( sLowerCaseConfigName );
int index = pFileConfig->m_Configurations.Find( sLowerCaseConfigName );
if ( index == -1 )
{
CSpecificConfig *pParent = ( pFileConfig==&m_BaseConfigData ? NULL : m_BaseConfigData.GetOrCreateConfig( sLowerCaseConfigName, NULL ) );
CSpecificConfig *pConfig = new CSpecificConfig( pParent );
pConfig->m_bFileExcluded = false;
pConfig->m_pKV->SetName( sLowerCaseConfigName );
index = pFileConfig->m_Configurations.Insert( sLowerCaseConfigName, pConfig );
}
// Remember what the current config is.
m_CurSpecificConfig.Push( pFileConfig->m_Configurations[index] );
}
void CBaseProjectDataCollector::EndConfigurationBlock()
{
m_CurSpecificConfig.Pop();
}
bool CBaseProjectDataCollector::StartPropertySection( configKeyword_e keyword, bool *pbShouldSkip )
{
m_CurPropertySection.Push( keyword );
return true;
}
void CBaseProjectDataCollector::HandleProperty( const char *pProperty, const char *pCustomScriptData )
{
CFmtStr sQualifiedProperty( "%s%s%s", m_CurPropertySection.Count() ? g_pVPC->KeywordToName( m_CurPropertySection.Top() ) : "",
m_CurPropertySection.Count() ? "/" : "",
pProperty );
bool bSetQualifiedProperty = false;
int i;
for ( i=0; i < m_RelevantPropertyNames.m_nNames; i++ )
{
if ( V_stricmp( m_RelevantPropertyNames.m_pNames[i], pProperty ) == 0 )
break;
if ( V_stricmp( m_RelevantPropertyNames.m_pNames[i], sQualifiedProperty.Access() ) == 0 )
{
bSetQualifiedProperty = true;
break;
}
}
if ( i == m_RelevantPropertyNames.m_nNames )
{
// not found
return;
}
if ( pCustomScriptData )
{
g_pVPC->GetScript().PushScript( "HandleProperty( custom script data )", pCustomScriptData );
}
const char *pNextToken = g_pVPC->GetScript().PeekNextToken( false );
if ( pNextToken && pNextToken[0] != 0 )
{
// Pass in the previous value so the $base substitution works.
CSpecificConfig *pConfig = m_CurSpecificConfig.Top();
const char *pBaseString = pConfig->m_pKV->GetString( bSetQualifiedProperty ? sQualifiedProperty.Access() : pProperty );
char buff[MAX_SYSTOKENCHARS];
if ( g_pVPC->GetScript().ParsePropertyValue( pBaseString, buff, sizeof( buff ) ) )
{
pConfig->m_pKV->SetString( bSetQualifiedProperty ? sQualifiedProperty.Access() : pProperty, buff );
}
}
if ( pCustomScriptData )
{
// Restore prior script state
g_pVPC->GetScript().PopScript();
}
}
void CBaseProjectDataCollector::EndPropertySection( configKeyword_e keyword )
{
configKeyword_e kw;
m_CurPropertySection.Pop( kw );
Assert( kw == keyword );
}
void CBaseProjectDataCollector::StartFolder( const char *pFolderName )
{
}
void CBaseProjectDataCollector::EndFolder()
{
}
bool CBaseProjectDataCollector::StartFile( const char *pFilename, bool bWarnIfAlreadyExists )
{
CFileConfig *pFileConfig = new CFileConfig;
pFileConfig->m_Filename = pFilename;
pFileConfig->m_nInsertOrder = m_Files.Count();
m_Files.Insert( pFilename, pFileConfig );
m_CurFileConfig.Push( pFileConfig );
m_CurSpecificConfig.Push( NULL );
char szFullPath[MAX_PATH];
V_GetCurrentDirectory( szFullPath, sizeof( szFullPath ) );
V_AppendSlash( szFullPath, sizeof( szFullPath ) );
V_strncat( szFullPath, pFilename, sizeof( szFullPath ) );
V_RemoveDotSlashes( szFullPath );
#if 0
// Add file to Perforce if it isn't there already
if ( Sys_Exists( szFullPath ) )
{
if ( m_bP4AutoAdd && p4 && !p4->IsFileInPerforce( szFullPath ) )
{
p4->OpenFileForAdd( szFullPath );
VPCStatus( "%s automatically opened for add in default changelist.", szFullPath );
}
}
else
{
// g_pVPC->Warning( "%s not found on disk at location specified in project script.", szFullPath );
}
#endif
return true;
}
void CBaseProjectDataCollector::EndFile()
{
m_CurFileConfig.Pop();
m_CurSpecificConfig.Pop();
}
// This is actually just per-file configuration data.
void CBaseProjectDataCollector::FileExcludedFromBuild( bool bExcluded )
{
CSpecificConfig *pConfig = m_CurSpecificConfig.Top();
pConfig->m_bFileExcluded = bExcluded;
}
void CBaseProjectDataCollector::FileIsSchema( bool bIsSchema )
{
CSpecificConfig *pConfig = m_CurSpecificConfig.Top();
pConfig->m_bIsSchema = bIsSchema;
}
void CBaseProjectDataCollector::FileIsDynamic( bool bIsDynamic )
{
CSpecificConfig *pConfig = m_CurSpecificConfig.Top();
pConfig->m_bIsDynamic = bIsDynamic;
}
bool CBaseProjectDataCollector::RemoveFile( const char *pFilename )
{
bool bRet = false;
int i = m_Files.Find( pFilename );
if ( i != m_Files.InvalidIndex() )
{
delete m_Files[i];
m_Files.RemoveAt( i );
bRet = true;
}
return bRet;
}
void CBaseProjectDataCollector::DoStandardVisualStudioReplacements( const char *pStartString, const char *pFullInputFilename, char *pOut, int outLen )
{
// Decompose the input filename.
char sInputDir[MAX_PATH], sFileBase[MAX_PATH];
if ( !V_ExtractFilePath( pFullInputFilename, sInputDir, sizeof( sInputDir ) ) )
V_strcpy( sInputDir, "." );
V_FileBase( pFullInputFilename, sFileBase, sizeof( sFileBase ) );
// Handle $(InputPath), $(InputDir), $(InputName)
char *strings[2] =
{
(char*)stackalloc( outLen ),
(char*)stackalloc( outLen )
};
V_StrSubst( pStartString, "$(InputPath)", pFullInputFilename, strings[0], outLen );
V_StrSubst( strings[0], "$(InputDir)", sInputDir, strings[1], outLen );
V_StrSubst( strings[1], "$(InputName)", sFileBase, strings[0], outLen );
V_StrSubst( strings[0], "$(IntDir)", "$(OBJ_DIR)", strings[1], outLen );
V_StrSubst( strings[1], "$(InputFileName)", pFullInputFilename + V_strlen(sInputDir), strings[0], outLen );
V_StrSubst( strings[0], "$(ConfigurationName)", "${CONFIGURATION}", strings[1], outLen );
V_StrSubst( strings[1], "$(Configuration)", "${CONFIGURATION}", strings[0], outLen );
V_strncpy( pOut, strings[0], outLen );
V_FixSlashes( pOut, '/' );
}

View File

@@ -0,0 +1,130 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
//
//=============================================================================
#ifndef BASEPROJECTDATACOLLECTOR_H
#define BASEPROJECTDATACOLLECTOR_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/keyvalues.h"
#include "tier1/utlstack.h"
class CSpecificConfig
{
public:
CSpecificConfig( CSpecificConfig *pParentConfig );
~CSpecificConfig();
const char *GetConfigName();
const char *GetOption( const char *pOptionName );
public:
CSpecificConfig *m_pParentConfig;
KeyValues *m_pKV;
bool m_bFileExcluded; // Is the file that holds this config excluded from the build?
bool m_bIsSchema; // Is this a schema file?
bool m_bIsDynamic; // Is this a schema file?
};
class CFileConfig
{
public:
~CFileConfig();
void Term();
const char *GetName();
CSpecificConfig *GetConfig( const char *pConfigName );
CSpecificConfig *GetOrCreateConfig( const char *pConfigName, CSpecificConfig *pParentConfig );
bool IsExcludedFrom( const char *pConfigName );
bool IsDynamicFile( const char *pConfigName );
public:
CUtlDict< CSpecificConfig*, int > m_Configurations;
CUtlString m_Filename; // "" if this is the config data for the whole project.
int m_nInsertOrder;
};
// This just holds the list of property names that we're supposed to scan for.
class CRelevantPropertyNames
{
public:
const char **m_pNames;
int m_nNames;
};
//
// This class is shared by the makefile and SlickEdit project file generator.
// It just collects interesting file properties into KeyValues and then the project file generator
// is responsible for using that data to write out a project file.
//
class CBaseProjectDataCollector : public IBaseProjectGenerator
{
// IBaseProjectGenerator implementation.
public:
CBaseProjectDataCollector( CRelevantPropertyNames *pNames );
~CBaseProjectDataCollector();
// Called before doing anything in a project (in g_pVPC->GetOutputFilename()).
virtual void StartProject();
virtual void EndProject();
// Access the project name.
virtual CUtlString GetProjectName();
virtual void SetProjectName( const char *pProjectName );
// Get a list of all configurations.
virtual void GetAllConfigurationNames( CUtlVector< CUtlString > &configurationNames );
// Configuration data is specified in between these calls and inside BeginPropertySection/EndPropertySection.
// If bFileSpecific is set, then the configuration data only applies to the last file added.
virtual void StartConfigurationBlock( const char *pConfigName, bool bFileSpecific );
virtual void EndConfigurationBlock();
// These functions are called when it enters a section like $Compiler, $Linker, etc.
// In between the BeginPropertySection/EndPropertySection, it'll call HandleProperty for any properties inside that section.
//
// If you pass pCustomScriptData to HandleProperty, it won't touch the global parsing state -
// it'll parse the platform filters and property value from pCustomScriptData instead.
virtual bool StartPropertySection( configKeyword_e keyword, bool *pbShouldSkip = NULL );
virtual void HandleProperty( const char *pProperty, const char *pCustomScriptData = NULL );
virtual void EndPropertySection( configKeyword_e keyword );
// Files go in folders. The generator should maintain a stack of folders as they're added.
virtual void StartFolder( const char *pFolderName );
virtual void EndFolder();
// Add files. Any config blocks/properties between StartFile/EndFile apply to this file only.
// It will only ever have one active file.
virtual bool StartFile( const char *pFilename, bool bWarnIfAlreadyExists );
virtual void EndFile();
// This is actually just per-file configuration data.
virtual void FileExcludedFromBuild( bool bExcluded );
virtual void FileIsSchema( bool bIsSchema );
virtual void FileIsDynamic( bool bIsDynamic );
// Remove the specified file.
virtual bool RemoveFile( const char *pFilename ); // returns ture if a file was removed
public:
// This is called in EndProject if bAutoCleanupAfterProject is set.
void Term();
static void DoStandardVisualStudioReplacements( const char *pStartString, const char *pFullInputFilename, char *pOut, int outLen );
public:
CUtlString m_ProjectName;
CUtlDict< CFileConfig *, int > m_Files;
CFileConfig m_BaseConfigData;
CUtlStack< CFileConfig* > m_CurFileConfig; // Either m_BaseConfigData or one of the files.
CUtlStack< CSpecificConfig* > m_CurSpecificConfig; // Debug, release?
CUtlStack< configKeyword_e > m_CurPropertySection;
CRelevantPropertyNames m_RelevantPropertyNames;
};
#endif // BASEPROJECTDATACOLLECTOR_H

244
external/vpc/utils/vpc/conditionals.cpp vendored Normal file
View File

@@ -0,0 +1,244 @@
//========= Copyright 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CVPC::SetupDefaultConditionals()
{
//
// PLATFORM Conditionals
//
{
FindOrCreateConditional( "WIN32", true, CONDITIONAL_PLATFORM );
FindOrCreateConditional( "WIN64", true, CONDITIONAL_PLATFORM );
// LINUX is the platform but the VPC scripts use $LINUX and $DEDICATED
// (which we automatically create later).
FindOrCreateConditional( "LINUX32", true, CONDITIONAL_PLATFORM );
FindOrCreateConditional( "LINUX64", true, CONDITIONAL_PLATFORM );
FindOrCreateConditional( "OSX32", true, CONDITIONAL_PLATFORM );
FindOrCreateConditional( "OSX64", true, CONDITIONAL_PLATFORM );
FindOrCreateConditional( "X360", true, CONDITIONAL_PLATFORM );
FindOrCreateConditional( "PS3", true, CONDITIONAL_PLATFORM );
}
//
// CUSTOM conditionals
//
{
// setup default custom conditionals
FindOrCreateConditional( "PROFILE", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "RETAIL", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "CALLCAP", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "FASTCAP", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "CERT", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "MEMTEST", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "NOFPO", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "POSIX", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "LV", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "DEMO", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "NO_STEAM", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "DVDEMU", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "QTDEBUG", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "NO_CEG", true, CONDITIONAL_CUSTOM );
FindOrCreateConditional( "UPLOAD_CEG", true, CONDITIONAL_CUSTOM );
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
const char *CVPC::GetTargetPlatformName()
{
for ( int i = 0; i < m_Conditionals.Count(); i++ )
{
conditional_t *pConditional = &m_Conditionals[i];
if ( pConditional->type == CONDITIONAL_PLATFORM && pConditional->m_bDefined )
{
return pConditional->name.String();
}
}
// fatal - should have already been default set
Assert( 0 );
VPCError( "Unspecified platform." );
return NULL;
}
//-----------------------------------------------------------------------------
// Case Insensitive. Returns true if platform conditional has been marked
// as defined.
//-----------------------------------------------------------------------------
bool CVPC::IsPlatformDefined( const char *pName )
{
for ( int i=0; i<m_Conditionals.Count(); i++ )
{
if ( m_Conditionals[i].type == CONDITIONAL_PLATFORM && !V_stricmp( pName, m_Conditionals[i].name.String() ) )
{
return m_Conditionals[i].m_bDefined;
}
}
return false;
}
//-----------------------------------------------------------------------------
// Case Insensitive
//-----------------------------------------------------------------------------
conditional_t *CVPC::FindOrCreateConditional( const char *pName, bool bCreate, conditionalType_e type )
{
for (int i=0; i<m_Conditionals.Count(); i++)
{
if ( !V_stricmp( pName, m_Conditionals[i].name.String() ) )
{
// found
return &m_Conditionals[i];
}
}
if ( !bCreate )
{
return NULL;
}
int index = m_Conditionals.AddToTail();
char tempName[256];
V_strncpy( tempName, pName, sizeof( tempName ) );
// primary internal use as lower case, but spewed to user as upper for style consistency
m_Conditionals[index].name = V_strlower( tempName );
m_Conditionals[index].upperCaseName = V_strupr( tempName );
m_Conditionals[index].type = type;
return &m_Conditionals[index];
}
void CVPC::SetConditional( const char *pString, bool bSet )
{
VPCStatus( false, "Set Conditional: $%s = %s", pString, ( bSet ? "1" : "0" ) );
conditional_t *pConditional = FindOrCreateConditional( pString, true, CONDITIONAL_CUSTOM );
if ( !pConditional )
{
VPCError( "Failed to find or create $%s conditional", pString );
}
pConditional->m_bDefined = bSet;
}
//-----------------------------------------------------------------------------
// Returns true if string has a conditional of the specified type
//-----------------------------------------------------------------------------
bool CVPC::ConditionHasDefinedType( const char* pCondition, conditionalType_e type )
{
char symbol[MAX_SYSTOKENCHARS];
for ( int i=0; i<m_Conditionals.Count(); i++ )
{
if ( m_Conditionals[i].type != type )
continue;
sprintf( symbol, "$%s", m_Conditionals[i].name.String() );
if ( V_stristr( pCondition, symbol ) )
{
// a define of expected type occurs in the conditional expression
return true;
}
}
return false;
}
//-----------------------------------------------------------------------------
// Callback for expression evaluator.
//-----------------------------------------------------------------------------
bool CVPC::ResolveConditionalSymbol( const char *pSymbol )
{
int offset = 0;
if ( !V_stricmp( pSymbol, "$0" ) || !V_stricmp( pSymbol, "0" ) )
{
return false;
}
else if ( !V_stricmp( pSymbol, "$1" ) || !V_stricmp( pSymbol, "1" ) )
{
return true;
}
if ( pSymbol[0] == '$' )
{
offset = 1;
}
conditional_t *pConditional = FindOrCreateConditional( (char*)pSymbol+offset, false, CONDITIONAL_NULL );
if ( pConditional )
{
// game conditionals only resolve true when they are 'defined' and 'active'
// only one game conditional is expected to be active at a time
if ( pConditional->type == CONDITIONAL_GAME )
{
if ( !pConditional->m_bDefined )
{
return false;
}
return pConditional->m_bGameConditionActive;
}
// all other type of conditions are gated by their 'defined' state
return pConditional->m_bDefined;
}
// unknown conditional, defaults to false
return false;
}
//-----------------------------------------------------------------------------
// Callback for expression evaluator.
//-----------------------------------------------------------------------------
static bool ResolveSymbol( const char *pSymbol )
{
return g_pVPC->ResolveConditionalSymbol( pSymbol );
}
//-----------------------------------------------------------------------------
// Callback for expression evaluator.
//-----------------------------------------------------------------------------
static void SymbolSyntaxError( const char *pReason )
{
// invoke internal syntax error hndling which spews script stack as well
g_pVPC->VPCSyntaxError( pReason );
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
bool CVPC::EvaluateConditionalExpression( const char *pExpression )
{
char conditionalBuffer[MAX_SYSTOKENCHARS];
ResolveMacrosInConditional( pExpression, conditionalBuffer, sizeof( conditionalBuffer ) );
if ( !conditionalBuffer[0] )
{
// empty string, same as not having a conditional
return true;
}
bool bResult = false;
CExpressionEvaluator ExpressionHandler;
bool bValid = ExpressionHandler.Evaluate( bResult, conditionalBuffer, ::ResolveSymbol, ::SymbolSyntaxError );
if ( !bValid )
{
g_pVPC->VPCSyntaxError( "VPC Conditional Evaluation Error" );
}
return bResult;
}

View File

@@ -0,0 +1,180 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
bool VPC_Config_General_AdditionalOutputFiles( const char *pPropertyName )
{
// Ignore this. We only care about it when looking at dependencies,
// and baseprojectdatacollector will get it in that case.
char buff[MAX_SYSTOKENCHARS];
ParsePropertyValue( &g_pScriptData, g_pScriptLine, NULL, buff, sizeof( buff ) );
return true;
}
bool VPC_Config_General_OutputDirectory( const char *pPropertyName )
{
SET_STRING_PROPERTY( pPropertyName, g_spConfig, get_OutputDirectory, put_OutputDirectory );
}
bool VPC_Config_General_IntermediateDirectory( const char *pPropertyName )
{
SET_STRING_PROPERTY( pPropertyName, g_spConfig, get_IntermediateDirectory, put_IntermediateDirectory );
}
bool VPC_Config_General_ExtensionsToDeleteOnClean( const char *pPropertyName )
{
SET_STRING_PROPERTY( pPropertyName, g_spConfig, get_DeleteExtensionsOnClean, put_DeleteExtensionsOnClean );
}
bool VPC_Config_General_BuildLogFile( const char *pPropertyName )
{
SET_STRING_PROPERTY( pPropertyName, g_spConfig, get_BuildLogFile, put_BuildLogFile );
}
bool VPC_Config_General_InheritedProjectPropertySheets( const char *pPropertyName )
{
SET_STRING_PROPERTY( pPropertyName, g_spConfig, get_InheritedPropertySheets, put_InheritedPropertySheets );
}
bool VPC_Config_General_ConfigurationType( const char *pPropertyName )
{
char buff[MAX_SYSTOKENCHARS];
if ( !ParsePropertyValue( &g_pScriptData, g_pScriptLine, NULL, buff, sizeof( buff ) ) )
return true;
ConfigurationTypes option = typeUnknown;
if ( !V_stricmp( buff, "Utility" ) )
option = typeUnknown;
else if ( !V_stricmp( buff, "Application (.exe)" ) || !V_stricmp( buff, "Title (.xex)" ) )
option = typeApplication;
else if ( !V_stricmp( buff, "Dynamic Library (.dll)" ) || !V_stricmp( buff, "Dynamic Library (.xex)" ) )
option = typeDynamicLibrary;
else if ( !V_stricmp( buff, "Static Library (.lib)" ) )
option = typeStaticLibrary;
else
VPC_SyntaxError();
SET_LIST_PROPERTY( pPropertyName, g_spConfig, get_ConfigurationType, put_ConfigurationType, ConfigurationTypes, option );
}
bool VPC_Config_General_UseOfMFC( const char *pPropertyName )
{
char buff[MAX_SYSTOKENCHARS];
if ( !ParsePropertyValue( &g_pScriptData, g_pScriptLine, NULL, buff, sizeof( buff ) ) )
return true;
useOfMfc option = useMfcStdWin;
if ( !V_stricmp( buff, "Use Standard Windows Libraries" ) )
option = useMfcStdWin;
else if ( !V_stricmp( buff, "Use MFC in a Static Library" ) )
option = useMfcStatic;
else if ( !V_stricmp( buff, "Use MFC in a Shared DLL" ) )
option = useMfcDynamic;
else
VPC_SyntaxError();
SET_LIST_PROPERTY( pPropertyName, g_spConfig, get_useOfMfc, put_useOfMfc, useOfMfc, option );
}
bool VPC_Config_General_UseOfATL( const char *pPropertyName )
{
char buff[MAX_SYSTOKENCHARS];
if ( !ParsePropertyValue( &g_pScriptData, g_pScriptLine, NULL, buff, sizeof( buff ) ) )
return true;
useOfATL option = useATLNotSet;
if ( !V_stricmp( buff, "Not Using ATL" ) )
option = useATLNotSet;
else if ( !V_stricmp( buff, "Static Link to ATL" ) )
option = useATLStatic;
else if ( !V_stricmp( buff, "Dynamic Link to ATL" ) )
option = useATLDynamic;
else
VPC_SyntaxError();
SET_LIST_PROPERTY( pPropertyName, g_spConfig, get_useOfATL, put_useOfATL, useOfATL, option );
}
bool VPC_Config_General_MinimizeCRTUseInATL( const char *pPropertyName )
{
SET_BOOL_PROPERTY( pPropertyName, g_spConfig, get_ATLMinimizesCRunTimeLibraryUsage, put_ATLMinimizesCRunTimeLibraryUsage );
}
bool VPC_Config_General_CharacterSet( const char *pPropertyName )
{
char buff[MAX_SYSTOKENCHARS];
if ( !ParsePropertyValue( &g_pScriptData, g_pScriptLine, NULL, buff, sizeof( buff ) ) )
return true;
charSet option = charSetNotSet;
if ( !V_stricmp( buff, "Not Set" ) )
option = charSetNotSet;
else if ( !V_stricmp( buff, "Use Unicode Character Set" ) )
option = charSetUnicode;
else if ( !V_stricmp( buff, "Use Multi-Byte Character Set" ) )
option = charSetMBCS;
else
VPC_SyntaxError();
SET_LIST_PROPERTY( pPropertyName, g_spConfig, get_CharacterSet, put_CharacterSet, charSet, option );
}
bool VPC_Config_General_CommonLanguageRuntimeSupport( const char *pPropertyName )
{
VPC_Error( "Setting '%s' Not Implemented", pPropertyName );
return false;
}
bool VPC_Config_General_WholeProgramOptimization( const char *pPropertyName )
{
char buff[MAX_SYSTOKENCHARS];
if ( !ParsePropertyValue( &g_pScriptData, g_pScriptLine, NULL, buff, sizeof( buff ) ) )
return true;
WholeProgramOptimizationTypes option = WholeProgramOptimizationNone;
if ( !V_stricmp( buff, "No Whole Program Optimization" ) )
option = WholeProgramOptimizationNone;
else if ( !V_stricmp( buff, "Use Link Time Code Generation" ) )
option = WholeProgramOptimizationLinkTimeCodeGen;
else if ( !V_stricmp( buff, "Profile Guided Optimization - Instrument" ) )
option = WholeProgramOptimizationPGOInstrument;
else if ( !V_stricmp( buff, "Profile Guided Optimization - Optimize" ) )
option = WholeProgramOptimizationPGOOptimize;
else if ( !V_stricmp( buff, "Profile Guided Optimization - Update" ) )
option = WholeProgramOptimizationPGOUpdate;
else
VPC_SyntaxError();
SET_LIST_PROPERTY( pPropertyName, g_spConfig, get_WholeProgramOptimization, put_WholeProgramOptimization, WholeProgramOptimizationTypes, option );
}
extern bool VPC_Config_IgnoreOption( const char *pPropertyName );
property_t g_generalProperties[] =
{
{g_pOption_AdditionalProjectDependencies, VPC_Config_IgnoreOption },
{g_pOption_AdditionalOutputFiles, VPC_Config_IgnoreOption },
{"$GameOutputFile", VPC_Config_IgnoreOption },
{"$OutputDirectory", VPC_Config_General_OutputDirectory },
{"$IntermediateDirectory", VPC_Config_General_IntermediateDirectory},
{"$ExtensionsToDeleteOnClean", VPC_Config_General_ExtensionsToDeleteOnClean},
{"$BuildLogFile", VPC_Config_General_BuildLogFile},
{"$InheritedProjectPropertySheets", VPC_Config_General_InheritedProjectPropertySheets},
{"$ConfigurationType", VPC_Config_General_ConfigurationType},
{"$UseOfMFC", VPC_Config_General_UseOfMFC, PLATFORM_WINDOWS},
{"$UseOfATL", VPC_Config_General_UseOfATL, PLATFORM_WINDOWS},
{"$MinimizeCRTUseInATL", VPC_Config_General_MinimizeCRTUseInATL, PLATFORM_WINDOWS},
{"$CharacterSet", VPC_Config_General_CharacterSet},
{"$CommonLanguageRuntimeSupport", VPC_Config_General_CommonLanguageRuntimeSupport, PLATFORM_WINDOWS},
{"$WholeProgramOptimization", VPC_Config_General_WholeProgramOptimization},
{NULL}
};

487
external/vpc/utils/vpc/configuration.cpp vendored Normal file
View File

@@ -0,0 +1,487 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
static KeywordName_t s_KeywordNameTable[] =
{
{"$General", KEYWORD_GENERAL},
{"$Debugging", KEYWORD_DEBUGGING},
{"$Compiler", KEYWORD_COMPILER},
{"$SNCCompiler", KEYWORD_PS3_SNCCOMPILER},
{"$GCCCompiler", KEYWORD_PS3_GCCCOMPILER},
{"$Librarian", KEYWORD_LIBRARIAN},
{"$Linker", KEYWORD_LINKER},
{"$SNCLinker", KEYWORD_PS3_SNCLINKER},
{"$GCCLinker", KEYWORD_PS3_GCCLINKER},
{"$ManifestTool", KEYWORD_MANIFEST},
{"$XMLDocumentGenerator", KEYWORD_XMLDOCGEN},
{"$BrowseInformation", KEYWORD_BROWSEINFO},
{"$Resources", KEYWORD_RESOURCES},
{"$PreBuildEvent", KEYWORD_PREBUILDEVENT},
{"$PreLinkEvent", KEYWORD_PRELINKEVENT},
{"$PostBuildEvent", KEYWORD_POSTBUILDEVENT},
{"$CustomBuildStep", KEYWORD_CUSTOMBUILDSTEP},
{"$Xbox360ImageConversion", KEYWORD_XBOXIMAGE},
{"$ConsoleDeployment", KEYWORD_XBOXDEPLOYMENT},
};
const char *CVPC::KeywordToName( configKeyword_e keyword )
{
COMPILE_TIME_ASSERT( ARRAYSIZE( s_KeywordNameTable ) == KEYWORD_MAX );
if ( keyword == KEYWORD_UNKNOWN )
{
return "???";
}
return s_KeywordNameTable[keyword].m_pName;
}
configKeyword_e CVPC::NameToKeyword( const char *pKeywordName )
{
COMPILE_TIME_ASSERT( ARRAYSIZE( s_KeywordNameTable ) == KEYWORD_MAX );
for ( int i = 0; i < ARRAYSIZE( s_KeywordNameTable ); i++ )
{
if ( !V_stricmp( pKeywordName, s_KeywordNameTable[i].m_pName ) )
{
return s_KeywordNameTable[i].m_Keyword;
}
}
return KEYWORD_UNKNOWN;
}
//-----------------------------------------------------------------------------
// VPC_Config_Keyword
//
//-----------------------------------------------------------------------------
void VPC_Config_Keyword( configKeyword_e keyword, const char *pkeywordToken )
{
const char *pToken;
bool bShouldSkip = false;
if ( !g_pVPC->GetProjectGenerator()->StartPropertySection( keyword, &bShouldSkip ) )
{
g_pVPC->VPCSyntaxError( "Unsupported Keyword: %s for target platform", pkeywordToken );
}
if ( bShouldSkip )
{
pToken = g_pVPC->GetScript().PeekNextToken( true );
if ( !pToken || !pToken[0] || V_stricmp( pToken, "{" ) )
g_pVPC->VPCSyntaxError();
g_pVPC->GetScript().SkipBracedSection();
}
else
{
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] || V_stricmp( pToken, "{" ) )
g_pVPC->VPCSyntaxError();
while ( 1 )
{
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] )
break;
if ( !V_stricmp( pToken, "}" ) )
{
// end of section
break;
}
// Copy off the token name so HandleProperty() doesn't have to (or else the parser will overwrite it on the next token).
char tempTokenName[MAX_PATH];
V_strncpy( tempTokenName, pToken, sizeof( tempTokenName ) );
g_pVPC->GetProjectGenerator()->HandleProperty( tempTokenName );
}
}
g_pVPC->GetProjectGenerator()->EndPropertySection( keyword );
}
//-----------------------------------------------------------------------------
// VPC_Keyword_Configuration
//
//-----------------------------------------------------------------------------
void VPC_Keyword_Configuration()
{
const char *pToken;
char szConfigName[MAX_PATH];
bool bAllowNextLine = false;
int i;
CUtlVector<CUtlString> configs;
char buff[MAX_SYSTOKENCHARS];
while ( 1 )
{
pToken = g_pVPC->GetScript().GetToken( bAllowNextLine );
if ( !pToken || !pToken[0] )
break;
if ( !V_stricmp( pToken, "\\" ) )
{
bAllowNextLine = true;
continue;
}
else
{
bAllowNextLine = false;
}
int index = configs.AddToTail();
configs[index] = pToken;
// check for another optional config
pToken = g_pVPC->GetScript().PeekNextToken( bAllowNextLine );
if ( !pToken || !pToken[0] || !V_stricmp( pToken, "{" ) || !V_stricmp( pToken, "}" ) || (pToken[0] == '$') )
break;
}
// no configuration specified, use all known
if ( !configs.Count() )
{
g_pVPC->GetProjectGenerator()->GetAllConfigurationNames( configs );
if ( !configs.Count() )
{
g_pVPC->VPCError( "Trying to parse a configuration block and no configs have been defined yet.\n[%s line:%d]", g_pVPC->GetScript().GetName(), g_pVPC->GetScript().GetLine() );
}
}
// save parser state
CScriptSource scriptSource = g_pVPC->GetScript().GetCurrentScript();
for ( i=0; i<configs.Count(); i++ )
{
// restore parser state
g_pVPC->GetScript().RestoreScript( scriptSource );
V_strncpy( szConfigName, configs[i].String(), sizeof( szConfigName ) );
// get access objects
g_pVPC->GetProjectGenerator()->StartConfigurationBlock( szConfigName, false );
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] || V_stricmp( pToken, "{" ) )
{
g_pVPC->VPCSyntaxError();
}
while ( 1 )
{
g_pVPC->GetScript().SkipToValidToken();
if ( !g_pVPC->GetScript().ParsePropertyValue( NULL, buff, sizeof( buff ) ) )
{
g_pVPC->GetScript().SkipBracedSection();
continue;
}
if ( !V_stricmp( buff, "}" ) )
{
// end of section
break;
}
configKeyword_e keyword = g_pVPC->NameToKeyword( buff );
if ( keyword == KEYWORD_UNKNOWN )
{
g_pVPC->VPCSyntaxError();
}
else
{
VPC_Config_Keyword( keyword, buff );
}
}
g_pVPC->GetProjectGenerator()->EndConfigurationBlock();
}
}
//-----------------------------------------------------------------------------
// VPC_Keyword_FileConfiguration
//
//-----------------------------------------------------------------------------
void VPC_Keyword_FileConfiguration()
{
const char *pToken;
char szConfigName[MAX_PATH];
bool bAllowNextLine = false;
char buff[MAX_SYSTOKENCHARS];
CUtlVector< CUtlString > configurationNames;
while ( 1 )
{
pToken = g_pVPC->GetScript().GetToken( bAllowNextLine );
if ( !pToken || !pToken[0] )
break;
if ( !V_stricmp( pToken, "\\" ) )
{
bAllowNextLine = true;
continue;
}
else
{
bAllowNextLine = false;
}
strcpy( szConfigName, pToken );
configurationNames.AddToTail( pToken );
// check for another optional config
pToken = g_pVPC->GetScript().PeekNextToken( bAllowNextLine );
if ( !pToken || !pToken[0] || !V_stricmp( pToken, "{" ) || !V_stricmp( pToken, "}" ) || (pToken[0] == '$') )
break;
}
// no configuration specified, use all known
if ( configurationNames.Count() == 0 )
{
g_pVPC->GetProjectGenerator()->GetAllConfigurationNames( configurationNames );
}
// save parser state
CScriptSource scriptSource = g_pVPC->GetScript().GetCurrentScript();
for ( int i=0; i < configurationNames.Count(); i++ )
{
// restore parser state
g_pVPC->GetScript().RestoreScript( scriptSource );
// Tell the generator we're about to feed it configuration data for this file.
g_pVPC->GetProjectGenerator()->StartConfigurationBlock( configurationNames[i].String(), true );
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] || V_stricmp( pToken, "{" ) )
{
g_pVPC->VPCSyntaxError();
}
while ( 1 )
{
g_pVPC->GetScript().SkipToValidToken();
pToken = g_pVPC->GetScript().PeekNextToken( true );
if ( pToken && pToken[0] && !V_stricmp( pToken, "$ExcludedFromBuild" ) )
{
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] )
g_pVPC->VPCSyntaxError();
char buff[MAX_SYSTOKENCHARS];
if ( g_pVPC->GetScript().ParsePropertyValue( NULL, buff, sizeof( buff ) ) )
{
g_pVPC->GetProjectGenerator()->FileExcludedFromBuild( Sys_StringToBool( buff ) );
}
continue;
}
if ( !g_pVPC->GetScript().ParsePropertyValue( NULL, buff, sizeof( buff ) ) )
{
g_pVPC->GetScript().SkipBracedSection();
continue;
}
if ( !V_stricmp( buff, "}" ) )
{
// end of section
break;
}
configKeyword_e keyword = g_pVPC->NameToKeyword( buff );
switch ( keyword )
{
case KEYWORD_COMPILER:
case KEYWORD_PS3_SNCCOMPILER:
case KEYWORD_PS3_GCCCOMPILER:
case KEYWORD_RESOURCES:
case KEYWORD_CUSTOMBUILDSTEP:
VPC_Config_Keyword( keyword, buff );
break;
default:
g_pVPC->VPCSyntaxError();
}
}
g_pVPC->GetProjectGenerator()->EndConfigurationBlock();
}
}
//-----------------------------------------------------------------------------
// Just advances past config keywords without acting on them
//
//-----------------------------------------------------------------------------
void VPC_Read_Config_Keywords( const char *pkeywordToken )
{
const char *pToken;
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] || V_stricmp( pToken, "{" ) )
g_pVPC->VPCSyntaxError();
while ( 1 )
{
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] )
break;
if ( !V_stricmp( pToken, "}" ) )
{
// end of section
break;
}
}
}
//-----------------------------------------------------------------------------
// Read a configuration block that applies to an entire folder
//
//-----------------------------------------------------------------------------
void VPC_Keyword_FolderConfiguration( folderConfig_t *pFolderConfig )
{
pFolderConfig->Clear();
const char *pToken;
char szConfigName[MAX_PATH];
bool bAllowNextLine = false;
char buff[MAX_SYSTOKENCHARS];
while ( 1 )
{
pToken = g_pVPC->GetScript().GetToken( bAllowNextLine );
if ( !pToken || !pToken[0] )
break;
if ( !V_stricmp( pToken, "\\" ) )
{
bAllowNextLine = true;
continue;
}
else
{
bAllowNextLine = false;
}
strcpy( szConfigName, pToken );
pFolderConfig->vecConfigurationNames.AddToTail( pToken );
// check for another optional config
pToken = g_pVPC->GetScript().PeekNextToken( bAllowNextLine );
if ( !pToken || !pToken[0] || !V_stricmp( pToken, "{" ) || !V_stricmp( pToken, "}" ) || ( pToken[0] == '$' ) )
break;
}
// no configuration specified, use all known
if ( pFolderConfig->vecConfigurationNames.Count() == 0 )
{
g_pVPC->GetProjectGenerator()->GetAllConfigurationNames( pFolderConfig->vecConfigurationNames );
}
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] || V_stricmp( pToken, "{" ) )
{
g_pVPC->VPCSyntaxError();
}
// save parser state so we remember where the block is. We'll refer back to it when handlign individual files.
pFolderConfig->scriptSource = g_pVPC->GetScript().GetCurrentScript();
// just read past all the tokens. We'll reparse this later, per file.
// it would be cool to parse just once, but leaf code in the project generator expects the parser to be in the right position and parses directly.
while ( 1 )
{
g_pVPC->GetScript().SkipToValidToken();
if ( !g_pVPC->GetScript().ParsePropertyValue( NULL, buff, sizeof( buff ) ) )
{
g_pVPC->GetScript().SkipBracedSection();
continue;
}
if ( !V_stricmp( buff, "}" ) )
{
// end of section
break;
}
configKeyword_e keyword = g_pVPC->NameToKeyword( buff );
switch ( keyword )
{
case KEYWORD_COMPILER:
case KEYWORD_PS3_SNCCOMPILER:
case KEYWORD_PS3_GCCCOMPILER:
case KEYWORD_RESOURCES:
case KEYWORD_CUSTOMBUILDSTEP:
{
VPC_Read_Config_Keywords( buff );
}
break;
default:
g_pVPC->VPCSyntaxError();
}
}
}
//-----------------------------------------------------------------------------
// Apply a folder-wide configuration to an individual file
//
//-----------------------------------------------------------------------------
void VPC_ApplyFolderConfigurationToFile( const folderConfig_t &folderConfig )
{
char buff[MAX_SYSTOKENCHARS];
g_pVPC->GetScript().PushCurrentScript();
for ( int i = 0; i < folderConfig.vecConfigurationNames.Count(); i++ )
{
g_pVPC->GetScript().RestoreScript( folderConfig.scriptSource );
// Tell the generator we're about to feed it configuration data for this file.
g_pVPC->GetProjectGenerator()->StartConfigurationBlock( folderConfig.vecConfigurationNames[i].String(), true );
while ( 1 )
{
g_pVPC->GetScript().SkipToValidToken();
if ( !g_pVPC->GetScript().ParsePropertyValue( NULL, buff, sizeof( buff ) ) )
{
g_pVPC->GetScript().SkipBracedSection();
continue;
}
if ( !V_stricmp( buff, "}" ) )
{
// end of section
break;
}
configKeyword_e keyword = g_pVPC->NameToKeyword( buff );
switch ( keyword )
{
case KEYWORD_COMPILER:
case KEYWORD_PS3_SNCCOMPILER:
case KEYWORD_PS3_GCCCOMPILER:
case KEYWORD_RESOURCES:
case KEYWORD_CUSTOMBUILDSTEP:
VPC_Config_Keyword( keyword, buff );
break;
default:
g_pVPC->VPCSyntaxError();
}
}
g_pVPC->GetProjectGenerator()->EndConfigurationBlock();
}
g_pVPC->GetScript().PopScript();
}

1133
external/vpc/utils/vpc/dependencies.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

197
external/vpc/utils/vpc/dependencies.h vendored Normal file
View File

@@ -0,0 +1,197 @@
//====== Copyright 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef DEPENDENCIES_H
#define DEPENDENCIES_H
#ifdef _WIN32
#pragma once
#endif
enum EDependencyType
{
k_eDependencyType_SourceFile, // .cpp, .cxx, .h, .hxx
k_eDependencyType_Project, // this is a project file WITHOUT the target-specific extension (.mak, .vpj, .vcproj).
k_eDependencyType_Library, // this is a library file
k_eDependencyType_Unknown // Unrecognized file extension (probably .ico or .rc2 or somesuch).
};
class CProjectDependencyGraph;
enum k_EDependsOnFlags
{
k_EDependsOnFlagCheckNormalDependencies = 0x01,
k_EDependsOnFlagCheckAdditionalDependencies = 0x02,
k_EDependsOnFlagRecurse = 0x04,
k_EDependsOnFlagTraversePastLibs = 0x08
};
// Flags to CProjectDependencyGraph::BuildProjectDependencies.
#define BUILDPROJDEPS_FULL_DEPENDENCY_SET 0x01 // This tells it to build a graph of all projects in the source tree _including_ all games.
#define BUILDPROJDEPS_CHECK_ALL_PROJECTS 0x02 // If this is set, then it reads all .vpc files.
// If this is not set, then it only includes the files from the command line with the "vpc +tier0 *bitmap +client /tf" syntax
class CDependency
{
friend class CProjectDependencyGraph;
friend class CSingleProjectScanner;
public:
CDependency( CProjectDependencyGraph *pDependencyGraph );
virtual ~CDependency();
// Flags are a combination of k_EDependsOnFlags.
bool DependsOn( CDependency *pTest, int flags=k_EDependsOnFlagCheckNormalDependencies | k_EDependsOnFlagRecurse );
const char* GetName() const;
// Returns true if the absolute filename of this thing (CDependency::m_Filename) matches the absolute path specified.
bool CompareAbsoluteFilename( const char *pAbsPath ) const;
private:
bool FindDependency_Internal( CUtlVector<CUtlBuffer> &callTreeOutputStack, CDependency *pTest, int flags, int depth );
void Mark();
bool HasBeenMarked();
public:
CUtlString m_Filename; // Full paths (slashes are platform dependent).
// This is the VPC filename for a project (use CDependency_Project::m_ProjectFilename for the VCPROJ/VPJ filename).
EDependencyType m_Type;
// Files that this guy depends on.
CUtlVector<CDependency*> m_Dependencies;
// Files added by $AdditionalProjectDependencies. This is in a separate list because we don't
// always want DependsOn() to check this.
CUtlVector<CDependency*> m_AdditionalDependencies;
private:
CProjectDependencyGraph *m_pDependencyGraph;
unsigned int m_iDependencyMark;
bool m_bCheckedIncludes; // Set to true when we have checked all the includes for this.
// Cache info.
int64 m_nCacheFileSize;
int64 m_nCacheModificationTime;
// Used by the cache.
bool m_bCacheDirty; // File size or modification time don't match.
};
// This represents a project (.vcproj) file, NOT a project like a projectIndex_t.
// There can be separate .vcproj files (and thus separate CDependency_Project) for each game and platform of a projectIndex_t.
// If m_Type == k_eDependencyType_Project, then you can cast to this.
class CDependency_Project : public CDependency
{
public:
typedef CDependency BaseClass;
CDependency_Project( CProjectDependencyGraph *pDependencyGraph );
// These functions read/write g_pVPC->GetOutputFilename() and such (all the m_xxStoredXXXX vars below).
void StoreProjectParameters( const char *szScriptName );
void ExportProjectParameters();
// Does a case-insensitive string compare against m_ProjectName.
// Returns -1 if not found or the index into projects.
static int FindByProjectName( CUtlVector<CDependency_Project*> &projects, const char *pTestName );
public:
// Include directories for the project.
CUtlVector<CUtlString> m_IncludeDirectories;
// Straight out of the $AdditionalProjectDependencies key (split on semicolons).
CUtlVector<CUtlString> m_AdditionalProjectDependencies;
// Straight out of the $AdditionalOutputFiles key (split on semicolons).
CUtlVector<CUtlString> m_AdditionalOutputFiles;
CUtlString m_ProjectName; // This comes from the $Project key in the .vpc file.
CUtlString m_ProjectFilename; // Absolute path to the VCPROJ file (g_pVPC->GetOutputFilename() - see CDependency::m_Filename for the VPC filename).
CUtlString m_ImportLibrary;
// Note that there can be multiple CDependency_Projects with the same m_iProjectIndex.
projectIndex_t m_iProjectIndex;
// This is used by /p4sln. It uses this to call into VPC_ParseProjectScript. These are the values of g_pVPC->GetOutputFilename(), szScriptName,
// and the defines at the time of building this project.
CUtlString m_StoredOutputFilename;
char m_szStoredScriptName[MAX_PATH];
char m_szStoredCurrentDirectory[MAX_PATH];
CUtlVector<bool> m_StoredConditionalsActive;
};
// This class builds a graph of all dependencies, starting at the projects.
class CProjectDependencyGraph : public IProjectIterator
{
friend class CDependency;
public:
CProjectDependencyGraph();
// This is the main function to generate dependencies.
// nBuildProjectDepsFlags is a combination of BUILDPROJDEPS_ flags.
void BuildProjectDependencies( int nBuildProjectDepsFlags, CUtlVector< CDependency_Project *> *pPhase1Projects = NULL );
bool HasGeneratedDependencies() const;
CDependency* FindDependency( const char *pFilename );
CDependency* FindOrCreateDependency( const char *pFilename );
// Look for all projects (that we've scanned during BuildProjectDependencies) that depend on the specified project.
// If bDownwards is true, then it adds iProject and all projects that _it depends on_.
// If bDownwards is false, then it adds iProject and all projects that _depend on it_.
void GetProjectDependencyTree( projectIndex_t iProject, CUtlVector<projectIndex_t> &dependentProjects, bool bDownwards );
// This solves the central mismatch between the way VPC references projects and the way the CDependency stuff does.
//
// - VPC uses projectIndex_t, but a single projectIndex_t can turn into multiple games (server_tf, server_episodic, etc) in VPC_IterateTargetProjects.
// - The dependency code has a separate CDependency_Project for each game.
//
// This takes a bunch of project indices (usually m_targetProjects, which comes from the command line's "+this -that *theother" syntax),
// which are game-agnostic, and based on what games were specified on the command line, it builds the list of CDependency_Project*s.
void TranslateProjectIndicesToDependencyProjects( CUtlVector<projectIndex_t> &projectList, CUtlVector<CDependency_Project*> &out );
// IProjectIterator overrides.
protected:
virtual bool VisitProject( projectIndex_t iProject, const char *szProjectName );
private:
void ClearAllDependencyMarks();
// Functions for the vpc.cache file management.
bool LoadCache( const char *pFilename );
bool SaveCache( const char *pFilename );
void WriteString( FILE *fp, CUtlString &utlString );
CUtlString ReadString( FILE *fp );
void CheckCacheEntries();
void RemoveDirtyCacheEntries();
void MarkAllCacheEntriesValid();
void ResolveAdditionalProjectDependencies( CUtlVector< CDependency_Project *> *pPhase1Projects = NULL );
public:
// Projects and everything they depend on.
CUtlVector<CDependency_Project*> m_Projects;
CUtlDict<CDependency*,int> m_AllFiles; // All files go in here. They should never be duplicated. These are indexed by the full filename (except .lib files, which have that stripped off).
bool m_bFullDependencySet; // See bFullDepedencySet passed into BuildProjectDependencies.
int m_nFilesParsedForIncludes;
private:
// Used when sweeping the dependency graph to prevent looping around forever.
unsigned int m_iDependencyMark;
bool m_bHasGeneratedDependencies; // Set to true after finishing BuildProjectDependencies.
};
bool IsLibraryFile( const char *pFilename );
bool IsSharedLibraryFile( const char *pFilename );
#endif // DEPENDENCIES_H

View File

@@ -0,0 +1,324 @@
//===== Copyright (c) 1996-2006, Valve Corporation, All rights reserved. ======//
//
// Purpose: ExprSimplifier builds a binary tree from an infix expression (in the
// form of a character array).
//
//===========================================================================//
#include "vpc.h"
static ExprTree mExprTree; // Tree representation of the expression
static char mCurToken; // Current token read from the input expression
static const char *mExpression; // Array of the expression characters
static int mCurPosition; // Current position in the input expression
static char mIdentifier[MAX_IDENTIFIER_LEN]; // Stores the identifier string
static GetSymbolProc_t g_pGetSymbolProc;
//-----------------------------------------------------------------------------
// Sets mCurToken to the next token in the input string. Skips all whitespace.
//-----------------------------------------------------------------------------
static char GetNextToken( void )
{
// while whitespace, Increment CurrentPosition
while( mExpression[mCurPosition] == ' ' )
++mCurPosition;
// CurrentToken = Expression[CurrentPosition]
mCurToken = mExpression[mCurPosition++];
return mCurToken;
}
//-----------------------------------------------------------------------------
// Utility funcs
//-----------------------------------------------------------------------------
static void FreeNode( ExprNode *node )
{
delete node;
}
static ExprNode *AllocateNode( void )
{
return new ExprNode;
}
static void FreeTree( ExprTree& node )
{
if(!node)
return;
FreeTree(node->left);
FreeTree(node->right);
FreeNode(node);
node = 0;
}
static bool IsConditional( const char token )
{
char nextchar = ' ';
if ( token == OR_OP || token == AND_OP )
{
nextchar = mExpression[mCurPosition++];
if ( (token & nextchar) == token )
{
return true;
}
else
g_pVPC->VPCSyntaxError( "Bad expression token: %c %c", token, nextchar );
}
return false;
}
static bool IsNotOp( const char token )
{
if ( token == NOT_OP )
return true;
else
return false;
}
static bool IsIdentifierOrConstant( const char token )
{
bool success = false;
if ( token == '$' )
{
// store the entire identifier
int i = 0;
mIdentifier[i++] = token;
while( (isalnum( mExpression[mCurPosition] ) || mExpression[mCurPosition] == '_') && i < MAX_IDENTIFIER_LEN )
{
mIdentifier[i] = mExpression[mCurPosition];
++mCurPosition;
++i;
}
if ( i < MAX_IDENTIFIER_LEN - 1 )
{
mIdentifier[i] = '\0';
success = true;
}
}
else
{
if ( isdigit( token ) )
{
int i = 0;
mIdentifier[i++] = token;
while( isdigit( mExpression[mCurPosition] ) && ( i < MAX_IDENTIFIER_LEN ) )
{
mIdentifier[i] = mExpression[mCurPosition];
++mCurPosition;
++i;
}
if ( i < MAX_IDENTIFIER_LEN - 1 )
{
mIdentifier[i] = '\0';
success = true;
}
}
}
return success;
}
static void MakeExprNode( ExprTree &tree, char token, Kind kind, ExprTree left, ExprTree right )
{
tree = AllocateNode();
tree->left = left;
tree->right = right;
tree->kind = kind;
switch ( kind )
{
case CONDITIONAL:
tree->data.cond = token;
break;
case LITERAL:
if ( isdigit( mIdentifier[0] ) )
{
tree->data.value = atoi( mIdentifier ) != 0;
}
else
{
tree->data.value = g_pGetSymbolProc( mIdentifier );
}
break;
case NOT:
break;
default:
g_pVPC->VPCError( "Error in ExpTree" );
}
}
static void MakeExpression( ExprTree& tree );
//-----------------------------------------------------------------------------
// Makes a factor :: { <expression> } | <identifier>.
//-----------------------------------------------------------------------------
static void MakeFactor( ExprTree& tree )
{
if ( mCurToken == '(' )
{
// Get the next token
GetNextToken();
// Make an expression, setting Tree to point to it
MakeExpression( tree );
}
else if ( IsIdentifierOrConstant( mCurToken ) )
{
// Make a literal node, set Tree to point to it, set left/right children to NULL.
MakeExprNode( tree, mCurToken, LITERAL, NULL, NULL );
}
else if ( IsNotOp( mCurToken ) )
{
// do nothing
return;
}
else
{
// This must be a bad token
g_pVPC->VPCSyntaxError( "Bad expression token: %c", mCurToken );
}
// Get the next token
GetNextToken();
}
//-----------------------------------------------------------------------------
// Makes a term :: <factor> { <not> }.
//-----------------------------------------------------------------------------
static void MakeTerm( ExprTree& tree )
{
// Make a factor, setting Tree to point to it
MakeFactor( tree );
// while the next token is !
while( IsNotOp( mCurToken ) )
{
// Make an operator node, setting left child to Tree and right to NULL. (Tree points to new node)
MakeExprNode( tree, mCurToken, NOT, tree, NULL );
// Get the next token.
GetNextToken();
// Make a factor, setting the right child of Tree to point to it.
MakeFactor(tree->right);
}
}
//-----------------------------------------------------------------------------
// Makes a complete expression :: <term> { <cond> <term> }.
//-----------------------------------------------------------------------------
static void MakeExpression( ExprTree& tree )
{
// Make a term, setting Tree to point to it
MakeTerm( tree );
// while the next token is a conditional
while ( IsConditional( mCurToken ) )
{
// Make a conditional node, setting left child to Tree and right to NULL. (Tree points to new node)
MakeExprNode( tree, mCurToken, CONDITIONAL, tree, NULL );
// Get the next token.
GetNextToken();
// Make a term, setting the right child of Tree to point to it.
MakeTerm( tree->right );
}
}
//-----------------------------------------------------------------------------
// returns true for success, false for failure
//-----------------------------------------------------------------------------
static bool BuildExpression( void )
{
// Get the first token, and build the tree.
GetNextToken();
MakeExpression( mExprTree );
return true;
}
//-----------------------------------------------------------------------------
// returns the value of the node after resolving all children
//-----------------------------------------------------------------------------
static bool SimplifyNode( ExprTree& node )
{
if( !node )
return false;
// Simplify the left and right children of this node
bool leftVal = SimplifyNode(node->left);
bool rightVal = SimplifyNode(node->right);
// Simplify this node
switch( node->kind )
{
case NOT:
// the child of '!' is always to the right
node->data.value = !rightVal;
break;
case CONDITIONAL:
if ( node->data.cond == AND_OP )
{
node->data.value = leftVal && rightVal;
}
else // OR_OP
{
node->data.value = leftVal || rightVal;
}
break;
default: // LITERAL
break;
}
// This node has beed resolved
node->kind = LITERAL;
return node->data.value;
}
//-----------------------------------------------------------------------------
// Interface to solve a conditional expression. Returns false on failure.
//-----------------------------------------------------------------------------
bool EvaluateExpression( bool &result, const char *InfixExpression, GetSymbolProc_t pGetSymbolProc )
{
if ( !InfixExpression )
return false;
g_pGetSymbolProc = pGetSymbolProc;
bool success = false;
mExpression = InfixExpression;
mExprTree = 0;
mCurPosition = 0;
// Building the expression tree will fail on bad syntax
if ( BuildExpression() )
{
success = true;
result = SimplifyNode( mExprTree );
}
FreeTree( mExprTree );
return success;
}

View File

@@ -0,0 +1,353 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
//
//=====================================================================================//
#include "vpc.h"
CGeneratorDefinition::CGeneratorDefinition()
{
Clear();
}
void CGeneratorDefinition::Clear()
{
m_pPropertyNames = NULL;
m_ScriptName.Clear();
m_NameString.Clear();
m_VersionString.Clear();
m_Tools.Purge();
m_ScriptCRC = 0;
}
void CGeneratorDefinition::IterateAttributesKey( ToolProperty_t *pProperty, KeyValues *pAttributesKV )
{
const char *pAttributeName = pAttributesKV->GetName();
const char *pValue = pAttributesKV->GetString( "" );
//Msg( "Attribute name: %s\n", pAttributeName );
if ( !V_stricmp( pAttributeName, "type" ) )
{
if ( !V_stricmp( pValue, "bool" ) || !V_stricmp( pValue, "boolean" ) )
{
pProperty->m_nType = PT_BOOLEAN;
}
else if ( !V_stricmp( pValue, "string" ) )
{
pProperty->m_nType = PT_STRING;
}
else if ( !V_stricmp( pValue, "list" ) )
{
pProperty->m_nType = PT_LIST;
}
else if ( !V_stricmp( pValue, "int" ) || !V_stricmp( pValue, "integer" ) )
{
pProperty->m_nType = PT_INTEGER;
}
else if ( !V_stricmp( pValue, "ignore" ) || !V_stricmp( pValue, "none" ) )
{
pProperty->m_nType = PT_IGNORE;
}
else if ( !V_stricmp( pValue, "deprecated" ) || !V_stricmp( pValue, "donotuse" ) )
{
pProperty->m_nType = PT_DEPRECATED;
}
else
{
// unknown
g_pVPC->VPCError( "Unknown type '%s' in '%s'", pValue, pProperty->m_ParseString.Get() );
}
}
else if ( !V_stricmp( pAttributeName, "alias" ) )
{
pProperty->m_AliasString = pValue;
}
else if ( !V_stricmp( pAttributeName, "legacy" ) )
{
pProperty->m_LegacyString = pValue;
}
else if ( !V_stricmp( pAttributeName, "InvertOutput" ) )
{
pProperty->m_bInvertOutput = pAttributesKV->GetBool();
}
else if ( !V_stricmp( pAttributeName, "output" ) )
{
pProperty->m_OutputString = pValue;
}
else if ( !V_stricmp( pAttributeName, "fixslashes" ) )
{
pProperty->m_bFixSlashes = pAttributesKV->GetBool();
}
else if ( !V_stricmp( pAttributeName, "PreferSemicolonNoComma" ) )
{
pProperty->m_bPreferSemicolonNoComma = pAttributesKV->GetBool();
}
else if ( !V_stricmp( pAttributeName, "PreferSemicolonNoSpace" ) )
{
pProperty->m_bPreferSemicolonNoSpace = pAttributesKV->GetBool();
}
else if ( !V_stricmp( pAttributeName, "AppendSlash" ) )
{
pProperty->m_bAppendSlash = pAttributesKV->GetBool();
}
else if ( !V_stricmp( pAttributeName, "GlobalProperty" ) )
{
pProperty->m_bEmitAsGlobalProperty = pAttributesKV->GetBool();
}
else if ( !V_stricmp( pAttributeName, "ordinals" ) )
{
if ( pProperty->m_nType == PT_UNKNOWN )
{
pProperty->m_nType = PT_LIST;
}
for ( KeyValues *pKV = pAttributesKV->GetFirstSubKey(); pKV; pKV = pKV->GetNextKey() )
{
const char *pOrdinalName = pKV->GetName();
const char *pOrdinalValue = pKV->GetString();
if ( !pOrdinalValue[0] )
{
g_pVPC->VPCError( "Unknown ordinal value for name '%s' in '%s'", pOrdinalName, pProperty->m_ParseString.Get() );
}
int iIndex = pProperty->m_Ordinals.AddToTail();
pProperty->m_Ordinals[iIndex].m_ParseString = pOrdinalName;
pProperty->m_Ordinals[iIndex].m_ValueString = pOrdinalValue;
}
}
else
{
g_pVPC->VPCError( "Unknown attribute '%s' in '%s'", pAttributeName, pProperty->m_ParseString.Get() );
}
}
void CGeneratorDefinition::IteratePropertyKey( GeneratorTool_t *pTool, KeyValues *pPropertyKV )
{
//Msg( "Property Key name: %s\n", pPropertyKV->GetName() );
int iIndex = pTool->m_Properties.AddToTail();
ToolProperty_t *pProperty = &pTool->m_Properties[iIndex];
pProperty->m_ParseString = pPropertyKV->GetName();
KeyValues *pKV = pPropertyKV->GetFirstSubKey();
if ( !pKV )
return;
for ( ;pKV; pKV = pKV->GetNextKey() )
{
IterateAttributesKey( pProperty, pKV );
}
}
void CGeneratorDefinition::IterateToolKey( KeyValues *pToolKV )
{
//Msg( "Tool Key name: %s\n", pToolKV->GetName() );
// find or create
GeneratorTool_t *pTool = NULL;
for ( int i = 0; i < m_Tools.Count(); i++ )
{
if ( !V_stricmp( pToolKV->GetName(), m_Tools[i].m_ParseString ) )
{
pTool = &m_Tools[i];
break;
}
}
if ( !pTool )
{
int iIndex = m_Tools.AddToTail();
pTool = &m_Tools[iIndex];
}
pTool->m_ParseString = pToolKV->GetName();
KeyValues *pKV = pToolKV->GetFirstSubKey();
if ( !pKV )
return;
for ( ;pKV; pKV = pKV->GetNextKey() )
{
IteratePropertyKey( pTool, pKV );
}
}
void CGeneratorDefinition::AssignIdentifiers()
{
CUtlVector< bool > usedPropertyNames;
int nTotalPropertyNames = 0;
while ( m_pPropertyNames[nTotalPropertyNames].m_nPropertyId >= 0 )
{
nTotalPropertyNames++;
}
usedPropertyNames.SetCount( nTotalPropertyNames );
// assign property identifiers
for ( int i = 0; i < m_Tools.Count(); i++ )
{
GeneratorTool_t *pTool = &m_Tools[i];
// assign the tool keyword
configKeyword_e keyword = g_pVPC->NameToKeyword( pTool->m_ParseString.Get() );
if ( keyword == KEYWORD_UNKNOWN )
{
g_pVPC->VPCError( "Unknown Tool Keyword '%s' in '%s'", pTool->m_ParseString.Get(), m_ScriptName.Get() );
}
pTool->m_nKeyword = keyword;
const char *pPrefix = m_NameString.Get();
const char *pToolName = pTool->m_ParseString.Get();
if ( pToolName[0] == '$' )
{
pToolName++;
}
for ( int j = 0; j < pTool->m_Properties.Count(); j++ )
{
ToolProperty_t *pProperty = &pTool->m_Properties[j];
if ( pProperty->m_nType == PT_IGNORE || pProperty->m_nType == PT_DEPRECATED )
{
continue;
}
const char *pPropertyName = pProperty->m_AliasString.Get();
if ( !pPropertyName[0] )
{
pPropertyName = pProperty->m_ParseString.Get();
}
if ( pPropertyName[0] == '$' )
{
pPropertyName++;
}
CUtlString prefixString = CFmtStr( "%s_%s", pPrefix, pToolName );
bool bFound = false;
for ( int k = 0; k < nTotalPropertyNames && !bFound; k++ )
{
if ( !V_stricmp( prefixString.Get(), m_pPropertyNames[k].m_pPrefixName ) )
{
if ( !V_stricmp( pPropertyName, m_pPropertyNames[k].m_pPropertyName ) )
{
pProperty->m_nPropertyId = m_pPropertyNames[k].m_nPropertyId;
bFound = true;
usedPropertyNames[k] = true;
}
}
}
if ( !bFound )
{
g_pVPC->VPCError( "Could not find PROPERTYNAME( %s, %s ) for %s", prefixString.Get(), pPropertyName, m_ScriptName.Get() );
}
}
}
if ( g_pVPC->IsVerbose() )
{
for ( int i = 0; i < usedPropertyNames.Count(); i++ )
{
if ( !usedPropertyNames[i] )
{
g_pVPC->VPCWarning( "Unused PROPERTYNAME( %s, %s ) in %s", m_pPropertyNames[i].m_pPrefixName, m_pPropertyNames[i].m_pPropertyName, m_ScriptName.Get() );
}
}
}
}
void CGeneratorDefinition::LoadDefinition( const char *pDefnitionName, PropertyName_t *pPropertyNames )
{
Clear();
m_pPropertyNames = pPropertyNames;
g_pVPC->GetScript().PushScript( CFmtStr( "vpc_scripts\\definitions\\%s", pDefnitionName ) );
// project definitions are KV format
KeyValues *pScriptKV = new KeyValues( g_pVPC->GetScript().GetName() );
pScriptKV->LoadFromBuffer( g_pVPC->GetScript().GetName(), g_pVPC->GetScript().GetData() );
m_ScriptName = g_pVPC->GetScript().GetName();
m_ScriptCRC = CRC32_ProcessSingleBuffer( g_pVPC->GetScript().GetData(), strlen( g_pVPC->GetScript().GetData() ) );
m_NameString = pScriptKV->GetName();
KeyValues *pKV = pScriptKV->GetFirstSubKey();
for ( ;pKV; pKV = pKV->GetNextKey() )
{
const char *pKeyName = pKV->GetName();
if ( !V_stricmp( pKeyName, "version" ) )
{
m_VersionString = pKV->GetString();
}
else
{
IterateToolKey( pKV );
}
}
g_pVPC->GetScript().PopScript();
pScriptKV->deleteThis();
g_pVPC->VPCStatus( false, "Definition: '%s' Version: %s", m_NameString.Get(), m_VersionString.Get() );
AssignIdentifiers();
}
const char *CGeneratorDefinition::GetScriptName( CRC32_t *pCRC )
{
if ( pCRC )
{
*pCRC = m_ScriptCRC;
}
return m_ScriptName.Get();
}
ToolProperty_t *CGeneratorDefinition::GetProperty( configKeyword_e keyword, const char *pPropertyName )
{
for ( int i = 0; i < m_Tools.Count(); i++ )
{
GeneratorTool_t *pTool = &m_Tools[i];
if ( pTool->m_nKeyword != keyword )
continue;
for ( int j = 0; j < pTool->m_Properties.Count(); j++ )
{
ToolProperty_t *pToolProperty = &pTool->m_Properties[j];
if ( !V_stricmp( pToolProperty->m_ParseString.Get(), pPropertyName ) )
{
// found
return pToolProperty;
}
if ( !pToolProperty->m_LegacyString.IsEmpty() && !V_stricmp( pToolProperty->m_LegacyString.Get(), pPropertyName ) )
{
// found
return pToolProperty;
}
}
}
// not found
return NULL;
}

View File

@@ -0,0 +1,130 @@
//===================== Copyright (c) Valve Corporation. All Rights Reserved. ======================
//
//
//==================================================================================================
#ifndef GENERATORDEFINITION_H
#define GENERATORDEFINITION_H
#ifdef _WIN32
#pragma once
#endif
struct PropertyName_t
{
int m_nPropertyId;
const char *m_pPrefixName;
const char *m_pPropertyName;
};
enum configKeyword_e
{
KEYWORD_UNKNOWN = -1,
KEYWORD_GENERAL,
KEYWORD_DEBUGGING,
KEYWORD_COMPILER,
KEYWORD_PS3_SNCCOMPILER,
KEYWORD_PS3_GCCCOMPILER,
KEYWORD_LIBRARIAN,
KEYWORD_LINKER,
KEYWORD_PS3_SNCLINKER,
KEYWORD_PS3_GCCLINKER,
KEYWORD_MANIFEST,
KEYWORD_XMLDOCGEN,
KEYWORD_BROWSEINFO,
KEYWORD_RESOURCES,
KEYWORD_PREBUILDEVENT,
KEYWORD_PRELINKEVENT,
KEYWORD_POSTBUILDEVENT,
KEYWORD_CUSTOMBUILDSTEP,
KEYWORD_XBOXIMAGE,
KEYWORD_XBOXDEPLOYMENT,
KEYWORD_MAX,
};
enum PropertyType_e
{
PT_UNKNOWN = 0,
PT_BOOLEAN,
PT_STRING,
PT_INTEGER,
PT_LIST,
PT_IGNORE,
PT_DEPRECATED,
};
struct PropertyOrdinal_t
{
CUtlString m_ParseString;
CUtlString m_ValueString;
};
struct ToolProperty_t
{
ToolProperty_t()
{
m_nPropertyId = -1;
m_nType = PT_UNKNOWN;
m_bFixSlashes = false;
m_bEmitAsGlobalProperty = false;
m_bInvertOutput = false;
m_bAppendSlash = false;
m_bPreferSemicolonNoComma = false;
m_bPreferSemicolonNoSpace = false;
}
CUtlString m_ParseString;
CUtlString m_AliasString;
CUtlString m_LegacyString;
CUtlString m_OutputString;
CUtlVector< PropertyOrdinal_t > m_Ordinals;
int m_nPropertyId;
PropertyType_e m_nType;
bool m_bFixSlashes;
bool m_bEmitAsGlobalProperty;
bool m_bInvertOutput;
bool m_bAppendSlash;
bool m_bPreferSemicolonNoComma;
bool m_bPreferSemicolonNoSpace;
};
struct GeneratorTool_t
{
GeneratorTool_t()
{
m_nKeyword = KEYWORD_UNKNOWN;
}
CUtlString m_ParseString;
CUtlVector< ToolProperty_t > m_Properties;
configKeyword_e m_nKeyword;
};
class CGeneratorDefinition
{
public:
CGeneratorDefinition();
void LoadDefinition( const char *pDefinitionName, PropertyName_t *pPropertyNames );
ToolProperty_t *GetProperty( configKeyword_e keyword, const char *pPropertyName );
const char *GetScriptName( CRC32_t *pCRC );
private:
void AssignIdentifiers();
void IterateToolKey( KeyValues *pToolKV );
void IteratePropertyKey( GeneratorTool_t *pTool, KeyValues *pPropertyKV );
void IterateAttributesKey( ToolProperty_t *pProperty, KeyValues *pAttributesKV );
void Clear();
PropertyName_t *m_pPropertyNames;
CUtlString m_ScriptName;
CUtlString m_NameString;
CUtlString m_VersionString;
CUtlVector< GeneratorTool_t > m_Tools;
CRC32_t m_ScriptCRC;
};
#endif // GENERATORDEFINITION_H

369
external/vpc/utils/vpc/groupscript.cpp vendored Normal file
View File

@@ -0,0 +1,369 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
// This keyword works in both group and project scripts
extern void VPC_SharedKeyword_Conditional();
//-----------------------------------------------------------------------------
// VPC_Group_FindOrCreateProject
//
//-----------------------------------------------------------------------------
projectIndex_t VPC_Group_FindOrCreateProject( const char *pName, bool bCreate )
{
for ( int i = 0; i < g_pVPC->m_Projects.Count(); i++ )
{
if ( !V_stricmp( pName, g_pVPC->m_Projects[i].name.String() ) )
{
return i;
}
}
if ( !bCreate )
return INVALID_INDEX;
int index = g_pVPC->m_Projects.AddToTail();
g_pVPC->m_Projects[index].name = pName;
return index;
}
//-----------------------------------------------------------------------------
// VPC_Group_CreateGroup
//
//-----------------------------------------------------------------------------
groupIndex_t VPC_Group_CreateGroup()
{
groupIndex_t index = g_pVPC->m_Groups.AddToTail();
return index;
}
//-----------------------------------------------------------------------------
// VPC_Group_FindOrCreateGroupTag
//
//-----------------------------------------------------------------------------
groupTagIndex_t VPC_Group_FindOrCreateGroupTag( const char *pName, bool bCreate )
{
for (int i=0; i<g_pVPC->m_GroupTags.Count(); i++)
{
if ( !V_stricmp( pName, g_pVPC->m_GroupTags[i].name.String() ) )
return i;
}
if ( !bCreate )
return INVALID_INDEX;
groupTagIndex_t index = g_pVPC->m_GroupTags.AddToTail();
g_pVPC->m_GroupTags[index].name = pName;
return index;
}
//-----------------------------------------------------------------------------
// VPC_GroupKeyword_Games
//
//-----------------------------------------------------------------------------
void VPC_GroupKeyword_Games()
{
const char *pToken;
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] || V_stricmp( pToken, "{" ) )
g_pVPC->VPCSyntaxError();
while ( 1 )
{
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] )
g_pVPC->VPCSyntaxError();
if ( !V_stricmp( pToken, "}" ) )
{
// end of section
break;
}
else
{
g_pVPC->FindOrCreateConditional( pToken, true, CONDITIONAL_GAME );
}
}
}
//-----------------------------------------------------------------------------
// VPC_GroupKeyword_Group
//
//-----------------------------------------------------------------------------
void VPC_GroupKeyword_Group()
{
const char *pToken;
bool bFirstToken = true;
groupIndex_t groupIndex;
projectIndex_t projectIndex;
groupIndex = VPC_Group_CreateGroup();
while ( 1 )
{
if ( !bFirstToken )
{
pToken = g_pVPC->GetScript().PeekNextToken( false );
if ( !pToken || !pToken[0] )
break;
}
else
{
bFirstToken = false;
}
pToken = g_pVPC->GetScript().GetToken( false );
if ( !pToken || !pToken[0] )
g_pVPC->VPCSyntaxError();
// specified tag now builds this group
groupTagIndex_t groupTagIndex = VPC_Group_FindOrCreateGroupTag( pToken, true );
g_pVPC->m_GroupTags[groupTagIndex].groups.AddToTail( groupIndex );
}
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] || V_stricmp( pToken, "{" ) )
g_pVPC->VPCSyntaxError();
while ( 1 )
{
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] )
g_pVPC->VPCSyntaxError();
if ( !V_stricmp( pToken, "}" ) )
{
// end of section
break;
}
else
{
projectIndex = VPC_Group_FindOrCreateProject( pToken, false );
if ( projectIndex != INVALID_INDEX )
{
int index = g_pVPC->m_Groups[groupIndex].projects.AddToTail();
g_pVPC->m_Groups[groupIndex].projects[index] = projectIndex;
}
else
{
g_pVPC->VPCWarning( "No Project %s defined, ignoring.", pToken );
continue;
}
}
}
}
//-----------------------------------------------------------------------------
// VPC_GroupKeyword_Project
//
//-----------------------------------------------------------------------------
void VPC_GroupKeyword_Project()
{
const char *pToken;
pToken = g_pVPC->GetScript().GetToken( false );
if ( !pToken || !pToken[0] )
g_pVPC->VPCSyntaxError();
if ( VPC_Group_FindOrCreateProject( pToken, false ) != INVALID_INDEX )
{
// already defined
g_pVPC->VPCWarning( "project %s already defined", pToken );
g_pVPC->VPCSyntaxError();
}
projectIndex_t projectIndex = VPC_Group_FindOrCreateProject( pToken, true );
// create a default group that contains just this project
groupIndex_t groupIndex = VPC_Group_CreateGroup();
g_pVPC->m_Groups[groupIndex].projects.AddToTail( projectIndex );
// create a default tag that matches the project name
groupTagIndex_t groupTagIndex = VPC_Group_FindOrCreateGroupTag( pToken, true );
g_pVPC->m_GroupTags[groupTagIndex].groups.AddToTail( groupIndex );
g_pVPC->m_GroupTags[groupTagIndex].bSameAsProject = true;
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] || V_stricmp( pToken, "{" ) )
g_pVPC->VPCSyntaxError();
while ( 1 )
{
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] )
g_pVPC->VPCSyntaxError();
if ( !V_stricmp( pToken, "}" ) )
{
// end of section
break;
}
else
{
scriptIndex_t scriptIndex = g_pVPC->m_Projects[projectIndex].scripts.AddToTail();
g_pVPC->m_Projects[projectIndex].scripts[scriptIndex].name = pToken;
pToken = g_pVPC->GetScript().PeekNextToken( false );
if ( pToken && pToken[0] )
{
pToken = g_pVPC->GetScript().GetToken( false );
g_pVPC->m_Projects[projectIndex].scripts[scriptIndex].m_condition = pToken;
}
}
}
}
//-----------------------------------------------------------------------------
// VPC_ParseGroupScript
//
//-----------------------------------------------------------------------------
void VPC_ParseGroupScript( const char *pScriptName )
{
char szScriptName[MAX_PATH];
const char *pToken;
// caller's pointer is aliased
strcpy( szScriptName, pScriptName );
V_FixSlashes( szScriptName );
g_pVPC->VPCStatus( false, "Parsing: %s", szScriptName );
g_pVPC->GetScript().PushScript( szScriptName );
while ( 1 )
{
pToken = g_pVPC->GetScript().GetToken( true );
if ( !pToken || !pToken[0] )
{
// end of file
break;
}
if ( !V_stricmp( pToken, "$include" ) )
{
pToken = g_pVPC->GetScript().GetToken( false );
if ( !pToken || !pToken[0] )
{
// end of file
g_pVPC->VPCSyntaxError();
}
// recurse into and run
VPC_ParseGroupScript( pToken );
}
else if ( !V_stricmp( pToken, "$games" ) )
{
VPC_GroupKeyword_Games();
}
else if ( !V_stricmp( pToken, "$group" ) )
{
VPC_GroupKeyword_Group();
}
else if ( !V_stricmp( pToken, "$project" ) )
{
VPC_GroupKeyword_Project();
}
else if ( !V_stricmp( pToken, "$Conditional" ) )
{
VPC_SharedKeyword_Conditional();
}
else
{
g_pVPC->VPCSyntaxError();
}
}
g_pVPC->GetScript().PopScript();
}
//-----------------------------------------------------------------------------
// Collect all the +XXX, remove all the -XXX
// This allows removal to be the expected trumping operation.
//-----------------------------------------------------------------------------
void CVPC::GenerateBuildSet( CProjectDependencyGraph &dependencyGraph )
{
// process +XXX commands
for ( int i = 0; i < m_BuildCommands.Count(); i++ )
{
const char *pCommand = m_BuildCommands[i].Get();
if ( pCommand[0] == '-' )
continue;
groupTagIndex_t groupTagIndex = VPC_Group_FindOrCreateGroupTag( pCommand+1, false );
if ( groupTagIndex == INVALID_INDEX )
continue;
groupTag_t *pGroupTag = &g_pVPC->m_GroupTags[groupTagIndex];
CUtlVector<projectIndex_t> projectsToAdd;
for ( int j=0; j<pGroupTag->groups.Count(); j++ )
{
group_t *pGroup = &g_pVPC->m_Groups[pGroupTag->groups[j]];
for ( int k=0; k<pGroup->projects.Count(); k++ )
{
projectIndex_t targetProject = pGroup->projects[k];
if ( pCommand[0] == '*' )
{
// Add this project and any projects that depend on it.
if ( !dependencyGraph.HasGeneratedDependencies() )
dependencyGraph.BuildProjectDependencies( BUILDPROJDEPS_CHECK_ALL_PROJECTS, m_pPhase1Projects );
dependencyGraph.GetProjectDependencyTree( targetProject, projectsToAdd, false );
}
else if ( pCommand[0] == '@' )
{
// Add this project and any projects that it depends on.
if ( !dependencyGraph.HasGeneratedDependencies() )
dependencyGraph.BuildProjectDependencies( BUILDPROJDEPS_CHECK_ALL_PROJECTS, m_pPhase1Projects );
dependencyGraph.GetProjectDependencyTree( targetProject, projectsToAdd, true );
}
else
{
projectsToAdd.AddToTail( targetProject );
}
}
}
// Add all the projects in the list.
for ( int j=0; j < projectsToAdd.Count(); j++ )
{
projectIndex_t targetProject = projectsToAdd[j];
if ( g_pVPC->m_TargetProjects.Find( targetProject ) == -1 )
{
g_pVPC->m_TargetProjects.AddToTail( targetProject );
}
}
}
// process -XXX commands, explicitly remove tagge projects
for ( int i=0; i<m_BuildCommands.Count(); i++ )
{
const char *pCommand = m_BuildCommands[i].Get();
if ( pCommand[0] == '+' || pCommand[0] == '*' || pCommand[0] == '@' )
continue;
groupTagIndex_t groupTagIndex = VPC_Group_FindOrCreateGroupTag( pCommand+1, false );
if ( groupTagIndex == INVALID_INDEX )
continue;
groupTag_t *pGroupTag = &g_pVPC->m_GroupTags[groupTagIndex];
for ( int j=0; j<pGroupTag->groups.Count(); j++ )
{
group_t *pGroup = &g_pVPC->m_Groups[pGroupTag->groups[j]];
for ( int k=0; k<pGroup->projects.Count(); k++ )
{
g_pVPC->m_TargetProjects.FindAndRemove( pGroup->projects[k] );
}
}
}
}

View File

@@ -0,0 +1,75 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef IBASEPROJECTGENERATOR_H
#define IBASEPROJECTGENERATOR_H
#ifdef _WIN32
#pragma once
#endif
//
// Usage:
//
// StartProject
// StartConfigurationBlock
// StartPropertySection
// HandleProperty...
// EndPropertySection
// EndConfigurationBlock
//
// AddFile...
// [inside each file it can do another configuration block as above]
// [also, files can be put in folders with StartFolder/AddFolder]
// EndProject
//
class IBaseProjectGenerator
{
public:
// What file extension does this use? (vcproj, mak, vpj).
virtual const char* GetProjectFileExtension() = 0;
// Called before doing anything in a project (in g_pVPC->GetOutputFilename()).
virtual void StartProject() = 0;
virtual void EndProject() = 0;
// Access the project name.
virtual CUtlString GetProjectName() = 0;
virtual void SetProjectName( const char *pProjectName ) = 0;
// Get a list of all configurations.
virtual void GetAllConfigurationNames( CUtlVector< CUtlString > &configurationNames ) = 0;
// Configuration data is specified in between these calls and inside BeginPropertySection/EndPropertySection.
// If bFileSpecific is set, then the configuration data only applies to the last file added.
virtual void StartConfigurationBlock( const char *pConfigName, bool bFileSpecific ) = 0;
virtual void EndConfigurationBlock() = 0;
// These functions are called when it enters a section like $Compiler, $Linker, etc.
// In between the BeginPropertySection/EndPropertySection, it'll call HandleProperty for any properties inside that section.
virtual bool StartPropertySection( configKeyword_e keyword, bool *pbShouldSkip = NULL ) = 0;
virtual void HandleProperty( const char *pProperty, const char *pCustomScriptData=NULL ) = 0;
virtual void EndPropertySection( configKeyword_e keyword ) = 0;
// Files go in folders. The generator should maintain a stack of folders as they're added.
virtual void StartFolder( const char *pFolderName ) = 0;
virtual void EndFolder() = 0;
// Add files. Any config blocks/properties between StartFile/EndFile apply to this file only.
// It will only ever have one active file.
virtual bool StartFile( const char *pFilename, bool bWarnIfAlreadyExists ) = 0;
virtual void EndFile() = 0;
// This is actually just per-file configuration data.
virtual void FileExcludedFromBuild( bool bExcluded ) = 0;
virtual void FileIsSchema( bool bIsSchema ) = 0; // Mark the current file as schema.
virtual void FileIsDynamic( bool bIsDynamic ) = 0; // Mark the current file as dynamic.
// Remove the specified file. return true if success
virtual bool RemoveFile( const char *pFilename ) = 0;
};
#endif // IBASEPROJECTGENERATOR_H

View File

@@ -0,0 +1,24 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef IBASESOLUTIONGENERATOR_H
#define IBASESOLUTIONGENERATOR_H
#ifdef _WIN32
#pragma once
#endif
#include "dependencies.h"
class IBaseSolutionGenerator
{
public:
virtual void GenerateSolutionFile( const char *pSolutionFilename, CUtlVector<CDependency_Project*> &projects ) = 0;
};
#endif // IBASESOLUTIONGENERATOR_H

167
external/vpc/utils/vpc/macros.cpp vendored Normal file
View File

@@ -0,0 +1,167 @@
//========= Copyright 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
void CVPC::SetMacro( const char *pName, const char *pValue, bool bSetupDefineInProjectFile )
{
// Setup the macro.
VPCStatus( false, "Set Macro: $%s = %s", pName, pValue );
macro_t *pMacro = FindOrCreateMacro( pName, true, pValue );
pMacro->m_bSetupDefineInProjectFile = bSetupDefineInProjectFile;
pMacro->m_bInternalCreatedMacro = true;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
macro_t *CVPC::FindOrCreateMacro( const char *pName, bool bCreate, const char *pValue )
{
for ( int i = 0; i < m_Macros.Count(); i++ )
{
if ( !V_stricmp( pName, m_Macros[i].name.String() ) )
{
if ( pValue && V_stricmp( pValue, m_Macros[i].value.String() ) )
{
// update
m_Macros[i].value = pValue;
}
return &m_Macros[i];
}
}
if ( !bCreate )
{
return NULL;
}
int index = m_Macros.AddToTail();
m_Macros[index].name = pName;
m_Macros[index].value = pValue;
return &m_Macros[index];
}
int CVPC::GetMacrosMarkedForCompilerDefines( CUtlVector< macro_t* > &macroDefines )
{
macroDefines.Purge();
for ( int i = 0; i < m_Macros.Count(); i++ )
{
if ( m_Macros[i].m_bSetupDefineInProjectFile )
{
macroDefines.AddToTail( &m_Macros[i] );
}
}
return macroDefines.Count();
}
static int __cdecl SortMacrosByNameLength( const macro_t *lhs, const macro_t *rhs )
{
if ( lhs->name.Length() < rhs->name.Length() )
return 1;
if ( lhs->name.Length() > rhs->name.Length() )
return -1;
return 0;
}
void CVPC::ResolveMacrosInStringInternal( char const *pString, char *pOutBuff, int outBuffSize, bool bStringIsConditional )
{
char macroName[MAX_SYSTOKENCHARS];
char buffer1[MAX_SYSTOKENCHARS];
char buffer2[MAX_SYSTOKENCHARS];
int i;
// ensure a "greedy" match by sorting longest to shortest
m_Macros.Sort( SortMacrosByNameLength );
// iterate and resolve user macros until all macros resolved
strcpy( buffer1, pString );
bool bDone;
do
{
bDone = true;
bool bDoReplace = true;
for ( i=0; i<m_Macros.Count(); i++ )
{
sprintf( macroName, "$%s", m_Macros[i].name.String() );
const char *pFound = V_stristr( buffer1, macroName );
if ( pFound && bStringIsConditional )
{
// if expanding a conditional, give conditionals priority over macros
// i.e. if the string we've found begins both a macro and conditional,
// don't expand the macro
for ( int j = 0; j < m_Conditionals.Count(); j++ )
{
if ( V_stristr( pFound+1, m_Conditionals[j].name.String() ) == pFound+1 )
{
bDoReplace = false;
// the warning is super chatty about $LINUX and $POSIX
if ( V_stricmp( macroName, "$LINUX" ) && V_stricmp( macroName, "$POSIX" ) )
g_pVPC->VPCWarning( "Not replacing macro %s with its value (%s) in conditional %s\n", macroName, m_Macros[i].value.Length() ? m_Macros[i].value.String() : "null" , pFound );
break;
}
}
}
// can't use ispunct as '|' and '&' are punctuation, but we dont want to warn on them
if ( pFound && bStringIsConditional && bDoReplace &&
( isalnum( pFound[strlen(macroName)] ) || pFound[strlen(macroName)] == '_' ) )
g_pVPC->VPCWarning( "Replacing macro %s with its value (%s) in conditional %s\n", macroName, m_Macros[i].value.Length() ? m_Macros[i].value.String() : "null" , pFound );
if ( bDoReplace && Sys_ReplaceString( buffer1, macroName, m_Macros[i].value.String(), buffer2, sizeof( buffer2 ) ) )
{
bDone = false;
}
strcpy( buffer1, buffer2 );
}
}
while ( !bDone );
int len = strlen( buffer1 );
if ( outBuffSize < len )
len = outBuffSize;
memcpy( pOutBuff, buffer1, len );
pOutBuff[len] = '\0';
}
void CVPC::ResolveMacrosInString( char const *pString, char *pOutBuff, int outBuffSize )
{
ResolveMacrosInStringInternal( pString, pOutBuff, outBuffSize, false );
}
void CVPC::ResolveMacrosInConditional( char const *pString, char *pOutBuff, int outBuffSize )
{
ResolveMacrosInStringInternal( pString, pOutBuff, outBuffSize, true );
}
void CVPC::RemoveScriptCreatedMacros()
{
for ( int i=0; i < m_Macros.Count(); i++ )
{
if ( !m_Macros[i].m_bInternalCreatedMacro )
{
m_Macros.Remove( i );
--i;
}
}
}
const char *CVPC::GetMacroValue( const char *pName )
{
for ( int i = 0; i < m_Macros.Count(); i++ )
{
if ( !V_stricmp( pName, m_Macros[i].name.String() ) )
{
return m_Macros[i].value.String();
}
}
// not found
return "";
}

2810
external/vpc/utils/vpc/main.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

273
external/vpc/utils/vpc/p4sln.cpp vendored Normal file
View File

@@ -0,0 +1,273 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#include "vpc.h"
#include "p4lib/ip4.h"
// fix filenames that have double backslashes at the start
// (Perforce will return this if the root of a clientspec is e.g. "D:\")
static const char* FixPerforceFilename( const char *filename )
{
if ( filename && V_strlen( filename ) > 2 && !V_strnicmp( filename + 1, ":\\\\", 3 ) )
{
// strip out the first backslash
static char newFilename[MAX_PATH];
V_snprintf( newFilename, sizeof(newFilename), "%c:%s",
filename[0],
&filename[3]
);
return newFilename;
}
return filename;
}
static void GetChangelistFilenames( CUtlVector<int> &changelists, CUtlVector<CUtlString> &changelistFilenames )
{
// P4 interface didn't initalize in main - abort
if ( !p4 )
{
g_pVPC->VPCWarning( "P4SLN: Perforce interface not available. Unable to generate solution from the given Perforce changelist." );
return;
}
CUtlVector<P4File_t> fileList;
int changeListIndex = 0;
if ( changelists.Count() )
{
changeListIndex = changelists[0];
}
if ( changeListIndex == -1 )
{
p4->GetOpenedFileList( fileList, false );
}
else if ( changeListIndex == 0 )
{
p4->GetOpenedFileList( fileList, true );
}
else
{
CUtlVector<P4File_t> partialFileList;
FOR_EACH_VEC( changelists, i )
{
p4->GetFileListInChangelist( changelists[i], partialFileList );
FOR_EACH_VEC( partialFileList, j )
{
fileList.AddToTail( partialFileList[j] );
}
}
}
// If -1 is in the changelist index, then include all.
bool bIncludeAllChangelists = ( changelists.Find( -1 ) != changelists.InvalidIndex() );
for ( int i=0; i < fileList.Count(); i++ )
{
if ( bIncludeAllChangelists || changelists.Find( fileList[i].m_iChangelist ) != changelists.InvalidIndex() )
{
const char *pFilename = p4->String( fileList[i].m_sLocalFile );
const char *pNewFilename = FixPerforceFilename( pFilename );
changelistFilenames.AddToTail( pNewFilename );
}
}
}
static void AddAdditionalDependencies( CUtlVector<CDependency_Project*> &projects, CUtlVector<CDependency_Project*> &allProjects )
{
for ( int nProject=0; nProject < projects.Count(); nProject++ )
{
CDependency_Project *pCurProject = projects[nProject];
// Look at all the $AdditionalProjectDependencies projects for this one.
for ( int nDependency=0; nDependency < pCurProject->m_AdditionalProjectDependencies.Count(); nDependency++ )
{
const char *pLookingFor = pCurProject->m_AdditionalProjectDependencies[nDependency].String();
// Search for a match in allProjects.
int nFound = CDependency_Project::FindByProjectName( allProjects, pLookingFor );
if ( nFound == -1 )
{
g_pVPC->VPCError( "P4SLN: Project %s lists '%s' in its $AdditionalProjectDependencies, but there is no project by that name.", pCurProject->GetName(), pLookingFor );
}
else
{
// Got a match.
CDependency_Project *pFound = allProjects[nFound];
int nTest = projects.Find( pFound );
if ( nTest == projects.InvalidIndex() )
{
projects.AddToTail( pFound );
}
}
}
}
}
static void GetProjectsDependingOnFiles( CProjectDependencyGraph &dependencyGraph, CUtlVector<CUtlString> &filenames, CUtlVector<CDependency_Project*> &projects )
{
// Now figure out the projects that depend on each of these files.
for ( int iFile=0; iFile < filenames.Count(); iFile++ )
{
CDependency *pFile = dependencyGraph.FindDependency( filenames[iFile].String() );
if ( !pFile )
{
char szRelative[MAX_PATH];
if ( !V_MakeRelativePath( filenames[iFile].String(), g_pVPC->GetSourcePath(), szRelative, sizeof( szRelative ) ) )
{
V_strncpy( szRelative, filenames[iFile].String(), sizeof( szRelative ) );
}
// This probably means their build commands on the command line didn't include
// any projects that included this file.
g_pVPC->VPCWarning( "%s is not found in the projects searched.", szRelative );
continue;
}
// Now see which projects depend on this file.
for ( int iProject=0; iProject < dependencyGraph.m_Projects.Count(); iProject++ )
{
CDependency_Project *pProject = dependencyGraph.m_Projects[iProject];
if ( pProject->DependsOn( pFile, k_EDependsOnFlagCheckNormalDependencies | k_EDependsOnFlagRecurse | k_EDependsOnFlagTraversePastLibs | k_EDependsOnFlagCheckAdditionalDependencies ) )
{
if ( projects.Find( pProject ) == -1 )
projects.AddToTail( pProject );
}
}
}
// generate the group restrictions
// the user can explicitly provide a set of groups to narrow the wide dependency target
CUtlVector< CUtlString > groupRestrictions;
groupRestrictions = g_pVPC->m_P4GroupRestrictions;
if ( !groupRestrictions.Count() )
{
// the default restriction is to the "everything" group
groupRestrictions.AddToTail( "everything" );
}
CUtlVector< projectIndex_t > allowedProjectIndices;
if ( groupRestrictions.Count() )
{
// get all of the allowed projects by iterating the restrict-to-groups
for ( int i = 0; i < groupRestrictions.Count(); i++ )
{
CUtlVector< projectIndex_t > projectIndices;
if ( !g_pVPC->GetProjectsInGroup( projectIndices, groupRestrictions[i].Get() ) )
{
g_pVPC->VPCError( "No projects found in group '%s'.", groupRestrictions[i].Get() );
}
// aggregate into wider list
for ( int j = 0; j < projectIndices.Count(); j++ )
{
allowedProjectIndices.AddToTail( projectIndices[j] );
}
}
}
// Make sure that each of the dependent projects are members of the restricted groups, otherwise prevent their inclusion.
CUtlVector< int > doomedProjectIndices;
if ( allowedProjectIndices.Count() )
{
for ( int j = 0; j < projects.Count(); j++ )
{
// find the target project in the allowed set
if ( allowedProjectIndices.Find( projects[j]->m_iProjectIndex ) == allowedProjectIndices.InvalidIndex() )
{
// the target project is not in the allowed set
// add in descending order so indices can be properly removed below from largest index to smallest
doomedProjectIndices.AddToHead( j );
}
}
// Remove the projects that are not part of the restrict-to-groups
// Indexes were added in descending order, so removal is actually from the end, truncating the set
for ( int j = 0; j < doomedProjectIndices.Count(); j++ )
{
projects.Remove( doomedProjectIndices[j] );
}
}
}
static void UpdateProjects( CUtlVector<CDependency_Project*> &projects )
{
for ( int iProject=0; iProject < projects.Count(); iProject++ )
{
Log_Msg( LOG_VPC, "\n" );
CDependency_Project *pDependency = projects[iProject];
pDependency->ExportProjectParameters();
if ( g_pVPC->IsForceGenerate() || !g_pVPC->IsProjectCurrent( g_pVPC->GetOutputFilename(), true ) )
{
project_t *pProject = &g_pVPC->m_Projects[ pDependency->m_iProjectIndex ];
g_pVPC->SetProjectName( pProject->name.String() );
g_pVPC->SetLoadAddressName( pProject->name.String() );
g_pVPC->ParseProjectScript( pDependency->m_szStoredScriptName, 0, false, true );
}
}
}
class CStringCaseLess
{
public:
bool Less( const char *lhs, const char *rhs, void *pCtx )
{
return ( V_stricmp( lhs, rhs ) < 0 ? true : false );
}
};
void GenerateSolutionForPerforceChangelist( CProjectDependencyGraph &dependencyGraph, CUtlVector<int> &changelists, IBaseSolutionGenerator *pGenerator, const char *pSolutionFilename )
{
// We want to check against ALL projects in projects.vgc.
int nDepFlags = BUILDPROJDEPS_FULL_DEPENDENCY_SET | BUILDPROJDEPS_CHECK_ALL_PROJECTS;
dependencyGraph.BuildProjectDependencies( nDepFlags );
// Get the list of files from Perforce.
CUtlVector<CUtlString> filenames;
GetChangelistFilenames( changelists, filenames );
// Get the list of projects that depend on these files.
CUtlVector<CDependency_Project*> projects;
GetProjectsDependingOnFiles( dependencyGraph, filenames, projects );
// Add g_targetProjects, which will include any other projects that they added on the command line with +tier0 *engine syntax.
CUtlVector<CDependency_Project*> commandLineProjects;
dependencyGraph.TranslateProjectIndicesToDependencyProjects( g_pVPC->m_TargetProjects, commandLineProjects );
for ( int i=0; i < commandLineProjects.Count(); i++ )
{
if ( projects.Find( commandLineProjects[i] ) == projects.InvalidIndex() )
projects.AddToTail( commandLineProjects[i] );
}
// Make sure the latest .vcproj files are generated.
UpdateProjects( projects );
// List the projects.
CUtlSortVector< CUtlString, CStringCaseLess > sortedProjectNames;
for ( int i=0; i < projects.Count(); i++ )
{
sortedProjectNames.InsertNoSort( projects[i]->GetName() );
}
sortedProjectNames.RedoSort();
Msg( "Dependent projects: \n\n" );
for ( int i=0; i < sortedProjectNames.Count(); i++ )
{
Msg( "%s\n", sortedProjectNames[i].Get() );
}
// Write the solution file.
pGenerator->GenerateSolutionFile( pSolutionFilename, projects );
}

17
external/vpc/utils/vpc/p4sln.h vendored Normal file
View File

@@ -0,0 +1,17 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef P4SLN_H
#define P4SLN_H
#ifdef _WIN32
#pragma once
#endif
void GenerateSolutionForPerforceChangelist( CProjectDependencyGraph &dependencyGraph, CUtlVector<int> &changelists, IBaseSolutionGenerator *pGenerator, const char *pSolutionFilename );
#endif // P4SLN_H

View File

@@ -0,0 +1,156 @@
//====== Copyright 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#include "vpc.h"
#include "projectgenerator_codelite.h"
#ifdef WIN32
#include <direct.h>
#define mkdir(dir, mode) _mkdir(dir)
#define getcwd _getcwd
#endif
static const char *k_pchSource = "Source Files";
static const char *k_pchHeaders = "Header Files";
static const char *k_pchResources = "Resources";
static const char *k_pchVPCFiles = "VPC Files";
void CProjectGenerator_CodeLite::GenerateCodeLiteProject( CBaseProjectDataCollector *pCollector, const char *pOutFilename, const char *pMakefileFilename )
{
char szProjectFile[MAX_PATH];
sprintf( szProjectFile, "%s.project", pOutFilename );
g_pVPC->VPCStatus( true, "Saving CodeLite project for: '%s' File: '%s'", pCollector->GetProjectName().String(), szProjectFile );
m_fp = fopen( szProjectFile, "wt" );
m_nIndent = 0;
m_pCollector = pCollector;
m_pMakefileFilename = pMakefileFilename;
Write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" );
Write( "<CodeLite_Project Name=\"%s\" InternalType=\"\">\n", pCollector->GetProjectName().String() );
{
++m_nIndent;
Write( "<Description/>\n" );
Write( "<Dependencies/>\n" );
Write( "<Settings Type=\"Dynamic Library\">\n" );
{
++m_nIndent;
Write( "<GlobalSettings>\n" );
++m_nIndent;
Write( "<Compiler Options=\"\" C_Options=\"\">\n" );
++m_nIndent;
Write( "<IncludePath Value=\"\"/>\n" );
--m_nIndent;
Write( "</Compiler>\n" );
Write( "<Linker Options=\"\">\n" );
++m_nIndent;
Write( "<LibraryPath Value=\"\"/>\n" );
--m_nIndent;
Write( "</Linker>\n" );
Write( "<ResourceCompiler Options=\"\"/>\n" );
--m_nIndent;
Write( "</GlobalSettings>\n" );
Write( "<Configuration Name=\"Debug\" CompilerType=\"gnu g++\" DebuggerType=\"GNU gdb debugger\" Type=\"Dynamic Library\" BuildCmpWithGlobalSettings=\"append\" BuildLnkWithGlobalSettings=\"append\" BuildResWithGlobalSettings=\"append\">\n" );
{
++m_nIndent;
Write( "<CustomBuild Enabled=\"yes\">\n" );
{
++m_nIndent;
Write( "<RebuildCommand>make CFG=debug -f %s clean all</RebuildCommand>\n", pMakefileFilename );
Write( "<CleanCommand>make CFG=debug -f %s clean</CleanCommand>\n", pMakefileFilename );
Write( "<BuildCommand>make CFG=debug -f %s -j `getconf _NPROCESSORS_ONLN`</BuildCommand>\n", pMakefileFilename );
Write( "<WorkingDirectory>$(ProjectPath)</WorkingDirectory>\n" );
--m_nIndent;
}
Write( "</CustomBuild>\n" );
--m_nIndent;
}
Write( "</Configuration>\n" );
Write( "<Configuration Name=\"Release\" CompilerType=\"gnu g++\" DebuggerType=\"GNU gdb debugger\" Type=\"Dynamic Library\" BuildCmpWithGlobalSettings=\"append\" BuildLnkWithGlobalSettings=\"append\" BuildResWithGlobalSettings=\"append\">\n" );
{
++m_nIndent;
Write( "<CustomBuild Enabled=\"yes\">\n" );
{
++m_nIndent;
Write( "<RebuildCommand>make -f %s clean all</RebuildCommand>\n", pMakefileFilename );
Write( "<CleanCommand>make -f %s clean</CleanCommand>\n", pMakefileFilename );
Write( "<BuildCommand>make -f %s -j `getconf _NPROCESSORS_ONLN`</BuildCommand>\n", pMakefileFilename );
Write( "<WorkingDirectory>$(ProjectPath)</WorkingDirectory>\n" );
--m_nIndent;
}
Write( "</CustomBuild>\n" );
--m_nIndent;
}
Write( "</Configuration>\n" );
--m_nIndent;
}
Write( "</Settings>\n" );
{
++m_nIndent;
WriteFilesFolder( k_pchSource, "*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.m;*.mm" );
WriteFilesFolder( k_pchHeaders, "*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if" );
WriteFilesFolder( k_pchResources, "*.plist;*.strings;*.xib" );
WriteFilesFolder( k_pchVPCFiles, "*.vpc" );
--m_nIndent;
}
--m_nIndent;
}
Write( "</CodeLite_Project>\n" );
fclose( m_fp );
}
void CProjectGenerator_CodeLite::WriteFilesFolder( const char *pFolderName, const char *pExtensions ) {
CUtlVector<char*> extensions;
V_SplitString( pExtensions, ";", extensions );
Write( "<VirtualDirectory Name=\"%s\">\n", pFolderName );
{
++m_nIndent;
for ( int i=m_pCollector->m_Files.First(); i != m_pCollector->m_Files.InvalidIndex(); i=m_pCollector->m_Files.Next( i ) ) {
const char *pFilename = m_pCollector->m_Files[i]->GetName();
// Make sure this file's extension is one of the extensions they're asking for.
bool bValidExt = false;
const char *pFileExtension = V_GetFileExtension( pFilename );
if ( pFileExtension ) {
for ( int iExt=0; iExt < extensions.Count(); iExt++ ) {
const char *pTestExt = extensions[iExt];
if ( pTestExt[0] == '*' && pTestExt[1] == '.' && V_stricmp( pTestExt+2, pFileExtension ) == 0 ) {
bValidExt = true;
break;
}
}
}
if ( bValidExt ) {
char sFixedSlashes[MAX_PATH];
V_strncpy( sFixedSlashes, pFilename, sizeof( sFixedSlashes ) );
Write( "<File Name=\"%s\"/>\n", sFixedSlashes );
}
}
--m_nIndent;
}
Write( "</VirtualDirectory>\n");
}
void CProjectGenerator_CodeLite::Write( const char *pMsg, ... ) {
char sOut[8192];
va_list marker;
va_start( marker, pMsg );
V_vsnprintf( sOut, sizeof( sOut ), pMsg, marker );
va_end( marker );
for ( int i=0; i < m_nIndent; i++ )
fprintf( m_fp, " " );
fprintf( m_fp, "%s", sOut );
}

View File

@@ -0,0 +1,51 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef PROJECTGENERATOR_CODELITE_H
#define PROJECTGENERATOR_CODELITE_H
#ifdef _WIN32
#pragma once
#endif
#include "baseprojectdatacollector.h"
class CProjectGenerator_CodeLite
{
public:
void GenerateCodeLiteProject( CBaseProjectDataCollector *pCollector, const char *pOutFilename, const char *pMakefileFilename );
private:
void Write( const char *pMsg, ... );
void WriteHeader();
void WriteFileReferences();
void WriteProject( const char *pchMakefileName );
void WriteBuildFiles();
void WriteBuildConfigurations();
void WriteLegacyTargets( const char *pchMakefileName );
void WriteTrailer();
void WriteConfig( CSpecificConfig *pConfig );
void WriteTarget_Build( CSpecificConfig *pConfig );
void WriteTarget_Compile( CSpecificConfig *pConfig );
void WriteTarget_Rebuild( CSpecificConfig *pConfig );
void WriteTarget_Link( CSpecificConfig *pConfig );
void WriteTarget_Debug( CSpecificConfig *pConfig );
void WriteIncludes( CSpecificConfig *pConfig );
void WriteFilesFolder( const char *pFolderName, const char *pExtensions );
void WriteFiles();
private:
CBaseProjectDataCollector *m_pCollector;
FILE *m_fp;
const char *m_pMakefileFilename;
int m_nIndent;
};
#endif // PROJECTGENERATOR_CODELITE_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef PROJECTGENERATOR_PS3_H
#define PROJECTGENERATOR_PS3_H
#ifdef _WIN32
#pragma once
#endif
#define PROPERTYNAME( X, Y ) X##_##Y,
enum PS3Properties_e
{
#include "projectgenerator_ps3.inc"
};
class CProjectGenerator_PS3 : public IVCProjWriter
{
public:
CProjectGenerator_PS3();
IBaseProjectGenerator *GetProjectGenerator() { return m_pVCProjGenerator; }
virtual bool Save( const char *pOutputFilename );
private:
bool WriteToXML();
bool WriteFolder( CProjectFolder *pFolder );
bool WriteFile( CProjectFile *pFile );
bool WriteConfiguration( CProjectConfiguration *pConfig );
bool WritePreBuildEventTool( CPreBuildEventTool *pPreBuildEventTool );
bool WriteCustomBuildTool( CCustomBuildTool *pCustomBuildTool );
bool WriteSNCCompilerTool( CCompilerTool *pCompilerTool );
bool WriteGCCCompilerTool( CCompilerTool *pCompilerTool );
bool WriteSNCLinkerTool( CLinkerTool *pLinkerTool );
bool WriteGCCLinkerTool( CLinkerTool *pLinkerTool );
bool WritePreLinkEventTool( CPreLinkEventTool *pPreLinkEventTool );
bool WriteLibrarianTool( CLibrarianTool *pLibrarianTool );
bool WritePostBuildEventTool( CPostBuildEventTool *pPostBuildEventTool );
const char *BoolStringToTrueFalseString( const char *pValue );
CXMLWriter m_XMLWriter;
CVCProjGenerator *m_pVCProjGenerator;
};
#endif // PROJECTGENERATOR_PS3_H

View File

@@ -0,0 +1,137 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Property Enumerations
//
//=====================================================================================//
// Config
PROPERTYNAME( PS3_GENERAL, ConfigurationType )
PROPERTYNAME( PS3_GENERAL, ExcludedFromBuild )
PROPERTYNAME( PS3_GENERAL, OutputDirectory )
PROPERTYNAME( PS3_GENERAL, IntermediateDirectory )
PROPERTYNAME( PS3_GENERAL, ExtensionsToDeleteOnClean )
PROPERTYNAME( PS3_GENERAL, BuildLogFile )
PROPERTYNAME( PS3_GENERAL, SystemIncludeDependencies )
PROPERTYNAME( PS3_GENERAL, SaveDebuggerPropertiesInProject )
// GCC Compiler
PROPERTYNAME( PS3_GCCCOMPILER, AdditionalIncludeDirectories )
PROPERTYNAME( PS3_GCCCOMPILER, PreprocessorDefinitions )
PROPERTYNAME( PS3_GCCCOMPILER, ForceIncludes )
PROPERTYNAME( PS3_GCCCOMPILER, GenerateDebugInformation )
PROPERTYNAME( PS3_GCCCOMPILER, Warnings )
PROPERTYNAME( PS3_GCCCOMPILER, ExtraWarnings )
PROPERTYNAME( PS3_GCCCOMPILER, WarnLoadHitStores )
PROPERTYNAME( PS3_GCCCOMPILER, WarnMicrocodedInstruction )
PROPERTYNAME( PS3_GCCCOMPILER, TreatWarningsAsErrors )
PROPERTYNAME( PS3_GCCCOMPILER, ObjectFileName )
PROPERTYNAME( PS3_GCCCOMPILER, CallprofHierarchicalProfiling )
PROPERTYNAME( PS3_GCCCOMPILER, SPURSUsage )
PROPERTYNAME( PS3_GCCCOMPILER, OptimizationLevel )
PROPERTYNAME( PS3_GCCCOMPILER, FastMath )
PROPERTYNAME( PS3_GCCCOMPILER, NoStrictAliasing )
PROPERTYNAME( PS3_GCCCOMPILER, UnrollLoops )
PROPERTYNAME( PS3_GCCCOMPILER, InlineFunctionSizeLimit )
PROPERTYNAME( PS3_GCCCOMPILER, TOCUsage )
PROPERTYNAME( PS3_GCCCOMPILER, SaveRestoreFunctions )
PROPERTYNAME( PS3_GCCCOMPILER, GenerateMicrocodedInstructions )
PROPERTYNAME( PS3_GCCCOMPILER, PositionIndependentCode )
PROPERTYNAME( PS3_GCCCOMPILER, FunctionSections )
PROPERTYNAME( PS3_GCCCOMPILER, DataSections )
PROPERTYNAME( PS3_GCCCOMPILER, StackCheck )
PROPERTYNAME( PS3_GCCCOMPILER, CPPExceptionsAndRTTIUsage )
PROPERTYNAME( PS3_GCCCOMPILER, CheckANSICompliance )
PROPERTYNAME( PS3_GCCCOMPILER, DefaultCharSigned )
PROPERTYNAME( PS3_GCCCOMPILER, Permissive )
PROPERTYNAME( PS3_GCCCOMPILER, EnableMSExtensions )
PROPERTYNAME( PS3_GCCCOMPILER, RelaxCPPCompliance )
PROPERTYNAME( PS3_GCCCOMPILER, AdditionalOptions )
// Librarian
PROPERTYNAME( PS3_LIBRARIAN, OutputFile )
PROPERTYNAME( PS3_LIBRARIAN, AdditionalDependencies )
PROPERTYNAME( PS3_LIBRARIAN, WholeArchive )
PROPERTYNAME( PS3_LIBRARIAN, LinkLibraryDependencies )
// GCC Linker
PROPERTYNAME( PS3_GCCLINKER, OutputFile )
PROPERTYNAME( PS3_GCCLINKER, AdditionalDependencies )
PROPERTYNAME( PS3_GCCLINKER, AdditionalLibraryDirectories )
PROPERTYNAME( PS3_GCCLINKER, ImportLibrary )
PROPERTYNAME( PS3_GCCLINKER, SPURSUsage )
PROPERTYNAME( PS3_GCCLINKER, PositionIndependentCode )
PROPERTYNAME( PS3_GCCLINKER, EmitRelocations )
PROPERTYNAME( PS3_GCCLINKER, GarbageCollection )
PROPERTYNAME( PS3_GCCLINKER, GenerateMapFile )
PROPERTYNAME( PS3_GCCLINKER, MapFileName )
PROPERTYNAME( PS3_GCCLINKER, LinkLibraryDependencies )
PROPERTYNAME( PS3_GCCLINKER, AdditionalOptions )
// SNC Compiler
PROPERTYNAME( PS3_SNCCOMPILER, AdditionalIncludeDirectories )
PROPERTYNAME( PS3_SNCCOMPILER, PreprocessorDefinitions )
PROPERTYNAME( PS3_SNCCOMPILER, ForceIncludes )
PROPERTYNAME( PS3_SNCCOMPILER, GenerateDebugInformation )
PROPERTYNAME( PS3_SNCCOMPILER, Warnings )
PROPERTYNAME( PS3_SNCCOMPILER, TreatMessagesAsErrors )
PROPERTYNAME( PS3_SNCCOMPILER, DisableSpecificWarnings )
PROPERTYNAME( PS3_SNCCOMPILER, ObjectFileName )
PROPERTYNAME( PS3_SNCCOMPILER, CallprofHierarchicalProfiling )
PROPERTYNAME( PS3_SNCCOMPILER, OptimizationLevel )
PROPERTYNAME( PS3_SNCCOMPILER, FastMath )
PROPERTYNAME( PS3_SNCCOMPILER, RelaxAliasChecking )
PROPERTYNAME( PS3_SNCCOMPILER, BranchlessCompares )
PROPERTYNAME( PS3_SNCCOMPILER, UnrollLoops )
PROPERTYNAME( PS3_SNCCOMPILER, AssumeAlignedPointers )
PROPERTYNAME( PS3_SNCCOMPILER, AssumeCorrectSign )
PROPERTYNAME( PS3_SNCCOMPILER, TOCPointerPreservation )
PROPERTYNAME( PS3_SNCCOMPILER, InitializedDataPlacement )
PROPERTYNAME( PS3_SNCCOMPILER, PromoteFPConstantsToDoubles )
PROPERTYNAME( PS3_SNCCOMPILER, CCPPDialect )
PROPERTYNAME( PS3_SNCCOMPILER, CPPExceptionsAndRTTIUsage )
PROPERTYNAME( PS3_SNCCOMPILER, DefaultCharUnsigned )
PROPERTYNAME( PS3_SNCCOMPILER, DefaultFPConstantsAsTypeFloat )
PROPERTYNAME( PS3_SNCCOMPILER, BuiltInDefinitionForWCHAR_TType )
PROPERTYNAME( PS3_SNCCOMPILER, CreateUsePrecompiledHeader )
PROPERTYNAME( PS3_SNCCOMPILER, PrecompiledHeaderFile )
PROPERTYNAME( PS3_SNCCOMPILER, AdditionalOptions )
// SNC Linker
PROPERTYNAME( PS3_SNCLINKER, OutputFile )
PROPERTYNAME( PS3_SNCLINKER, OutputFormat )
PROPERTYNAME( PS3_SNCLINKER, AdditionalDependencies )
PROPERTYNAME( PS3_SNCLINKER, AdditionalLibraryDirectories )
PROPERTYNAME( PS3_SNCLINKER, IgnoreAllDefaultLibraries )
PROPERTYNAME( PS3_SNCLINKER, UsingExceptionHandling )
PROPERTYNAME( PS3_SNCLINKER, TOCPointerElimination )
PROPERTYNAME( PS3_SNCLINKER, ForceSymbolReferences )
PROPERTYNAME( PS3_SNCLINKER, CallprofHierarchicalProfiling )
PROPERTYNAME( PS3_SNCLINKER, DebugInfoAndSymbolStripping )
PROPERTYNAME( PS3_SNCLINKER, UnusedFunctionAndDataStripping )
PROPERTYNAME( PS3_SNCLINKER, ImportLibrary )
PROPERTYNAME( PS3_SNCLINKER, GenerateMapFile )
PROPERTYNAME( PS3_SNCLINKER, MapFileName )
PROPERTYNAME( PS3_SNCLINKER, LinkLibraryDependencies )
PROPERTYNAME( PS3_SNCLINKER, AdditionalOptions )
// Pre Build
PROPERTYNAME( PS3_PREBUILDEVENT, CommandLine )
PROPERTYNAME( PS3_PREBUILDEVENT, Description )
PROPERTYNAME( PS3_PREBUILDEVENT, ExcludedFromBuild )
// Pre Link
PROPERTYNAME( PS3_PRELINKEVENT, CommandLine )
PROPERTYNAME( PS3_PRELINKEVENT, Description )
PROPERTYNAME( PS3_PRELINKEVENT, ExcludedFromBuild )
// Post Build
PROPERTYNAME( PS3_POSTBUILDEVENT, CommandLine )
PROPERTYNAME( PS3_POSTBUILDEVENT, Description )
PROPERTYNAME( PS3_POSTBUILDEVENT, ExcludedFromBuild )
// Custom Build
PROPERTYNAME( PS3_CUSTOMBUILDSTEP, CommandLine )
PROPERTYNAME( PS3_CUSTOMBUILDSTEP, Description )
PROPERTYNAME( PS3_CUSTOMBUILDSTEP, Outputs )
PROPERTYNAME( PS3_CUSTOMBUILDSTEP, AdditionalDependencies )

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,379 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef VCPROJGENERATOR_H
#define VCPROJGENERATOR_H
#ifdef _WIN32
#pragma once
#endif
class CProjectConfiguration;
class CVCProjGenerator;
class CProjectTool;
struct PropertyState_t
{
ToolProperty_t *m_pToolProperty;
CUtlString m_OrdinalString;
CUtlString m_StringValue;
};
// ps3 visual studio integration
enum PS3VSIType_e
{
PS3_VSI_TYPE_UNDEFINED = -1,
PS3_VSI_TYPE_SNC = 0,
PS3_VSI_TYPE_GCC = 1,
};
class CProjectFile
{
public:
CProjectFile( CVCProjGenerator *pGenerator, const char *pFilename );
~CProjectFile();
bool GetConfiguration( const char *pConfigName, CProjectConfiguration **ppConfig );
bool AddConfiguration( const char *pConfigName, CProjectConfiguration **ppConfig );
bool RemoveConfiguration( CProjectConfiguration *pConfig );
CUtlString m_Name;
CVCProjGenerator *m_pGenerator;
CUtlVector< CProjectConfiguration* > m_Configs;
};
class CProjectFolder
{
public:
CProjectFolder( CVCProjGenerator *pGenerator, const char *pFolderName );
~CProjectFolder();
bool GetFolder( const char *pFolderName, CProjectFolder **pFolder );
bool AddFolder( const char *pFolderName, CProjectFolder **pFolder );
void AddFile( const char *pFilename, CProjectFile **ppFile );
bool FindFile( const char *pFilename );
bool RemoveFile( const char *pFilename );
CUtlString m_Name;
CVCProjGenerator *m_pGenerator;
CUtlLinkedList< CProjectFolder* > m_Folders;
CUtlLinkedList< CProjectFile* > m_Files;
};
class CPropertyStateLessFunc
{
public:
bool Less( const int& lhs, const int& rhs, void *pContext );
};
class CPropertyStates
{
public:
CPropertyStates();
bool SetProperty( ToolProperty_t *pToolProperty, CProjectTool *pRootTool = NULL );
bool SetBoolProperty( ToolProperty_t *pToolProperty, bool bEnabled );
PropertyState_t *GetProperty( int nPropertyId );
PropertyState_t *GetProperty( const char *pPropertyName );
CUtlVector< PropertyState_t > m_Properties;
CUtlSortVector< int, CPropertyStateLessFunc > m_PropertiesInOutputOrder;
private:
bool SetStringProperty( ToolProperty_t *pToolProperty, CProjectTool *pRootTool = NULL );
bool SetListProperty( ToolProperty_t *pToolProperty, CProjectTool *pRootTool = NULL );
bool SetBoolProperty( ToolProperty_t *pToolProperty, CProjectTool *pRootTool = NULL );
bool SetBoolProperty( ToolProperty_t *pToolProperty, CProjectTool *pRootTool, bool bEnabled );
bool SetIntegerProperty( ToolProperty_t *pToolProperty, CProjectTool *pRootTool = NULL );
};
class CProjectTool
{
public:
CProjectTool( CVCProjGenerator *pGenerator )
{
m_pGenerator = pGenerator;
}
CVCProjGenerator *GetGenerator() { return m_pGenerator; }
// when the property belongs to the root tool (i.e. linker), no root tool is passed in
// when the property is for the file's specific configuration tool, (i.e. compiler/debug), the root tool must be supplied
virtual bool SetProperty( ToolProperty_t *pToolProperty, CProjectTool *pRootTool = NULL );
CPropertyStates m_PropertyStates;
private:
CVCProjGenerator *m_pGenerator;
};
class CDebuggingTool : public CProjectTool
{
public:
CDebuggingTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CCompilerTool : public CProjectTool
{
public:
CCompilerTool( CVCProjGenerator *pGenerator, const char *pConfigName, bool bIsFileConfig ) : CProjectTool( pGenerator )
{
m_ConfigName = pConfigName;
m_bIsFileConfig = bIsFileConfig;
}
bool SetProperty( ToolProperty_t *pToolProperty, CProjectTool *pRootTool = NULL );
private:
CUtlString m_ConfigName;
bool m_bIsFileConfig;
};
class CLibrarianTool : public CProjectTool
{
public:
CLibrarianTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CLinkerTool : public CProjectTool
{
public:
CLinkerTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CManifestTool : public CProjectTool
{
public:
CManifestTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CXMLDocGenTool : public CProjectTool
{
public:
CXMLDocGenTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CBrowseInfoTool : public CProjectTool
{
public:
CBrowseInfoTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CResourcesTool : public CProjectTool
{
public:
CResourcesTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CPreBuildEventTool : public CProjectTool
{
public:
CPreBuildEventTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CPreLinkEventTool : public CProjectTool
{
public:
CPreLinkEventTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CPostBuildEventTool : public CProjectTool
{
public:
CPostBuildEventTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CCustomBuildTool : public CProjectTool
{
public:
CCustomBuildTool( CVCProjGenerator *pGenerator, const char *pConfigName, bool bIsFileConfig ) : CProjectTool( pGenerator )
{
m_ConfigName = pConfigName;
m_bIsFileConfig = bIsFileConfig;
}
bool SetProperty( ToolProperty_t *pToolProperty, CProjectTool *pRootTool = NULL );
private:
CUtlString m_ConfigName;
bool m_bIsFileConfig;
};
class CXboxImageTool : public CProjectTool
{
public:
CXboxImageTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CXboxDeploymentTool : public CProjectTool
{
public:
CXboxDeploymentTool( CVCProjGenerator *pGenerator ) : CProjectTool( pGenerator ) {}
};
class CProjectConfiguration
{
public:
CProjectConfiguration( CVCProjGenerator *pGenerator, const char *pConfigName, const char *pFilename );
~CProjectConfiguration();
CDebuggingTool *GetDebuggingTool() { return m_pDebuggingTool; }
CCompilerTool *GetCompilerTool() { return m_pCompilerTool; }
CLibrarianTool *GetLibrarianTool() { return m_pLibrarianTool; }
CLinkerTool *GetLinkerTool() { return m_pLinkerTool; }
CManifestTool *GetManifestTool() { return m_pManifestTool; }
CXMLDocGenTool *GetXMLDocGenTool() { return m_pXMLDocGenTool; }
CBrowseInfoTool *GetBrowseInfoTool() { return m_pBrowseInfoTool; }
CResourcesTool *GetResourcesTool() { return m_pResourcesTool; }
CPreBuildEventTool *GetPreBuildEventTool() { return m_pPreBuildEventTool; }
CPreLinkEventTool *GetPreLinkEventTool() { return m_pPreLinkEventTool; }
CPostBuildEventTool *GetPostBuildEventTool() { return m_pPostBuildEventTool; }
CCustomBuildTool *GetCustomBuildTool() { return m_pCustomBuildTool; }
CXboxImageTool *GetXboxImageTool() { return m_pXboxImageTool; }
CXboxDeploymentTool *GetXboxDeploymentTool() { return m_pXboxDeploymentTool; }
bool IsEmpty();
bool SetProperty( ToolProperty_t *pToolProperty );
CVCProjGenerator *m_pGenerator;
// type of config, and config's properties
bool m_bIsFileConfig;
CUtlString m_Name;
CPropertyStates m_PropertyStates;
private:
// the config's tools
CDebuggingTool *m_pDebuggingTool;
CCompilerTool *m_pCompilerTool;
CLibrarianTool *m_pLibrarianTool;
CLinkerTool *m_pLinkerTool;
CManifestTool *m_pManifestTool;
CXMLDocGenTool *m_pXMLDocGenTool;
CBrowseInfoTool *m_pBrowseInfoTool;
CResourcesTool *m_pResourcesTool;
CPreBuildEventTool *m_pPreBuildEventTool;
CPreLinkEventTool *m_pPreLinkEventTool;
CPostBuildEventTool *m_pPostBuildEventTool;
CCustomBuildTool *m_pCustomBuildTool;
CXboxImageTool *m_pXboxImageTool;
CXboxDeploymentTool *m_pXboxDeploymentTool;
};
class IVCProjWriter
{
public:
virtual bool Save( const char *pOutputFilename ) = 0;
};
class CVCProjGenerator : public CBaseProjectDataCollector
{
public:
typedef CBaseProjectDataCollector BaseClass;
CVCProjGenerator();
virtual const char *GetProjectFileExtension();
virtual void StartProject();
virtual void EndProject();
virtual CUtlString GetProjectName();
virtual void SetProjectName( const char *pProjectName );
virtual void GetAllConfigurationNames( CUtlVector< CUtlString > &configurationNames );
virtual void StartConfigurationBlock( const char *pConfigName, bool bFileSpecific );
virtual void EndConfigurationBlock();
virtual bool StartPropertySection( configKeyword_e keyword, bool *pbShouldSkip );
virtual void HandleProperty( const char *pProperty, const char *pCustomScriptData );
virtual void EndPropertySection( configKeyword_e keyword );
virtual void StartFolder( const char *pFolderName );
virtual void EndFolder();
virtual bool StartFile( const char *pFilename, bool bWarnIfAlreadyExists );
virtual void EndFile();
virtual void FileExcludedFromBuild( bool bExcluded );
virtual bool RemoveFile( const char *pFilename );
CGeneratorDefinition *GetGeneratorDefinition() { return m_pGeneratorDefinition; }
void SetupGeneratorDefinition( IVCProjWriter *pVCProjWriter, const char *pDefinitionName, PropertyName_t *pPropertyNames );
PS3VSIType_e GetVSIType() { return m_VSIType; }
CUtlString GetGUIDString() { return m_GUIDString; }
bool GetRootConfiguration( const char *pConfigName, CProjectConfiguration **pConfig );
CProjectFolder *GetRootFolder() { return m_pRootFolder; }
private:
void Clear();
bool Config_GetConfigurations( const char *pszConfigName );
// returns true if found, false otherwise
bool GetFolder( const char *pFolderName, CProjectFolder *pParentFolder, CProjectFolder **pOutFolder );
// returns true if added, false otherwise (duplicate)
bool AddFolder( const char *pFolderName, CProjectFolder *pParentFolder, CProjectFolder **pOutFolder );
// returns true if found, false otherwise
bool FindFile( const char *pFilename, CProjectFile **pFile );
void AddFileToFolder( const char *pFilename, CProjectFolder *pFolder, bool bWarnIfExists, CProjectFile **pFile );
// returns true if removed, false otherwise (not found)
bool RemoveFileFromFolder( const char *pFilename, CProjectFolder *pFolder );
bool IsConfigurationNameValid( const char *pConfigName );
void SetGUID( const char *pOutputFilename );
configKeyword_e SetPS3VisualStudioIntegrationType( configKeyword_e eKeyword );
void ApplyInternalPreprocessorDefinitions();
private:
configKeyword_e m_nActivePropertySection;
CGeneratorDefinition *m_pGeneratorDefinition;
CDebuggingTool *m_pDebuggingTool;
CCompilerTool *m_pCompilerTool;
CLibrarianTool *m_pLibrarianTool;
CLinkerTool *m_pLinkerTool;
CManifestTool *m_pManifestTool;
CXMLDocGenTool *m_pXMLDocGenTool;
CBrowseInfoTool *m_pBrowseInfoTool;
CResourcesTool *m_pResourcesTool;
CPreBuildEventTool *m_pPreBuildEventTool;
CPreLinkEventTool *m_pPreLinkEventTool;
CPostBuildEventTool *m_pPostBuildEventTool;
CCustomBuildTool *m_pCustomBuildTool;
CXboxImageTool *m_pXboxImageTool;
CXboxDeploymentTool *m_pXboxDeploymentTool;
CProjectConfiguration *m_pConfig;
CProjectConfiguration *m_pFileConfig;
CProjectFile *m_pProjectFile;
CSimplePointerStack< CProjectFolder*, CProjectFolder*, 128 > m_spFolderStack;
CSimplePointerStack< CCompilerTool*, CCompilerTool*, 128 > m_spCompilerStack;
CSimplePointerStack< CCustomBuildTool*, CCustomBuildTool*, 128 > m_spCustomBuildToolStack;
CUtlString m_ProjectName;
CUtlString m_OutputFilename;
CProjectFolder *m_pRootFolder;
CUtlVector< CProjectConfiguration* > m_RootConfigurations;
// primary file dictionary
CUtlRBTree< CProjectFile*, int > m_FileDictionary;
CUtlString m_GUIDString;
IVCProjWriter *m_pVCProjWriter;
// ps3 visual studio integration
PS3VSIType_e m_VSIType;
};
#endif // VCPROJGENERATOR_H

View File

@@ -0,0 +1,349 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
#undef PROPERTYNAME
#define PROPERTYNAME( X, Y ) { X##_##Y, #X, #Y },
static PropertyName_t s_Win32PropertyNames[] =
{
#include "projectgenerator_win32.inc"
{ -1, NULL, NULL }
};
IBaseProjectGenerator* GetWin32ProjectGenerator()
{
static CProjectGenerator_Win32 *s_pProjectGenerator = NULL;
if ( !s_pProjectGenerator )
{
s_pProjectGenerator = new CProjectGenerator_Win32();
}
return s_pProjectGenerator->GetProjectGenerator();
}
CProjectGenerator_Win32::CProjectGenerator_Win32()
{
m_pVCProjGenerator = new CVCProjGenerator();
m_pVCProjGenerator->SetupGeneratorDefinition( this, "win32_2005.def", s_Win32PropertyNames );
}
bool CProjectGenerator_Win32::WriteFile( CProjectFile *pFile )
{
m_XMLWriter.PushNode( "File" );
m_XMLWriter.Write( CFmtStrMax( "RelativePath=\"%s\"", pFile->m_Name.Get() ) );
m_XMLWriter.Write( ">" );
for ( int i = 0; i < pFile->m_Configs.Count(); i++ )
{
if ( !WriteConfiguration( pFile->m_Configs[i] ) )
return false;
}
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Win32::WriteFolder( CProjectFolder *pFolder )
{
m_XMLWriter.PushNode( "Filter" );
m_XMLWriter.Write( CFmtStrMax( "Name=\"%s\"", m_XMLWriter.FixupXMLString( pFolder->m_Name.Get() ) ) );
m_XMLWriter.Write( ">" );
for ( int iIndex = pFolder->m_Files.Head(); iIndex != pFolder->m_Files.InvalidIndex(); iIndex = pFolder->m_Files.Next( iIndex ) )
{
if ( !WriteFile( pFolder->m_Files[iIndex] ) )
return false;
}
for ( int iIndex = pFolder->m_Folders.Head(); iIndex != pFolder->m_Folders.InvalidIndex(); iIndex = pFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolder( pFolder->m_Folders[iIndex] ) )
return false;
}
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Win32::WriteConfiguration( CProjectConfiguration *pConfig )
{
const char *pTargetPlatformName = g_pVPC->IsPlatformDefined( "win64" ) ? "x64" : "Win32";
if ( pConfig->m_bIsFileConfig )
{
m_XMLWriter.PushNode( "FileConfiguration" );
}
else
{
m_XMLWriter.PushNode( "Configuration" );
}
const char *pOutputName = "???";
if ( !V_stricmp( pConfig->m_Name.Get(), "debug" ) )
{
pOutputName = "Debug";
}
else if ( !V_stricmp( pConfig->m_Name.Get(), "release" ) )
{
pOutputName = "Release";
}
else
{
return false;
}
m_XMLWriter.Write( CFmtStrMax( "Name=\"%s|%s\"", pOutputName, pTargetPlatformName ) );
// write configuration properties
for ( int i = 0; i < pConfig->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pConfig->m_PropertyStates.m_PropertiesInOutputOrder[i];
WriteProperty( &pConfig->m_PropertyStates.m_Properties[sortedIndex] );
}
m_XMLWriter.Write( ">" );
if ( !WriteTool( "VCPreBuildEventTool", pConfig->GetPreBuildEventTool() ) )
return false;
if ( !WriteTool( "VCCustomBuildTool", pConfig->GetCustomBuildTool() ) )
return false;
if ( !WriteNULLTool( "VCXMLDataGeneratorTool", pConfig ) )
return false;
if ( !WriteNULLTool( "VCWebServiceProxyGeneratorTool", pConfig ) )
return false;
if ( !WriteNULLTool( "VCMIDLTool", pConfig ) )
return false;
if ( !WriteTool( "VCCLCompilerTool", pConfig->GetCompilerTool() ) )
return false;
if ( !WriteNULLTool( "VCManagedResourceCompilerTool", pConfig ) )
return false;
if ( !WriteTool( "VCResourceCompilerTool", pConfig->GetResourcesTool() ) )
return false;
if ( !WriteTool( "VCPreLinkEventTool", pConfig->GetPreLinkEventTool() ) )
return false;
if ( !WriteTool( "VCLinkerTool", pConfig->GetLinkerTool() ) )
return false;
if ( !WriteTool( "VCLibrarianTool", pConfig->GetLibrarianTool() ) )
return false;
if ( !WriteNULLTool( "VCALinkTool", pConfig ) )
return false;
if ( !WriteTool( "VCManifestTool", pConfig->GetManifestTool() ) )
return false;
if ( !WriteTool( "VCXDCMakeTool", pConfig->GetXMLDocGenTool() ) )
return false;
if ( !WriteTool( "VCBscMakeTool", pConfig->GetBrowseInfoTool() ) )
return false;
if ( !WriteNULLTool( "VCFxCopTool", pConfig ) )
return false;
if ( !pConfig->GetLibrarianTool() )
{
if ( !WriteNULLTool( "VCAppVerifierTool", pConfig ) )
return false;
if ( !WriteNULLTool( "VCWebDeploymentTool", pConfig ) )
return false;
}
if ( !WriteTool( "VCPostBuildEventTool", pConfig->GetPostBuildEventTool() ) )
return false;
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Win32::WriteToXML()
{
const char *pTargetPlatformName = g_pVPC->IsPlatformDefined( "win64" ) ? "x64" : "Win32";
m_XMLWriter.PushNode( "VisualStudioProject" );
m_XMLWriter.Write( "ProjectType=\"Visual C++\"" );
if ( g_pVPC->BUse2008() )
m_XMLWriter.Write( "Version=\"9.00\"" );
else
m_XMLWriter.Write( "Version=\"8.00\"" );
m_XMLWriter.Write( CFmtStrMax( "Name=\"%s\"", m_pVCProjGenerator->GetProjectName().Get() ) );
m_XMLWriter.Write( CFmtStrMax( "ProjectGUID=\"%s\"", m_pVCProjGenerator->GetGUIDString().Get() ) );
if ( g_pVPC->BUseP4SCC() )
m_XMLWriter.Write( "SccProjectName=\"Perforce Project\"\nSccLocalPath=\"..\"\nSccProvider=\"MSSCCI:Perforce SCM\"\n" );
m_XMLWriter.Write( ">" );
m_XMLWriter.PushNode( "Platforms" );
m_XMLWriter.PushNode( "Platform" );
m_XMLWriter.Write( CFmtStrMax( "Name=\"%s\"", pTargetPlatformName) );
m_XMLWriter.PopNode( false );
m_XMLWriter.PopNode( true );
m_XMLWriter.PushNode( "ToolFiles" );
m_XMLWriter.PopNode( true );
CUtlVector< CUtlString > configurationNames;
m_pVCProjGenerator->GetAllConfigurationNames( configurationNames );
// write the root configurations
m_XMLWriter.PushNode( "Configurations" );
for ( int i = 0; i < configurationNames.Count(); i++ )
{
CProjectConfiguration *pConfiguration = NULL;
if ( m_pVCProjGenerator->GetRootConfiguration( configurationNames[i].Get(), &pConfiguration ) )
{
if ( !WriteConfiguration( pConfiguration ) )
return false;
}
}
m_XMLWriter.PopNode( true );
m_XMLWriter.PushNode( "References" );
m_XMLWriter.PopNode( true );
m_XMLWriter.PushNode( "Files" );
CProjectFolder *pRootFolder = m_pVCProjGenerator->GetRootFolder();
for ( int iIndex = pRootFolder->m_Folders.Head(); iIndex != pRootFolder->m_Folders.InvalidIndex(); iIndex = pRootFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolder( pRootFolder->m_Folders[iIndex] ) )
return false;
}
for ( int iIndex = pRootFolder->m_Files.Head(); iIndex != pRootFolder->m_Files.InvalidIndex(); iIndex = pRootFolder->m_Files.Next( iIndex ) )
{
if ( !WriteFile( pRootFolder->m_Files[iIndex] ) )
return false;
}
m_XMLWriter.PopNode( true );
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Win32::Save( const char *pOutputFilename )
{
if ( !m_XMLWriter.Open( pOutputFilename ) )
return false;
bool bValid = WriteToXML();
m_XMLWriter.Close();
return bValid;
}
bool CProjectGenerator_Win32::WriteNULLTool( const char *pToolName, const CProjectConfiguration *pConfig )
{
if ( pConfig->m_bIsFileConfig )
return true;
m_XMLWriter.PushNode( "Tool" );
m_XMLWriter.Write( CFmtStr( "Name=\"%s\"", pToolName ) );
m_XMLWriter.PopNode( false );
return true;
}
bool CProjectGenerator_Win32::WriteTool( const char *pToolName, const CProjectTool *pProjectTool )
{
if ( !pProjectTool )
{
// not an error, some tools n/a for a config
return true;
}
m_XMLWriter.PushNode( "Tool" );
m_XMLWriter.Write( CFmtStr( "Name=\"%s\"", pToolName ) );
for ( int i = 0; i < pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder[i];
WriteProperty( &pProjectTool->m_PropertyStates.m_Properties[sortedIndex] );
}
m_XMLWriter.PopNode( false );
return true;
}
bool CProjectGenerator_Win32::WriteProperty( const PropertyState_t *pPropertyState, const char *pOutputName, const char *pOutputValue )
{
if ( !pPropertyState )
{
m_XMLWriter.Write( CFmtStrMax( "%s=\"%s\"", pOutputName, pOutputValue ) );
return true;
}
if ( !pOutputName )
{
pOutputName = pPropertyState->m_pToolProperty->m_OutputString.Get();
if ( !pOutputName[0] )
{
pOutputName = pPropertyState->m_pToolProperty->m_ParseString.Get();
if ( pOutputName[0] == '$' )
{
pOutputName++;
}
}
}
if ( pPropertyState )
{
switch ( pPropertyState->m_pToolProperty->m_nType )
{
case PT_BOOLEAN:
{
bool bEnabled = Sys_StringToBool( pPropertyState->m_StringValue.Get() );
if ( pPropertyState->m_pToolProperty->m_bInvertOutput )
{
bEnabled ^= 1;
}
m_XMLWriter.Write( CFmtStrMax( "%s=\"%s\"", pOutputName, bEnabled ? "true" : "false" ) );
}
break;
case PT_STRING:
m_XMLWriter.Write( CFmtStrMax( "%s=\"%s\"", pOutputName, m_XMLWriter.FixupXMLString( pPropertyState->m_StringValue.Get() ) ) );
break;
case PT_LIST:
case PT_INTEGER:
m_XMLWriter.Write( CFmtStrMax( "%s=\"%s\"", pOutputName, pPropertyState->m_StringValue.Get() ) );
break;
case PT_IGNORE:
break;
default:
g_pVPC->VPCError( "CProjectGenerator_Win32: WriteProperty, %s - not implemented", pOutputName );
}
}
return true;
}

View File

@@ -0,0 +1,41 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef PROJECTGENERATOR_WIN32_H
#define PROJECTGENERATOR_WIN32_H
#ifdef _WIN32
#pragma once
#endif
#define PROPERTYNAME( X, Y ) X##_##Y,
enum Win32Properties_e
{
#include "projectgenerator_win32.inc"
};
class CProjectGenerator_Win32 : public IVCProjWriter
{
public:
CProjectGenerator_Win32();
IBaseProjectGenerator *GetProjectGenerator() { return m_pVCProjGenerator; }
virtual bool Save( const char *pOutputFilename );
private:
bool WriteToXML();
bool WriteFolder( CProjectFolder *pFolder );
bool WriteFile( CProjectFile *pFile );
bool WriteConfiguration( CProjectConfiguration *pConfig );
bool WriteProperty( const PropertyState_t *pPropertyState, const char *pOutputName = NULL, const char *pValue = NULL );
bool WriteTool( const char *pToolName, const CProjectTool *pProjectTool );
bool WriteNULLTool( const char *pToolName, const CProjectConfiguration *pConfig );
CXMLWriter m_XMLWriter;
CVCProjGenerator *m_pVCProjGenerator;
};
#endif // PROJECTGENERATOR_WIN32_H

View File

@@ -0,0 +1,252 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Property Enumerations
//
//=====================================================================================//
// Config
PROPERTYNAME( WIN32_GENERAL, ExcludedFromBuild )
PROPERTYNAME( WIN32_GENERAL, OutputDirectory )
PROPERTYNAME( WIN32_GENERAL, IntermediateDirectory )
PROPERTYNAME( WIN32_GENERAL, ConfigurationType )
PROPERTYNAME( WIN32_GENERAL, CharacterSet )
PROPERTYNAME( WIN32_GENERAL, WholeProgramOptimization )
PROPERTYNAME( WIN32_GENERAL, ExtensionsToDeleteOnClean )
PROPERTYNAME( WIN32_GENERAL, BuildLogFile )
PROPERTYNAME( WIN32_GENERAL, InheritedProjectPropertySheets )
PROPERTYNAME( WIN32_GENERAL, UseOfMFC )
PROPERTYNAME( WIN32_GENERAL, UseOfATL )
PROPERTYNAME( WIN32_GENERAL, MinimizeCRTUseInATL )
// Debugging
PROPERTYNAME( WIN32_DEBUGGING, Command )
PROPERTYNAME( WIN32_DEBUGGING, CommandArguments )
PROPERTYNAME( WIN32_DEBUGGING, RemoteMachine )
PROPERTYNAME( WIN32_DEBUGGING, WorkingDirectory )
PROPERTYNAME( WIN32_DEBUGGING, Attach )
PROPERTYNAME( WIN32_DEBUGGING, DebuggerType )
PROPERTYNAME( WIN32_DEBUGGING, Environment )
PROPERTYNAME( WIN32_DEBUGGING, MergeEnvironment )
PROPERTYNAME( WIN32_DEBUGGING, SQLDebugging )
// Compiler
PROPERTYNAME( WIN32_COMPILER, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_COMPILER, AdditionalOptions )
PROPERTYNAME( WIN32_COMPILER, Optimization )
PROPERTYNAME( WIN32_COMPILER, InlineFunctionExpansion )
PROPERTYNAME( WIN32_COMPILER, EnableIntrinsicFunctions )
PROPERTYNAME( WIN32_COMPILER, FavorSizeOrSpeed )
PROPERTYNAME( WIN32_COMPILER, EnableFiberSafeOptimizations )
PROPERTYNAME( WIN32_COMPILER, WholeProgramOptimization )
PROPERTYNAME( WIN32_COMPILER, AdditionalIncludeDirectories )
PROPERTYNAME( WIN32_COMPILER, PreprocessorDefinitions )
PROPERTYNAME( WIN32_COMPILER, IgnoreStandardIncludePath )
PROPERTYNAME( WIN32_COMPILER, GeneratePreprocessedFile )
PROPERTYNAME( WIN32_COMPILER, KeepComments )
PROPERTYNAME( WIN32_COMPILER, EnableStringPooling )
PROPERTYNAME( WIN32_COMPILER, EnableMinimalRebuild )
PROPERTYNAME( WIN32_COMPILER, EnableCPPExceptions )
PROPERTYNAME( WIN32_COMPILER, BasicRuntimeChecks )
PROPERTYNAME( WIN32_COMPILER, SmallerTypeCheck )
PROPERTYNAME( WIN32_COMPILER, RuntimeLibrary )
PROPERTYNAME( WIN32_COMPILER, StructMemberAlignment )
PROPERTYNAME( WIN32_COMPILER, BufferSecurityCheck )
PROPERTYNAME( WIN32_COMPILER, EnableFunctionLevelLinking )
PROPERTYNAME( WIN32_COMPILER, EnableEnhancedInstructionSet )
PROPERTYNAME( WIN32_COMPILER, FloatingPointModel )
PROPERTYNAME( WIN32_COMPILER, EnableFloatingPointExceptions )
PROPERTYNAME( WIN32_COMPILER, DisableLanguageExtensions )
PROPERTYNAME( WIN32_COMPILER, DefaultCharUnsigned )
PROPERTYNAME( WIN32_COMPILER, TreatWCHAR_TAsBuiltInType )
PROPERTYNAME( WIN32_COMPILER, ForceConformanceInForLoopScope )
PROPERTYNAME( WIN32_COMPILER, EnableRunTimeTypeInfo )
PROPERTYNAME( WIN32_COMPILER, OpenMPSupport )
PROPERTYNAME( WIN32_COMPILER, CreateUsePrecompiledHeader )
PROPERTYNAME( WIN32_COMPILER, CreateUsePCHThroughFile )
PROPERTYNAME( WIN32_COMPILER, PrecompiledHeaderFile )
PROPERTYNAME( WIN32_COMPILER, ExpandAttributedSource )
PROPERTYNAME( WIN32_COMPILER, AssemblerOutput )
PROPERTYNAME( WIN32_COMPILER, ASMListLocation )
PROPERTYNAME( WIN32_COMPILER, ObjectFileName )
PROPERTYNAME( WIN32_COMPILER, ProgramDatabaseFileName )
PROPERTYNAME( WIN32_COMPILER, GenerateXMLDocumentationFiles )
PROPERTYNAME( WIN32_COMPILER, EnableBrowseInformation )
PROPERTYNAME( WIN32_COMPILER, BrowseFile )
PROPERTYNAME( WIN32_COMPILER, WarningLevel )
PROPERTYNAME( WIN32_COMPILER, TreatWarningsAsErrors )
PROPERTYNAME( WIN32_COMPILER, Detect64bitPortabilityIssues )
PROPERTYNAME( WIN32_COMPILER, SuppressStartupBanner )
PROPERTYNAME( WIN32_COMPILER, DebugInformationFormat )
PROPERTYNAME( WIN32_COMPILER, CompileAs )
PROPERTYNAME( WIN32_COMPILER, ForceIncludes )
PROPERTYNAME( WIN32_COMPILER, ShowIncludes )
PROPERTYNAME( WIN32_COMPILER, UndefineAllPreprocessorDefinitions )
PROPERTYNAME( WIN32_COMPILER, UndefinePreprocessorDefinitions )
PROPERTYNAME( WIN32_COMPILER, UseFullPaths )
PROPERTYNAME( WIN32_COMPILER, OmitDefaultLibraryNames )
PROPERTYNAME( WIN32_COMPILER, TrapIntegerDividesOptimization )
PROPERTYNAME( WIN32_COMPILER, PreschedulingOptimization )
PROPERTYNAME( WIN32_COMPILER, InlineAssemblyOptimization )
PROPERTYNAME( WIN32_COMPILER, RegisterReservation )
PROPERTYNAME( WIN32_COMPILER, Stalls )
PROPERTYNAME( WIN32_COMPILER, CallAttributedProfiling )
PROPERTYNAME( WIN32_COMPILER, XMLDocumentationFileName )
PROPERTYNAME( WIN32_COMPILER, DisableSpecificWarnings )
PROPERTYNAME( WIN32_COMPILER, ResolveUsingReferences )
PROPERTYNAME( WIN32_COMPILER, OmitFramePointers )
PROPERTYNAME( WIN32_COMPILER, CallingConvention )
PROPERTYNAME( WIN32_COMPILER, ForceUsing )
PROPERTYNAME( WIN32_COMPILER, ErrorReporting )
// Librarian
PROPERTYNAME( WIN32_LIBRARIAN, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_LIBRARIAN, AdditionalDependencies )
PROPERTYNAME( WIN32_LIBRARIAN, OutputFile )
PROPERTYNAME( WIN32_LIBRARIAN, AdditionalLibraryDirectories )
PROPERTYNAME( WIN32_LIBRARIAN, SuppressStartupBanner )
PROPERTYNAME( WIN32_LIBRARIAN, ModuleDefinitionFileName )
PROPERTYNAME( WIN32_LIBRARIAN, IgnoreAllDefaultLibraries )
PROPERTYNAME( WIN32_LIBRARIAN, IgnoreSpecificLibrary )
PROPERTYNAME( WIN32_LIBRARIAN, ExportNamedFunctions )
PROPERTYNAME( WIN32_LIBRARIAN, ForceSymbolReferences )
PROPERTYNAME( WIN32_LIBRARIAN, LinkLibraryDependencies )
PROPERTYNAME( WIN32_LIBRARIAN, AdditionalOptions )
// Linker
PROPERTYNAME( WIN32_LINKER, IgnoreImportLibrary )
PROPERTYNAME( WIN32_LINKER, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_LINKER, AdditionalOptions )
PROPERTYNAME( WIN32_LINKER, AdditionalDependencies )
PROPERTYNAME( WIN32_LINKER, ShowProgress )
PROPERTYNAME( WIN32_LINKER, OutputFile )
PROPERTYNAME( WIN32_LINKER, Version )
PROPERTYNAME( WIN32_LINKER, EnableIncrementalLinking )
PROPERTYNAME( WIN32_LINKER, SuppressStartupBanner )
PROPERTYNAME( WIN32_LINKER, AdditionalLibraryDirectories )
PROPERTYNAME( WIN32_LINKER, GenerateManifest )
PROPERTYNAME( WIN32_LINKER, IgnoreAllDefaultLibraries )
PROPERTYNAME( WIN32_LINKER, IgnoreSpecificLibrary )
PROPERTYNAME( WIN32_LINKER, ModuleDefinitionFile )
PROPERTYNAME( WIN32_LINKER, GenerateDebugInfo )
PROPERTYNAME( WIN32_LINKER, DebuggableAssembly )
PROPERTYNAME( WIN32_LINKER, GenerateProgramDatabaseFile )
PROPERTYNAME( WIN32_LINKER, GenerateMapFile )
PROPERTYNAME( WIN32_LINKER, MapFileName )
PROPERTYNAME( WIN32_LINKER, SubSystem )
PROPERTYNAME( WIN32_LINKER, EnableLargeAddresses )
PROPERTYNAME( WIN32_LINKER, MapExports )
PROPERTYNAME( WIN32_LINKER, StackReserveSize )
PROPERTYNAME( WIN32_LINKER, StackCommitSize )
PROPERTYNAME( WIN32_LINKER, References )
PROPERTYNAME( WIN32_LINKER, EnableCOMDATFolding )
PROPERTYNAME( WIN32_LINKER, LinkTimeCodeGeneration )
PROPERTYNAME( WIN32_LINKER, EntryPoint )
PROPERTYNAME( WIN32_LINKER, NoEntryPoint )
PROPERTYNAME( WIN32_LINKER, SetChecksum )
PROPERTYNAME( WIN32_LINKER, BaseAddress )
PROPERTYNAME( WIN32_LINKER, ImportLibrary )
PROPERTYNAME( WIN32_LINKER, TargetMachine )
PROPERTYNAME( WIN32_LINKER, FixedBaseAddress )
PROPERTYNAME( WIN32_LINKER, ErrorReporting )
PROPERTYNAME( WIN32_LINKER, FunctionOrder )
PROPERTYNAME( WIN32_LINKER, LinkLibraryDependencies )
PROPERTYNAME( WIN32_LINKER, UseLibraryDependencyInputs )
PROPERTYNAME( WIN32_LINKER, ForceSymbolReferences )
PROPERTYNAME( WIN32_LINKER, StripPrivateSymbols )
PROPERTYNAME( WIN32_LINKER, ProfileGuidedDatabase )
PROPERTYNAME( WIN32_LINKER, MergeSections )
PROPERTYNAME( WIN32_LINKER, RegisterOutput )
PROPERTYNAME( WIN32_LINKER, AddModuleToAssembly )
PROPERTYNAME( WIN32_LINKER, EmbedManagedResourceFile )
PROPERTYNAME( WIN32_LINKER, DelayLoadedDLLs )
PROPERTYNAME( WIN32_LINKER, AssemblyLinkResource )
PROPERTYNAME( WIN32_LINKER, ManifestFile )
PROPERTYNAME( WIN32_LINKER, AdditionalManifestDependencies )
PROPERTYNAME( WIN32_LINKER, AllowIsolation )
PROPERTYNAME( WIN32_LINKER, HeapReserveSize )
PROPERTYNAME( WIN32_LINKER, HeapCommitSize )
PROPERTYNAME( WIN32_LINKER, TerminalServer )
PROPERTYNAME( WIN32_LINKER, SwapRunFromCD )
PROPERTYNAME( WIN32_LINKER, SwapRunFromNetwork )
PROPERTYNAME( WIN32_LINKER, Driver )
PROPERTYNAME( WIN32_LINKER, OptimizeForWindows98 )
PROPERTYNAME( WIN32_LINKER, MIDLCommands )
PROPERTYNAME( WIN32_LINKER, IgnoreEmbeddedIDL )
PROPERTYNAME( WIN32_LINKER, MergeIDLBaseFileName )
PROPERTYNAME( WIN32_LINKER, TypeLibrary )
PROPERTYNAME( WIN32_LINKER, TypeLibResourceID )
PROPERTYNAME( WIN32_LINKER, TurnOffAssemblyGeneration )
PROPERTYNAME( WIN32_LINKER, DelayLoadedDLL )
PROPERTYNAME( WIN32_LINKER, Profile )
PROPERTYNAME( WIN32_LINKER, CLRThreadAttribute )
PROPERTYNAME( WIN32_LINKER, CLRImageType )
PROPERTYNAME( WIN32_LINKER, KeyFile )
PROPERTYNAME( WIN32_LINKER, KeyContainer )
PROPERTYNAME( WIN32_LINKER, DelaySign )
PROPERTYNAME( WIN32_LINKER, CLRUnmanagedCodeCheck )
// Manifest
PROPERTYNAME( WIN32_MANIFESTTOOL, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_MANIFESTTOOL, SuppressStartupBanner )
PROPERTYNAME( WIN32_MANIFESTTOOL, VerboseOutput )
PROPERTYNAME( WIN32_MANIFESTTOOL, AssemblyIdentity )
PROPERTYNAME( WIN32_MANIFESTTOOL, UseFAT32WorkAround )
PROPERTYNAME( WIN32_MANIFESTTOOL, AdditionalManifestFiles )
PROPERTYNAME( WIN32_MANIFESTTOOL, InputResourceManifests )
PROPERTYNAME( WIN32_MANIFESTTOOL, EmbedManifest )
PROPERTYNAME( WIN32_MANIFESTTOOL, OutputManifestFile )
PROPERTYNAME( WIN32_MANIFESTTOOL, ManifestResourceFile )
PROPERTYNAME( WIN32_MANIFESTTOOL, GenerateCatalogFiles )
PROPERTYNAME( WIN32_MANIFESTTOOL, DependencyInformationFile )
PROPERTYNAME( WIN32_MANIFESTTOOL, TypeLibraryFile )
PROPERTYNAME( WIN32_MANIFESTTOOL, RegistrarScriptFile )
PROPERTYNAME( WIN32_MANIFESTTOOL, ComponentFileName )
PROPERTYNAME( WIN32_MANIFESTTOOL, ReplacementsFile )
PROPERTYNAME( WIN32_MANIFESTTOOL, UpdateFileHashes )
PROPERTYNAME( WIN32_MANIFESTTOOL, UpdateFileHashesSearchPath )
PROPERTYNAME( WIN32_MANIFESTTOOL, AdditionalOptions )
// XML Document Generator
PROPERTYNAME( WIN32_XMLDOCUMENTGENERATOR, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_XMLDOCUMENTGENERATOR, SuppressStartupBanner )
PROPERTYNAME( WIN32_XMLDOCUMENTGENERATOR, ValidateIntelliSense )
PROPERTYNAME( WIN32_XMLDOCUMENTGENERATOR, AdditionalDocumentFiles )
PROPERTYNAME( WIN32_XMLDOCUMENTGENERATOR, OutputDocumentFile )
PROPERTYNAME( WIN32_XMLDOCUMENTGENERATOR, DocumentLibraryDependencies )
PROPERTYNAME( WIN32_XMLDOCUMENTGENERATOR, AdditionalOptions )
// Browse Information
PROPERTYNAME( WIN32_BROWSEINFORMATION, SuppressStartupBanner )
PROPERTYNAME( WIN32_BROWSEINFORMATION, OutputFile )
PROPERTYNAME( WIN32_BROWSEINFORMATION, AdditionalOptions )
// Resources
PROPERTYNAME( WIN32_RESOURCES, PreprocessorDefinitions )
PROPERTYNAME( WIN32_RESOURCES, Culture )
PROPERTYNAME( WIN32_RESOURCES, AdditionalIncludeDirectories )
PROPERTYNAME( WIN32_RESOURCES, IgnoreStandardIncludePath )
PROPERTYNAME( WIN32_RESOURCES, ShowProgress )
PROPERTYNAME( WIN32_RESOURCES, ResourceFileName )
PROPERTYNAME( WIN32_RESOURCES, AdditionalOptions )
// Pre Build
PROPERTYNAME( WIN32_PREBUILDEVENT, Description )
PROPERTYNAME( WIN32_PREBUILDEVENT, CommandLine )
PROPERTYNAME( WIN32_PREBUILDEVENT, ExcludedFromBuild )
// Pre Link
PROPERTYNAME( WIN32_PRELINKEVENT, Description )
PROPERTYNAME( WIN32_PRELINKEVENT, CommandLine )
PROPERTYNAME( WIN32_PRELINKEVENT, ExcludedFromBuild )
// Post Build
PROPERTYNAME( WIN32_POSTBUILDEVENT, Description )
PROPERTYNAME( WIN32_POSTBUILDEVENT, CommandLine )
PROPERTYNAME( WIN32_POSTBUILDEVENT, ExcludedFromBuild )
// Custom Build
PROPERTYNAME( WIN32_CUSTOMBUILDSTEP, Description )
PROPERTYNAME( WIN32_CUSTOMBUILDSTEP, CommandLine )
PROPERTYNAME( WIN32_CUSTOMBUILDSTEP, AdditionalDependencies )
PROPERTYNAME( WIN32_CUSTOMBUILDSTEP, Outputs )

View File

@@ -0,0 +1,625 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
#undef PROPERTYNAME
#define PROPERTYNAME( X, Y ) { X##_##Y, #X, #Y },
static PropertyName_t s_Win32PropertyNames_2010[] =
{
#include "projectgenerator_win32_2010.inc"
{ -1, NULL, NULL }
};
IBaseProjectGenerator* GetWin32ProjectGenerator_2010()
{
static CProjectGenerator_Win32_2010 *s_pProjectGenerator = NULL;
if ( !s_pProjectGenerator )
{
s_pProjectGenerator = new CProjectGenerator_Win32_2010();
}
return s_pProjectGenerator->GetProjectGenerator();
}
CProjectGenerator_Win32_2010::CProjectGenerator_Win32_2010()
{
m_pVCProjGenerator = new CVCProjGenerator();
m_pVCProjGenerator->SetupGeneratorDefinition( this, "win32_2010.def", s_Win32PropertyNames_2010 );
}
enum TypeKeyNames_e
{
TKN_LIBRARY = 0,
TKN_INCLUDE,
TKN_COMPILE,
TKN_RESOURCECOMPILE,
TKN_CUSTOMBUILD,
TKN_NONE,
TKN_MAX_COUNT,
};
static const char *s_TypeKeyNames[] =
{
"Library",
"ClInclude",
"ClCompile",
"ResourceCompile",
"CustomBuild",
"None"
};
const char *CProjectGenerator_Win32_2010::GetKeyNameForFile( CProjectFile *pFile )
{
COMPILE_TIME_ASSERT( ARRAYSIZE( s_TypeKeyNames ) == TKN_MAX_COUNT );
const char *pExtension = V_GetFileExtension( pFile->m_Name.Get() );
const char *pKeyName = s_TypeKeyNames[TKN_NONE];
if ( pExtension )
{
if ( pFile->m_Configs.Count() && pFile->m_Configs[0]->GetCustomBuildTool() )
{
pKeyName = s_TypeKeyNames[TKN_CUSTOMBUILD];
}
else if ( IsCFileExtension( pExtension ) )
{
pKeyName = s_TypeKeyNames[TKN_COMPILE];
}
else if ( IsHFileExtension( pExtension ) )
{
pKeyName = s_TypeKeyNames[TKN_INCLUDE];
}
else if ( !V_stricmp( pExtension, "lib" ) )
{
pKeyName = s_TypeKeyNames[TKN_LIBRARY];
}
else if ( !V_stricmp( pExtension, "rc" ) )
{
pKeyName = s_TypeKeyNames[TKN_RESOURCECOMPILE];
}
}
return pKeyName;
}
bool CProjectGenerator_Win32_2010::WritePropertyGroupTool( CProjectTool *pProjectTool, CProjectConfiguration *pConfiguration )
{
if ( !pProjectTool )
return true;
for ( int i = 0; i < pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder[i];
if ( !pProjectTool->m_PropertyStates.m_Properties[sortedIndex].m_pToolProperty->m_bEmitAsGlobalProperty )
continue;
if ( !WriteProperty( &pProjectTool->m_PropertyStates.m_Properties[sortedIndex], true, pConfiguration->m_Name.Get() ) )
return false;
}
return true;
}
bool CProjectGenerator_Win32_2010::WriteFile( CProjectFile *pFile, const char *pFileTypeName )
{
const char *pKeyName = GetKeyNameForFile( pFile );
if ( V_stricmp( pFileTypeName, pKeyName ) )
{
// skip it
return true;
}
if ( !pFile->m_Configs.Count() )
{
m_XMLWriter.Write( CFmtStrMax( "<%s Include=\"%s\" />", pKeyName, pFile->m_Name.Get() ) );
}
else
{
m_XMLWriter.PushNode( pKeyName, CFmtStr( "Include=\"%s\"", pFile->m_Name.Get() ) );
for ( int i = 0; i < pFile->m_Configs.Count(); i++ )
{
if ( !WriteConfiguration( pFile->m_Configs[i] ) )
return false;
}
m_XMLWriter.PopNode( true );
}
return true;
}
bool CProjectGenerator_Win32_2010::WriteFolder( CProjectFolder *pFolder, const char *pFileTypeName, int nDepth )
{
if ( !nDepth )
{
m_XMLWriter.PushNode( "ItemGroup" );
}
for ( int iIndex = pFolder->m_Files.Head(); iIndex != pFolder->m_Files.InvalidIndex(); iIndex = pFolder->m_Files.Next( iIndex ) )
{
if ( !WriteFile( pFolder->m_Files[iIndex], pFileTypeName ) )
return false;
}
for ( int iIndex = pFolder->m_Folders.Head(); iIndex != pFolder->m_Folders.InvalidIndex(); iIndex = pFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolder( pFolder->m_Folders[iIndex], pFileTypeName, nDepth+1 ) )
return false;
}
if ( !nDepth )
{
m_XMLWriter.PopNode( true );
}
return true;
}
bool CProjectGenerator_Win32_2010::WriteConfiguration( CProjectConfiguration *pConfig )
{
if ( !pConfig->m_bIsFileConfig )
{
const char *pTargetPlatformName = g_pVPC->IsPlatformDefined( "win64" ) ? "x64" : "Win32";
m_XMLWriter.PushNode( "PropertyGroup", CFmtStr( "Condition=\"'$(Configuration)|$(Platform)'=='%s|%s'\" Label=\"Configuration\"", pConfig->m_Name.Get(), pTargetPlatformName ) );
for ( int i = 0; i < pConfig->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pConfig->m_PropertyStates.m_PropertiesInOutputOrder[i];
if ( pConfig->m_PropertyStates.m_Properties[sortedIndex].m_pToolProperty->m_bEmitAsGlobalProperty )
continue;
if ( !WriteProperty( &pConfig->m_PropertyStates.m_Properties[sortedIndex] ) )
return false;
}
m_XMLWriter.PopNode( true );
}
else
{
for ( int i = 0; i < pConfig->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pConfig->m_PropertyStates.m_PropertiesInOutputOrder[i];
if ( !WriteProperty( &pConfig->m_PropertyStates.m_Properties[sortedIndex], true, pConfig->m_Name.Get() ) )
return false;
}
if ( !WriteTool( "ClCompile", pConfig->GetCompilerTool(), pConfig ) )
return false;
if ( !WriteTool( "CustomBuildStep", pConfig->GetCustomBuildTool(), pConfig ) )
return false;
}
return true;
}
bool CProjectGenerator_Win32_2010::WriteTools( CProjectConfiguration *pConfig )
{
const char *pTargetPlatformName = g_pVPC->IsPlatformDefined( "win64" ) ? "x64" : "Win32";
m_XMLWriter.PushNode( "ItemDefinitionGroup", CFmtStr( "Condition=\"'$(Configuration)|$(Platform)'=='%s|%s'\"", pConfig->m_Name.Get(), pTargetPlatformName ) );
if ( !WriteTool( "PreBuildEvent", pConfig->GetPreBuildEventTool(), pConfig ) )
return false;
if ( !WriteTool( "ClCompile", pConfig->GetCompilerTool(), pConfig ) )
return false;
if ( !WriteTool( "ResourceCompile", pConfig->GetResourcesTool(), pConfig ) )
return false;
if ( !WriteTool( "PreLinkEvent", pConfig->GetPreLinkEventTool(), pConfig ) )
return false;
if ( !WriteTool( "Link", pConfig->GetLinkerTool(), pConfig ) )
return false;
if ( !WriteTool( "Lib", pConfig->GetLibrarianTool(), pConfig ) )
return false;
if ( !WriteTool( "Manifest", pConfig->GetManifestTool(), pConfig ) )
return false;
if ( !WriteTool( "Xdcmake", pConfig->GetXMLDocGenTool(), pConfig ) )
return false;
if ( !WriteTool( "Bscmake", pConfig->GetBrowseInfoTool(), pConfig ) )
return false;
if ( !WriteTool( "PostBuildEvent", pConfig->GetPostBuildEventTool(), pConfig ) )
return false;
if ( !WriteTool( "CustomBuildStep", pConfig->GetCustomBuildTool(), pConfig ) )
return false;
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Win32_2010::WritePrimaryXML( const char *pOutputFilename )
{
if ( !m_XMLWriter.Open( pOutputFilename, true ) )
return false;
const char *pTargetPlatformName = g_pVPC->IsPlatformDefined( "win64" ) ? "x64" : "Win32";
m_XMLWriter.PushNode( "Project", "DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"" );
m_XMLWriter.PushNode( "ItemGroup", "Label=\"ProjectConfigurations\"" );
CUtlVector< CUtlString > configurationNames;
m_pVCProjGenerator->GetAllConfigurationNames( configurationNames );
const char *pPlatformString = "Win32";
if ( g_pVPC->IsPlatformDefined( "WIN64" ) )
pPlatformString = "x64";
for ( int i = 0; i < configurationNames.Count(); i++ )
{
m_XMLWriter.PushNode( "ProjectConfiguration", CFmtStr( "Include=\"%s|%s\"", configurationNames[i].Get(), pTargetPlatformName ) );
m_XMLWriter.WriteLineNode( "Configuration", "", configurationNames[i].Get() );
m_XMLWriter.WriteLineNode( "Platform", "", CFmtStr( "%s", pTargetPlatformName ) );
m_XMLWriter.PopNode( true );
}
m_XMLWriter.PopNode( true );
m_XMLWriter.PushNode( "PropertyGroup", "Label=\"Globals\"" );
m_XMLWriter.WriteLineNode( "ProjectName", "", m_pVCProjGenerator->GetProjectName().Get() );
m_XMLWriter.WriteLineNode( "ProjectGuid", "", m_pVCProjGenerator->GetGUIDString().Get() );
if ( g_pVPC->BUseP4SCC() )
{
m_XMLWriter.WriteLineNode( "SccProjectName", "", "Perforce Project" );
// it looks like 2k10 (at least) doesn't hook files in the project but not under
// the project root into source control, so make all the projects local paths
// the solution dir
char szCurrentDirectory[MAX_PATH];
V_GetCurrentDirectory( szCurrentDirectory, V_ARRAYSIZE( szCurrentDirectory ) );
char szRelativeFilename[MAX_PATH];
if ( !V_MakeRelativePath( g_pVPC->GetStartDirectory(), szCurrentDirectory, szRelativeFilename, sizeof( szRelativeFilename ) ) )
V_strncpy( szRelativeFilename, ".", V_ARRAYSIZE( szRelativeFilename ) );
m_XMLWriter.WriteLineNode( "SccLocalPath", "", szRelativeFilename );
m_XMLWriter.WriteLineNode( "SccProvider", "", "MSSCCI:Perforce SCM" );
}
m_XMLWriter.PopNode( true );
m_XMLWriter.Write( "<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />" );
// When building 64 bit, use 64 bit toolchain (there is no 64 bit toolchain for 32 bit projects).
// This property is written early/specially to ensure it is written prior to Microsoft.Cpp.props
if ( g_pVPC->IsPlatformDefined( "win64" ) && !g_pVPC->BUse32BitTools() )
{
m_XMLWriter.PushNode( "PropertyGroup" );
m_XMLWriter.WriteLineNode( "PreferredToolArchitecture", NULL, "x64" );
m_XMLWriter.PopNode( true );
}
// write the root configurations
for ( int i = 0; i < configurationNames.Count(); i++ )
{
CProjectConfiguration *pConfiguration = NULL;
if ( m_pVCProjGenerator->GetRootConfiguration( configurationNames[i].Get(), &pConfiguration ) )
{
if ( !WriteConfiguration( pConfiguration ) )
return false;
}
}
m_XMLWriter.Write( "<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />" );
m_XMLWriter.PushNode( "ImportGroup", "Label=\"ExtensionSettings\"" );
m_XMLWriter.PopNode( true );
for ( int i = 0; i < configurationNames.Count(); i++ )
{
m_XMLWriter.PushNode( "ImportGroup", CFmtStr( "Condition=\"'$(Configuration)|$(Platform)'=='%s|%s'\" Label=\"PropertySheets\"", configurationNames[i].Get(), pTargetPlatformName ) );
m_XMLWriter.Write( "<Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />" );
m_XMLWriter.PopNode( true );
}
m_XMLWriter.Write( "<PropertyGroup Label=\"UserMacros\" />" );
m_XMLWriter.PushNode( "PropertyGroup" );
m_XMLWriter.WriteLineNode( "_ProjectFileVersion", "", "10.0.30319.1" );
for ( int i = 0; i < configurationNames.Count(); i++ )
{
CProjectConfiguration *pConfiguration = NULL;
if ( m_pVCProjGenerator->GetRootConfiguration( configurationNames[i].Get(), &pConfiguration ) )
{
for ( int j = 0; j < pConfiguration->m_PropertyStates.m_PropertiesInOutputOrder.Count(); j++ )
{
int sortedIndex = pConfiguration->m_PropertyStates.m_PropertiesInOutputOrder[j];
if ( !pConfiguration->m_PropertyStates.m_Properties[sortedIndex].m_pToolProperty->m_bEmitAsGlobalProperty )
continue;
if ( !WriteProperty( &pConfiguration->m_PropertyStates.m_Properties[sortedIndex], true, pConfiguration->m_Name.Get() ) )
return false;
}
if ( !WritePropertyGroupTool( pConfiguration->GetPreBuildEventTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetPreLinkEventTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetLinkerTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetLibrarianTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetPostBuildEventTool(), pConfiguration ) )
return false;
}
}
m_XMLWriter.PopNode( true );
// write the tool configurations
for ( int i = 0; i < configurationNames.Count(); i++ )
{
CProjectConfiguration *pConfiguration = NULL;
if ( m_pVCProjGenerator->GetRootConfiguration( configurationNames[i].Get(), &pConfiguration ) )
{
if ( !WriteTools( pConfiguration ) )
return false;
}
}
// write root folders
for ( int i = 0; i < TKN_MAX_COUNT; i++ )
{
if ( !WriteFolder( m_pVCProjGenerator->GetRootFolder(), s_TypeKeyNames[i], 0 ) )
return false;
}
m_XMLWriter.Write( "<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />" );
m_XMLWriter.PushNode( "ImportGroup", "Label=\"ExtensionTargets\"" );
m_XMLWriter.PopNode( true );
m_XMLWriter.PopNode( true );
m_XMLWriter.Close();
return true;
}
bool CProjectGenerator_Win32_2010::WriteFolderToSecondaryXML( CProjectFolder *pFolder, const char *pParentPath )
{
CUtlString parentPath = CFmtStr( "%s%s%s", pParentPath, pParentPath[0] ? "\\" : "", pFolder->m_Name.Get() );
MD5Context_t ctx;
unsigned char digest[MD5_DIGEST_LENGTH];
V_memset( &ctx, 0, sizeof( ctx ) );
V_memset( digest, 0, sizeof( digest ) );
MD5Init( &ctx );
MD5Update( &ctx, (unsigned char *)parentPath.Get(), strlen( parentPath.Get() ) );
MD5Final( digest, &ctx );
char szMD5[64];
V_binarytohex( digest, MD5_DIGEST_LENGTH, szMD5, sizeof( szMD5 ) );
V_strupr( szMD5 );
char szGUID[MAX_PATH];
V_snprintf( szGUID, sizeof( szGUID ), "{%8.8s-%4.4s-%4.4s-%4.4s-%12.12s}", szMD5, &szMD5[8], &szMD5[12], &szMD5[16], &szMD5[20] );
m_XMLFilterWriter.PushNode( "Filter", CFmtStr( "Include=\"%s\"", parentPath.Get() ) );
m_XMLFilterWriter.WriteLineNode( "UniqueIdentifier", "", szGUID );
m_XMLFilterWriter.PopNode( true );
for ( int iIndex = pFolder->m_Folders.Head(); iIndex != pFolder->m_Folders.InvalidIndex(); iIndex = pFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolderToSecondaryXML( pFolder->m_Folders[iIndex], parentPath.Get() ) )
return false;
}
return true;
}
bool CProjectGenerator_Win32_2010::WriteFileToSecondaryXML( CProjectFile *pFile, const char *pParentPath, const char *pFileTypeName )
{
const char *pKeyName = GetKeyNameForFile( pFile );
if ( V_stricmp( pFileTypeName, pKeyName ) )
{
// skip it
return true;
}
if ( pParentPath )
{
m_XMLFilterWriter.PushNode( pKeyName, CFmtStr( "Include=\"%s\"", pFile->m_Name.Get() ) );
m_XMLFilterWriter.WriteLineNode( "Filter", "", pParentPath );
m_XMLFilterWriter.PopNode( true );
}
else
{
m_XMLFilterWriter.Write( CFmtStr( "<%s Include=\"%s\" />", pKeyName, pFile->m_Name.Get() ) );
}
return true;
}
bool CProjectGenerator_Win32_2010::WriteFolderContentsToSecondaryXML( CProjectFolder *pFolder, const char *pParentPath, const char *pFileTypeName, int nDepth )
{
CUtlString parentPath;
if ( pParentPath )
{
parentPath = CFmtStr( "%s%s%s", pParentPath, pParentPath[0] ? "\\" : "", pFolder->m_Name.Get() );
}
if ( !nDepth )
{
m_XMLFilterWriter.PushNode( "ItemGroup", NULL );
}
for ( int iIndex = pFolder->m_Files.Head(); iIndex != pFolder->m_Files.InvalidIndex(); iIndex = pFolder->m_Files.Next( iIndex ) )
{
if ( !WriteFileToSecondaryXML( pFolder->m_Files[iIndex], parentPath.Get(), pFileTypeName ) )
return false;
}
for ( int iIndex = pFolder->m_Folders.Head(); iIndex != pFolder->m_Folders.InvalidIndex(); iIndex = pFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolderContentsToSecondaryXML( pFolder->m_Folders[iIndex], parentPath.Get(), pFileTypeName, nDepth+1 ) )
return false;
}
if ( !nDepth )
{
m_XMLFilterWriter.PopNode( true );
}
return true;
}
bool CProjectGenerator_Win32_2010::WriteSecondaryXML( const char *pOutputFilename )
{
if ( !m_XMLFilterWriter.Open( pOutputFilename, true ) )
return false;
m_XMLFilterWriter.PushNode( "Project", "ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"" );
// write the root folders
m_XMLFilterWriter.PushNode( "ItemGroup", NULL );
CProjectFolder *pRootFolder = m_pVCProjGenerator->GetRootFolder();
for ( int iIndex = pRootFolder->m_Folders.Head(); iIndex != pRootFolder->m_Folders.InvalidIndex(); iIndex = pRootFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolderToSecondaryXML( pRootFolder->m_Folders[iIndex], "" ) )
return false;
}
m_XMLFilterWriter.PopNode( true );
// write folder contents
for ( int i = 0; i < TKN_MAX_COUNT; i++ )
{
if ( !WriteFolderContentsToSecondaryXML( pRootFolder, NULL, s_TypeKeyNames[i], 0 ) )
return false;
}
m_XMLFilterWriter.PopNode( true );
m_XMLFilterWriter.Close();
return true;
}
bool CProjectGenerator_Win32_2010::WriteTool( const char *pToolName, const CProjectTool *pProjectTool, CProjectConfiguration *pConfig )
{
if ( !pProjectTool )
{
// not an error, some tools n/a for a config
return true;
}
if ( !pConfig->m_bIsFileConfig )
{
m_XMLWriter.PushNode( pToolName, NULL );
}
for ( int i = 0; i < pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder[i];
if ( !pConfig->m_bIsFileConfig )
{
if ( pProjectTool->m_PropertyStates.m_Properties[sortedIndex].m_pToolProperty->m_bEmitAsGlobalProperty )
continue;
if ( !WriteProperty( &pProjectTool->m_PropertyStates.m_Properties[sortedIndex] ) )
return false;
}
else
{
if ( !WriteProperty( &pProjectTool->m_PropertyStates.m_Properties[sortedIndex], true, pConfig->m_Name.Get() ) )
return false;
}
}
if ( !pConfig->m_bIsFileConfig )
{
m_XMLWriter.PopNode( true );
}
return true;
}
bool CProjectGenerator_Win32_2010::WriteProperty( const PropertyState_t *pPropertyState, bool bEmitConfiguration, const char *pConfigName, const char *pOutputName, const char *pOutputValue )
{
if ( !pPropertyState )
{
m_XMLWriter.WriteLineNode( pOutputName, "", pOutputValue );
return true;
}
if ( !pOutputName )
{
pOutputName = pPropertyState->m_pToolProperty->m_OutputString.Get();
if ( !pOutputName[0] )
{
pOutputName = pPropertyState->m_pToolProperty->m_ParseString.Get();
if ( pOutputName[0] == '$' )
{
pOutputName++;
}
}
}
const char *pCondition = "";
CUtlString conditionString;
if ( bEmitConfiguration )
{
const char *pTargetPlatformName = g_pVPC->IsPlatformDefined( "win64" ) ? "x64" : "Win32";
conditionString = CFmtStr( " Condition=\"'$(Configuration)|$(Platform)'=='%s|%s'\"", pConfigName, pTargetPlatformName );
pCondition = conditionString.Get();
}
if ( pPropertyState )
{
switch ( pPropertyState->m_pToolProperty->m_nType )
{
case PT_BOOLEAN:
{
bool bEnabled = Sys_StringToBool( pPropertyState->m_StringValue.Get() );
if ( pPropertyState->m_pToolProperty->m_bInvertOutput )
{
bEnabled ^= 1;
}
m_XMLWriter.WriteLineNode( pOutputName, pCondition, bEnabled ? "true" : "false" );
}
break;
case PT_STRING:
m_XMLWriter.WriteLineNode( pOutputName, pCondition, m_XMLWriter.FixupXMLString( pPropertyState->m_StringValue.Get() ) );
break;
case PT_LIST:
case PT_INTEGER:
m_XMLWriter.WriteLineNode( pOutputName, pCondition, pPropertyState->m_StringValue.Get() );
break;
case PT_IGNORE:
break;
default:
g_pVPC->VPCError( "CProjectGenerator_Win32_2010: WriteProperty, %s - not implemented", pOutputName );
}
}
return true;
}
bool CProjectGenerator_Win32_2010::Save( const char *pOutputFilename )
{
bool bValid = WritePrimaryXML( pOutputFilename );
if ( bValid )
{
bValid = WriteSecondaryXML( CFmtStr( "%s.filters", pOutputFilename ) );
if ( !bValid )
{
g_pVPC->VPCError( "Cannot save to the specified project '%s'", pOutputFilename );
}
}
return bValid;
}

View File

@@ -0,0 +1,54 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef PROJECTGENERATOR_WIN32_2010_H
#define PROJECTGENERATOR_WIN32_2010_H
#ifdef _WIN32
#pragma once
#endif
#define PROPERTYNAME( X, Y ) X##_##Y,
enum Win32_2010_Properties_e
{
#include "projectgenerator_win32_2010.inc"
};
class CProjectGenerator_Win32_2010 : public IVCProjWriter
{
public:
CProjectGenerator_Win32_2010();
IBaseProjectGenerator *GetProjectGenerator() { return m_pVCProjGenerator; }
virtual bool Save( const char *pOutputFilename );
private:
// primary XML - foo.vcxproj
bool WritePrimaryXML( const char *pOutputFilename );
bool WriteFolder( CProjectFolder *pFolder, const char *pFileTypeName, int nDepth );
bool WriteFile( CProjectFile *pFile, const char *pFileTypeName );
bool WriteConfiguration( CProjectConfiguration *pConfig );
bool WriteTools( CProjectConfiguration *pConfig );
bool WriteProperty( const PropertyState_t *pPropertyState, bool bEmitConfiguration = false, const char *pConfigurationName = NULL, const char *pOutputName = NULL, const char *pValue = NULL );
bool WriteTool( const char *pToolName, const CProjectTool *pProjectTool, CProjectConfiguration *pConfig );
bool WriteNULLTool( const char *pToolName, const CProjectConfiguration *pConfig );
bool WritePropertyGroupTool( CProjectTool *pProjectTool, CProjectConfiguration *pConfiguration );
bool WritePropertyGroup();
// secondary XML - foo.vcxproj.filters
bool WriteSecondaryXML( const char *pOutputFilename );
bool WriteFolderToSecondaryXML( CProjectFolder *pFolder, const char *pParentPath );
bool WriteFolderContentsToSecondaryXML( CProjectFolder *pFolder, const char *pParentPath, const char *pFileTypeName, int nDepth );
bool WriteFileToSecondaryXML( CProjectFile *pFile, const char *pParentPath, const char *pFileTypeName );
const char *GetKeyNameForFile( CProjectFile *pFile );
CXMLWriter m_XMLWriter;
CXMLWriter m_XMLFilterWriter;
CVCProjGenerator *m_pVCProjGenerator;
};
#endif // PROJECTGENERATOR_WIN32_2010_H

View File

@@ -0,0 +1,299 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Property Enumerations
//
//=====================================================================================//
// Config
PROPERTYNAME( WIN32_2010_GENERAL, ExcludedFromBuild )
PROPERTYNAME( WIN32_2010_GENERAL, OutputDirectory )
PROPERTYNAME( WIN32_2010_GENERAL, IntermediateDirectory )
PROPERTYNAME( WIN32_2010_GENERAL, ConfigurationType )
PROPERTYNAME( WIN32_2010_GENERAL, CharacterSet )
PROPERTYNAME( WIN32_2010_GENERAL, WholeProgramOptimization )
PROPERTYNAME( WIN32_2010_GENERAL, ExtensionsToDeleteOnClean )
PROPERTYNAME( WIN32_2010_GENERAL, BuildLogFile )
PROPERTYNAME( WIN32_2010_GENERAL, InheritedProjectPropertySheets )
PROPERTYNAME( WIN32_2010_GENERAL, UseOfMFC )
PROPERTYNAME( WIN32_2010_GENERAL, UseOfATL )
PROPERTYNAME( WIN32_2010_GENERAL, MinimizeCRTUseInATL )
PROPERTYNAME( WIN32_2010_GENERAL, TargetName )
PROPERTYNAME( WIN32_2010_GENERAL, TargetExtension )
PROPERTYNAME( WIN32_2010_GENERAL, PlatformToolset )
PROPERTYNAME( WIN32_2010_GENERAL, ExecutableDirectories )
// Debugging
PROPERTYNAME( WIN32_2010_DEBUGGING, Command )
PROPERTYNAME( WIN32_2010_DEBUGGING, CommandArguments )
PROPERTYNAME( WIN32_2010_DEBUGGING, RemoteMachine )
PROPERTYNAME( WIN32_2010_DEBUGGING, WorkingDirectory )
PROPERTYNAME( WIN32_2010_DEBUGGING, Attach )
PROPERTYNAME( WIN32_2010_DEBUGGING, DebuggerType )
PROPERTYNAME( WIN32_2010_DEBUGGING, Environment )
PROPERTYNAME( WIN32_2010_DEBUGGING, MergeEnvironment )
PROPERTYNAME( WIN32_2010_DEBUGGING, SQLDebugging )
// Compiler
PROPERTYNAME( WIN32_2010_COMPILER, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_2010_COMPILER, AdditionalOptions )
PROPERTYNAME( WIN32_2010_COMPILER, Optimization )
PROPERTYNAME( WIN32_2010_COMPILER, InlineFunctionExpansion )
PROPERTYNAME( WIN32_2010_COMPILER, EnableIntrinsicFunctions )
PROPERTYNAME( WIN32_2010_COMPILER, FavorSizeOrSpeed )
PROPERTYNAME( WIN32_2010_COMPILER, EnableFiberSafeOptimizations )
PROPERTYNAME( WIN32_2010_COMPILER, WholeProgramOptimization )
PROPERTYNAME( WIN32_2010_COMPILER, AdditionalIncludeDirectories )
PROPERTYNAME( WIN32_2010_COMPILER, PreprocessorDefinitions )
PROPERTYNAME( WIN32_2010_COMPILER, IgnoreStandardIncludePath )
PROPERTYNAME( WIN32_2010_COMPILER, GeneratePreprocessedFile )
PROPERTYNAME( WIN32_2010_COMPILER, KeepComments )
PROPERTYNAME( WIN32_2010_COMPILER, EnableStringPooling )
PROPERTYNAME( WIN32_2010_COMPILER, EnableMinimalRebuild )
PROPERTYNAME( WIN32_2010_COMPILER, EnableCPPExceptions )
PROPERTYNAME( WIN32_2010_COMPILER, BasicRuntimeChecks )
PROPERTYNAME( WIN32_2010_COMPILER, SmallerTypeCheck )
PROPERTYNAME( WIN32_2010_COMPILER, RuntimeLibrary )
PROPERTYNAME( WIN32_2010_COMPILER, StructMemberAlignment )
PROPERTYNAME( WIN32_2010_COMPILER, BufferSecurityCheck )
PROPERTYNAME( WIN32_2010_COMPILER, EnableFunctionLevelLinking )
PROPERTYNAME( WIN32_2010_COMPILER, EnableEnhancedInstructionSet )
PROPERTYNAME( WIN32_2010_COMPILER, FloatingPointModel )
PROPERTYNAME( WIN32_2010_COMPILER, EnableFloatingPointExceptions )
PROPERTYNAME( WIN32_2010_COMPILER, DisableLanguageExtensions )
PROPERTYNAME( WIN32_2010_COMPILER, DefaultCharUnsigned )
PROPERTYNAME( WIN32_2010_COMPILER, TreatWCHAR_TAsBuiltInType )
PROPERTYNAME( WIN32_2010_COMPILER, ForceConformanceInForLoopScope )
PROPERTYNAME( WIN32_2010_COMPILER, EnableRunTimeTypeInfo )
PROPERTYNAME( WIN32_2010_COMPILER, OpenMPSupport )
PROPERTYNAME( WIN32_2010_COMPILER, PrecompiledHeader )
PROPERTYNAME( WIN32_2010_COMPILER, PrecompiledHeaderFile )
PROPERTYNAME( WIN32_2010_COMPILER, PrecompiledHeaderOutputFile )
PROPERTYNAME( WIN32_2010_COMPILER, ExpandAttributedSource )
PROPERTYNAME( WIN32_2010_COMPILER, AssemblerOutput )
PROPERTYNAME( WIN32_2010_COMPILER, ASMListLocation )
PROPERTYNAME( WIN32_2010_COMPILER, ObjectFileName )
PROPERTYNAME( WIN32_2010_COMPILER, ProgramDatabaseFileName )
PROPERTYNAME( WIN32_2010_COMPILER, GenerateXMLDocumentationFiles )
PROPERTYNAME( WIN32_2010_COMPILER, EnableBrowseInformation )
PROPERTYNAME( WIN32_2010_COMPILER, BrowseFile )
PROPERTYNAME( WIN32_2010_COMPILER, WarningLevel )
PROPERTYNAME( WIN32_2010_COMPILER, TreatWarningsAsErrors )
PROPERTYNAME( WIN32_2010_COMPILER, Detect64bitPortabilityIssues )
PROPERTYNAME( WIN32_2010_COMPILER, SuppressStartupBanner )
PROPERTYNAME( WIN32_2010_COMPILER, DebugInformationFormat )
PROPERTYNAME( WIN32_2010_COMPILER, CompileAs )
PROPERTYNAME( WIN32_2010_COMPILER, ForceIncludes )
PROPERTYNAME( WIN32_2010_COMPILER, ShowIncludes )
PROPERTYNAME( WIN32_2010_COMPILER, UndefineAllPreprocessorDefinitions )
PROPERTYNAME( WIN32_2010_COMPILER, UndefinePreprocessorDefinitions )
PROPERTYNAME( WIN32_2010_COMPILER, UseFullPaths )
PROPERTYNAME( WIN32_2010_COMPILER, OmitDefaultLibraryNames )
PROPERTYNAME( WIN32_2010_COMPILER, TrapIntegerDividesOptimization )
PROPERTYNAME( WIN32_2010_COMPILER, PreschedulingOptimization )
PROPERTYNAME( WIN32_2010_COMPILER, InlineAssemblyOptimization )
PROPERTYNAME( WIN32_2010_COMPILER, RegisterReservation )
PROPERTYNAME( WIN32_2010_COMPILER, Stalls )
PROPERTYNAME( WIN32_2010_COMPILER, CallAttributedProfiling )
PROPERTYNAME( WIN32_2010_COMPILER, XMLDocumentationFileName )
PROPERTYNAME( WIN32_2010_COMPILER, DisableSpecificWarnings )
PROPERTYNAME( WIN32_2010_COMPILER, ResolveUsingReferences )
PROPERTYNAME( WIN32_2010_COMPILER, OmitFramePointers )
PROPERTYNAME( WIN32_2010_COMPILER, CallingConvention )
PROPERTYNAME( WIN32_2010_COMPILER, ForceUsing )
PROPERTYNAME( WIN32_2010_COMPILER, ErrorReporting )
PROPERTYNAME( WIN32_2010_COMPILER, CommonLanguageRuntimeSupport )
PROPERTYNAME( WIN32_2010_COMPILER, MultiProcessorCompilation )
PROPERTYNAME( WIN32_2010_COMPILER, UseUnicodeForAssemblerListing )
PROPERTYNAME( WIN32_2010_COMPILER, IgnoreStandardIncludePaths )
PROPERTYNAME( WIN32_2010_COMPILER, PreprocessToAFile )
PROPERTYNAME( WIN32_2010_COMPILER, PreprocessSuppressLineNumbers )
PROPERTYNAME( WIN32_2010_COMPILER, CreateHotpatchableImage )
PROPERTYNAME( WIN32_2010_COMPILER, BrowseInformationFile )
PROPERTYNAME( WIN32_2010_COMPILER, ForcedIncludeFile )
PROPERTYNAME( WIN32_2010_COMPILER, ForcedUsingFile )
PROPERTYNAME( WIN32_2010_COMPILER, OmitDefaultLibName )
PROPERTYNAME( WIN32_2010_COMPILER, InternalCompilerErrorReporting )
PROPERTYNAME( WIN32_2010_COMPILER, TreatSpecificWarningsAsErrors )
// Librarian
PROPERTYNAME( WIN32_2010_LIBRARIAN, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_2010_LIBRARIAN, AdditionalDependencies )
PROPERTYNAME( WIN32_2010_LIBRARIAN, OutputFile )
PROPERTYNAME( WIN32_2010_LIBRARIAN, AdditionalLibraryDirectories )
PROPERTYNAME( WIN32_2010_LIBRARIAN, SuppressStartupBanner )
PROPERTYNAME( WIN32_2010_LIBRARIAN, ModuleDefinitionFileName )
PROPERTYNAME( WIN32_2010_LIBRARIAN, IgnoreAllDefaultLibraries )
PROPERTYNAME( WIN32_2010_LIBRARIAN, IgnoreSpecificLibrary )
PROPERTYNAME( WIN32_2010_LIBRARIAN, ExportNamedFunctions )
PROPERTYNAME( WIN32_2010_LIBRARIAN, ForceSymbolReferences )
PROPERTYNAME( WIN32_2010_LIBRARIAN, LinkLibraryDependencies )
PROPERTYNAME( WIN32_2010_LIBRARIAN, TargetMachine )
PROPERTYNAME( WIN32_2010_LIBRARIAN, AdditionalOptions )
// Linker
PROPERTYNAME( WIN32_2010_LINKER, IgnoreImportLibrary )
PROPERTYNAME( WIN32_2010_LINKER, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_2010_LINKER, AdditionalOptions )
PROPERTYNAME( WIN32_2010_LINKER, AdditionalDependencies )
PROPERTYNAME( WIN32_2010_LINKER, ShowProgress )
PROPERTYNAME( WIN32_2010_LINKER, OutputFile )
PROPERTYNAME( WIN32_2010_LINKER, Version )
PROPERTYNAME( WIN32_2010_LINKER, EnableIncrementalLinking )
PROPERTYNAME( WIN32_2010_LINKER, SuppressStartupBanner )
PROPERTYNAME( WIN32_2010_LINKER, AdditionalLibraryDirectories )
PROPERTYNAME( WIN32_2010_LINKER, IgnoreSpecificDefaultLibraries )
PROPERTYNAME( WIN32_2010_LINKER, GenerateManifest )
PROPERTYNAME( WIN32_2010_LINKER, IgnoreAllDefaultLibraries )
PROPERTYNAME( WIN32_2010_LINKER, IgnoreSpecificLibrary )
PROPERTYNAME( WIN32_2010_LINKER, ModuleDefinitionFile )
PROPERTYNAME( WIN32_2010_LINKER, GenerateDebugInfo )
PROPERTYNAME( WIN32_2010_LINKER, DebuggableAssembly )
PROPERTYNAME( WIN32_2010_LINKER, GenerateProgramDatabaseFile )
PROPERTYNAME( WIN32_2010_LINKER, GenerateMapFile )
PROPERTYNAME( WIN32_2010_LINKER, MapFileName )
PROPERTYNAME( WIN32_2010_LINKER, SubSystem )
PROPERTYNAME( WIN32_2010_LINKER, EnableLargeAddresses )
PROPERTYNAME( WIN32_2010_LINKER, MapExports )
PROPERTYNAME( WIN32_2010_LINKER, StackReserveSize )
PROPERTYNAME( WIN32_2010_LINKER, StackCommitSize )
PROPERTYNAME( WIN32_2010_LINKER, References )
PROPERTYNAME( WIN32_2010_LINKER, EnableCOMDATFolding )
PROPERTYNAME( WIN32_2010_LINKER, LinkTimeCodeGeneration )
PROPERTYNAME( WIN32_2010_LINKER, EntryPoint )
PROPERTYNAME( WIN32_2010_LINKER, NoEntryPoint )
PROPERTYNAME( WIN32_2010_LINKER, SetChecksum )
PROPERTYNAME( WIN32_2010_LINKER, BaseAddress )
PROPERTYNAME( WIN32_2010_LINKER, ImportLibrary )
PROPERTYNAME( WIN32_2010_LINKER, TargetMachine )
PROPERTYNAME( WIN32_2010_LINKER, FixedBaseAddress )
PROPERTYNAME( WIN32_2010_LINKER, ErrorReporting )
PROPERTYNAME( WIN32_2010_LINKER, FunctionOrder )
PROPERTYNAME( WIN32_2010_LINKER, LinkLibraryDependencies )
PROPERTYNAME( WIN32_2010_LINKER, UseLibraryDependencyInputs )
PROPERTYNAME( WIN32_2010_LINKER, ForceSymbolReferences )
PROPERTYNAME( WIN32_2010_LINKER, StripPrivateSymbols )
PROPERTYNAME( WIN32_2010_LINKER, ProfileGuidedDatabase )
PROPERTYNAME( WIN32_2010_LINKER, MergeSections )
PROPERTYNAME( WIN32_2010_LINKER, RegisterOutput )
PROPERTYNAME( WIN32_2010_LINKER, AddModuleToAssembly )
PROPERTYNAME( WIN32_2010_LINKER, EmbedManagedResourceFile )
PROPERTYNAME( WIN32_2010_LINKER, DelayLoadedDLLs )
PROPERTYNAME( WIN32_2010_LINKER, AssemblyLinkResource )
PROPERTYNAME( WIN32_2010_LINKER, ManifestFile )
PROPERTYNAME( WIN32_2010_LINKER, AdditionalManifestDependencies )
PROPERTYNAME( WIN32_2010_LINKER, AllowIsolation )
PROPERTYNAME( WIN32_2010_LINKER, HeapReserveSize )
PROPERTYNAME( WIN32_2010_LINKER, HeapCommitSize )
PROPERTYNAME( WIN32_2010_LINKER, TerminalServer )
PROPERTYNAME( WIN32_2010_LINKER, SwapRunFromCD )
PROPERTYNAME( WIN32_2010_LINKER, SwapRunFromNetwork )
PROPERTYNAME( WIN32_2010_LINKER, Driver )
PROPERTYNAME( WIN32_2010_LINKER, OptimizeForWindows98 )
PROPERTYNAME( WIN32_2010_LINKER, MIDLCommands )
PROPERTYNAME( WIN32_2010_LINKER, IgnoreEmbeddedIDL )
PROPERTYNAME( WIN32_2010_LINKER, MergeIDLBaseFileName )
PROPERTYNAME( WIN32_2010_LINKER, TypeLibrary )
PROPERTYNAME( WIN32_2010_LINKER, TypeLibResourceID )
PROPERTYNAME( WIN32_2010_LINKER, TurnOffAssemblyGeneration )
PROPERTYNAME( WIN32_2010_LINKER, DelayLoadedDLL )
PROPERTYNAME( WIN32_2010_LINKER, Profile )
PROPERTYNAME( WIN32_2010_LINKER, CLRThreadAttribute )
PROPERTYNAME( WIN32_2010_LINKER, CLRImageType )
PROPERTYNAME( WIN32_2010_LINKER, KeyFile )
PROPERTYNAME( WIN32_2010_LINKER, KeyContainer )
PROPERTYNAME( WIN32_2010_LINKER, DelaySign )
PROPERTYNAME( WIN32_2010_LINKER, CLRUnmanagedCodeCheck )
PROPERTYNAME( WIN32_2010_LINKER, PerUserRedirection )
PROPERTYNAME( WIN32_2010_LINKER, LinkStatus )
PROPERTYNAME( WIN32_2010_LINKER, PreventDllBinding )
PROPERTYNAME( WIN32_2010_LINKER, TreatLinkerWarningsAsErrors )
PROPERTYNAME( WIN32_2010_LINKER, ForceFileOutput )
PROPERTYNAME( WIN32_2010_LINKER, CreateHotpatchableImage )
PROPERTYNAME( WIN32_2010_LINKER, SpecifySectionAttributes )
PROPERTYNAME( WIN32_2010_LINKER, EnableUserAccountControl )
PROPERTYNAME( WIN32_2010_LINKER, UACExecutionLevel )
PROPERTYNAME( WIN32_2010_LINKER, UACBypassUIProtection )
PROPERTYNAME( WIN32_2010_LINKER, MinimumRequiredVersion )
PROPERTYNAME( WIN32_2010_LINKER, RandomizedBaseAddress )
PROPERTYNAME( WIN32_2010_LINKER, DataExecutionPrevention )
PROPERTYNAME( WIN32_2010_LINKER, UnloaddelayloadedDLL )
PROPERTYNAME( WIN32_2010_LINKER, NobinddelayloadedDLL )
PROPERTYNAME( WIN32_2010_LINKER, SectionAlignment )
PROPERTYNAME( WIN32_2010_LINKER, PreserveLastErrorCodeforPInvokeCalls )
PROPERTYNAME( WIN32_2010_LINKER, ImageHasSafeExceptionHandlers )
// Manifest
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, SuppressStartupBanner )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, VerboseOutput )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, AssemblyIdentity )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, UseFAT32WorkAround )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, AdditionalManifestFiles )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, InputResourceManifests )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, EmbedManifest )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, OutputManifestFile )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, ManifestResourceFile )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, GenerateCatalogFiles )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, DependencyInformationFile )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, TypeLibraryFile )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, RegistrarScriptFile )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, ComponentFileName )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, ReplacementsFile )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, UpdateFileHashes )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, UpdateFileHashesSearchPath )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, AdditionalOptions )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, GenerateManifestFromManagedAssembly )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, SuppressDependencyElement )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, GenerateCategoryTags )
PROPERTYNAME( WIN32_2010_MANIFESTTOOL, EnableDPIAwareness )
// XML Document Generator
PROPERTYNAME( WIN32_2010_XMLDOCUMENTGENERATOR, UseUNICODEResponseFiles )
PROPERTYNAME( WIN32_2010_XMLDOCUMENTGENERATOR, SuppressStartupBanner )
PROPERTYNAME( WIN32_2010_XMLDOCUMENTGENERATOR, ValidateIntelliSense )
PROPERTYNAME( WIN32_2010_XMLDOCUMENTGENERATOR, AdditionalDocumentFiles )
PROPERTYNAME( WIN32_2010_XMLDOCUMENTGENERATOR, OutputDocumentFile )
PROPERTYNAME( WIN32_2010_XMLDOCUMENTGENERATOR, DocumentLibraryDependencies )
PROPERTYNAME( WIN32_2010_XMLDOCUMENTGENERATOR, AdditionalOptions )
// Browse Information
PROPERTYNAME( WIN32_2010_BROWSEINFORMATION, SuppressStartupBanner )
PROPERTYNAME( WIN32_2010_BROWSEINFORMATION, OutputFile )
PROPERTYNAME( WIN32_2010_BROWSEINFORMATION, AdditionalOptions )
PROPERTYNAME( WIN32_2010_BROWSEINFORMATION, PreserveSBRFiles )
// Resources
PROPERTYNAME( WIN32_2010_RESOURCES, PreprocessorDefinitions )
PROPERTYNAME( WIN32_2010_RESOURCES, Culture )
PROPERTYNAME( WIN32_2010_RESOURCES, AdditionalIncludeDirectories )
PROPERTYNAME( WIN32_2010_RESOURCES, IgnoreStandardIncludePath )
PROPERTYNAME( WIN32_2010_RESOURCES, ShowProgress )
PROPERTYNAME( WIN32_2010_RESOURCES, ResourceFileName )
PROPERTYNAME( WIN32_2010_RESOURCES, AdditionalOptions )
// Pre Build
PROPERTYNAME( WIN32_2010_PREBUILDEVENT, Description )
PROPERTYNAME( WIN32_2010_PREBUILDEVENT, CommandLine )
PROPERTYNAME( WIN32_2010_PREBUILDEVENT, ExcludedFromBuild )
PROPERTYNAME( WIN32_2010_PREBUILDEVENT, UseInBuild )
// Pre Link
PROPERTYNAME( WIN32_2010_PRELINKEVENT, Description )
PROPERTYNAME( WIN32_2010_PRELINKEVENT, CommandLine )
PROPERTYNAME( WIN32_2010_PRELINKEVENT, ExcludedFromBuild )
PROPERTYNAME( WIN32_2010_PRELINKEVENT, UseInBuild )
// Post Build
PROPERTYNAME( WIN32_2010_POSTBUILDEVENT, Description )
PROPERTYNAME( WIN32_2010_POSTBUILDEVENT, CommandLine )
PROPERTYNAME( WIN32_2010_POSTBUILDEVENT, ExcludedFromBuild )
PROPERTYNAME( WIN32_2010_POSTBUILDEVENT, UseInBuild )
// Custom Build
PROPERTYNAME( WIN32_2010_CUSTOMBUILDSTEP, Description )
PROPERTYNAME( WIN32_2010_CUSTOMBUILDSTEP, CommandLine )
PROPERTYNAME( WIN32_2010_CUSTOMBUILDSTEP, AdditionalDependencies )
PROPERTYNAME( WIN32_2010_CUSTOMBUILDSTEP, Outputs )
PROPERTYNAME( WIN32_2010_CUSTOMBUILDSTEP, ExecuteAfter )
PROPERTYNAME( WIN32_2010_CUSTOMBUILDSTEP, ExecuteBefore )

View File

@@ -0,0 +1,343 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
#undef PROPERTYNAME
#define PROPERTYNAME( X, Y ) { X##_##Y, #X, #Y },
static PropertyName_t s_Xbox360PropertyNames[] =
{
#include "projectgenerator_xbox360.inc"
{ -1, NULL, NULL }
};
IBaseProjectGenerator* GetXbox360ProjectGenerator()
{
static CProjectGenerator_Xbox360 *s_pProjectGenerator = NULL;
if ( !s_pProjectGenerator )
{
s_pProjectGenerator = new CProjectGenerator_Xbox360();
}
return s_pProjectGenerator->GetProjectGenerator();
}
CProjectGenerator_Xbox360::CProjectGenerator_Xbox360()
{
m_pVCProjGenerator = new CVCProjGenerator();
m_pVCProjGenerator->SetupGeneratorDefinition( this, "xbox360.def", s_Xbox360PropertyNames );
}
bool CProjectGenerator_Xbox360::WriteFile( CProjectFile *pFile )
{
m_XMLWriter.PushNode( "File" );
m_XMLWriter.Write( CFmtStrMax( "RelativePath=\"%s\"", pFile->m_Name.Get() ) );
m_XMLWriter.Write( ">" );
for ( int i = 0; i < pFile->m_Configs.Count(); i++ )
{
if ( !WriteConfiguration( pFile->m_Configs[i] ) )
return false;
}
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Xbox360::WriteFolder( CProjectFolder *pFolder )
{
m_XMLWriter.PushNode( "Filter" );
m_XMLWriter.Write( CFmtStrMax( "Name=\"%s\"", m_XMLWriter.FixupXMLString( pFolder->m_Name.Get() ) ) );
m_XMLWriter.Write( ">" );
for ( int iIndex = pFolder->m_Files.Head(); iIndex != pFolder->m_Files.InvalidIndex(); iIndex = pFolder->m_Files.Next( iIndex ) )
{
if ( !WriteFile( pFolder->m_Files[iIndex] ) )
return false;
}
for ( int iIndex = pFolder->m_Folders.Head(); iIndex != pFolder->m_Folders.InvalidIndex(); iIndex = pFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolder( pFolder->m_Folders[iIndex] ) )
return false;
}
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Xbox360::WriteConfiguration( CProjectConfiguration *pConfig )
{
if ( pConfig->m_bIsFileConfig )
{
m_XMLWriter.PushNode( "FileConfiguration" );
}
else
{
m_XMLWriter.PushNode( "Configuration" );
}
const char *pOutputName = "???";
if ( !V_stricmp( pConfig->m_Name.Get(), "debug" ) )
{
pOutputName = "Debug|Xbox 360";
}
else if ( !V_stricmp( pConfig->m_Name.Get(), "release" ) )
{
pOutputName = "Release|Xbox 360";
}
else
{
return false;
}
m_XMLWriter.Write( CFmtStrMax( "Name=\"%s\"", pOutputName ) );
// write configuration properties
for ( int i = 0; i < pConfig->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pConfig->m_PropertyStates.m_PropertiesInOutputOrder[i];
WriteProperty( &pConfig->m_PropertyStates.m_Properties[sortedIndex] );
}
if ( !pConfig->m_bIsFileConfig && pConfig->m_PropertyStates.m_Properties.Count() )
{
WriteProperty( NULL, "UseOfMFC", "-1" );
WriteProperty( NULL, "UseOfATL", "0" );
}
m_XMLWriter.Write( ">" );
if ( !WriteTool( "VCPreBuildEventTool", pConfig->GetPreBuildEventTool() ) )
return false;
if ( !WriteTool( "VCCustomBuildTool", pConfig->GetCustomBuildTool() ) )
return false;
if ( !WriteNULLTool( "VCXMLDataGeneratorTool", pConfig ) )
return false;
if ( !WriteNULLTool( "VCWebServiceProxyGeneratorTool", pConfig ) )
return false;
if ( !WriteNULLTool( "VCMIDLTool", pConfig ) )
return false;
if ( !WriteTool( "VCCLX360CompilerTool", pConfig->GetCompilerTool() ) )
return false;
if ( !WriteNULLTool( "VCManagedResourceCompilerTool", pConfig ) )
return false;
if ( !WriteNULLTool( "VCResourceCompilerTool", pConfig ) )
return false;
if ( !WriteTool( "VCPreLinkEventTool", pConfig->GetPreLinkEventTool() ) )
return false;
if ( !WriteTool( "VCX360LinkerTool", pConfig->GetLinkerTool() ) )
return false;
if ( !WriteTool( "VCLibrarianTool", pConfig->GetLibrarianTool() ) )
return false;
if ( !WriteNULLTool( "VCALinkTool", pConfig ) )
return false;
if ( !WriteTool( "VCX360ImageTool", pConfig->GetXboxImageTool() ) )
return false;
if ( !WriteTool( "VCBscMakeTool", pConfig->GetBrowseInfoTool() ) )
return false;
if ( !WriteTool( "VCX360DeploymentTool", pConfig->GetXboxDeploymentTool() ) )
return false;
if ( !WriteTool( "VCPostBuildEventTool", pConfig->GetPostBuildEventTool() ) )
return false;
if ( !pConfig->m_bIsFileConfig )
{
m_XMLWriter.PushNode( "DebuggerTool" );
m_XMLWriter.PopNode( false );
}
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Xbox360::WriteToXML()
{
m_XMLWriter.PushNode( "VisualStudioProject" );
m_XMLWriter.Write( "ProjectType=\"Visual C++\"" );
if ( g_pVPC->BUse2008() )
m_XMLWriter.Write( "Version=\"9.00\"" );
else
m_XMLWriter.Write( "Version=\"8.00\"" );
m_XMLWriter.Write( CFmtStrMax( "Name=\"%s\"", m_pVCProjGenerator->GetProjectName().Get() ) );
m_XMLWriter.Write( CFmtStrMax( "ProjectGUID=\"%s\"", m_pVCProjGenerator->GetGUIDString().Get() ) );
m_XMLWriter.Write( ">" );
m_XMLWriter.PushNode( "Platforms" );
m_XMLWriter.PushNode( "Platform" );
m_XMLWriter.Write( "Name=\"Xbox 360\"" );
m_XMLWriter.PopNode( false );
m_XMLWriter.PopNode( true );
m_XMLWriter.PushNode( "ToolFiles" );
m_XMLWriter.PopNode( true );
CUtlVector< CUtlString > configurationNames;
m_pVCProjGenerator->GetAllConfigurationNames( configurationNames );
// write the root configurations
m_XMLWriter.PushNode( "Configurations" );
for ( int i = 0; i < configurationNames.Count(); i++ )
{
CProjectConfiguration *pConfiguration = NULL;
if ( m_pVCProjGenerator->GetRootConfiguration( configurationNames[i].Get(), &pConfiguration ) )
{
if ( !WriteConfiguration( pConfiguration ) )
return false;
}
}
m_XMLWriter.PopNode( true );
m_XMLWriter.PushNode( "References" );
m_XMLWriter.PopNode( true );
m_XMLWriter.PushNode( "Files" );
CProjectFolder *pRootFolder = m_pVCProjGenerator->GetRootFolder();
for ( int iIndex = pRootFolder->m_Folders.Head(); iIndex != pRootFolder->m_Folders.InvalidIndex(); iIndex = pRootFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolder( pRootFolder->m_Folders[iIndex] ) )
return false;
}
for ( int iIndex = pRootFolder->m_Files.Head(); iIndex != pRootFolder->m_Files.InvalidIndex(); iIndex = pRootFolder->m_Files.Next( iIndex ) )
{
if ( !WriteFile( pRootFolder->m_Files[iIndex] ) )
return false;
}
m_XMLWriter.PopNode( true );
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Xbox360::Save( const char *pOutputFilename )
{
if ( !m_XMLWriter.Open( pOutputFilename ) )
return false;
bool bValid = WriteToXML();
m_XMLWriter.Close();
return bValid;
}
bool CProjectGenerator_Xbox360::WriteNULLTool( const char *pToolName, const CProjectConfiguration *pConfig )
{
if ( pConfig->m_bIsFileConfig )
return true;
m_XMLWriter.PushNode( "Tool" );
m_XMLWriter.Write( CFmtStr( "Name=\"%s\"", pToolName ) );
m_XMLWriter.PopNode( false );
return true;
}
bool CProjectGenerator_Xbox360::WriteTool( const char *pToolName, const CProjectTool *pProjectTool )
{
if ( !pProjectTool )
{
// not an error, some tools n/a for a config
return true;
}
m_XMLWriter.PushNode( "Tool" );
m_XMLWriter.Write( CFmtStr( "Name=\"%s\"", pToolName ) );
for ( int i = 0; i < pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder[i];
WriteProperty( &pProjectTool->m_PropertyStates.m_Properties[sortedIndex] );
}
m_XMLWriter.PopNode( false );
return true;
}
bool CProjectGenerator_Xbox360::WriteProperty( const PropertyState_t *pPropertyState, const char *pOutputName, const char *pOutputValue )
{
if ( !pPropertyState )
{
m_XMLWriter.Write( CFmtStrMax( "%s=\"%s\"", pOutputName, pOutputValue ) );
return true;
}
if ( !pOutputName )
{
pOutputName = pPropertyState->m_pToolProperty->m_OutputString.Get();
if ( !pOutputName[0] )
{
pOutputName = pPropertyState->m_pToolProperty->m_ParseString.Get();
if ( pOutputName[0] == '$' )
{
pOutputName++;
}
}
}
if ( pPropertyState )
{
switch ( pPropertyState->m_pToolProperty->m_nType )
{
case PT_BOOLEAN:
{
bool bEnabled = Sys_StringToBool( pPropertyState->m_StringValue.Get() );
if ( pPropertyState->m_pToolProperty->m_bInvertOutput )
{
bEnabled ^= 1;
}
m_XMLWriter.Write( CFmtStrMax( "%s=\"%s\"", pOutputName, bEnabled ? "true" : "false" ) );
}
break;
case PT_STRING:
m_XMLWriter.Write( CFmtStrMax( "%s=\"%s\"", pOutputName, m_XMLWriter.FixupXMLString( pPropertyState->m_StringValue.Get() ) ) );
break;
case PT_LIST:
case PT_INTEGER:
m_XMLWriter.Write( CFmtStrMax( "%s=\"%s\"", pOutputName, pPropertyState->m_StringValue.Get() ) );
break;
case PT_IGNORE:
break;
default:
g_pVPC->VPCError( "CProjectGenerator_Xbox360: WriteProperty, %s - not implemented", pOutputName );
}
}
return true;
}

View File

@@ -0,0 +1,41 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef PROJECTGENERATOR_XBOX360_H
#define PROJECTGENERATOR_XBOX360_H
#ifdef _WIN32
#pragma once
#endif
#define PROPERTYNAME( X, Y ) X##_##Y,
enum Xbox360Properties_e
{
#include "projectgenerator_xbox360.inc"
};
class CProjectGenerator_Xbox360 : public IVCProjWriter
{
public:
CProjectGenerator_Xbox360();
IBaseProjectGenerator *GetProjectGenerator() { return m_pVCProjGenerator; }
virtual bool Save( const char *pOutputFilename );
private:
bool WriteToXML();
bool WriteFolder( CProjectFolder *pFolder );
bool WriteFile( CProjectFile *pFile );
bool WriteConfiguration( CProjectConfiguration *pConfig );
bool WriteProperty( const PropertyState_t *pPropertyState, const char *pOutputName = NULL, const char *pValue = NULL );
bool WriteTool( const char *pToolName, const CProjectTool *pProjectTool );
bool WriteNULLTool( const char *pToolName, const CProjectConfiguration *pConfig );
CXMLWriter m_XMLWriter;
CVCProjGenerator *m_pVCProjGenerator;
};
#endif // PROJECTGENERATOR_XBOX360_H

View File

@@ -0,0 +1,192 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Property Enumerations
//
//=====================================================================================//
// Config
PROPERTYNAME( XBOX360_GENERAL, ExcludedFromBuild )
PROPERTYNAME( XBOX360_GENERAL, OutputDirectory )
PROPERTYNAME( XBOX360_GENERAL, IntermediateDirectory )
PROPERTYNAME( XBOX360_GENERAL, ConfigurationType )
PROPERTYNAME( XBOX360_GENERAL, CharacterSet )
PROPERTYNAME( XBOX360_GENERAL, WholeProgramOptimization )
PROPERTYNAME( XBOX360_GENERAL, ExtensionsToDeleteOnClean )
PROPERTYNAME( XBOX360_GENERAL, BuildLogFile )
PROPERTYNAME( XBOX360_GENERAL, InheritedProjectPropertySheets )
// Debugging
PROPERTYNAME( XBOX360_DEBUGGING, Command )
PROPERTYNAME( XBOX360_DEBUGGING, CommandArguments )
PROPERTYNAME( XBOX360_DEBUGGING, RemoteMachine )
// Compiler
PROPERTYNAME( XBOX360_COMPILER, AdditionalOptions )
PROPERTYNAME( XBOX360_COMPILER, Optimization )
PROPERTYNAME( XBOX360_COMPILER, InlineFunctionExpansion )
PROPERTYNAME( XBOX360_COMPILER, EnableIntrinsicFunctions )
PROPERTYNAME( XBOX360_COMPILER, FavorSizeOrSpeed )
PROPERTYNAME( XBOX360_COMPILER, EnableFiberSafeOptimizations )
PROPERTYNAME( XBOX360_COMPILER, WholeProgramOptimization )
PROPERTYNAME( XBOX360_COMPILER, AdditionalIncludeDirectories )
PROPERTYNAME( XBOX360_COMPILER, PreprocessorDefinitions )
PROPERTYNAME( XBOX360_COMPILER, IgnoreStandardIncludePath )
PROPERTYNAME( XBOX360_COMPILER, GeneratePreprocessedFile )
PROPERTYNAME( XBOX360_COMPILER, KeepComments )
PROPERTYNAME( XBOX360_COMPILER, EnableStringPooling )
PROPERTYNAME( XBOX360_COMPILER, EnableMinimalRebuild )
PROPERTYNAME( XBOX360_COMPILER, EnableCPPExceptions )
PROPERTYNAME( XBOX360_COMPILER, BasicRuntimeChecks )
PROPERTYNAME( XBOX360_COMPILER, SmallerTypeCheck )
PROPERTYNAME( XBOX360_COMPILER, RuntimeLibrary )
PROPERTYNAME( XBOX360_COMPILER, StructMemberAlignment )
PROPERTYNAME( XBOX360_COMPILER, BufferSecurityCheck )
PROPERTYNAME( XBOX360_COMPILER, EnableFunctionLevelLinking )
PROPERTYNAME( XBOX360_COMPILER, FloatingPointModel )
PROPERTYNAME( XBOX360_COMPILER, EnableFloatingPointExceptions )
PROPERTYNAME( XBOX360_COMPILER, DisableLanguageExtensions )
PROPERTYNAME( XBOX360_COMPILER, DefaultCharUnsigned )
PROPERTYNAME( XBOX360_COMPILER, TreatWCHAR_TAsBuiltInType )
PROPERTYNAME( XBOX360_COMPILER, ForceConformanceInForLoopScope )
PROPERTYNAME( XBOX360_COMPILER, EnableRunTimeTypeInfo )
PROPERTYNAME( XBOX360_COMPILER, OpenMPSupport )
PROPERTYNAME( XBOX360_COMPILER, CreateUsePrecompiledHeader )
PROPERTYNAME( XBOX360_COMPILER, CreateUsePCHThroughFile )
PROPERTYNAME( XBOX360_COMPILER, PrecompiledHeaderFile )
PROPERTYNAME( XBOX360_COMPILER, ExpandAttributedSource )
PROPERTYNAME( XBOX360_COMPILER, AssemblerOutput )
PROPERTYNAME( XBOX360_COMPILER, ASMListLocation )
PROPERTYNAME( XBOX360_COMPILER, ObjectFileName )
PROPERTYNAME( XBOX360_COMPILER, ProgramDatabaseFileName )
PROPERTYNAME( XBOX360_COMPILER, EnableBrowseInformation )
PROPERTYNAME( XBOX360_COMPILER, BrowseFile )
PROPERTYNAME( XBOX360_COMPILER, WarningLevel )
PROPERTYNAME( XBOX360_COMPILER, TreatWarningsAsErrors )
PROPERTYNAME( XBOX360_COMPILER, SuppressStartupBanner )
PROPERTYNAME( XBOX360_COMPILER, DebugInformationFormat )
PROPERTYNAME( XBOX360_COMPILER, CompileAs )
PROPERTYNAME( XBOX360_COMPILER, ForceIncludes )
PROPERTYNAME( XBOX360_COMPILER, ShowIncludes )
PROPERTYNAME( XBOX360_COMPILER, UndefineAllPreprocessorDefinitions )
PROPERTYNAME( XBOX360_COMPILER, UndefinePreprocessorDefinitions )
PROPERTYNAME( XBOX360_COMPILER, UseFullPaths )
PROPERTYNAME( XBOX360_COMPILER, OmitDefaultLibraryNames )
PROPERTYNAME( XBOX360_COMPILER, TrapIntegerDividesOptimization )
PROPERTYNAME( XBOX360_COMPILER, PreschedulingOptimization )
PROPERTYNAME( XBOX360_COMPILER, InlineAssemblyOptimization )
PROPERTYNAME( XBOX360_COMPILER, RegisterReservation )
PROPERTYNAME( XBOX360_COMPILER, Stalls )
PROPERTYNAME( XBOX360_COMPILER, CallAttributedProfiling )
PROPERTYNAME( XBOX360_COMPILER, UseUNICODEResponseFiles )
PROPERTYNAME( XBOX360_COMPILER, GenerateXMLDocumentationFiles )
PROPERTYNAME( XBOX360_COMPILER, XMLDocumentationFileName )
PROPERTYNAME( XBOX360_COMPILER, DisableSpecificWarnings )
// Librarian
PROPERTYNAME( XBOX360_LIBRARIAN, OutputFile )
PROPERTYNAME( XBOX360_LIBRARIAN, AdditionalDependencies )
PROPERTYNAME( XBOX360_LIBRARIAN, AdditionalLibraryDirectories )
PROPERTYNAME( XBOX360_LIBRARIAN, SuppressStartupBanner )
PROPERTYNAME( XBOX360_LIBRARIAN, ModuleDefinitionFileName )
PROPERTYNAME( XBOX360_LIBRARIAN, IgnoreAllDefaultLibraries )
PROPERTYNAME( XBOX360_LIBRARIAN, IgnoreSpecificLibrary )
PROPERTYNAME( XBOX360_LIBRARIAN, ExportNamedFunctions )
PROPERTYNAME( XBOX360_LIBRARIAN, ForceSymbolReferences )
PROPERTYNAME( XBOX360_LIBRARIAN, UseUNICODEResponseFiles )
PROPERTYNAME( XBOX360_LIBRARIAN, LinkLibraryDependencies )
PROPERTYNAME( XBOX360_LIBRARIAN, AdditionalOptions )
// Linker
PROPERTYNAME( XBOX360_LINKER, IgnoreImportLibrary )
PROPERTYNAME( XBOX360_LINKER, AdditionalOptions )
PROPERTYNAME( XBOX360_LINKER, AdditionalDependencies )
PROPERTYNAME( XBOX360_LINKER, ShowProgress )
PROPERTYNAME( XBOX360_LINKER, OutputFile )
PROPERTYNAME( XBOX360_LINKER, EnableIncrementalLinking )
PROPERTYNAME( XBOX360_LINKER, SuppressStartupBanner )
PROPERTYNAME( XBOX360_LINKER, AdditionalLibraryDirectories )
PROPERTYNAME( XBOX360_LINKER, IgnoreAllDefaultLibraries )
PROPERTYNAME( XBOX360_LINKER, IgnoreSpecificLibrary )
PROPERTYNAME( XBOX360_LINKER, ModuleDefinitionFile )
PROPERTYNAME( XBOX360_LINKER, GenerateDebugInfo )
PROPERTYNAME( XBOX360_LINKER, GenerateProgramDatabaseFile )
PROPERTYNAME( XBOX360_LINKER, GenerateMapFile )
PROPERTYNAME( XBOX360_LINKER, MapFileName )
PROPERTYNAME( XBOX360_LINKER, MapExports )
PROPERTYNAME( XBOX360_LINKER, StackReserveSize )
PROPERTYNAME( XBOX360_LINKER, StackCommitSize )
PROPERTYNAME( XBOX360_LINKER, References )
PROPERTYNAME( XBOX360_LINKER, EnableCOMDATFolding )
PROPERTYNAME( XBOX360_LINKER, LinkTimeCodeGeneration )
PROPERTYNAME( XBOX360_LINKER, EntryPoint )
PROPERTYNAME( XBOX360_LINKER, NoEntryPoint )
PROPERTYNAME( XBOX360_LINKER, SetChecksum )
PROPERTYNAME( XBOX360_LINKER, BaseAddress )
PROPERTYNAME( XBOX360_LINKER, ImportLibrary )
PROPERTYNAME( XBOX360_LINKER, FixedBaseAddress )
PROPERTYNAME( XBOX360_LINKER, ErrorReporting )
PROPERTYNAME( XBOX360_LINKER, FunctionOrder )
PROPERTYNAME( XBOX360_LINKER, Version )
PROPERTYNAME( XBOX360_LINKER, LinkLibraryDependencies )
PROPERTYNAME( XBOX360_LINKER, UseLibraryDependencyInputs )
PROPERTYNAME( XBOX360_LINKER, UseUNICODEResponseFiles )
PROPERTYNAME( XBOX360_LINKER, ForceSymbolReferences )
PROPERTYNAME( XBOX360_LINKER, StripPrivateSymbols )
PROPERTYNAME( XBOX360_LINKER, ProfileGuidedDatabase )
PROPERTYNAME( XBOX360_LINKER, MergeSections )
// Browse Information
PROPERTYNAME( XBOX360_BROWSEINFORMATION, SuppressStartupBanner )
PROPERTYNAME( XBOX360_BROWSEINFORMATION, OutputFile )
PROPERTYNAME( XBOX360_BROWSEINFORMATION, AdditionalOptions )
// Pre Build
PROPERTYNAME( XBOX360_PREBUILDEVENT, Description )
PROPERTYNAME( XBOX360_PREBUILDEVENT, CommandLine )
PROPERTYNAME( XBOX360_PREBUILDEVENT, ExcludedFromBuild )
// Pre Link
PROPERTYNAME( XBOX360_PRELINKEVENT, Description )
PROPERTYNAME( XBOX360_PRELINKEVENT, CommandLine )
PROPERTYNAME( XBOX360_PRELINKEVENT, ExcludedFromBuild )
// Post Build
PROPERTYNAME( XBOX360_POSTBUILDEVENT, Description )
PROPERTYNAME( XBOX360_POSTBUILDEVENT, CommandLine )
PROPERTYNAME( XBOX360_POSTBUILDEVENT, ExcludedFromBuild )
// Custom Build
PROPERTYNAME( XBOX360_CUSTOMBUILDSTEP, Description )
PROPERTYNAME( XBOX360_CUSTOMBUILDSTEP, CommandLine )
PROPERTYNAME( XBOX360_CUSTOMBUILDSTEP, Outputs )
PROPERTYNAME( XBOX360_CUSTOMBUILDSTEP, AdditionalDependencies )
// Image Conversion
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, OutputFile )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, SuppressStartupBanner )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, ProjectDefaults )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, WorkspaceSize )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, ExportByName )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, OpticalDiscDriveMapping )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, PAL50Incompatible )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, TitleID )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, LANKey )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, BaseAddress )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, HeapSize )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, AdditionalSections )
PROPERTYNAME( XBOX360_XBOX360IMAGECONVERSION, AdditionalOptions )
// Console Deployment
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, ExcludedFromBuild )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, SuppressStartupBanner )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, DeploymentRoot )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, DeploymentFiles )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, Progress )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, ForceCopy )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, DeploymentType )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, EmulationType )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, Layout )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, LayoutRoot )
PROPERTYNAME( XBOX360_CONSOLEDEPLOYMENT, AdditionalOptions )

View File

@@ -0,0 +1,596 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
#undef PROPERTYNAME
#define PROPERTYNAME( X, Y ) { X##_##Y, #X, #Y },
static PropertyName_t s_Xbox360PropertyNames_2010[] =
{
#include "projectgenerator_xbox360_2010.inc"
{ -1, NULL, NULL }
};
IBaseProjectGenerator* GetXbox360ProjectGenerator_2010()
{
static CProjectGenerator_Xbox360_2010 *s_pProjectGenerator = NULL;
if ( !s_pProjectGenerator )
{
s_pProjectGenerator = new CProjectGenerator_Xbox360_2010();
}
return s_pProjectGenerator->GetProjectGenerator();
}
CProjectGenerator_Xbox360_2010::CProjectGenerator_Xbox360_2010()
{
m_pVCProjGenerator = new CVCProjGenerator();
m_pVCProjGenerator->SetupGeneratorDefinition( this, "xbox360_2010.def", s_Xbox360PropertyNames_2010 );
}
enum TypeKeyNames_e
{
TKN_LIBRARY = 0,
TKN_INCLUDE,
TKN_COMPILE,
TKN_RESOURCECOMPILE,
TKN_CUSTOMBUILD,
TKN_NONE,
TKN_MAX_COUNT,
};
static const char *s_TypeKeyNames[] =
{
"Library",
"ClInclude",
"ClCompile",
"ResourceCompile",
"CustomBuild",
"None"
};
const char *CProjectGenerator_Xbox360_2010::GetKeyNameForFile( CProjectFile *pFile )
{
COMPILE_TIME_ASSERT( ARRAYSIZE( s_TypeKeyNames ) == TKN_MAX_COUNT );
const char *pExtension = V_GetFileExtension( pFile->m_Name.Get() );
const char *pKeyName = s_TypeKeyNames[TKN_NONE];
if ( pExtension )
{
if ( pFile->m_Configs.Count() && pFile->m_Configs[0]->GetCustomBuildTool() )
{
pKeyName = s_TypeKeyNames[TKN_CUSTOMBUILD];
}
else if ( IsCFileExtension( pExtension ) )
{
pKeyName = s_TypeKeyNames[TKN_COMPILE];
}
else if ( IsHFileExtension( pExtension ) )
{
pKeyName = s_TypeKeyNames[TKN_INCLUDE];
}
else if ( !V_stricmp( pExtension, "lib" ) )
{
pKeyName = s_TypeKeyNames[TKN_LIBRARY];
}
else if ( !V_stricmp( pExtension, "rc" ) )
{
pKeyName = s_TypeKeyNames[TKN_RESOURCECOMPILE];
}
}
return pKeyName;
}
bool CProjectGenerator_Xbox360_2010::WritePropertyGroupTool( CProjectTool *pProjectTool, CProjectConfiguration *pConfiguration )
{
if ( !pProjectTool )
return true;
for ( int i = 0; i < pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder[i];
if ( !pProjectTool->m_PropertyStates.m_Properties[sortedIndex].m_pToolProperty->m_bEmitAsGlobalProperty )
continue;
if ( !WriteProperty( &pProjectTool->m_PropertyStates.m_Properties[sortedIndex], true, pConfiguration->m_Name.Get() ) )
return false;
}
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteFile( CProjectFile *pFile, const char *pFileTypeName )
{
const char *pKeyName = GetKeyNameForFile( pFile );
if ( V_stricmp( pFileTypeName, pKeyName ) )
{
// skip it
return true;
}
if ( !pFile->m_Configs.Count() )
{
m_XMLWriter.Write( CFmtStrMax( "<%s Include=\"%s\" />", pKeyName, pFile->m_Name.Get() ) );
}
else
{
m_XMLWriter.PushNode( pKeyName, CFmtStr( "Include=\"%s\"", pFile->m_Name.Get() ) );
for ( int i = 0; i < pFile->m_Configs.Count(); i++ )
{
if ( !WriteConfiguration( pFile->m_Configs[i] ) )
return false;
}
m_XMLWriter.PopNode( true );
}
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteFolder( CProjectFolder *pFolder, const char *pFileTypeName, int nDepth )
{
if ( !nDepth )
{
m_XMLWriter.PushNode( "ItemGroup" );
}
for ( int iIndex = pFolder->m_Files.Head(); iIndex != pFolder->m_Files.InvalidIndex(); iIndex = pFolder->m_Files.Next( iIndex ) )
{
if ( !WriteFile( pFolder->m_Files[iIndex], pFileTypeName ) )
return false;
}
for ( int iIndex = pFolder->m_Folders.Head(); iIndex != pFolder->m_Folders.InvalidIndex(); iIndex = pFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolder( pFolder->m_Folders[iIndex], pFileTypeName, nDepth+1 ) )
return false;
}
if ( !nDepth )
{
m_XMLWriter.PopNode( true );
}
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteConfiguration( CProjectConfiguration *pConfig )
{
if ( !pConfig->m_bIsFileConfig )
{
m_XMLWriter.PushNode( "PropertyGroup", CFmtStr( "Condition=\"'$(Configuration)|$(Platform)'=='%s|Xbox 360'\" Label=\"Configuration\"", pConfig->m_Name.Get() ) );
for ( int i = 0; i < pConfig->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pConfig->m_PropertyStates.m_PropertiesInOutputOrder[i];
if ( pConfig->m_PropertyStates.m_Properties[sortedIndex].m_pToolProperty->m_bEmitAsGlobalProperty )
continue;
if ( !WriteProperty( &pConfig->m_PropertyStates.m_Properties[sortedIndex] ) )
return false;
}
WriteProperty( NULL, false, NULL, "UseOfAtl", "false" );
m_XMLWriter.PopNode( true );
}
else
{
for ( int i = 0; i < pConfig->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pConfig->m_PropertyStates.m_PropertiesInOutputOrder[i];
if ( !WriteProperty( &pConfig->m_PropertyStates.m_Properties[sortedIndex], true, pConfig->m_Name.Get() ) )
return false;
}
if ( !WriteTool( "ClCompile", pConfig->GetCompilerTool(), pConfig ) )
return false;
if ( !WriteTool( "CustomBuildStep", pConfig->GetCustomBuildTool(), pConfig ) )
return false;
}
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteTools( CProjectConfiguration *pConfig )
{
m_XMLWriter.PushNode( "ItemDefinitionGroup", CFmtStr( "Condition=\"'$(Configuration)|$(Platform)'=='%s|Xbox 360'\"", pConfig->m_Name.Get() ) );
if ( !WriteTool( "PreBuildEvent", pConfig->GetPreBuildEventTool(), pConfig ) )
return false;
if ( !WriteTool( "CustomBuildStep", pConfig->GetCustomBuildTool(), pConfig ) )
return false;
if ( !WriteTool( "ClCompile", pConfig->GetCompilerTool(), pConfig ) )
return false;
if ( !WriteTool( "PreLinkEvent", pConfig->GetPreLinkEventTool(), pConfig ) )
return false;
if ( !WriteTool( "Link", pConfig->GetLinkerTool(), pConfig ) )
return false;
if ( !WriteTool( "Lib", pConfig->GetLibrarianTool(), pConfig ) )
return false;
if ( !WriteTool( "ImageXex", pConfig->GetXboxImageTool(), pConfig ) )
return false;
if ( !WriteTool( "Bscmake", pConfig->GetBrowseInfoTool(), pConfig ) )
return false;
if ( !WriteTool( "Deploy", pConfig->GetXboxDeploymentTool(), pConfig ) )
return false;
if ( !WriteTool( "PostBuildEvent", pConfig->GetPostBuildEventTool(), pConfig ) )
return false;
m_XMLWriter.PopNode( true );
return true;
}
bool CProjectGenerator_Xbox360_2010::WritePrimaryXML( const char *pOutputFilename )
{
if ( !m_XMLWriter.Open( pOutputFilename, true ) )
return false;
m_XMLWriter.PushNode( "Project", "DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"" );
m_XMLWriter.PushNode( "ItemGroup", "Label=\"ProjectConfigurations\"" );
CUtlVector< CUtlString > configurationNames;
m_pVCProjGenerator->GetAllConfigurationNames( configurationNames );
for ( int i = 0; i < configurationNames.Count(); i++ )
{
m_XMLWriter.PushNode( "ProjectConfiguration", CFmtStr( "Include=\"%s|Xbox 360\"", configurationNames[i].Get() ) );
m_XMLWriter.WriteLineNode( "Configuration", "", configurationNames[i].Get() );
m_XMLWriter.WriteLineNode( "Platform", "", "Xbox 360" );
m_XMLWriter.PopNode( true );
}
m_XMLWriter.PopNode( true );
m_XMLWriter.PushNode( "PropertyGroup", "Label=\"Globals\"" );
m_XMLWriter.WriteLineNode( "ProjectName", "", m_pVCProjGenerator->GetProjectName().Get() );
m_XMLWriter.WriteLineNode( "ProjectGuid", "", m_pVCProjGenerator->GetGUIDString().Get() );
m_XMLWriter.PopNode( true );
m_XMLWriter.Write( "<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />" );
// write the root configurations
for ( int i = 0; i < configurationNames.Count(); i++ )
{
CProjectConfiguration *pConfiguration = NULL;
if ( m_pVCProjGenerator->GetRootConfiguration( configurationNames[i].Get(), &pConfiguration ) )
{
if ( !WriteConfiguration( pConfiguration ) )
return false;
}
}
m_XMLWriter.Write( "<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />" );
m_XMLWriter.PushNode( "ImportGroup", "Label=\"ExtensionSettings\"" );
m_XMLWriter.PopNode( true );
for ( int i = 0; i < configurationNames.Count(); i++ )
{
m_XMLWriter.PushNode( "ImportGroup", CFmtStr( "Condition=\"'$(Configuration)|$(Platform)'=='%s|Xbox 360'\" Label=\"PropertySheets\"", configurationNames[i].Get() ) );
m_XMLWriter.Write( "<Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />" );
m_XMLWriter.PopNode( true );
}
m_XMLWriter.Write( "<PropertyGroup Label=\"UserMacros\" />" );
m_XMLWriter.PushNode( "PropertyGroup" );
m_XMLWriter.WriteLineNode( "_ProjectFileVersion", "", "10.0.30319.1" );
for ( int i = 0; i < configurationNames.Count(); i++ )
{
CProjectConfiguration *pConfiguration = NULL;
if ( m_pVCProjGenerator->GetRootConfiguration( configurationNames[i].Get(), &pConfiguration ) )
{
for ( int j = 0; j < pConfiguration->m_PropertyStates.m_PropertiesInOutputOrder.Count(); j++ )
{
int sortedIndex = pConfiguration->m_PropertyStates.m_PropertiesInOutputOrder[j];
if ( !pConfiguration->m_PropertyStates.m_Properties[sortedIndex].m_pToolProperty->m_bEmitAsGlobalProperty )
continue;
if ( !WriteProperty( &pConfiguration->m_PropertyStates.m_Properties[sortedIndex], true, pConfiguration->m_Name.Get() ) )
return false;
}
if ( !WritePropertyGroupTool( pConfiguration->GetPreBuildEventTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetPreLinkEventTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetLinkerTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetLibrarianTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetPostBuildEventTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetXboxImageTool(), pConfiguration ) )
return false;
if ( !WritePropertyGroupTool( pConfiguration->GetXboxDeploymentTool(), pConfiguration ) )
return false;
}
}
m_XMLWriter.PopNode( true );
// write the tool configurations
for ( int i = 0; i < configurationNames.Count(); i++ )
{
CProjectConfiguration *pConfiguration = NULL;
if ( m_pVCProjGenerator->GetRootConfiguration( configurationNames[i].Get(), &pConfiguration ) )
{
if ( !WriteTools( pConfiguration ) )
return false;
}
}
// write root folders
for ( int i = 0; i < TKN_MAX_COUNT; i++ )
{
if ( !WriteFolder( m_pVCProjGenerator->GetRootFolder(), s_TypeKeyNames[i], 0 ) )
return false;
}
m_XMLWriter.Write( "<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />" );
m_XMLWriter.PushNode( "ImportGroup", "Label=\"ExtensionTargets\"" );
m_XMLWriter.PopNode( true );
m_XMLWriter.PopNode( true );
m_XMLWriter.Close();
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteFolderToSecondaryXML( CProjectFolder *pFolder, const char *pParentPath )
{
CUtlString parentPath = CFmtStr( "%s%s%s", pParentPath, pParentPath[0] ? "\\" : "", pFolder->m_Name.Get() );
MD5Context_t ctx;
unsigned char digest[MD5_DIGEST_LENGTH];
V_memset( &ctx, 0, sizeof( ctx ) );
V_memset( digest, 0, sizeof( digest ) );
MD5Init( &ctx );
MD5Update( &ctx, (unsigned char *)parentPath.Get(), strlen( parentPath.Get() ) );
MD5Final( digest, &ctx );
char szMD5[64];
V_binarytohex( digest, MD5_DIGEST_LENGTH, szMD5, sizeof( szMD5 ) );
V_strupr( szMD5 );
char szGUID[MAX_PATH];
V_snprintf( szGUID, sizeof( szGUID ), "{%8.8s-%4.4s-%4.4s-%4.4s-%12.12s}", szMD5, &szMD5[8], &szMD5[12], &szMD5[16], &szMD5[20] );
m_XMLFilterWriter.PushNode( "Filter", CFmtStr( "Include=\"%s\"", parentPath.Get() ) );
m_XMLFilterWriter.WriteLineNode( "UniqueIdentifier", "", szGUID );
m_XMLFilterWriter.PopNode( true );
for ( int iIndex = pFolder->m_Folders.Head(); iIndex != pFolder->m_Folders.InvalidIndex(); iIndex = pFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolderToSecondaryXML( pFolder->m_Folders[iIndex], parentPath.Get() ) )
return false;
}
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteFileToSecondaryXML( CProjectFile *pFile, const char *pParentPath, const char *pFileTypeName )
{
const char *pKeyName = GetKeyNameForFile( pFile );
if ( V_stricmp( pFileTypeName, pKeyName ) )
{
// skip it
return true;
}
if ( pParentPath )
{
m_XMLFilterWriter.PushNode( pKeyName, CFmtStr( "Include=\"%s\"", pFile->m_Name.Get() ) );
m_XMLFilterWriter.WriteLineNode( "Filter", "", pParentPath );
m_XMLFilterWriter.PopNode( true );
}
else
{
m_XMLFilterWriter.Write( CFmtStr( "<%s Include=\"%s\" />", pKeyName, pFile->m_Name.Get() ) );
}
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteFolderContentsToSecondaryXML( CProjectFolder *pFolder, const char *pParentPath, const char *pFileTypeName, int nDepth )
{
CUtlString parentPath;
if ( pParentPath )
{
parentPath = CFmtStr( "%s%s%s", pParentPath, pParentPath[0] ? "\\" : "", pFolder->m_Name.Get() );
}
if ( !nDepth )
{
m_XMLFilterWriter.PushNode( "ItemGroup", NULL );
}
for ( int iIndex = pFolder->m_Files.Head(); iIndex != pFolder->m_Files.InvalidIndex(); iIndex = pFolder->m_Files.Next( iIndex ) )
{
if ( !WriteFileToSecondaryXML( pFolder->m_Files[iIndex], parentPath.Get(), pFileTypeName ) )
return false;
}
for ( int iIndex = pFolder->m_Folders.Head(); iIndex != pFolder->m_Folders.InvalidIndex(); iIndex = pFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolderContentsToSecondaryXML( pFolder->m_Folders[iIndex], parentPath.Get(), pFileTypeName, nDepth+1 ) )
return false;
}
if ( !nDepth )
{
m_XMLFilterWriter.PopNode( true );
}
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteSecondaryXML( const char *pOutputFilename )
{
if ( !m_XMLFilterWriter.Open( pOutputFilename, true ) )
return false;
m_XMLFilterWriter.PushNode( "Project", "ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"" );
// write the root folders
m_XMLFilterWriter.PushNode( "ItemGroup", NULL );
CProjectFolder *pRootFolder = m_pVCProjGenerator->GetRootFolder();
for ( int iIndex = pRootFolder->m_Folders.Head(); iIndex != pRootFolder->m_Folders.InvalidIndex(); iIndex = pRootFolder->m_Folders.Next( iIndex ) )
{
if ( !WriteFolderToSecondaryXML( pRootFolder->m_Folders[iIndex], "" ) )
return false;
}
m_XMLFilterWriter.PopNode( true );
// write folder contents
for ( int i = 0; i < TKN_MAX_COUNT; i++ )
{
if ( !WriteFolderContentsToSecondaryXML( pRootFolder, NULL, s_TypeKeyNames[i], 0 ) )
return false;
}
m_XMLFilterWriter.PopNode( true );
m_XMLFilterWriter.Close();
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteTool( const char *pToolName, const CProjectTool *pProjectTool, CProjectConfiguration *pConfig )
{
if ( !pProjectTool )
{
// not an error, some tools n/a for a config
return true;
}
if ( !pConfig->m_bIsFileConfig )
{
m_XMLWriter.PushNode( pToolName, NULL );
}
for ( int i = 0; i < pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder.Count(); i++ )
{
int sortedIndex = pProjectTool->m_PropertyStates.m_PropertiesInOutputOrder[i];
if ( !pConfig->m_bIsFileConfig )
{
if ( pProjectTool->m_PropertyStates.m_Properties[sortedIndex].m_pToolProperty->m_bEmitAsGlobalProperty )
continue;
if ( !WriteProperty( &pProjectTool->m_PropertyStates.m_Properties[sortedIndex] ) )
return false;
}
else
{
if ( !WriteProperty( &pProjectTool->m_PropertyStates.m_Properties[sortedIndex], true, pConfig->m_Name.Get() ) )
return false;
}
}
if ( !pConfig->m_bIsFileConfig )
{
m_XMLWriter.PopNode( true );
}
return true;
}
bool CProjectGenerator_Xbox360_2010::WriteProperty( const PropertyState_t *pPropertyState, bool bEmitConfiguration, const char *pConfigName, const char *pOutputName, const char *pOutputValue )
{
if ( !pPropertyState )
{
m_XMLWriter.WriteLineNode( pOutputName, "", pOutputValue );
return true;
}
if ( !pOutputName )
{
pOutputName = pPropertyState->m_pToolProperty->m_OutputString.Get();
if ( !pOutputName[0] )
{
pOutputName = pPropertyState->m_pToolProperty->m_ParseString.Get();
if ( pOutputName[0] == '$' )
{
pOutputName++;
}
}
}
const char *pCondition = "";
CUtlString conditionString;
if ( bEmitConfiguration )
{
conditionString = CFmtStr( " Condition=\"'$(Configuration)|$(Platform)'=='%s|Xbox 360'\"", pConfigName );
pCondition = conditionString.Get();
}
if ( pPropertyState )
{
switch ( pPropertyState->m_pToolProperty->m_nType )
{
case PT_BOOLEAN:
{
bool bEnabled = Sys_StringToBool( pPropertyState->m_StringValue.Get() );
if ( pPropertyState->m_pToolProperty->m_bInvertOutput )
{
bEnabled ^= 1;
}
m_XMLWriter.WriteLineNode( pOutputName, pCondition, bEnabled ? "true" : "false" );
}
break;
case PT_STRING:
m_XMLWriter.WriteLineNode( pOutputName, pCondition, m_XMLWriter.FixupXMLString( pPropertyState->m_StringValue.Get() ) );
break;
case PT_LIST:
case PT_INTEGER:
m_XMLWriter.WriteLineNode( pOutputName, pCondition, pPropertyState->m_StringValue.Get() );
break;
case PT_IGNORE:
break;
default:
g_pVPC->VPCError( "CProjectGenerator_Xbox360_2010: WriteProperty, %s - not implemented", pOutputName );
}
}
return true;
}
bool CProjectGenerator_Xbox360_2010::Save( const char *pOutputFilename )
{
bool bValid = WritePrimaryXML( pOutputFilename );
if ( bValid )
{
bValid = WriteSecondaryXML( CFmtStr( "%s.filters", pOutputFilename ) );
if ( !bValid )
{
g_pVPC->VPCError( "Cannot save to the specified project '%s'", pOutputFilename );
}
}
return bValid;
}

View File

@@ -0,0 +1,54 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef PROJECTGENERATOR_XBOX360_2010_H
#define PROJECTGENERATOR_XBOX360_2010_H
#ifdef _WIN32
#pragma once
#endif
#define PROPERTYNAME( X, Y ) X##_##Y,
enum Xbox360_2010_Properties_e
{
#include "projectgenerator_xbox360_2010.inc"
};
class CProjectGenerator_Xbox360_2010 : public IVCProjWriter
{
public:
CProjectGenerator_Xbox360_2010();
IBaseProjectGenerator *GetProjectGenerator() { return m_pVCProjGenerator; }
virtual bool Save( const char *pOutputFilename );
private:
// primary XML - foo.vcxproj
bool WritePrimaryXML( const char *pOutputFilename );
bool WriteFolder( CProjectFolder *pFolder, const char *pFileTypeName, int nDepth );
bool WriteFile( CProjectFile *pFile, const char *pFileTypeName );
bool WriteConfiguration( CProjectConfiguration *pConfig );
bool WriteTools( CProjectConfiguration *pConfig );
bool WriteProperty( const PropertyState_t *pPropertyState, bool bEmitConfiguration = false, const char *pConfigurationName = NULL, const char *pOutputName = NULL, const char *pValue = NULL );
bool WriteTool( const char *pToolName, const CProjectTool *pProjectTool, CProjectConfiguration *pConfig );
bool WriteNULLTool( const char *pToolName, const CProjectConfiguration *pConfig );
bool WritePropertyGroupTool( CProjectTool *pProjectTool, CProjectConfiguration *pConfiguration );
bool WritePropertyGroup();
// secondary XML - foo.vcxproj.filters
bool WriteSecondaryXML( const char *pOutputFilename );
bool WriteFolderToSecondaryXML( CProjectFolder *pFolder, const char *pParentPath );
bool WriteFolderContentsToSecondaryXML( CProjectFolder *pFolder, const char *pParentPath, const char *pFileTypeName, int nDepth );
bool WriteFileToSecondaryXML( CProjectFile *pFile, const char *pParentPath, const char *pFileTypeName );
const char *GetKeyNameForFile( CProjectFile *pFile );
CXMLWriter m_XMLWriter;
CXMLWriter m_XMLFilterWriter;
CVCProjGenerator *m_pVCProjGenerator;
};
#endif // PROJECTGENERATOR_XBOX360_2010_H

View File

@@ -0,0 +1,210 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Property Enumerations
//
//=====================================================================================//
// Config
PROPERTYNAME( XBOX360_2010_GENERAL, ExcludedFromBuild )
PROPERTYNAME( XBOX360_2010_GENERAL, OutputDirectory )
PROPERTYNAME( XBOX360_2010_GENERAL, IntermediateDirectory )
PROPERTYNAME( XBOX360_2010_GENERAL, ConfigurationType )
PROPERTYNAME( XBOX360_2010_GENERAL, CharacterSet )
PROPERTYNAME( XBOX360_2010_GENERAL, WholeProgramOptimization )
PROPERTYNAME( XBOX360_2010_GENERAL, ExtensionsToDeleteOnClean )
PROPERTYNAME( XBOX360_2010_GENERAL, BuildLogFile )
PROPERTYNAME( XBOX360_2010_GENERAL, PlatformToolset )
// Debugging
PROPERTYNAME( XBOX360_2010_DEBUGGING, Command )
PROPERTYNAME( XBOX360_2010_DEBUGGING, CommandArguments )
PROPERTYNAME( XBOX360_2010_DEBUGGING, RemoteMachine )
PROPERTYNAME( XBOX360_2010_DEBUGGING, MapDVDDrive )
PROPERTYNAME( XBOX360_2010_DEBUGGING, CheckUpToDate )
// Compiler
PROPERTYNAME( XBOX360_2010_COMPILER, AdditionalOptions )
PROPERTYNAME( XBOX360_2010_COMPILER, Optimization )
PROPERTYNAME( XBOX360_2010_COMPILER, InlineFunctionExpansion )
PROPERTYNAME( XBOX360_2010_COMPILER, EnableIntrinsicFunctions )
PROPERTYNAME( XBOX360_2010_COMPILER, FavorSizeOrSpeed )
PROPERTYNAME( XBOX360_2010_COMPILER, EnableFiberSafeOptimizations )
PROPERTYNAME( XBOX360_2010_COMPILER, WholeProgramOptimization )
PROPERTYNAME( XBOX360_2010_COMPILER, AdditionalIncludeDirectories )
PROPERTYNAME( XBOX360_2010_COMPILER, PreprocessorDefinitions )
PROPERTYNAME( XBOX360_2010_COMPILER, IgnoreStandardIncludePaths )
PROPERTYNAME( XBOX360_2010_COMPILER, PreprocessToAFile )
PROPERTYNAME( XBOX360_2010_COMPILER, PreprocessSuppressLineNumbers )
PROPERTYNAME( XBOX360_2010_COMPILER, KeepComments )
PROPERTYNAME( XBOX360_2010_COMPILER, EnableStringPooling )
PROPERTYNAME( XBOX360_2010_COMPILER, EnableMinimalRebuild )
PROPERTYNAME( XBOX360_2010_COMPILER, EnableCPPExceptions )
PROPERTYNAME( XBOX360_2010_COMPILER, BasicRuntimeChecks )
PROPERTYNAME( XBOX360_2010_COMPILER, RuntimeLibrary )
PROPERTYNAME( XBOX360_2010_COMPILER, StructMemberAlignment )
PROPERTYNAME( XBOX360_2010_COMPILER, BufferSecurityCheck )
PROPERTYNAME( XBOX360_2010_COMPILER, EnableFunctionLevelLinking )
PROPERTYNAME( XBOX360_2010_COMPILER, FloatingPointModel )
PROPERTYNAME( XBOX360_2010_COMPILER, EnableFloatingPointExceptions )
PROPERTYNAME( XBOX360_2010_COMPILER, DisableLanguageExtensions )
PROPERTYNAME( XBOX360_2010_COMPILER, TreatWCHAR_TAsBuiltInType )
PROPERTYNAME( XBOX360_2010_COMPILER, ForceConformanceInForLoopScope )
PROPERTYNAME( XBOX360_2010_COMPILER, EnableRunTimeTypeInfo )
PROPERTYNAME( XBOX360_2010_COMPILER, OpenMPSupport )
PROPERTYNAME( XBOX360_2010_COMPILER, PrecompiledHeader )
PROPERTYNAME( XBOX360_2010_COMPILER, PrecompiledHeaderFile )
PROPERTYNAME( XBOX360_2010_COMPILER, PrecompiledHeaderOutputFile )
PROPERTYNAME( XBOX360_2010_COMPILER, ExpandAttributedSource )
PROPERTYNAME( XBOX360_2010_COMPILER, AssemblerOutput )
PROPERTYNAME( XBOX360_2010_COMPILER, ASMListLocation )
PROPERTYNAME( XBOX360_2010_COMPILER, ObjectFileName )
PROPERTYNAME( XBOX360_2010_COMPILER, ProgramDatabaseFileName )
PROPERTYNAME( XBOX360_2010_COMPILER, EnableBrowseInformation )
PROPERTYNAME( XBOX360_2010_COMPILER, BrowseInformationFile )
PROPERTYNAME( XBOX360_2010_COMPILER, WarningLevel )
PROPERTYNAME( XBOX360_2010_COMPILER, TreatWarningsAsErrors )
PROPERTYNAME( XBOX360_2010_COMPILER, SuppressStartupBanner )
PROPERTYNAME( XBOX360_2010_COMPILER, DebugInformationFormat )
PROPERTYNAME( XBOX360_2010_COMPILER, CompileAs )
PROPERTYNAME( XBOX360_2010_COMPILER, ForcedIncludeFile )
PROPERTYNAME( XBOX360_2010_COMPILER, ShowIncludes )
PROPERTYNAME( XBOX360_2010_COMPILER, UndefineAllPreprocessorDefinitions )
PROPERTYNAME( XBOX360_2010_COMPILER, UndefinePreprocessorDefinitions )
PROPERTYNAME( XBOX360_2010_COMPILER, UseFullPaths )
PROPERTYNAME( XBOX360_2010_COMPILER, OmitDefaultLibraryName )
PROPERTYNAME( XBOX360_2010_COMPILER, TrapIntegerDividesOptimization )
PROPERTYNAME( XBOX360_2010_COMPILER, PreschedulingOptimization )
PROPERTYNAME( XBOX360_2010_COMPILER, InlineAssemblyOptimization )
PROPERTYNAME( XBOX360_2010_COMPILER, RegisterReservation )
PROPERTYNAME( XBOX360_2010_COMPILER, AnalyzeStalls )
PROPERTYNAME( XBOX360_2010_COMPILER, CallAttributedProfiling )
PROPERTYNAME( XBOX360_2010_COMPILER, SmallerTypeCheck )
PROPERTYNAME( XBOX360_2010_COMPILER, DisableSpecificWarnings )
PROPERTYNAME( XBOX360_2010_COMPILER, MultiProcessorCompilation )
PROPERTYNAME( XBOX360_2010_COMPILER, UseUnicodeForAssemblerListing )
PROPERTYNAME( XBOX360_2010_COMPILER, ForcedUsingFile )
PROPERTYNAME( XBOX360_2010_COMPILER, DeduceVariableType )
PROPERTYNAME( XBOX360_2010_COMPILER, CodeAnalysisForCCPP )
PROPERTYNAME( XBOX360_2010_COMPILER, DisabledWarningDirectories )
// Librarian
PROPERTYNAME( XBOX360_2010_LIBRARIAN, UseUNICODEResponseFiles )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, AdditionalDependencies )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, OutputFile )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, AdditionalLibraryDirectories )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, SuppressStartupBanner )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, ModuleDefinitionFileName )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, IgnoreAllDefaultLibraries )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, IgnoreSpecificDefaultLibraries )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, ExportNamedFunctions )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, ForceSymbolReferences )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, LinkLibraryDependencies )
PROPERTYNAME( XBOX360_2010_LIBRARIAN, AdditionalOptions )
// Linker
PROPERTYNAME( XBOX360_2010_LINKER, IgnoreImportLibrary )
PROPERTYNAME( XBOX360_2010_LINKER, AdditionalOptions )
PROPERTYNAME( XBOX360_2010_LINKER, AdditionalDependencies )
PROPERTYNAME( XBOX360_2010_LINKER, ShowProgress )
PROPERTYNAME( XBOX360_2010_LINKER, OutputFile )
PROPERTYNAME( XBOX360_2010_LINKER, Version )
PROPERTYNAME( XBOX360_2010_LINKER, EnableIncrementalLinking )
PROPERTYNAME( XBOX360_2010_LINKER, SuppressStartupBanner )
PROPERTYNAME( XBOX360_2010_LINKER, AdditionalLibraryDirectories )
PROPERTYNAME( XBOX360_2010_LINKER, IgnoreAllDefaultLibraries )
PROPERTYNAME( XBOX360_2010_LINKER, IgnoreSpecificDefaultLibraries )
PROPERTYNAME( XBOX360_2010_LINKER, ModuleDefinitionFile )
PROPERTYNAME( XBOX360_2010_LINKER, GenerateDebugInfo )
PROPERTYNAME( XBOX360_2010_LINKER, GenerateProgramDatabaseFile )
PROPERTYNAME( XBOX360_2010_LINKER, GenerateMapFile )
PROPERTYNAME( XBOX360_2010_LINKER, MapFileName )
PROPERTYNAME( XBOX360_2010_LINKER, MapExports )
PROPERTYNAME( XBOX360_2010_LINKER, StackCommitSize )
PROPERTYNAME( XBOX360_2010_LINKER, References )
PROPERTYNAME( XBOX360_2010_LINKER, EnableCOMDATFolding )
PROPERTYNAME( XBOX360_2010_LINKER, LinkTimeCodeGeneration )
PROPERTYNAME( XBOX360_2010_LINKER, EntryPoint )
PROPERTYNAME( XBOX360_2010_LINKER, NoEntryPoint )
PROPERTYNAME( XBOX360_2010_LINKER, SetChecksum )
PROPERTYNAME( XBOX360_2010_LINKER, BaseAddress )
PROPERTYNAME( XBOX360_2010_LINKER, ImportLibrary )
PROPERTYNAME( XBOX360_2010_LINKER, FixedBaseAddress )
PROPERTYNAME( XBOX360_2010_LINKER, ErrorReporting )
PROPERTYNAME( XBOX360_2010_LINKER, FunctionOrder )
PROPERTYNAME( XBOX360_2010_LINKER, LinkLibraryDependencies )
PROPERTYNAME( XBOX360_2010_LINKER, UseLibraryDependencyInputs )
PROPERTYNAME( XBOX360_2010_LINKER, ForceSymbolReferences )
PROPERTYNAME( XBOX360_2010_LINKER, StripPrivateSymbols )
PROPERTYNAME( XBOX360_2010_LINKER, ProfileGuidedDatabase )
PROPERTYNAME( XBOX360_2010_LINKER, MergeSections )
PROPERTYNAME( XBOX360_2010_LINKER, AutomaticModuleDefinitionFile )
// Browse Information
PROPERTYNAME( XBOX360_2010_BROWSEINFORMATION, SuppressStartupBanner )
PROPERTYNAME( XBOX360_2010_BROWSEINFORMATION, OutputFile )
PROPERTYNAME( XBOX360_2010_BROWSEINFORMATION, AdditionalOptions )
PROPERTYNAME( XBOX360_2010_BROWSEINFORMATION, PreserveSBRFiles )
// Pre Build
PROPERTYNAME( XBOX360_2010_PREBUILDEVENT, Description )
PROPERTYNAME( XBOX360_2010_PREBUILDEVENT, CommandLine )
PROPERTYNAME( XBOX360_2010_PREBUILDEVENT, ExcludedFromBuild )
PROPERTYNAME( XBOX360_2010_PREBUILDEVENT, UseInBuild )
// Pre Link
PROPERTYNAME( XBOX360_2010_PRELINKEVENT, Description )
PROPERTYNAME( XBOX360_2010_PRELINKEVENT, CommandLine )
PROPERTYNAME( XBOX360_2010_PRELINKEVENT, ExcludedFromBuild )
PROPERTYNAME( XBOX360_2010_PRELINKEVENT, UseInBuild )
// Post Build
PROPERTYNAME( XBOX360_2010_POSTBUILDEVENT, Description )
PROPERTYNAME( XBOX360_2010_POSTBUILDEVENT, CommandLine )
PROPERTYNAME( XBOX360_2010_POSTBUILDEVENT, ExcludedFromBuild )
PROPERTYNAME( XBOX360_2010_POSTBUILDEVENT, UseInBuild )
// Custom Build
PROPERTYNAME( XBOX360_2010_CUSTOMBUILDSTEP, Description )
PROPERTYNAME( XBOX360_2010_CUSTOMBUILDSTEP, CommandLine )
PROPERTYNAME( XBOX360_2010_CUSTOMBUILDSTEP, AdditionalDependencies )
PROPERTYNAME( XBOX360_2010_CUSTOMBUILDSTEP, Outputs )
PROPERTYNAME( XBOX360_2010_CUSTOMBUILDSTEP, ExecuteAfter )
PROPERTYNAME( XBOX360_2010_CUSTOMBUILDSTEP, ExecuteBefore )
// Image Conversion
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, SuppressStartupBanner )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, ConfigurationFile )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, OutputFile )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, TitleID )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, LANKey )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, BaseAddress )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, HeapSize )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, WorkspaceSize )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, AdditionalSections )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, ExportByName )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, OpticalDiscDriveMapping )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, PAL50Incompatible )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, MultidiscTitle )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, PreferBigButtonInput )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, CrossPlatformSystemLink )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, AllowAvatarGetMetadataByXUID )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, AllowControllerSwapping )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, RequireFullExperience )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, GameVoiceRequiredUI )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, KinectElevationControl )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, SkeletalTrackingRequirement )
PROPERTYNAME( XBOX360_2010_XBOX360IMAGECONVERSION, AdditionalOptions )
// Console Deployment
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, ExcludedFromBuild )
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, SuppressStartupBanner )
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, DeploymentFiles )
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, Progress )
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, ForceCopy )
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, DeploymentType )
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, DeploymentRoot )
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, EmulationType )
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, LayoutFile )
PROPERTYNAME( XBOX360_2010_CONSOLEDEPLOYMENT, AdditionalOptions )

2484
external/vpc/utils/vpc/projectscript.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

565
external/vpc/utils/vpc/scriptsource.cpp vendored Normal file
View File

@@ -0,0 +1,565 @@
//===================== Copyright (c) Valve Corporation. All Rights Reserved. ======================
//
//
//
//==================================================================================================
#include "vpc.h"
#define MAX_SCRIPT_STACK_SIZE 32
CScript::CScript()
{
m_ScriptName = "(empty)";
m_nScriptLine = 0;
m_pScriptData = NULL;
m_pScriptLine = &m_nScriptLine;
m_Token[0] = '\0';
m_PeekToken[0] = '\0';
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
const char *CScript::SkipWhitespace( const char *data, bool *pHasNewLines, int* pNumLines )
{
int c;
while ( ( c = *data ) <= ' ' )
{
if ( c == '\n' )
{
if ( pNumLines )
{
(*pNumLines)++;
}
if ( pHasNewLines )
{
*pHasNewLines = true;
}
}
else if ( !c )
{
return ( NULL );
}
data++;
}
return data;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
const char *CScript::SkipToValidToken( const char *data, bool *pHasNewLines, int* pNumLines )
{
int c;
for ( ;; )
{
data = SkipWhitespace( data, pHasNewLines, pNumLines );
c = *data;
if ( !c )
{
break;
}
if ( c == '/' && data[1] == '/' )
{
// skip double slash comments
data += 2;
while ( *data && *data != '\n' )
{
data++;
}
if ( *data && *data == '\n' )
{
data++;
if ( pNumLines )
{
(*pNumLines)++;
}
if ( pHasNewLines )
{
*pHasNewLines = true;
}
}
}
else if ( c == '/' && data[1] == '*' )
{
// skip /* */ comments
data += 2;
while ( *data && ( *data != '*' || data[1] != '/' ) )
{
if ( *data == '\n' )
{
if ( pNumLines )
{
(*pNumLines)++;
}
if ( pHasNewLines )
{
*pHasNewLines = true;
}
}
data++;
}
if ( *data )
{
data += 2;
}
}
else
{
break;
}
}
return data;
}
//-----------------------------------------------------------------------------
// The next token should be an open brace.
// Skips until a matching close brace is found.
// Internal brace depths are properly skipped.
//-----------------------------------------------------------------------------
void CScript::SkipBracedSection( const char** dataptr, int* numlines )
{
const char* token;
int depth;
depth = 0;
do
{
token = GetToken( dataptr, true, numlines );
if ( token[1] == '\0' )
{
if ( token[0] == '{' )
depth++;
else if ( token[0] == '}' )
depth--;
}
}
while( depth && *dataptr );
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CScript::SkipRestOfLine( const char** dataptr, int* numlines )
{
const char* p;
int c;
p = *dataptr;
while ( ( c = *p++ ) != '\0' )
{
if ( c == '\n' )
{
if ( numlines )
( *numlines )++;
break;
}
}
*dataptr = p;
}
//-----------------------------------------------------------------------------
// Does not corrupt results obtained with GetToken().
//-----------------------------------------------------------------------------
const char* CScript::PeekNextToken( const char *dataptr, bool bAllowLineBreaks )
{
// save the primary token, about to be corrupted
char savedToken[MAX_SYSTOKENCHARS];
V_strncpy( savedToken, m_Token, MAX_SYSTOKENCHARS );
const char *pSaved = dataptr;
const char *pToken = GetToken( &pSaved, bAllowLineBreaks, NULL );
// restore
V_strncpy( m_PeekToken, pToken, MAX_SYSTOKENCHARS );
V_strncpy( m_Token, savedToken, MAX_SYSTOKENCHARS );
return m_PeekToken;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
const char *CScript::GetToken( const char **dataptr, bool allowLineBreaks, int *pNumLines )
{
char c;
char endSymbol;
int len;
bool hasNewLines;
const char* data;
c = 0;
data = *dataptr;
len = 0;
m_Token[0] = 0;
hasNewLines = false;
// make sure incoming data is valid
if ( !data )
{
*dataptr = NULL;
return m_Token;
}
for ( ;; )
{
// skip whitespace
data = SkipWhitespace( data, &hasNewLines, pNumLines );
if ( !data )
{
*dataptr = NULL;
return m_Token;
}
if ( hasNewLines && !allowLineBreaks )
{
*dataptr = data;
return m_Token;
}
c = *data;
if ( c == '/' && data[1] == '/' )
{
// skip double slash comments
data += 2;
while ( *data && *data != '\n' )
{
data++;
}
if ( *data && *data == '\n' )
{
if ( !allowLineBreaks )
continue;
data++;
if ( pNumLines )
{
(*pNumLines)++;
}
}
}
else if ( c =='/' && data[1] == '*' )
{
// skip /* */ comments
data += 2;
while ( *data && ( *data != '*' || data[1] != '/' ) )
{
if ( *data == '\n' && pNumLines )
{
(*pNumLines)++;
}
data++;
}
if ( *data )
{
data += 2;
}
}
else
break;
}
// handle scoped strings "???" <???> [???]
if ( c == '\"' || c == '<' || c == '[')
{
bool bConditionalExpression = false;
endSymbol = '\0';
switch ( c )
{
case '\"':
endSymbol = '\"';
break;
case '<':
endSymbol = '>';
break;
case '[':
bConditionalExpression = true;
endSymbol = ']';
break;
}
// want to preserve entire conditional expession [blah...blah...blah]
// maintain a conditional's open/close scope characters
if ( !bConditionalExpression )
{
// skip past scope character
data++;
}
for ( ;; )
{
c = *data++;
if ( c == endSymbol || !c )
{
if ( c == endSymbol && bConditionalExpression )
{
// keep end symbol
m_Token[len++] = c;
}
m_Token[len] = 0;
*dataptr = (char*)data;
return m_Token;
}
if ( len < MAX_SYSTOKENCHARS-1 )
{
m_Token[len++] = c;
}
}
}
// parse a regular word
do
{
if ( len < MAX_SYSTOKENCHARS )
{
m_Token[len++] = c;
}
data++;
c = *data;
}
while ( c > ' ' );
if ( len >= MAX_SYSTOKENCHARS )
{
len = 0;
}
m_Token[len] = '\0';
*dataptr = (char*)data;
return m_Token;
}
void CScript::PushScript( const char *pFilename )
{
// parse the text script
if ( !Sys_Exists( pFilename ) )
{
g_pVPC->VPCError( "Cannot open %s", pFilename );
}
char *pScriptBuffer;
Sys_LoadTextFileWithIncludes( pFilename, &pScriptBuffer, false );
PushScript( pFilename, pScriptBuffer, 1, true );
}
void CScript::PushScript( const char *pScriptName, const char *pScriptData, int nScriptLine, bool bFreeScriptAtPop )
{
if ( m_ScriptStack.Count() > MAX_SCRIPT_STACK_SIZE )
{
g_pVPC->VPCError( "PushScript( scriptname=%s ) - stack overflow\n", pScriptName );
}
// Push the current state onto the stack.
m_ScriptStack.Push( GetCurrentScript() );
// Set their state as the current state.
m_ScriptName = pScriptName;
m_pScriptData = pScriptData;
m_nScriptLine = nScriptLine;
m_bFreeScriptAtPop = bFreeScriptAtPop;
}
void CScript::PushCurrentScript()
{
PushScript( m_ScriptName.Get(), m_pScriptData, m_nScriptLine, m_bFreeScriptAtPop );
}
CScriptSource CScript::GetCurrentScript()
{
return CScriptSource( m_ScriptName.Get(), m_pScriptData, m_nScriptLine, m_bFreeScriptAtPop );
}
void CScript::RestoreScript( const CScriptSource &scriptSource )
{
m_ScriptName = scriptSource.GetName();
m_pScriptData = scriptSource.GetData();
m_nScriptLine = scriptSource.GetLine();
m_bFreeScriptAtPop = scriptSource.IsFreeScriptAtPop();
}
void CScript::PopScript()
{
if ( m_ScriptStack.Count() == 0 )
{
g_pVPC->VPCError( "PopScript(): stack is empty" );
}
if ( m_bFreeScriptAtPop && m_pScriptData )
{
free( (void *)m_pScriptData );
}
// Restore the top entry on the stack and pop it off.
const CScriptSource &state = m_ScriptStack.Top();
m_ScriptName = state.GetName();
m_pScriptData = state.GetData();
m_nScriptLine = state.GetLine();
m_bFreeScriptAtPop = state.IsFreeScriptAtPop();
m_ScriptStack.Pop();
}
void CScript::EnsureScriptStackEmpty()
{
if ( m_ScriptStack.Count() != 0 )
{
g_pVPC->VPCError( "EnsureScriptStackEmpty(): script stack is not empty!" );
}
}
void CScript::SpewScriptStack()
{
if ( m_ScriptStack.Count() )
{
CUtlString str;
// emit stack with current at top
str += "Script Stack:\n";
str += CFmtStr( " %s Line:%d\n", m_ScriptName.String(), m_nScriptLine );
for ( int i = m_ScriptStack.Count() - 1; i >= 0; i-- )
{
if ( i == 0 && !m_ScriptStack[i].GetData() && m_ScriptStack[i].GetLine() <= 0 )
{
// ignore empty bottom of stack
break;
}
str += CFmtStr( " %s Line:%d\n", m_ScriptStack[i].GetName(), m_ScriptStack[i].GetLine() );
}
str += "\n";
Log_Msg( LOG_VPC, "%s", str.String() );
}
}
const char *CScript::GetToken( bool bAllowLineBreaks )
{
return GetToken( &m_pScriptData, bAllowLineBreaks, m_pScriptLine );
}
const char *CScript::PeekNextToken( bool bAllowLineBreaks )
{
return PeekNextToken( m_pScriptData, bAllowLineBreaks );
}
void CScript::SkipRestOfLine()
{
SkipRestOfLine( &m_pScriptData, m_pScriptLine );
}
void CScript::SkipBracedSection()
{
SkipBracedSection( &m_pScriptData, m_pScriptLine );
}
void CScript::SkipToValidToken()
{
m_pScriptData = SkipToValidToken( m_pScriptData, NULL, m_pScriptLine );
}
//-----------------------------------------------------------------------------
// Handles expressions of the form <$BASE> <xxx> ... <xxx> [condition]
// Output is a concatenated string.
//
// Returns true if expression should be used, false if it should be ignored due
// to an optional condition that evaluated false.
//-----------------------------------------------------------------------------
bool CScript::ParsePropertyValue( const char *pBaseString, char *pOutBuff, int outBuffSize )
{
const char **pScriptData = &m_pScriptData;
int *pScriptLine = m_pScriptLine;
const char *pToken;
const char *pNextToken;
char *pOut = pOutBuff;
int remaining = outBuffSize-1;
int len;
bool bAllowNextLine = false;
char buffer1[MAX_SYSTOKENCHARS];
char buffer2[MAX_SYSTOKENCHARS];
bool bResult = true;
while ( 1 )
{
pToken = GetToken( pScriptData, bAllowNextLine, pScriptLine );
if ( !pToken || !pToken[0] )
g_pVPC->VPCSyntaxError();
pNextToken = PeekNextToken( *pScriptData, false );
if ( !pNextToken || !pNextToken[0] )
{
// current token is last token
// last token can be optional conditional, need to identify
// backup and reparse up to last token
if ( pToken && pToken[0] == '[' )
{
// last token is an optional conditional
bResult = g_pVPC->EvaluateConditionalExpression( pToken );
break;
}
}
if ( !V_stricmp( pToken, "\\" ) )
{
bAllowNextLine = true;
continue;
}
else
{
bAllowNextLine = false;
}
if ( !V_stricmp( pToken, "\\n" ) )
{
pToken = "\n";
}
if ( pToken[0] )
{
// handle reserved macro
if ( !pBaseString )
pBaseString = "";
strcpy( buffer1, pToken );
Sys_ReplaceString( buffer1, "$base", pBaseString, buffer2, sizeof( buffer2 ) );
g_pVPC->ResolveMacrosInString( buffer2, buffer1, sizeof( buffer1 ) );
len = strlen( buffer1 );
if ( remaining < len )
len = remaining;
if ( len > 0 )
{
memcpy( pOut, buffer1, len );
pOut += len;
remaining -= len;
}
}
pToken = PeekNextToken( *pScriptData, false );
if ( !pToken || !pToken[0] || !V_stricmp( pNextToken, "}" ) )
break;
}
*pOut++ = '\0';
if ( !pOutBuff[0] )
g_pVPC->VPCSyntaxError();
return bResult;
}

95
external/vpc/utils/vpc/scriptsource.h vendored Normal file
View File

@@ -0,0 +1,95 @@
//===================== Copyright (c) Valve Corporation. All Rights Reserved. ======================
//
// This module manages a stack of "script sources".
//
//==================================================================================================
#ifndef SCRIPTSOURCE_H
#define SCRIPTSOURCE_H
#ifdef _WIN32
#pragma once
#endif
#define MAX_SYSPRINTMSG 4096
#define MAX_SYSTOKENCHARS 4096
class CScriptSource
{
public:
CScriptSource()
{
Set( "", NULL, 0, false );
}
CScriptSource( const char *pScriptName, const char *pScriptData, int nScriptLine, bool bFreeScriptAtPop )
{
Set( pScriptName, pScriptData, nScriptLine, bFreeScriptAtPop );
}
void Set( const char *pScriptName, const char *pScriptData, int nScriptLine, bool bFreeScriptAtPop )
{
m_ScriptName = pScriptName;
m_pScriptData = pScriptData;
m_nScriptLine = nScriptLine;
m_bFreeScriptAtPop = bFreeScriptAtPop;
}
const char *GetName() const { return m_ScriptName.Get(); }
const char *GetData() const { return m_pScriptData; }
int GetLine() const { return m_nScriptLine; }
bool IsFreeScriptAtPop() const { return m_bFreeScriptAtPop; }
private:
CUtlString m_ScriptName;
const char *m_pScriptData;
int m_nScriptLine;
bool m_bFreeScriptAtPop;
};
class CScript
{
public:
CScript();
void PushScript( const char *pFilename );
void PushScript( const char *pScriptName, const char *ppScriptData, int nScriptLine = 1, bool bFreeScriptAtPop = false );
void PushCurrentScript();
void PopScript();
CScriptSource GetCurrentScript();
void RestoreScript( const CScriptSource &scriptSource );
void EnsureScriptStackEmpty();
void SpewScriptStack();
const char *GetName() const { return m_ScriptName.Get(); }
const char *GetData() const { return m_pScriptData; }
int GetLine() const { return m_nScriptLine; }
const char *GetToken( bool bAllowLineBreaks );
const char *PeekNextToken( bool bAllowLineBreaks );
void SkipRestOfLine();
void SkipBracedSection();
void SkipToValidToken();
bool ParsePropertyValue( const char *pBaseString, char *pOutBuff, int outBuffSize );
private:
const char *SkipWhitespace( const char *data, bool *pHasNewLines, int *pNumLines );
const char *SkipToValidToken( const char *data, bool *pHasNewLines, int *pNumLines );
void SkipBracedSection( const char **dataptr, int *numlines );
void SkipRestOfLine( const char **dataptr, int *numlines );
const char *PeekNextToken( const char *dataptr, bool bAllowLineBreaks );
const char *GetToken( const char **dataptr, bool allowLineBreaks, int *pNumLines );
CUtlStack< CScriptSource > m_ScriptStack;
int m_nScriptLine;
int *m_pScriptLine;
const char *m_pScriptData;
CUtlString m_ScriptName;
bool m_bFreeScriptAtPop;
char m_Token[MAX_SYSTOKENCHARS];
char m_PeekToken[MAX_SYSTOKENCHARS];
};
#endif // SCRIPTSOURCE_H

View File

@@ -0,0 +1,285 @@
//====== Copyright 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#include "vpc.h"
#include "dependencies.h"
#include "utlgraph.h"
class CSolutionGenerator_CodeLite : public IBaseSolutionGenerator {
public:
CSolutionGenerator_CodeLite() {
m_nIndent = 0;
m_fp = NULL;
}
virtual void GenerateSolutionFile( const char *pSolutionFilename, CUtlVector<CDependency_Project*> &projects ) {
char szSolutionName[MAX_PATH];
V_FileBase( pSolutionFilename, szSolutionName, MAX_PATH );
char szSolutionFileBaseName[MAX_PATH];
// Default extension.
char szTmpSolutionFilename[MAX_PATH];
if ( !V_GetFileExtension( pSolutionFilename ) ) {
V_strncpy( szSolutionFileBaseName, pSolutionFilename, sizeof( szSolutionFileBaseName ) );
V_snprintf( szTmpSolutionFilename, sizeof( szTmpSolutionFilename ), "%s.workspace", pSolutionFilename );
pSolutionFilename = szTmpSolutionFilename;
} else {
V_StripExtension( pSolutionFilename, szSolutionFileBaseName, sizeof( szSolutionFileBaseName ) );
}
Msg( "\nWriting CodeLite workspace %s.\n\n", pSolutionFilename );
// Write the file.
m_fp = fopen( pSolutionFilename, "wt" );
if ( !m_fp )
g_pVPC->VPCError( "Can't open %s for writing.", pSolutionFilename );
Write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" );
Write( "<CodeLite_Workspace Name=\"%s\" Database=\"%s.tags\">\n", szSolutionName, szSolutionFileBaseName );
++m_nIndent;
Write( "<Project Name=\"all\" Path=\"%s.project\" Active=\"Yes\"/>\n", szSolutionFileBaseName);
for ( int i=0; i < projects.Count(); i++ ) {
CDependency_Project *pCurProject = projects[i];
project_t *pProjectT = &g_pVPC->m_Projects[ pCurProject->m_iProjectIndex ];
char szProjectFileBaseName[MAX_PATH];
V_StripExtension( pCurProject->m_ProjectFilename.String(), szProjectFileBaseName, sizeof( szProjectFileBaseName ) );
Write( "<Project Name=\"%s\" Path=\"%s.project\"/>\n", pProjectT->name.String(), szProjectFileBaseName );
}
Write( "<BuildMatrix>\n" );
++m_nIndent;
Write( "<WorkspaceConfiguration Name=\"Debug\" Selected=\"no\">\n" );
++m_nIndent;
Write( "<Project Name=\"all\" ConfigName=\"Debug\"/>\n" );
for ( int i=0; i < projects.Count(); i++ ) {
CDependency_Project *pCurProject = projects[i];
project_t *pProjectT = &g_pVPC->m_Projects[ pCurProject->m_iProjectIndex ];
Write( "<Project Name=\"%s\" ConfigName=\"Debug\"/>\n", pProjectT->name.String() );
}
--m_nIndent;
Write( "</WorkspaceConfiguration>\n" );
Write( "<WorkspaceConfiguration Name=\"Release\" Selected=\"yes\">\n" );
++m_nIndent;
Write( "<Project Name=\"all\" ConfigName=\"Release\"/>\n" );
for ( int i=0; i < projects.Count(); i++ ) {
CDependency_Project *pCurProject = projects[i];
project_t *pProjectT = &g_pVPC->m_Projects[ pCurProject->m_iProjectIndex ];
Write( "<Project Name=\"%s\" ConfigName=\"Release\"/>\n", pProjectT->name.String() );
}
--m_nIndent;
Write( "</WorkspaceConfiguration>\n" );
--m_nIndent;
Write( "</BuildMatrix>\n" );
--m_nIndent;
Write( "</CodeLite_Workspace>\n" );
fclose( m_fp );
WriteBuildOrderProject( szSolutionFileBaseName, projects );
}
void WriteBuildOrderProject( const char *pszSolutionFileBaseName, CUtlVector<CDependency_Project*> &projects ) {
// write out a project with no files to encode the build order (dependencies)
char szProjectFileName[MAX_PATH];
V_snprintf( szProjectFileName, sizeof( szProjectFileName ), "%s.project", pszSolutionFileBaseName );
m_nIndent = 0;
m_fp = fopen( szProjectFileName, "wt" );
if ( !m_fp )
g_pVPC->VPCError( "Can't open %s for writing.", szProjectFileName );
Write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" );
Write( "<CodeLite_Project Name=\"all\" InternalType=\"\">\n" );
{
++m_nIndent;
Write( "<Description/>\n" );
Write( "<Dependencies/>\n" );
Write( "<Settings Type=\"Static Library\">\n" );
{
++m_nIndent;
Write( "<GlobalSettings>\n" );
++m_nIndent;
Write( "<Compiler Options=\"\" C_Options=\"\">\n" );
++m_nIndent;
Write( "<IncludePath Value=\"\"/>\n" );
--m_nIndent;
Write( "</Compiler>\n" );
Write( "<Linker Options=\"\">\n" );
++m_nIndent;
Write( "<LibraryPath Value=\"\"/>\n" );
--m_nIndent;
Write( "</Linker>\n" );
Write( "<ResourceCompiler Options=\"\"/>\n" );
--m_nIndent;
Write( "</GlobalSettings>\n" );
Write( "<Configuration Name=\"Debug\" CompilerType=\"gnu g++\" DebuggerType=\"GNU gdb debugger\" Type=\"Executable\" BuildCmpWithGlobalSettings=\"append\" BuildLnkWithGlobalSettings=\"append\" BuildResWithGlobalSettings=\"append\">\n" );
#if 0
++m_nIndent;
Write( "<Compiler Options=\"-g\" C_Options="" Required="yes" PreCompiledHeader="">\n" );
++m_nIndent;
Write( "<IncludePath Value=\"\"/>" );
--m_nIndent;
--m_nIndent;
#endif
Write( "</Configuration>\n" );
Write( "<Configuration Name=\"Release\" CompilerType=\"gnu g++\" DebuggerType=\"GNU gdb debugger\" Type=\"Executable\" BuildCmpWithGlobalSettings=\"append\" BuildLnkWithGlobalSettings=\"append\" BuildResWithGlobalSettings=\"append\">\n" );
#if 0
++m_nIndent;
Write( "<Compiler Options=\"-g\" C_Options="" Required="yes" PreCompiledHeader="">\n" );
++m_nIndent;
Write( "<IncludePath Value=\"\"/>" );
--m_nIndent;
--m_nIndent;
#endif
Write( "</Configuration>\n" );
--m_nIndent;
}
Write( "</Settings>\n" );
--m_nIndent;
CUtlGraph<int, int> dependencyGraph;
// walk the project list building a dependency graph
for ( int i=0; i < projects.Count(); i++ )
{
CDependency_Project *pCurProject = projects[i];
CUtlVector<CDependency_Project*> additionalProjectDependencies;
ResolveAdditionalProjectDependencies( pCurProject, projects, additionalProjectDependencies );
//project_t *pProjectT = &g_projects[ pCurProject->m_iProjectIndex ];
//printf( "%s depends on\n", pProjectT->name.String() );
for ( int iTestProject=0; iTestProject < projects.Count(); iTestProject++ ) {
if ( i == iTestProject )
continue;
// do I depend on anyone?
CDependency_Project *pTestProject = projects[iTestProject];
int dependsOnFlags = k_EDependsOnFlagTraversePastLibs | k_EDependsOnFlagCheckNormalDependencies | k_EDependsOnFlagRecurse;
if ( pCurProject->DependsOn( pTestProject, dependsOnFlags ) || additionalProjectDependencies.Find( pTestProject ) != additionalProjectDependencies.InvalidIndex() ) {
// add an edge from this project to the one it depends on
dependencyGraph.AddEdge( i, iTestProject, 1 );
//printf( " %s -> %s\n", projects[ i ]->m_ProjectName.String(),
// projects[ iTestProject ]->m_ProjectName.String() );
}
}
}
Write( "<Dependencies Name=\"Debug\">\n" );
++m_nIndent;
CUtlVector<int> visitedList;
for( int i = 0; i < projects.Count(); i++ ) {
TraverseFrom( projects, dependencyGraph, visitedList, i );
}
--m_nIndent;
Write( "</Dependencies>\n" );
Write( "<Dependencies Name=\"Release\">\n" );
++m_nIndent;
visitedList.Purge();
for( int i = 0; i < projects.Count(); i++ ) {
TraverseFrom( projects, dependencyGraph, visitedList, i );
}
--m_nIndent;
Write( "</Dependencies>\n" );
}
Write( "</CodeLite_Project>\n" );
fclose( m_fp );
}
void TraverseFrom( CUtlVector<CDependency_Project*> &projects, CUtlGraph<int, int> &dependencyGraph, CUtlVector<int> &visitedList, int root ) {
CUtlGraphVisitor<int> visitor( dependencyGraph );
if ( visitedList.Find( root ) != visitedList.InvalidIndex() )
return;
// this project has no dependencies, just emit it
if ( !visitor.Begin( root ) )
{
Write( "<Project Name=\"%s\"/>\n", projects[ root ]->m_ProjectName.String() );
visitedList.AddToTail( root );
return;
}
// printf( "considering %i (%s)\n", root, projects[ root ]->m_ProjectName.String() );
while ( visitor.Advance() ) {
// printf( "%i (%s) depends on %i (%s)\n", root, projects[ root ]->m_ProjectName.String(), visitor.CurrentNode(), projects[ visitor.CurrentNode() ]->m_ProjectName.String() );
TraverseFrom( projects, dependencyGraph, visitedList, visitor.CurrentNode() );
}
Write( "<Project Name=\"%s\"/>\n", projects[ root ]->m_ProjectName.String() );
visitedList.AddToTail( root );
// printf( "emitting %i (%s)\n", root, projects[ root ]->m_ProjectName.String() );
}
void ResolveAdditionalProjectDependencies(
CDependency_Project *pCurProject,
CUtlVector<CDependency_Project*> &projects,
CUtlVector<CDependency_Project*> &additionalProjectDependencies ) {
for ( int i=0; i < pCurProject->m_AdditionalProjectDependencies.Count(); i++ ) {
const char *pLookingFor = pCurProject->m_AdditionalProjectDependencies[i].String();
int j;
for ( j=0; j < projects.Count(); j++ ) {
if ( V_stricmp( projects[j]->m_ProjectName.String(), pLookingFor ) == 0 )
break;
}
if ( j == projects.Count() )
g_pVPC->VPCError( "Project %s lists '%s' in its $AdditionalProjectDependencies, but there is no project by that name in the selected projects.", pCurProject->GetName(), pLookingFor );
additionalProjectDependencies.AddToTail( projects[j] );
}
}
const char* FindInFile( const char *pFilename, const char *pFileData, const char *pSearchFor ) {
const char *pPos = V_stristr( pFileData, pSearchFor );
if ( !pPos )
g_pVPC->VPCError( "Can't find ProjectGUID in %s.", pFilename );
return pPos + V_strlen( pSearchFor );
}
void Write( const char *pMsg, ... ) {
char sOut[8192];
va_list marker;
va_start( marker, pMsg );
V_vsnprintf( sOut, sizeof( sOut ), pMsg, marker );
va_end( marker );
for ( int i=0; i < m_nIndent; i++ )
fprintf( m_fp, " " );
fprintf( m_fp, "%s", sOut );
}
FILE *m_fp;
int m_nIndent;
};
static CSolutionGenerator_CodeLite g_SolutionGenerator_CodeLite;
IBaseSolutionGenerator* GetSolutionGenerator_CodeLite() {
return &g_SolutionGenerator_CodeLite;
}

View File

@@ -0,0 +1,341 @@
//====== Copyright 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#include "vpc.h"
#include "dependencies.h"
extern void V_MakeAbsoluteCygwinPath( char *pOut, int outLen, const char *pRelativePath );
extern void MakeFriendlyProjectName( char *pchProject )
{
int strLen = V_strlen( pchProject );
for ( int j = 0; j < strLen; j++ )
{
if ( pchProject[j] == ' ' )
pchProject[j] = '_';
if ( pchProject[j] == '(' || pchProject[j] == ')' )
{
V_memmove( pchProject+j, pchProject+j+1, strLen - j );
strLen--;
}
}
}
class CSolutionGenerator_Makefile : public IBaseSolutionGenerator
{
private:
void GenerateProjectNames( CUtlVector<CUtlString> &projNames, CUtlVector<CDependency_Project*> &projects )
{
for ( int i=0; i < projects.Count(); i++ )
{
CDependency_Project *pCurProject = projects[i];
char szFriendlyName[256];
V_strncpy( szFriendlyName, pCurProject->m_ProjectName.String(), sizeof(szFriendlyName) );
MakeFriendlyProjectName( szFriendlyName );
projNames[ projNames.AddToTail() ] = szFriendlyName;
}
}
public:
virtual void GenerateSolutionFile( const char *pSolutionFilename, CUtlVector<CDependency_Project*> &projects )
{
// Default extension.
char szTmpSolutionFilename[MAX_PATH];
if ( !V_GetFileExtension( pSolutionFilename ) )
{
V_snprintf( szTmpSolutionFilename, sizeof( szTmpSolutionFilename ), "%s.mak", pSolutionFilename );
pSolutionFilename = szTmpSolutionFilename;
}
const char *pTargetPlatformName;
// forestw: if PLATFORM macro exists we should use its value, this accommodates overrides of PLATFORM in .vpc files
macro_t *pMacro = g_pVPC->FindOrCreateMacro( "PLATFORM", false, NULL );
if ( pMacro )
pTargetPlatformName = pMacro->value.String();
else
pTargetPlatformName = g_pVPC->GetTargetPlatformName();
Msg( "\nWriting master makefile %s.\n\n", pSolutionFilename );
// Write the file.
FILE *fp = fopen( pSolutionFilename, "wt" );
if ( !fp )
g_pVPC->VPCError( "Can't open %s for writing.", pSolutionFilename );
fprintf( fp, "# VPC MASTER MAKEFILE\n\n" );
fprintf( fp, "# Disable built-in rules/variables. We don't depend on them, and they slow down make processing.\n" );
fprintf( fp, "MAKEFLAGS += --no-builtin-rules --no-builtin-variables\n" );
fprintf( fp, "ifeq ($(MAKE_VERBOSE),)\n" );
fprintf( fp, "MAKEFLAGS += --no-print-directory\n" );
fprintf( fp, "endif\n\n" );
fprintf( fp, "ifneq \"$(LINUX_TOOLS_PATH)\" \"\"\n" );
fprintf( fp, " TOOL_PATH = $(LINUX_TOOLS_PATH)/\n" );
fprintf( fp, " SHELL := $(TOOL_PATH)bash\n" );
fprintf( fp, "else\n" );
fprintf( fp, " SHELL := /bin/bash\n" );
fprintf( fp, "endif\n" );
fprintf( fp, "ifndef NO_CHROOT\n" );
if ( V_stristr( pTargetPlatformName, "64" ) )
{
fprintf( fp, " export CHROOT_NAME ?= $(subst /,_,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))amd64\n");
fprintf( fp, " RUNTIME_NAME ?= steamrt_scout_amd64\n");
fprintf( fp, " CHROOT_PERSONALITY ?= linux\n");
}
else if ( V_stristr( pTargetPlatformName, "32" ) )
{
fprintf( fp, " export CHROOT_NAME ?= $(subst /,_,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))\n");
fprintf( fp, " RUNTIME_NAME ?= steamrt_scout_i386\n");
fprintf( fp, " CHROOT_PERSONALITY ?= linux32\n");
}
else
{
g_pVPC->VPCError( "TargetPlatform (%s) doesn't seem to be 32 or 64 bit, can't configure chroot parameters", pTargetPlatformName );
}
fprintf( fp, " CHROOT_CONF := /etc/schroot/chroot.d/$(CHROOT_NAME).conf\n");
fprintf( fp, " CHROOT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/tools/runtime/linux)\n\n");
fprintf( fp, " export MAKE_CHROOT = 1\n" );
fprintf( fp, " ifneq (\"$(SCHROOT_CHROOT_NAME)\", \"$(CHROOT_NAME)\")\n");
fprintf( fp, " SHELL := schroot --chroot $(CHROOT_NAME) -- /bin/bash\n");
fprintf( fp, " endif\n");
fprintf( fp, "endif\n\n" ); // NO_CHROOT
fprintf( fp, "ECHO = $(TOOL_PATH)echo\n" );
fprintf( fp, "ETAGS = $(TOOL_PATH)etags\n" );
fprintf( fp, "FIND = $(TOOL_PATH)find\n" );
fprintf( fp, "UNAME = $(TOOL_PATH)uname\n" );
fprintf( fp, "XARGS = $(TOOL_PATH)xargs\n" );
fprintf( fp, "\n");
fprintf( fp, "# to control parallelism, set the MAKE_JOBS environment variable\n" );
fprintf( fp, "ifeq ($(strip $(MAKE_JOBS)),)\n");
fprintf( fp, " ifeq ($(shell $(UNAME)),Darwin)\n" );
fprintf( fp, " CPUS := $(shell /usr/sbin/sysctl -n hw.ncpu)\n" );
fprintf( fp, " endif\n");
fprintf( fp, " ifeq ($(shell $(UNAME)),Linux)\n" );
fprintf( fp, " CPUS := $(shell $(TOOL_PATH)grep processor /proc/cpuinfo | $(TOOL_PATH)wc -l)\n" );
fprintf( fp, " endif\n");
fprintf( fp, " MAKE_JOBS := $(CPUS)\n" );
fprintf( fp, "endif\n\n" );
fprintf( fp, "ifeq ($(strip $(MAKE_JOBS)),)\n");
fprintf( fp, " MAKE_JOBS := 8\n" );
fprintf( fp, "endif\n\n" );
// Handle VALVE_NO_PROJECT_DEPS
fprintf( fp, "# make VALVE_NO_PROJECT_DEPS 1 or empty (so VALVE_NO_PROJECT_DEPS=0 works as expected)\n");
fprintf( fp, "ifeq ($(strip $(VALVE_NO_PROJECT_DEPS)),1)\n");
fprintf( fp, "\tVALVE_NO_PROJECT_DEPS := 1\n");
fprintf( fp, "else\n");
fprintf( fp, "\tVALVE_NO_PROJECT_DEPS :=\n");
fprintf( fp, "endif\n\n");
// Handle VALVE_NO_PROJECT_DEPS
fprintf( fp, "# make VALVE_NO_PROJECT_DEPS 1 or empty (so VALVE_NO_PROJECT_DEPS=0 works as expected)\n");
fprintf( fp, "ifeq ($(strip $(VALVE_NO_PROJECT_DEPS)),1)\n");
fprintf( fp, "\tVALVE_NO_PROJECT_DEPS := 1\n");
fprintf( fp, "else\n");
fprintf( fp, "\tVALVE_NO_PROJECT_DEPS :=\n");
fprintf( fp, "endif\n\n");
// First, make a target with all the project names.
fprintf( fp, "# All projects (default target)\n" );
fprintf( fp, "all: $(CHROOT_CONF)\n" );
fprintf( fp, "\t$(MAKE) -f $(lastword $(MAKEFILE_LIST)) -j$(MAKE_JOBS) all-targets\n\n" );
fprintf( fp, "all-targets : " );
CUtlVector<CUtlString> projNames;
GenerateProjectNames( projNames, projects );
for ( int i=0; i < projects.Count(); i++ )
{
fprintf( fp, "%s ", projNames[i].String() );
}
fprintf( fp, "\n\n\n# Individual projects + dependencies\n\n" );
for ( int i=0; i < projects.Count(); i++ )
{
CDependency_Project *pCurProject = projects[i];
CUtlVector<CDependency_Project*> additionalProjectDependencies;
ResolveAdditionalProjectDependencies( pCurProject, projects, additionalProjectDependencies );
fprintf( fp, "%s : $(if $(VALVE_NO_PROJECT_DEPS),,$(CHROOT_CONF) ", projNames[i].String() );
for ( int iTestProject=0; iTestProject < projects.Count(); iTestProject++ )
{
if ( i == iTestProject )
continue;
CDependency_Project *pTestProject = projects[iTestProject];
int dependsOnFlags = k_EDependsOnFlagTraversePastLibs | k_EDependsOnFlagCheckNormalDependencies | k_EDependsOnFlagRecurse;
if ( pCurProject->DependsOn( pTestProject, dependsOnFlags ) || additionalProjectDependencies.Find( pTestProject ) != additionalProjectDependencies.InvalidIndex() )
{
fprintf( fp, "%s ", projNames[iTestProject].String() );
}
}
fprintf( fp, ")" ); // Closing $(if) above
// Now add the code to build this thing.
char sDirTemp[MAX_PATH], sDir[MAX_PATH];
V_strncpy( sDirTemp, pCurProject->m_ProjectFilename.String(), sizeof( sDirTemp ) );
V_StripFilename( sDirTemp );
V_MakeAbsoluteCygwinPath( sDir, sizeof( sDir ), sDirTemp );
const char *pFilename = V_UnqualifiedFileName( pCurProject->m_ProjectFilename.String() );
fprintf( fp, "\n\t@echo \"Building: %s\"", projNames[i].String());
fprintf( fp, "\n\t@+cd %s && $(MAKE) -f %s $(SUBMAKE_PARAMS) $(CLEANPARAM)", sDir, pFilename );
fprintf( fp, "\n\n" );
}
fprintf( fp, "# this is a bit over-inclusive, but the alternative (actually adding each referenced c/cpp/h file to\n" );
fprintf( fp, "# the tags file) seems like more work than it's worth. feel free to fix that up if it bugs you. \n" );
fprintf( fp, "TAGS:\n" );
fprintf( fp, "\t@rm -f TAGS\n" );
for ( int i=0; i < projects.Count(); i++ )
{
CDependency_Project *pCurProject = projects[i];
char sDirTemp[MAX_PATH], sDir[MAX_PATH];
V_strncpy( sDirTemp, pCurProject->m_ProjectFilename.String(), sizeof( sDirTemp ) );
V_StripFilename( sDirTemp );
V_MakeAbsoluteCygwinPath( sDir, sizeof( sDir ), sDirTemp );
fprintf( fp, "\t@$(FIND) %s -name \'*.cpp\' -print0 | $(XARGS) -0 $(ETAGS) --declarations --ignore-indentation --append\n", sDir );
fprintf( fp, "\t@$(FIND) %s -name \'*.h\' -print0 | $(XARGS) -0 $(ETAGS) --language=c++ --declarations --ignore-indentation --append\n", sDir );
fprintf( fp, "\t@$(FIND) %s -name \'*.c\' -print0 | $(XARGS) -0 $(ETAGS) --declarations --ignore-indentation --append\n", sDir );
}
fprintf( fp, "\n\n" );
fprintf( fp, "\n# Mark all the projects as phony or else make will see the directories by the same name and think certain targets \n\n" );
fprintf( fp, ".PHONY: TAGS showtargets regen showregen clean cleantargets cleanandremove relink " );
for ( int i=0; i < projects.Count(); i++ )
{
fprintf( fp, "%s ", projNames[i].String() );
}
fprintf( fp, "\n\n\n" );
fprintf( fp, "\n# The standard clean command to clean it all out.\n" );
fprintf( fp, "\nclean: \n" );
fprintf( fp, "\t@$(MAKE) -f $(lastword $(MAKEFILE_LIST)) -j$(MAKE_JOBS) all-targets CLEANPARAM=clean\n\n\n" );
fprintf( fp, "\n# clean targets, so we re-link next time.\n" );
fprintf( fp, "\ncleantargets: \n" );
fprintf( fp, "\t@$(MAKE) -f $(lastword $(MAKEFILE_LIST)) -j$(MAKE_JOBS) all-targets CLEANPARAM=cleantargets\n\n\n" );
fprintf( fp, "\n# p4 edit and remove targets, so we get an entirely clean build.\n" );
fprintf( fp, "\ncleanandremove: \n" );
fprintf( fp, "\t@$(MAKE) -f $(lastword $(MAKEFILE_LIST)) -j$(MAKE_JOBS) all-targets CLEANPARAM=cleanandremove\n\n\n" );
fprintf( fp, "\n#relink\n" );
fprintf( fp, "\nrelink: cleantargets \n" );
fprintf( fp, "\t@$(MAKE) -f $(lastword $(MAKEFILE_LIST)) -j$(MAKE_JOBS) all-targets\n\n\n" );
// Create the showtargets target.
fprintf( fp, "\n# Here's a command to list out all the targets\n\n" );
fprintf( fp, "\nshowtargets: \n" );
fprintf( fp, "\t@$(ECHO) '-------------------' && \\\n" );
fprintf( fp, "\t$(ECHO) '----- TARGETS -----' && \\\n" );
fprintf( fp, "\t$(ECHO) '-------------------' && \\\n" );
fprintf( fp, "\t$(ECHO) 'clean' && \\\n" );
fprintf( fp, "\t$(ECHO) 'regen' && \\\n" );
fprintf( fp, "\t$(ECHO) 'showregen' && \\\n" );
for ( int i=0; i < projects.Count(); i++ )
{
fprintf( fp, "\t$(ECHO) '%s'", projNames[i].String() );
if ( i != projects.Count()-1 )
fprintf( fp, " && \\" );
fprintf( fp, "\n" );
}
fprintf( fp, "\n\n" );
// Create the regen target.
fprintf( fp, "\n# Here's a command to regenerate this makefile\n\n" );
fprintf( fp, "\nregen: \n" );
fprintf( fp, "\t" );
ICommandLine *pCommandLine = CommandLine();
for ( int i=0; i < pCommandLine->ParmCount(); i++ )
{
fprintf( fp, "%s ", pCommandLine->GetParm( i ) );
}
fprintf( fp, "\n\n" );
// Create the showregen target.
fprintf( fp, "\n# Here's a command to list out all the targets\n\n" );
fprintf( fp, "\nshowregen: \n" );
fprintf( fp, "\t@$(ECHO) " );
for ( int i=0; i < pCommandLine->ParmCount(); i++ )
{
fprintf( fp, "%s ", pCommandLine->GetParm( i ) );
}
fprintf( fp, "\n\n" );
// Auto-create the chroot if it's not there
fprintf( fp, "ifdef CHROOT_CONF\n"
"$(CHROOT_CONF): $(CHROOT_DIR)/$(RUNTIME_NAME)/timestamp\n"
"$(CHROOT_CONF): SHELL = /bin/bash\n"
"$(CHROOT_DIR)/$(RUNTIME_NAME)/timestamp: $(CHROOT_DIR)/$(RUNTIME_NAME).tar.xz\n"
"\t@echo \"Configuring schroot at $(CHROOT_DIR) (requires sudo)\"\n"
"\tsudo $(CHROOT_DIR)/configure_runtime.sh ${CHROOT_NAME} $(RUNTIME_NAME) $(CHROOT_PERSONALITY)\n"
"endif\n");
fclose( fp );
}
void ResolveAdditionalProjectDependencies(
CDependency_Project *pCurProject,
CUtlVector<CDependency_Project*> &projects,
CUtlVector<CDependency_Project*> &additionalProjectDependencies )
{
for ( int i=0; i < pCurProject->m_AdditionalProjectDependencies.Count(); i++ )
{
const char *pLookingFor = pCurProject->m_AdditionalProjectDependencies[i].String();
int j;
for ( j=0; j < projects.Count(); j++ )
{
if ( V_stricmp( projects[j]->m_ProjectName.String(), pLookingFor ) == 0 )
break;
}
if ( j == projects.Count() )
g_pVPC->VPCError( "Project %s lists '%s' in its $AdditionalProjectDependencies, but there is no project by that name in the selected projects.", pCurProject->GetName(), pLookingFor );
additionalProjectDependencies.AddToTail( projects[j] );
}
}
const char* FindInFile( const char *pFilename, const char *pFileData, const char *pSearchFor )
{
const char *pPos = V_stristr( pFileData, pSearchFor );
if ( !pPos )
g_pVPC->VPCError( "Can't find ProjectGUID in %s.", pFilename );
return pPos + V_strlen( pSearchFor );
}
};
static CSolutionGenerator_Makefile g_SolutionGenerator_Makefile;
IBaseSolutionGenerator* GetMakefileSolutionGenerator()
{
return &g_SolutionGenerator_Makefile;
}

View File

@@ -0,0 +1,370 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#include "vpc.h"
#include "dependencies.h"
#include "tier1/checksum_md5.h"
class CVCProjInfo
{
public:
CUtlString m_ProjectName;
CUtlString m_ProjectGUID;
};
struct RegStartPoint
{
HKEY baseKey;
const char* const baseDir;
};
class CSolutionGenerator_Win32 : public IBaseSolutionGenerator
{
public:
void GetVCPROJSolutionGUID( char (&szSolutionGUID)[256] )
{
HKEY hKey;
int firstVer = 8;
const int lastVer = 14; // Handle up to VS 14, AKA VS 2015
if ( g_pVPC->Is2010() )
{
firstVer = 10;
}
else if ( g_pVPC->BUse2008() )
{
firstVer = 9;
}
for ( int vsVer = firstVer; vsVer <= lastVer; ++vsVer )
{
// Handle both VisualStudio and VCExpress (used by some SourceSDK customers)
RegStartPoint searchPoints[] =
{
{ HKEY_LOCAL_MACHINE, "Software\\Microsoft\\VisualStudio\\%d.0\\Projects" }, // Visual Studio Professional
{ HKEY_LOCAL_MACHINE, "Software\\Microsoft\\VCExpress\\%d.0\\Projects" }, // VC Express 2010 and 2012
{ HKEY_CURRENT_USER, "Software\\Microsoft\\WDExpress\\%d.0_Config\\Projects" }, // WinDev Express -- VS Express starting with VS 2013
};
for ( int j = 0; j < ARRAYSIZE(searchPoints); ++j )
{
RegStartPoint& searchPoint = searchPoints[ j ];
char pRegKeyName[1000];
V_snprintf( pRegKeyName, ARRAYSIZE(pRegKeyName), searchPoint.baseDir, vsVer );
LONG ret = RegOpenKeyEx( searchPoint.baseKey, pRegKeyName, 0, KEY_READ, &hKey );
//if ( ret != ERROR_SUCCESS )
// g_pVPC->VPCError( "Unable to open registry key %s.", pRegKeyName );
for ( int i=0; i < 200; i++ )
{
char szKeyName[MAX_PATH];
DWORD dwKeyNameSize = sizeof( szKeyName );
ret = RegEnumKeyEx( hKey, i, szKeyName, &dwKeyNameSize, NULL, NULL, NULL, NULL );
if ( ret == ERROR_NO_MORE_ITEMS )
break;
HKEY hSubKey;
LONG ret = RegOpenKeyEx( hKey, szKeyName, 0, KEY_READ, &hSubKey );
if ( ret == ERROR_SUCCESS )
{
DWORD dwType;
char ext[MAX_PATH];
DWORD dwExtLen = sizeof( ext );
ret = RegQueryValueEx( hSubKey, "DefaultProjectExtension", NULL, &dwType, (BYTE*)ext, &dwExtLen );
RegCloseKey( hSubKey );
// VS 2012 and beyond has the DefaultProjectExtension as vcxproj instead of vcproj
if ( ret == ERROR_SUCCESS && dwType == REG_SZ && ( V_stricmp( ext, "vcproj" ) == 0 || V_stricmp( ext, "vcxproj" ) == 0 ) )
{
V_strncpy( szSolutionGUID, szKeyName, ARRAYSIZE(szSolutionGUID) );
RegCloseKey( hKey );
return;
}
}
}
RegCloseKey( hKey );
}
}
g_pVPC->VPCError( "Unable to find RegKey for .vcproj or .vcxproj files in solutions." );
}
virtual void GenerateSolutionFile( const char *pSolutionFilename, CUtlVector<CDependency_Project*> &projects )
{
// Default extension.
char szTmpSolutionFilename[MAX_PATH];
if ( !V_GetFileExtension( pSolutionFilename ) )
{
V_snprintf( szTmpSolutionFilename, sizeof( szTmpSolutionFilename ), "%s.sln", pSolutionFilename );
pSolutionFilename = szTmpSolutionFilename;
}
Msg( "\nWriting solution file %s.\n\n", pSolutionFilename );
char szSolutionGUID[256];
GetVCPROJSolutionGUID( szSolutionGUID );
CUtlVector<CVCProjInfo> vcprojInfos;
GetProjectInfos( projects, vcprojInfos );
// Write the file.
FILE *fp = fopen( pSolutionFilename, "wt" );
if ( !fp )
g_pVPC->VPCError( "Can't open %s for writing.", pSolutionFilename );
if ( g_pVPC->Is2015() )
{
fprintf( fp, "\xef\xbb\xbf\nMicrosoft Visual Studio Solution File, Format Version 12.00\n" ); // still on 12
fprintf( fp, "# Visual Studio 2015\n" );
}
else if ( g_pVPC->Is2013() )
{
fprintf( fp, "\xef\xbb\xbf\nMicrosoft Visual Studio Solution File, Format Version 12.00\n" ); // Format didn't change from VS 2012 to VS 2013
fprintf( fp, "# Visual Studio 2013\n" );
}
else if ( g_pVPC->Is2012() )
{
fprintf( fp, "\xef\xbb\xbf\nMicrosoft Visual Studio Solution File, Format Version 12.00\n" );
fprintf( fp, "# Visual Studio 2012\n" );
}
else if ( g_pVPC->Is2010() )
{
fprintf( fp, "\xef\xbb\xbf\nMicrosoft Visual Studio Solution File, Format Version 11.00\n" );
fprintf( fp, "# Visual Studio 2010\n" );
}
else if ( g_pVPC->BUse2008() )
{
fprintf( fp, "\xef\xbb\xbf\nMicrosoft Visual Studio Solution File, Format Version 10.00\n" );
fprintf( fp, "# Visual Studio 2008\n" );
}
else
{
fprintf( fp, "\xef\xbb\xbf\nMicrosoft Visual Studio Solution File, Format Version 9.00\n" );
fprintf( fp, "# Visual Studio 2005\n" );
}
fprintf( fp, "#\n" );
fprintf( fp, "# Automatically generated solution:\n" );
fprintf( fp, "# devtools\\bin\\vpc " );
for ( int k = 1; k < __argc; ++ k )
fprintf( fp, "%s ", __argv[k] );
fprintf( fp, "\n" );
fprintf( fp, "#\n" );
fprintf( fp, "#\n" );
if ( !g_pVPC->Is2010() )
{
// if /slnItems <filename> is passed on the command line, build a Solution Items project
const char *pSolutionItemsFilename = g_pVPC->GetSolutionItemsFilename();
if ( pSolutionItemsFilename[0] != '\0' )
{
fprintf( fp, "Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{AAAAAAAA-8B4A-11D0-8D11-90A07D6D6F7D}\"\n" );
fprintf( fp, "\tProjectSection(SolutionItems) = preProject\n" );
WriteSolutionItems( fp );
fprintf( fp, "\tEndProjectSection\n" );
fprintf( fp, "EndProject\n" );
}
}
for ( int i=0; i < projects.Count(); i++ )
{
CDependency_Project *pCurProject = projects[i];
CVCProjInfo *pProjInfo = &vcprojInfos[i];
// Get a relative filename for the vcproj file.
const char *pFullProjectFilename = pCurProject->m_ProjectFilename.String();
char szRelativeFilename[MAX_PATH];
if ( !V_MakeRelativePath( pFullProjectFilename, g_pVPC->GetSourcePath(), szRelativeFilename, sizeof( szRelativeFilename ) ) )
g_pVPC->VPCError( "Can't make a relative path (to the base source directory) for %s.", pFullProjectFilename );
fprintf( fp, "Project(\"%s\") = \"%s\", \"%s\", \"{%s}\"\n", szSolutionGUID, pProjInfo->m_ProjectName.String(), szRelativeFilename, pProjInfo->m_ProjectGUID.String() );
bool bHasDependencies = false;
for ( int iTestProject=0; iTestProject < projects.Count(); iTestProject++ )
{
if ( i == iTestProject )
continue;
CDependency_Project *pTestProject = projects[iTestProject];
if ( pCurProject->DependsOn( pTestProject, k_EDependsOnFlagCheckNormalDependencies | k_EDependsOnFlagTraversePastLibs | k_EDependsOnFlagRecurse ) ||
pCurProject->DependsOn( pTestProject, k_EDependsOnFlagCheckAdditionalDependencies | k_EDependsOnFlagTraversePastLibs ) )
{
if ( !bHasDependencies )
{
fprintf( fp, "\tProjectSection(ProjectDependencies) = postProject\n" );
bHasDependencies = true;
}
fprintf( fp, "\t\t{%s} = {%s}\n", vcprojInfos[iTestProject].m_ProjectGUID.String(), vcprojInfos[iTestProject].m_ProjectGUID.String() );
}
}
if ( bHasDependencies )
fprintf( fp, "\tEndProjectSection\n" );
fprintf( fp, "EndProject\n" );
}
fclose( fp );
Sys_CopyToMirror( pSolutionFilename );
}
const char* FindInFile( const char *pFilename, const char *pFileData, const char *pSearchFor )
{
const char *pPos = V_stristr( pFileData, pSearchFor );
if ( !pPos )
{
g_pVPC->VPCError( "Can't find %s in %s.", pSearchFor, pFilename );
}
return pPos + V_strlen( pSearchFor );
}
void GetProjectInfos( CUtlVector<CDependency_Project*> &projects, CUtlVector<CVCProjInfo> &vcprojInfos )
{
for ( int i=0; i < projects.Count(); i++ )
{
CDependency_Project *pCurProject = projects[i];
const char *pFilename = pCurProject->m_ProjectFilename.String();
CVCProjInfo vcprojInfo;
char *pFileData;
int nResult = Sys_LoadFile( pFilename, (void**)&pFileData, false );
if ( nResult == -1 )
g_pVPC->VPCError( "Can't open %s to get ProjectGUID.", pFilename );
const char *pSearchFor;
if ( g_pVPC->Is2010() )
{
pSearchFor = "<ProjectGuid>{";
}
else
{
pSearchFor = "ProjectGUID=\"{";
}
const char *pPos = FindInFile( pFilename, pFileData, pSearchFor );
char szGuid[37];
const char *pGuid = pPos;
V_strncpy( szGuid, pGuid, sizeof( szGuid ) );
vcprojInfo.m_ProjectGUID = szGuid;
const char *pEnd;
if ( g_pVPC->Is2010() )
{
pPos = FindInFile( pFilename, pFileData, "<ProjectName>" );
pEnd = V_stristr( pPos, "<" );
}
else
{
pPos = FindInFile( pFilename, pFileData, "Name=\"" );
pEnd = V_stristr( pPos, "\"" );
}
if ( !pEnd || (pEnd - pPos) > 1024 || (pEnd - pPos) <= 0 )
g_pVPC->VPCError( "Can't find valid 'Name=' in %s.", pFilename );
char szName[256];
V_strncpy( szName, pPos, (pEnd - pPos) + 1 );
vcprojInfo.m_ProjectName = szName;
vcprojInfos.AddToTail( vcprojInfo );
free( pFileData );
}
}
// Parse g_SolutionItemsFilename, reading in filenames (including wildcards),
// and add them to the Solution Items project we're already writing.
void WriteSolutionItems( FILE *fp )
{
char szFullSolutionItemsPath[MAX_PATH];
if ( V_IsAbsolutePath( g_pVPC->GetSolutionItemsFilename() ) )
V_strncpy( szFullSolutionItemsPath, g_pVPC->GetSolutionItemsFilename(), sizeof( szFullSolutionItemsPath ) );
else
V_ComposeFileName( g_pVPC->GetStartDirectory(), g_pVPC->GetSolutionItemsFilename(), szFullSolutionItemsPath, sizeof( szFullSolutionItemsPath ) );
g_pVPC->GetScript().PushScript( szFullSolutionItemsPath );
int numSolutionItems = 0;
while ( g_pVPC->GetScript().GetData() )
{
// read a line
const char *pToken = g_pVPC->GetScript().GetToken( false );
// strip out \r\n chars
char *end = V_strstr( pToken, "\n" );
if ( end )
{
*end = '\0';
}
end = V_strstr( pToken, "\r" );
if ( end )
{
*end = '\0';
}
// bail on strings too small to be paths
if ( V_strlen( pToken ) < 3 )
continue;
// compose an absolute path w/o any ../
char szFullPath[MAX_PATH];
if ( V_IsAbsolutePath( pToken ) )
V_strncpy( szFullPath, pToken, sizeof( szFullPath ) );
else
V_ComposeFileName( g_pVPC->GetStartDirectory(), pToken, szFullPath, sizeof( szFullPath ) );
if ( !V_RemoveDotSlashes( szFullPath ) )
continue;
if ( V_strstr( szFullPath, "*" ) != NULL )
{
// wildcard!
char szWildcardPath[MAX_PATH];
V_strncpy( szWildcardPath, szFullPath, sizeof( szWildcardPath ) );
V_StripFilename( szWildcardPath );
struct _finddata32_t data;
intptr_t handle = _findfirst32( szFullPath, &data );
if ( handle != -1L )
{
do
{
if ( ( data.attrib & _A_SUBDIR ) == 0 )
{
// not a dir, just a filename - add it
V_ComposeFileName( szWildcardPath, data.name, szFullPath, sizeof( szFullPath ) );
if ( V_RemoveDotSlashes( szFullPath ) )
{
fprintf( fp, "\t\t%s = %s\n", szFullPath, szFullPath );
++numSolutionItems;
}
}
} while ( _findnext32( handle, &data ) == 0 );
_findclose( handle );
}
}
else
{
// just a file - add it
fprintf( fp, "\t\t%s = %s\n", szFullPath, szFullPath );
++numSolutionItems;
}
}
g_pVPC->GetScript().PopScript();
Msg( "Found %d solution files in %s\n", numSolutionItems, g_pVPC->GetSolutionItemsFilename() );
}
};
static CSolutionGenerator_Win32 g_SolutionGenerator_Win32;
IBaseSolutionGenerator* GetSolutionGenerator_Win32()
{
return &g_SolutionGenerator_Win32;
}

File diff suppressed because it is too large Load Diff

781
external/vpc/utils/vpc/sys_utils.cpp vendored Normal file
View File

@@ -0,0 +1,781 @@
//========= Copyright <20> 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#include "vpc.h"
#ifdef STEAM
#include "tier1/utlintrusivelist.h"
#endif
#ifdef POSIX
#define _O_RDONLY O_RDONLY
#define _open open
#include <sys/errno.h>
#define _lseek lseek
#define _read read
#define _close close
#define _stat stat
#include <glob.h>
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <io.h>
#include <ShellAPI.h>
#endif
#ifdef OSX
#include <mach-o/dyld.h>
#endif
CXMLWriter::CXMLWriter()
{
m_fp = NULL;
m_b2010Format = false;
}
bool CXMLWriter::Open( const char *pFilename, bool b2010Format )
{
m_FilenameString = pFilename;
m_b2010Format = b2010Format;
m_fp = fopen( pFilename, "wt" );
if ( !m_fp )
return false;
if ( b2010Format )
{
Write( "\xEF\xBB\xBF<?xml version=\"1.0\" encoding=\"utf-8\"?>" );
}
else
{
// 2005 format
Write( "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n" );
}
return true;
}
void CXMLWriter::Close()
{
if ( !m_fp )
return;
fclose( m_fp );
Sys_CopyToMirror( m_FilenameString.Get() );
m_fp = NULL;
m_FilenameString = NULL;
}
void CXMLWriter::PushNode( const char *pName )
{
Indent();
char *pNewName = strdup( pName );
m_Nodes.Push( pNewName );
fprintf( m_fp, "<%s%s\n", pName, m_Nodes.Count() == 2 ? ">" : "" );
}
void CXMLWriter::PushNode( const char *pName, const char *pString )
{
Indent();
char *pNewName = strdup( pName );
m_Nodes.Push( pNewName );
fprintf( m_fp, "<%s%s%s>\n", pName, pString ? " " : "", pString ? pString : "" );
}
void CXMLWriter::WriteLineNode( const char *pName, const char *pExtra, const char *pString )
{
Indent();
fprintf( m_fp, "<%s%s>%s</%s>\n", pName, pExtra ? pExtra : "", pString, pName );
}
void CXMLWriter::PopNode( bool bEmitLabel )
{
char *pName;
m_Nodes.Pop( pName );
Indent();
if ( bEmitLabel )
{
fprintf( m_fp, "</%s>\n", pName );
}
else
{
fprintf( m_fp, "/>\n" );
}
free( pName );
}
void CXMLWriter::Write( const char *p )
{
if ( m_fp )
{
Indent();
fprintf( m_fp, "%s\n", p );
}
}
CUtlString CXMLWriter::FixupXMLString( const char *pInput )
{
struct XMLFixup_t
{
const char *m_pFrom;
const char *m_pTo;
bool m_b2010Only;
};
// these tokens are not allowed in xml vcproj and be be escaped per msdev docs
XMLFixup_t xmlFixups[] =
{
{"&", "&amp;", false},
{"\"", "&quot;", false},
{"\'", "&apos;", false},
{"\n", "&#x0D;&#x0A;", false},
{">", "&gt;", false},
{"<", "&lt;", false},
{"$(InputFileName)", "%(Filename)%(Extension)", true},
{"$(InputName)", "%(Filename)", true},
{"$(InputPath)", "%(FullPath)", true},
{"$(InputDir)", "%(RootDir)%(Directory)", true},
};
bool bNeedsFixups = false;
CUtlVector< bool > needsFixups;
CUtlString outString;
needsFixups.SetCount( ARRAYSIZE( xmlFixups ) );
for ( int i = 0; i < ARRAYSIZE( xmlFixups ); i++ )
{
needsFixups[i] = false;
if ( !m_b2010Format && xmlFixups[i].m_b2010Only )
continue;
if ( V_stristr( pInput, xmlFixups[i].m_pFrom ) )
{
needsFixups[i] = true;
bNeedsFixups = true;
}
}
if ( !bNeedsFixups )
{
outString = pInput;
}
else
{
int flip = 0;
char bigBuffer[2][8192];
V_strncpy( bigBuffer[flip], pInput, sizeof( bigBuffer[0] ) );
for ( int i = 0; i < ARRAYSIZE( xmlFixups ); i++ )
{
if ( !needsFixups[i] )
continue;
if ( !V_StrSubst( bigBuffer[flip], xmlFixups[i].m_pFrom, xmlFixups[i].m_pTo, bigBuffer[flip ^ 1], sizeof( bigBuffer[0] ), false ) )
{
g_pVPC->VPCError( "XML overflow - Increase big buffer" );
}
flip ^= 1;
}
outString = bigBuffer[flip];
}
return outString;
}
void CXMLWriter::Indent()
{
for ( int i = 0; i < m_Nodes.Count(); i++ )
{
if ( m_b2010Format )
{
fprintf( m_fp, " " );
}
else
{
fprintf( m_fp, "\t" );
}
}
}
//-----------------------------------------------------------------------------
// Sys_LoadFile
//
//-----------------------------------------------------------------------------
int Sys_LoadFile( const char* filename, void** bufferptr, bool bText )
{
int handle;
long length;
char* buffer;
*bufferptr = NULL;
if ( !Sys_Exists( filename ) )
return ( -1 );
int flags = _O_RDONLY;
#if !defined( POSIX )
flags |= (bText ? _O_TEXT : _O_BINARY);
#endif
handle = _open( filename, flags );
if ( handle == -1 )
Sys_Error( "Sys_LoadFile(): Error opening %s: %s", filename, strerror( errno ) );
length = _lseek( handle, 0, SEEK_END );
_lseek( handle, 0, SEEK_SET );
buffer = ( char* )malloc( length+1 );
int bytesRead = _read( handle, buffer, length );
if ( !bText && ( bytesRead != length ) )
Sys_Error( "Sys_LoadFile(): read truncated failure" );
_close( handle );
// text mode is truncated, add null for parsing
buffer[bytesRead] = '\0';
*bufferptr = ( void* )buffer;
return ( length );
}
//-----------------------------------------------------------------------------
// Sys_LoadFileIntoBuffer
//
//-----------------------------------------------------------------------------
bool Sys_LoadFileIntoBuffer( const char *pchFileIn, CUtlBuffer &buf, bool bText )
{
buf.SetBufferType( bText, bText );
struct stat statBuf;
if ( stat( pchFileIn, &statBuf ) != 0 )
return false;
buf.EnsureCapacity( (int)(statBuf.st_size + 1) );
if ( !buf.IsValid() )
return false;
FILE *fp = fopen( pchFileIn, "rb" );
if ( !fp )
return false;
char *pBuffer = (char*)buf.Base();
int nBytesRead = statBuf.st_size * fread( pBuffer, statBuf.st_size, 1, fp );
fclose( fp );
buf.SeekPut( CUtlBuffer::SEEK_HEAD, nBytesRead );
pBuffer[statBuf.st_size] = 0; // terminate buffer without changing put size
return nBytesRead == statBuf.st_size;
}
//-----------------------------------------------------------------------------
// Sys_FileLength
//-----------------------------------------------------------------------------
long Sys_FileLength( const char* filename, bool bText )
{
long length;
if ( filename )
{
int flags = _O_RDONLY;
#if !defined( POSIX )
flags |= (bText ? _O_TEXT : _O_BINARY);
#endif
int handle = _open( filename, flags );
if ( handle == -1 )
{
// file does not exist
return ( -1 );
}
length = _lseek( handle, 0, SEEK_END );
_close( handle );
}
else
{
return ( -1 );
}
return ( length );
}
//-----------------------------------------------------------------------------
// Sys_StripPath
//
// Removes path portion from a fully qualified name, leaving filename and extension.
//-----------------------------------------------------------------------------
void Sys_StripPath( const char* inpath, char* outpath )
{
const char* src;
src = inpath + strlen( inpath );
while ( ( src != inpath ) && ( *( src-1 ) != '\\' ) && ( *( src-1 ) != '/' ) && ( *( src-1 ) != ':' ) )
src--;
strcpy( outpath,src );
}
//-----------------------------------------------------------------------------
// Sys_Exists
//
// Returns TRUE if file exists.
//-----------------------------------------------------------------------------
bool Sys_Exists( const char* filename )
{
FILE* test;
if ( ( test = fopen( filename, "rb" ) ) == NULL )
return ( false );
fclose( test );
return ( true );
}
//-----------------------------------------------------------------------------
// Sys_Touch
//
// Returns TRUE if the file could be accessed for write
//-----------------------------------------------------------------------------
bool Sys_Touch( const char* filename )
{
FILE* test;
if ( ( test = fopen( filename, "wb" ) ) == NULL )
return ( false );
fclose( test );
return ( true );
}
//-----------------------------------------------------------------------------
// Sys_FileInfo
//-----------------------------------------------------------------------------
bool Sys_FileInfo( const char *pFilename, int64 &nFileSize, int64 &nModifyTime )
{
struct _stat statData;
int rt = _stat( pFilename, &statData );
if ( rt != 0 )
return false;
nFileSize = statData.st_size;
nModifyTime = statData.st_mtime;
return true;
}
//-----------------------------------------------------------------------------
// Ignores allowable trailing characters.
//-----------------------------------------------------------------------------
bool Sys_StringToBool( const char *pString )
{
if ( !V_strnicmp( pString, "no", 2 ) ||
!V_strnicmp( pString, "off", 3 ) ||
!V_strnicmp( pString, "false", 5 ) ||
!V_strnicmp( pString, "not set", 7 ) ||
!V_strnicmp( pString, "disabled", 8 ) ||
!V_strnicmp( pString, "0", 1 ) )
{
// false
return false;
}
else if ( !V_strnicmp( pString, "yes", 3 ) ||
!V_strnicmp( pString, "on", 2 ) ||
!V_strnicmp( pString, "true", 4 ) ||
!V_strnicmp( pString, "set", 3 ) ||
!V_strnicmp( pString, "enabled", 7 ) ||
!V_strnicmp( pString, "1", 1 ) )
{
// true
return true;
}
else
{
// unknown boolean expression
g_pVPC->VPCSyntaxError( "Unknown boolean expression '%s'", pString );
}
// assume false
return false;
}
bool Sys_ReplaceString( const char *pStream, const char *pSearch, const char *pReplace, char *pOutBuff, int outBuffSize )
{
const char *pFind;
const char *pStart = pStream;
char *pOut = pOutBuff;
int len;
bool bReplaced = false;
while ( 1 )
{
// find sub string
pFind = V_stristr( pStart, pSearch );
if ( !pFind )
{
/// end of string
len = strlen( pStart );
pFind = pStart + len;
memcpy( pOut, pStart, len );
pOut += len;
break;
}
else
{
bReplaced = true;
}
// copy up to sub string
len = pFind - pStart;
memcpy( pOut, pStart, len );
pOut += len;
// substitute new string
len = strlen( pReplace );
memcpy( pOut, pReplace, len );
pOut += len;
// advance past sub string
pStart = pFind + strlen( pSearch );
}
*pOut = '\0';
return bReplaced;
}
//--------------------------------------------------------------------------------
// string match with wildcards.
// '?' = match any char
//--------------------------------------------------------------------------------
bool Sys_StringPatternMatch( char const *pSrcPattern, char const *pString )
{
for (;;)
{
char nPat = *(pSrcPattern++);
char nString= *(pString++);
if ( !( ( nPat == nString ) || ( ( nPat == '?' ) && nString ) ) )
return false;
if ( !nString )
return true; // end of string
}
}
bool Sys_EvaluateEnvironmentExpression( const char *pExpression, const char *pDefault, char *pOutBuff, int nOutBuffSize )
{
char *pEnvVarName = (char*)StringAfterPrefix( pExpression, "$env(" );
if ( !pEnvVarName )
{
// not an environment specification
return false;
}
char *pLastChar = &pEnvVarName[ V_strlen( pEnvVarName ) - 1 ];
if ( !*pEnvVarName || *pLastChar != ')' )
{
g_pVPC->VPCSyntaxError( "$env() must have a closing ')' in \"%s\"\n", pExpression );
}
// get the contents of the $env( blah..blah ) expressions
// handles expresions that could have whitepsaces
g_pVPC->GetScript().PushScript( pExpression, pEnvVarName );
const char *pToken = g_pVPC->GetScript().GetToken( false );
g_pVPC->GetScript().PopScript();
if ( pToken && pToken[0] )
{
const char *pResolve = getenv( pToken );
if ( !pResolve )
{
// not defined, use default
pResolve = pDefault ? pDefault : "";
}
V_strncpy( pOutBuff, pResolve, nOutBuffSize );
}
return true;
}
bool Sys_ExpandFilePattern( const char *pPattern, CUtlVector< CUtlString > &vecResults )
{
#if defined( _WIN32 )
char rgchPathPart[MAX_PATH];
V_strncpy( rgchPathPart, pPattern, V_ARRAYSIZE( rgchPathPart ) );
V_StripFilename( rgchPathPart );
if ( V_strlen( rgchPathPart ) )
V_strncat( rgchPathPart, "\\", V_ARRAYSIZE( rgchPathPart ) );
WIN32_FIND_DATA findData;
HANDLE hFind = FindFirstFile( pPattern, &findData );
if ( hFind != INVALID_HANDLE_VALUE )
{
vecResults.AddToTail( CFmtStr( "%s%s", rgchPathPart, findData.cFileName ).Access() );
BOOL bMore = TRUE;
while ( bMore )
{
bMore = FindNextFile( hFind, &findData );
if ( bMore )
vecResults.AddToTail( CFmtStr( "%s%s", rgchPathPart, findData.cFileName ).Access() );
}
FindClose( hFind );
}
#elif defined( POSIX )
glob_t gr;
if ( glob( pPattern, 0, NULL, &gr ) == 0 )
{
for ( int i = 0; i < gr.gl_pathc; i++ )
{
vecResults.AddToTail( gr.gl_pathv[i] );
}
globfree( &gr );
}
#else
#error
#endif
return vecResults.Count() > 0;
}
bool Sys_GetExecutablePath( char *pBuf, int cbBuf )
{
#if defined( _WIN32 )
return ( 0 != GetModuleFileNameA( NULL, pBuf, cbBuf ) );
#elif defined(OSX)
uint32_t _nBuff = cbBuf;
bool bSuccess = _NSGetExecutablePath(pBuf, &_nBuff) == 0;
pBuf[cbBuf-1] = '\0';
return bSuccess;
#elif defined LINUX
ssize_t nRead = readlink("/proc/self/exe", pBuf, cbBuf-1 );
if ( nRead != -1 )
{
pBuf[ nRead ] = 0;
return true;
}
pBuf[0] = 0;
return false;
#else
#error Sys_GetExecutablePath
#endif
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void Sys_CreatePath( const char *path )
{
#if defined( _WIN32 )
char pFullPath[MAX_PATH];
V_MakeAbsolutePath( pFullPath, sizeof(pFullPath), path );
// If Sys_CreatePath is called with a filename, all is well.
// If it is called with a folder name, it must have a trailing slash:
if ( !V_GetFileExtension( pFullPath ) )
V_AppendSlash( pFullPath, sizeof(pFullPath) );
char *ptr;
// skip past the drive path, but don't strip
if ( pFullPath[1] == ':' )
{
ptr = strchr( pFullPath, '\\' );
}
else
{
ptr = pFullPath;
}
while ( ptr )
{
ptr = strchr( ptr+1, '\\' );
if ( ptr )
{
*ptr = '\0';
#if defined( _WIN32 ) || defined( WIN32 )
CreateDirectory( pFullPath, NULL );
#else
#error Sys_CreatePath: this mkdir is probably correct but has not been tested
mkdir( pFullPath, 0777 );
#endif
*ptr = '\\';
}
}
#endif
}
//-----------------------------------------------------------------------------
// Given some arbitrary case filename, provides what the OS thinks it is.
// Windows specific. Returns false if file cannot be resolved (i.e. does not exist).
//-----------------------------------------------------------------------------
bool Sys_GetActualFilenameCase( const char *pFilename, char *pOutputBuffer, int nOutputBufferSize )
{
#if defined( _WINDOWS )
char filenameBuffer[MAX_PATH];
V_strncpy( filenameBuffer, pFilename, sizeof( filenameBuffer ) );
V_FixSlashes( filenameBuffer );
V_RemoveDotSlashes( filenameBuffer );
int nFilenameLength = V_strlen( filenameBuffer );
CUtlString actualFilename;
// march along filename, resolving up to next seperator
int nLastComponentStart = 0;
bool bAddSeparator = false;
int i = 0;
while ( i < nFilenameLength )
{
// cannot resolve these, emit as-is
if ( !V_strnicmp( filenameBuffer + i, ".\\", 2 ) )
{
i += 2;
actualFilename += CUtlString( ".\\" );
continue;
}
// cannot resolve these, emit as-is
if ( !V_strnicmp( filenameBuffer + i, "..\\", 3 ) )
{
i += 3;
actualFilename += CUtlString( "..\\" );
continue;
}
// skip until path separator
while ( i < nFilenameLength && filenameBuffer[i] != '\\' )
{
++i;
}
bool bFoundSeparator = ( i < nFilenameLength );
// truncate at separator, windows resolves each component in pieces
filenameBuffer[i] = 0;
SHFILEINFOA info = {0};
HRESULT hr = SHGetFileInfoA( filenameBuffer, 0, &info, sizeof( info ), SHGFI_DISPLAYNAME );
if ( SUCCEEDED( hr ) )
{
// reassemble based on actual component
if ( bAddSeparator )
{
actualFilename += CUtlString( "\\" );
}
actualFilename += CUtlString( info.szDisplayName );
}
else
{
return false;
}
// restore path separator
if ( bFoundSeparator )
{
filenameBuffer[i] = '\\';
}
++i;
nLastComponentStart = i;
bAddSeparator = true;
}
V_strncpy( pOutputBuffer, actualFilename.Get(), nOutputBufferSize );
return true;
#else
return false;
#endif
}
//-----------------------------------------------------------------------------
// Given some arbitrary case filename, determine if OS version matches.
//-----------------------------------------------------------------------------
bool Sys_IsFilenameCaseConsistent( const char *pFilename, char *pOutputBuffer, int nOutputBufferSize )
{
V_strncpy( pOutputBuffer, pFilename, nOutputBufferSize );
// normalize the provided filename separators
CUtlString filename = pFilename;
V_FixSlashes( filename.Get() );
V_RemoveDotSlashes( filename.Get() );
if ( !Sys_GetActualFilenameCase( filename.Get(), pOutputBuffer, nOutputBufferSize ) )
return false;
if ( !V_strcmp( filename.Get(), pOutputBuffer ) )
return true;
return false;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
bool Sys_CopyToMirror( const char *pFilename )
{
if ( !pFilename || !pFilename[0] )
return false;
const char *pMirrorPath = g_pVPC->GetOutputMirrorPath();
if ( !pMirrorPath || !pMirrorPath[0] )
return false;
char absolutePathToOriginal[MAX_PATH];
if ( V_IsAbsolutePath( pFilename ) )
{
V_strncpy( absolutePathToOriginal, pFilename, sizeof( absolutePathToOriginal ) );
}
else
{
// need to determine where file resides for mirroring
char currentDirectory[MAX_PATH] = { 0 };
V_GetCurrentDirectory( currentDirectory, sizeof( currentDirectory ) );
V_ComposeFileName( currentDirectory, pFilename, absolutePathToOriginal, sizeof( absolutePathToOriginal ) );
}
if ( !Sys_Exists( absolutePathToOriginal ) )
{
g_pVPC->VPCWarning( "Cannot mirror '%s', cannot resolve to expected '%s'", pFilename, absolutePathToOriginal );
return false;
}
const char *pTargetPath = StringAfterPrefix( absolutePathToOriginal, g_pVPC->GetSourcePath() );
if ( !pTargetPath || !pTargetPath[0] )
{
g_pVPC->VPCWarning( "Cannot mirror '%s', missing expected prefix '%s' in '%s'", pFilename, g_pVPC->GetSourcePath(), absolutePathToOriginal );
return false;
}
// supply the mirror path head
char absolutePathToMirror[MAX_PATH];
if ( pTargetPath[0] == '\\' )
{
pTargetPath++;
}
V_ComposeFileName( pMirrorPath, pTargetPath, absolutePathToMirror, sizeof( absolutePathToMirror ) );
#ifdef _WIN32
Sys_CreatePath( absolutePathToMirror );
if ( !CopyFile( absolutePathToOriginal, absolutePathToMirror, FALSE ) )
{
g_pVPC->VPCWarning( "Cannot mirror '%s' to '%s'", absolutePathToOriginal, absolutePathToMirror );
return false;
}
else
{
g_pVPC->VPCStatus( true, "Mirror: '%s' to '%s'", absolutePathToOriginal, absolutePathToMirror );
}
#endif
return true;
}

157
external/vpc/utils/vpc/sys_utils.h vendored Normal file
View File

@@ -0,0 +1,157 @@
//======= Copyright 1996-2005, Valve Corporation, All rights reserved. ======//
//
// File Utilities.
//
//===========================================================================//
#ifdef _WIN32
#pragma once
#endif
#define _CRT_SECURE_NO_DEPRECATE 1
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
#ifdef POSIX
#include <unistd.h>
#endif
#if defined( LINUX ) || defined( _LINUX )
#include <sys/io.h>
#endif
#include "tier0/platform.h"
#include "../vpccrccheck/crccheck_shared.h"
template< class T, class NullType, int nMax >
class CSimplePointerStack
{
public:
inline CSimplePointerStack()
{
m_nCount = 0;
}
inline void Purge()
{
for ( int i=0; i < m_nCount; i++ )
m_Values[i] = (NullType)NULL;
m_nCount = 0;
}
inline int Count()
{
return m_nCount;
}
inline T& Top()
{
Assert( m_nCount > 0 );
return m_Values[m_nCount-1];
}
inline void Pop( T &val )
{
Assert( m_nCount > 0 );
--m_nCount;
val = m_Values[m_nCount];
m_Values[m_nCount] = (NullType)NULL;
}
inline void Pop()
{
Assert( m_nCount > 0 );
--m_nCount;
m_Values[m_nCount] = (NullType)NULL;
}
inline void Push( T &val )
{
Assert( m_nCount+1 < nMax );
m_Values[m_nCount] = val;
++m_nCount;
}
public:
T m_Values[nMax];
int m_nCount;
};
class CXMLWriter
{
public:
CXMLWriter();
bool Open( const char *pFilename, bool bIs2010Format = false );
void Close();
void PushNode( const char *pName );
void PopNode( bool bEmitLabel );
void WriteLineNode( const char *pName, const char *pExtra, const char *pString );
void PushNode( const char *pName, const char *pString );
void Write( const char *p );
CUtlString FixupXMLString( const char *pInput );
private:
void Indent();
bool m_b2010Format;
FILE *m_fp;
CUtlString m_FilenameString;
CSimplePointerStack< char *, char *, 128 > m_Nodes;
};
long Sys_FileLength( const char* filename, bool bText = false );
int Sys_LoadFile( const char *filename, void **bufferptr, bool bText = false );
bool Sys_LoadFileIntoBuffer( const char *pchFileIn, CUtlBuffer &buf, bool bText );
void Sys_StripPath( const char *path, char *outpath );
bool Sys_Exists( const char *filename );
bool Sys_Touch( const char *filename );
bool Sys_FileInfo( const char *pFilename, int64 &nFileSize, int64 &nModifyTime );
bool Sys_StringToBool( const char *pString );
bool Sys_ReplaceString( const char *pStream, const char *pSearch, const char *pReplace, char *pOutBuff, int outBuffSize );
bool Sys_StringPatternMatch( char const *pSrcPattern, char const *pString );
bool Sys_EvaluateEnvironmentExpression( const char *pExpression, const char *pDefault, char *pOutBuff, int nOutBuffSize );
bool Sys_ExpandFilePattern( const char *pPattern, CUtlVector< CUtlString > &vecResults );
bool Sys_GetExecutablePath( char *pBuf, int cbBuf );
bool Sys_CopyToMirror( const char *pFilename );
inline bool IsCFileExtension( const char *pExtension )
{
if ( !pExtension )
return false;
return !V_stricmp( pExtension, "cpp" ) ||
!V_stricmp( pExtension, "cxx" ) ||
!V_stricmp( pExtension, "cc" ) ||
!V_stricmp( pExtension, "c" );
}
bool Sys_GetActualFilenameCase( const char *pFilename, char *pOutputBuffer, int nOutputBufferSize );
bool Sys_IsFilenameCaseConsistent( const char *pFilename, char *pOutputBuffer, int nOutputBufferSize );
inline bool IsHFileExtension( const char *pExtension )
{
if ( !pExtension )
return false;
return !V_stricmp( pExtension, "hpp" ) ||
!V_stricmp( pExtension, "hxx" ) ||
!V_stricmp( pExtension, "hh" ) ||
!V_stricmp( pExtension, "h" );
}

482
external/vpc/utils/vpc/vpc.h vendored Normal file
View File

@@ -0,0 +1,482 @@
//========= Copyright 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: VPC
//
//=====================================================================================//
#pragma once
// Exclude rarely-used stuff from Windows headers
#define WIN32_LEAN_AND_MEAN
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN
#endif
#include "utlstring.h"
#include "utlrbtree.h"
#include "utlvector.h"
#include "utlbuffer.h"
#include "utlstack.h"
#include "utldict.h"
#include "utlsortvector.h"
#include "checksum_crc.h"
#include "checksum_md5.h"
#include "fmtstr.h"
#include "exprevaluator.h"
#include "tier1/interface.h"
#include "p4lib/ip4.h"
#include "scriptsource.h"
#include "logging.h"
#ifdef STEAM
#include "vstdlib/strtools.h"
#else
#include "tier1/strtools.h"
#endif
#include "sys_utils.h"
#include "keyvalues.h"
#include "generatordefinition.h"
DECLARE_LOGGING_CHANNEL( LOG_VPC );
#if defined( WIN32 )
#include <atlbase.h>
#include <io.h>
#endif // WIN32
struct KeywordName_t
{
const char *m_pName;
configKeyword_e m_Keyword;
};
typedef bool (*procptr_t)( const char *pPropertyName );
typedef bool (*GetSymbolProc_t)( const char *pKey );
#define INVALID_INDEX -1
struct property_t
{
const char *pName;
procptr_t handler;
int platformMask;
};
enum conditionalType_e
{
CONDITIONAL_NULL,
CONDITIONAL_PLATFORM,
CONDITIONAL_GAME,
CONDITIONAL_CUSTOM
};
struct conditional_t
{
conditional_t()
{
type = CONDITIONAL_NULL;
m_bDefined = false;
m_bGameConditionActive = false;
}
CUtlString name;
CUtlString upperCaseName;
conditionalType_e type;
// a conditional can be present in the table but not defined
// e.g. default conditionals that get set by command line args
bool m_bDefined;
// only used during multiple game iterations for game conditionals as each 'defined' game becomes active
bool m_bGameConditionActive;
};
struct macro_t
{
macro_t()
{
m_bSetupDefineInProjectFile = false;
m_bInternalCreatedMacro = false;
}
CUtlString name;
CUtlString value;
// If set to true, then VPC will add this as a -Dname=value parameter to the compiler's command line.
bool m_bSetupDefineInProjectFile;
// VPC created this macro itself rather than the macro being created from a script file.
bool m_bInternalCreatedMacro;
};
typedef int scriptIndex_t;
struct script_t
{
CUtlString name;
CUtlString m_condition;
};
typedef int projectIndex_t;
struct project_t
{
CUtlString name;
CUtlVector< script_t > scripts;
};
typedef int groupIndex_t;
struct group_t
{
CUtlVector< projectIndex_t > projects;
};
typedef int groupTagIndex_t;
struct groupTag_t
{
groupTag_t()
{
bSameAsProject = false;
}
CUtlString name;
CUtlVector< groupIndex_t > groups;
// this tag is an implicit definition of the project
bool bSameAsProject;
};
struct scriptList_t
{
scriptList_t()
{
m_crc = 0;
}
CUtlString m_scriptName;
CRC32_t m_crc;
};
class IProjectIterator
{
public:
// iProject indexes g_projectList.
virtual bool VisitProject( projectIndex_t iProject, const char *szScriptPath ) = 0;
};
#include "ibasesolutiongenerator.h"
#include "ibaseprojectgenerator.h"
#if defined( WIN32 )
#include "baseprojectdatacollector.h"
#include "projectgenerator_vcproj.h"
#include "projectgenerator_win32.h"
#include "projectgenerator_win32_2010.h"
#include "projectgenerator_xbox360.h"
#include "projectgenerator_xbox360_2010.h"
#include "projectgenerator_ps3.h"
#endif
enum EVSVersion
{
k_EVSVersion_Invalid,
k_EVSVersion_2005,
k_EVSVersion_2008,
k_EVSVersion_2010,
k_EVSVersion_2012,
k_EVSVersion_2013,
k_EVSVersion_2015,
};
class CVPC
{
public:
CVPC();
~CVPC();
bool Init( int argc, char **argv );
void Shutdown( bool bHasError = false );
void VPCError( PRINTF_FORMAT_STRING const char *pFormat, ... );
void VPCWarning( PRINTF_FORMAT_STRING const char *pFormat, ... );
void VPCStatus( bool bAlwaysSpew, PRINTF_FORMAT_STRING const char *pFormat, ... );
void VPCSyntaxError( PRINTF_FORMAT_STRING const char *pFormat = NULL, ... );
bool IsProjectCurrent( const char *pVCProjFilename, bool bSpewStatus );
bool HasCommandLineParameter( const char *pParamName );
bool HasP4SLNCommand();
CScript &GetScript() { return m_Script; }
bool IsVerbose() { return m_bVerbose; }
bool IsQuiet() { return m_bQuiet; }
bool IsShowDependencies() { return m_bShowDeps; }
bool IsForceGenerate() { return m_bForceGenerate; }
bool IsPosixPCHDisabled() { return m_bNoPosixPCH; }
bool IsForceIterate() { return m_bForceIterate; }
bool IsDecorateProject() { return m_bDecorateProject; }
const char *GetDecorateString() { return m_strDecorate.String(); }
bool IsCheckFiles() { return m_bCheckFiles; }
bool Is2010() { return m_bUseVS2010FileFormat || m_eVSVersion == k_EVSVersion_2010; }
bool Is2012() { return m_eVSVersion == k_EVSVersion_2012; } // When this returns true so does Is2010() because of the file format similarities
bool Is2013() { return m_eVSVersion == k_EVSVersion_2013; } // When this returns true so does Is2010() because of the file format similarities
bool Is2015() { return m_eVSVersion == k_EVSVersion_2015; } // When this returns true so does Is2010() because of the file format similarities
bool BUse2008() { return m_eVSVersion == k_EVSVersion_2008; }
bool IsDedicatedBuild() { return m_bDedicatedBuild; }
bool IsUnity() { return m_bUseUnity; }
bool IsShowCaseIssues() { return m_bShowCaseIssues; }
bool UseValveBinDir() { return m_bUseValveBinDir; }
bool IsVerboseMakefile() { return m_bVerboseMakefile; }
bool BUseP4SCC() { return m_bP4SCC; }
bool BUse32BitTools() { return m_b32BitTools; }
void DecorateProjectName( char *pchProjectName );
int GetMissingFilesCount() const { return m_FilesMissing; }
void IncrementFileMissing() { ++m_FilesMissing; }
void ResetMissingFilesCount() { m_FilesMissing = 0; }
bool IsIgnoreRedundancyWarning() { return m_bIgnoreRedundancyWarning; }
void SetIgnoreRedundancyWarning( bool bSet ) { m_bIgnoreRedundancyWarning = bSet; }
const char *GetStartDirectory() { return m_StartDirectory.Get(); }
const char *GetSourcePath() { return m_SourcePath.Get(); }
const char *GetProjectPath() { return m_ProjectPath.Get(); }
const char *GetCRCString() { return m_SupplementalCRCString.Get(); }
const char *GetSolutionItemsFilename() { return m_SolutionItemsFilename.Get(); }
const char *GetOutputFilename() { return m_OutputFilename.Get(); }
void SetOutputFilename( const char *pOutputFilename ) { m_OutputFilename = pOutputFilename; }
const char *GetProjectName() { return m_ProjectName.Get(); }
void SetProjectName( const char *pProjectName ) { m_ProjectName = pProjectName; }
const char *GetLoadAddressName() { return m_LoadAddressName.Get(); }
void SetLoadAddressName( const char *pLoadAddressName ) { m_LoadAddressName = pLoadAddressName; }
const char *GetOutputMirrorPath() { return m_OutputMirrorString.Get(); }
int ProcessCommandLine();
// Returns the mask identifying what platforms whould be built
bool IsPlatformDefined( const char *pName );
const char *GetTargetPlatformName();
void GetProjectDependencies( CUtlVector<CDependency_Project *> &referencedProjects );
void SetPhase1Projects( CUtlVector<CDependency_Project *> *pPhase1Projects ) { m_pPhase1Projects = pPhase1Projects; }
IBaseProjectGenerator *GetProjectGenerator() { return m_pProjectGenerator; }
void SetProjectGenerator( IBaseProjectGenerator *pGenerator ) { m_pProjectGenerator = pGenerator; }
IBaseSolutionGenerator *GetSolutionGenerator() { return m_pSolutionGenerator; }
// Conditionals
conditional_t *FindOrCreateConditional( const char *pName, bool bCreate, conditionalType_e type );
void ResolveMacrosInConditional( char const *pString, char *pOutBuff, int outBuffSize );
bool ResolveConditionalSymbol( const char *pSymbol );
bool EvaluateConditionalExpression( const char *pExpression );
bool ConditionHasDefinedType( const char* pCondition, conditionalType_e type );
void SetConditional( const char *pName, bool bSet = true );
// Macros
macro_t *FindOrCreateMacro( const char *pName, bool bCreate, const char *pValue );
void ResolveMacrosInString( char const *pString, char *pOutBuff, int outBuffSize );
int GetMacrosMarkedForCompilerDefines( CUtlVector< macro_t* > &macroDefines );
void RemoveScriptCreatedMacros();
const char *GetMacroValue( const char *pName );
void SetMacro( const char *pName, const char *pValue, bool bSetupDefineInProjectFile );
// Iterates all the projects in the specified list, checks their conditionals, and calls pIterator->VisitProject for
// each one that passes the conditional tests.
//
// If bForce is false, then it does a CRC check before visiting any project to see if the target project file is
// already up-to-date with its .vpc file.
void IterateTargetProjects( CUtlVector<projectIndex_t> &projectList, IProjectIterator *pIterator );
bool ParseProjectScript( const char *pScriptName, int depth, bool bQuiet, bool bWriteCRCCheckFile );
void AddScriptToCRCCheck( const char *pScriptName, CRC32_t crc );
const char *KeywordToName( configKeyword_e keyword );
configKeyword_e NameToKeyword( const char *pKeywordName );
int GetProjectsInGroup( CUtlVector< projectIndex_t > &projectList, const char *pGroupHame );
private:
void SpewUsage( void );
bool LoadPerforceInterface();
void UnloadPerforceInterface();
void InProcessCRCCheck();
void CheckForInstalledXDK();
void DetermineSourcePath();
void SetDefaultSourcePath();
void SetupGenerators();
void SetupDefaultConditionals();
void SetMacrosAndConditionals();
void ResolveMacrosInStringInternal( char const *pString, char *pOutBuff, int outBuffSize, bool bStringIsConditional );
void HandleSingleCommandLineArg( const char *pArg );
void ParseBuildOptions( int argc, char *argv[] );
bool CheckBinPath( char *pOutBinPath, int outBinPathSize );
bool RestartFromCorrectLocation( bool *pIsChild );
void GenerateOptionsCRCString();
void CreateOutputFilename( project_t *pProject, const char *pchPlatform, const char *pchPhase, const char *pGameName, const char *pchExtension );
void FindProjectFromVCPROJ( const char *pScriptNameVCProj );
const char *BuildTempGroupScript( const char *pScriptName );
bool HandleP4SLN( IBaseSolutionGenerator *pSolutionGenerator );
void HandleMKSLN( IBaseSolutionGenerator *pSolutionGenerator );
void GenerateBuildSet( CProjectDependencyGraph &dependencyGraph );
bool BuildTargetProjects();
bool BuildTargetProject( IProjectIterator *pIterator, projectIndex_t projectIndex, script_t *pProjectScript, const char *pGameName );
bool m_bVerbose;
bool m_bQuiet;
bool m_bUsageOnly;
bool m_bHelp;
bool m_bSpewPlatforms;
bool m_bSpewGames;
bool m_bSpewGroups;
bool m_bSpewProjects;
bool m_bIgnoreRedundancyWarning;
bool m_bSpewProperties;
bool m_bTestMode;
bool m_bForceGenerate;
bool m_bNoPosixPCH;
bool m_bForceIterate;
bool m_bEnableVpcGameMacro;
bool m_bCheckFiles;
bool m_bDecorateProject;
bool m_bShowDeps;
bool m_bP4AutoAdd;
bool m_bP4SlnCheckEverything;
bool m_bDedicatedBuild;
bool m_bAppendSrvToDedicated; // concat "_srv" to dedicated server .so's.
bool m_bUseValveBinDir; // On Linux, use gcc toolchain from /valve/bin/
bool m_bAnyProjectQualified;
EVSVersion m_eVSVersion;
bool m_bUseVS2010FileFormat;
bool m_bUseUnity;
bool m_bShowCaseIssues;
bool m_bVerboseMakefile;
bool m_bP4SCC; // VPC_SCC_INTEGRATION define, or "/srcctl" cmd line option, or env var VPC_SRCCTL=1
bool m_b32BitTools; // Normally we prefer the 64-bit toolchain when building a 64-bit target. This turns that off.
// How many of the files listed in the VPC files are missing?
int m_FilesMissing;
int m_nArgc;
char **m_ppArgv;
CColorizedLoggingListener m_LoggingListener;
CSysModule *m_pP4Module;
CSysModule *m_pFilesystemModule;
CScript m_Script;
// Path where vpc was started from
CUtlString m_StartDirectory;
// Root path to the sources (i.e. the directory where the vpc_scripts directory can be found in).
CUtlString m_SourcePath;
// path to the project being processed (i.e. the directory where this project's .vpc can be found).
CUtlString m_ProjectPath;
// strings derived from command-line commands which is checked alongside project CRCs:
CUtlString m_SupplementalCRCString;
CUtlString m_ExtraOptionsCRCString;
CUtlString m_MKSolutionFilename;
CUtlString m_SolutionItemsFilename; // For /slnitems
CUtlString m_P4SolutionFilename; // For /p4sln
CUtlVector< int > m_iP4Changelists;
CUtlString m_OutputFilename;
CUtlString m_ProjectName;
CUtlString m_LoadAddressName;
CUtlString m_OutputMirrorString;
CUtlString m_TempGroupScriptFilename;
CUtlString m_strDecorate;
// This abstracts the differences between different output methods.
IBaseProjectGenerator *m_pProjectGenerator;
IBaseSolutionGenerator *m_pSolutionGenerator;
CUtlVector< CUtlString > m_BuildCommands;
CUtlVector<CDependency_Project *> *m_pPhase1Projects;
public:
CUtlVector< conditional_t > m_Conditionals;
CUtlVector< macro_t > m_Macros;
CUtlVector< scriptList_t > m_ScriptList;
CUtlVector< project_t > m_Projects;
CUtlVector< projectIndex_t > m_TargetProjects;
CProjectDependencyGraph m_dependencyGraph;
CUtlVector< group_t > m_Groups;
CUtlVector< groupTag_t > m_GroupTags;
CUtlVector< CUtlString > m_P4GroupRestrictions;
CUtlVector< CUtlString > m_SchemaFiles;
CUtlDict< CUtlString, int > m_CustomBuildSteps;
bool m_bGeneratedProject;
CUtlDict< bool > m_UnityFilesSeen;
CUtlStack< CUtlString > m_UnityStack;
CUtlString m_sUnityCurrent;
bool m_bInMkSlnPass;
};
extern CVPC *g_pVPC;
extern const char *g_pOption_ImportLibrary; // "$ImportLibrary";
extern const char *g_pOption_OutputFile; // "$OutputFile";
extern const char *g_pOption_GameOutputFile; // "$GameOutputFile";
extern const char *g_pOption_AdditionalIncludeDirectories; // "$AdditionalIncludeDirectories"
extern const char *g_pOption_AdditionalProjectDependencies; // "$AdditionalProjectDependencies"
extern const char *g_pOption_AdditionalOutputFiles; // "$AdditionalOutputFiles"
extern const char *g_pOption_PreprocessorDefinitions; // "$PreprocessorDefinitions"
extern char *g_IncludeSeparators[2];
extern void VPC_ParseGroupScript( const char *pScriptName );
extern groupTagIndex_t VPC_Group_FindOrCreateGroupTag( const char *pName, bool bCreate );
extern void VPC_Keyword_Configuration();
extern void VPC_Keyword_FileConfiguration();
struct folderConfig_t
{
CUtlVector<CUtlString> vecConfigurationNames;
CScriptSource scriptSource;
bool BHasConfig() { return vecConfigurationNames.Count() > 0; }
void Clear() { vecConfigurationNames.RemoveAll(); }
};
void VPC_Keyword_FolderConfiguration( folderConfig_t *pFolderConfig );
void VPC_ApplyFolderConfigurationToFile( const folderConfig_t &folderConfig );
extern void VPC_Config_SpewProperties( configKeyword_e keyword );
extern bool VPC_Config_IgnoreOption( const char *pPropertyName );
extern void VPC_FakeKeyword_SchemaFolder( class CBaseProjectDataCollector *pDataCollector );

22
external/vpc/utils/vpc/vpc.sln vendored Normal file
View File

@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vpc", "vpc.vcxproj", "{36C5F545-588F-4091-B480-89E03EDBDA93}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{36C5F545-588F-4091-B480-89E03EDBDA93}.Debug|Win32.ActiveCfg = Debug|Win32
{36C5F545-588F-4091-B480-89E03EDBDA93}.Debug|Win32.Build.0 = Debug|Win32
{36C5F545-588F-4091-B480-89E03EDBDA93}.Release|Win32.ActiveCfg = Release|Win32
{36C5F545-588F-4091-B480-89E03EDBDA93}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

237
external/vpc/utils/vpc/vpc.vcxproj vendored Normal file
View File

@@ -0,0 +1,237 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{36C5F545-588F-4091-B480-89E03EDBDA93}</ProjectGuid>
<RootNamespace>vpc</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\public;..\..\public\tier0;..\..\public\tier1;..\..\public\vstdlib;..\..\common\;..\..\common\p4api</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;PLATFORM_WINDOWS;COMPILER_MSVC;COMPILER_MSVC32;_USE_32BIT_TIME_T;STATIC_TIER0;NO_MALLOC_OVERRIDE;STATIC_VSTDLIB;STANDALONE_VPC;_MBCS;_CRT_NO_VA_START_VALIDATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
<CompileAs>CompileAsCpp</CompileAs>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ExceptionHandling>Async</ExceptionHandling>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;wsock32.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>p4 edit ..\..\..\..\devtools\bin\vpc.exe &amp;&amp; copy /y $(TargetPath) ..\..\..\..\devtools\bin\vpc.exe
p4 edit ..\..\..\..\devtools\bin\vpc.pdb &amp;&amp; copy /y $(TargetDir)\vpc.pdb ..\..\..\..\devtools\bin\vpc.pdb
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\public;..\..\public\tier0;..\..\public\tier1;..\..\public\vstdlib;..\..\common\;..\..\common\p4api</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;PLATFORM_WINDOWS;COMPILER_MSVC;COMPILER_MSVC32;_USE_32BIT_TIME_T;STATIC_TIER0;NO_MALLOC_OVERRIDE;STATIC_VSTDLIB;STANDALONE_VPC;_MBCS;_CRT_NO_VA_START_VALIDATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
<CompileAs>CompileAsCpp</CompileAs>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;wsock32.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>p4 edit ..\..\..\..\devtools\bin\vpc.exe &amp;&amp; copy /y $(TargetPath) ..\..\..\..\devtools\bin\vpc.exe
p4 edit ..\..\..\..\devtools\bin\vpc.pdb &amp;&amp; copy /y $(TargetDir)\vpc.pdb ..\..\..\..\devtools\bin\vpc.pdb
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\interfaces\interfaces.cpp" />
<ClCompile Include="..\..\p4lib\p4.cpp" />
<ClCompile Include="..\..\tier0\assert_dialog.cpp" />
<ClCompile Include="..\..\tier0\commandline.cpp" />
<ClCompile Include="..\..\tier0\cpu.cpp" />
<ClCompile Include="..\..\tier0\cputopology.cpp" />
<ClCompile Include="..\..\tier0\dbg.cpp" />
<ClCompile Include="..\..\tier0\fasttimer.cpp" />
<ClCompile Include="..\..\tier0\logging.cpp" />
<ClCompile Include="..\..\tier0\mem.cpp" />
<ClCompile Include="..\..\tier0\memdbg.cpp" />
<ClCompile Include="..\..\tier0\memstd.cpp" />
<ClCompile Include="..\..\tier0\memvalidate.cpp" />
<ClCompile Include="..\..\tier0\mem_helpers.cpp" />
<ClCompile Include="..\..\tier0\minidump.cpp" />
<ClCompile Include="..\..\tier0\pch_tier0.cpp" />
<ClCompile Include="..\..\tier0\platform.cpp" />
<ClCompile Include="..\..\tier0\pme.cpp" />
<ClCompile Include="..\..\tier0\pmelib.cpp" />
<ClCompile Include="..\..\tier0\stacktools.cpp" />
<ClCompile Include="..\..\tier0\threadtools.cpp" />
<ClCompile Include="..\..\tier0\tier0_strtools.cpp" />
<ClCompile Include="..\..\tier0\valobject.cpp" />
<ClCompile Include="..\..\tier0\vprof.cpp" />
<ClCompile Include="..\..\tier0\win32consoleio.cpp" />
<ClCompile Include="..\..\tier1\characterset.cpp" />
<ClCompile Include="..\..\tier1\checksum_crc.cpp" />
<ClCompile Include="..\..\tier1\checksum_md5.cpp" />
<ClCompile Include="..\..\tier1\convar.cpp" />
<ClCompile Include="..\..\tier1\exprevaluator.cpp" />
<ClCompile Include="..\..\tier1\generichash.cpp" />
<ClCompile Include="..\..\tier1\interface.cpp" />
<ClCompile Include="..\..\tier1\keyvalues.cpp" />
<ClCompile Include="..\..\tier1\mempool.cpp" />
<ClCompile Include="..\..\tier1\memstack.cpp" />
<ClCompile Include="..\..\tier1\splitstring.cpp" />
<ClCompile Include="..\..\tier1\stringpool.cpp" />
<ClCompile Include="..\..\tier1\strtools.cpp" />
<ClCompile Include="..\..\tier1\tier1.cpp" />
<ClCompile Include="..\..\tier1\utlbuffer.cpp" />
<ClCompile Include="..\..\tier1\utlstring.cpp" />
<ClCompile Include="..\..\tier1\utlsymbol.cpp" />
<ClCompile Include="..\..\vstdlib\cvar.cpp" />
<ClCompile Include="..\..\vstdlib\keyvaluessystem.cpp" />
<ClCompile Include="..\..\vstdlib\random.cpp" />
<ClCompile Include="..\..\vstdlib\vstrtools.cpp" />
<ClCompile Include="..\vpccrccheck\crccheck_shared.cpp" />
<ClCompile Include="baseprojectdatacollector.cpp" />
<ClCompile Include="conditionals.cpp" />
<ClCompile Include="configuration.cpp" />
<ClCompile Include="dependencies.cpp" />
<ClCompile Include="exprsimplifier.cpp" />
<ClCompile Include="generatordefinition.cpp" />
<ClCompile Include="groupscript.cpp" />
<ClCompile Include="macros.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="p4sln.cpp" />
<ClCompile Include="projectgenerator_codelite.cpp" />
<ClCompile Include="projectgenerator_makefile.cpp" />
<ClCompile Include="projectgenerator_ps3.cpp" />
<ClCompile Include="projectgenerator_vcproj.cpp" />
<ClCompile Include="projectgenerator_win32.cpp" />
<ClCompile Include="projectgenerator_win32_2010.cpp" />
<ClCompile Include="projectgenerator_xbox360.cpp" />
<ClCompile Include="projectgenerator_xbox360_2010.cpp" />
<ClCompile Include="projectscript.cpp" />
<ClCompile Include="scriptsource.cpp" />
<ClCompile Include="solutiongenerator_codelite.cpp" />
<ClCompile Include="solutiongenerator_makefile.cpp" />
<ClCompile Include="solutiongenerator_win32.cpp" />
<ClCompile Include="solutiongenerator_xcode.cpp" />
<ClCompile Include="sys_utils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tier0\cputopology.h" />
<ClInclude Include="..\..\tier0\memstd.h" />
<ClInclude Include="..\..\tier0\mem_helpers.h" />
<ClInclude Include="..\..\tier0\mem_impl_type.h" />
<ClInclude Include="..\..\tier0\pch_tier0.h" />
<ClInclude Include="..\..\tier0\resource.h" />
<ClInclude Include="..\..\tier0\tier0_strtools.h" />
<ClInclude Include="..\..\vstdlib\concommandhash.h" />
<ClInclude Include="..\vpccrccheck\crccheck_shared.h" />
<ClInclude Include="baseprojectdatacollector.h" />
<ClInclude Include="dependencies.h" />
<ClInclude Include="generatordefinition.h" />
<ClInclude Include="ibaseprojectgenerator.h" />
<ClInclude Include="ibasesolutiongenerator.h" />
<ClInclude Include="p4sln.h" />
<ClInclude Include="projectgenerator_codelite.h" />
<ClInclude Include="projectgenerator_ps3.h" />
<ClInclude Include="projectgenerator_vcproj.h" />
<ClInclude Include="projectgenerator_win32.h" />
<ClInclude Include="projectgenerator_win32_2010.h" />
<ClInclude Include="projectgenerator_xbox360.h" />
<ClInclude Include="projectgenerator_xbox360_2010.h" />
<ClInclude Include="projectgenerator_xcode.h" />
<ClInclude Include="scriptsource.h" />
<ClInclude Include="sys_utils.h" />
<ClInclude Include="vpc.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\vpc_scripts\definitions\ps3.def" />
<None Include="..\..\vpc_scripts\definitions\win32_2005.def" />
<None Include="..\..\vpc_scripts\definitions\win32_2010.def" />
<None Include="..\..\vpc_scripts\definitions\xbox360.def" />
<None Include="..\..\vpc_scripts\definitions\xbox360_2010.def" />
<None Include="Makefile" />
<None Include="projectgenerator_ps3.inc" />
<None Include="projectgenerator_win32.inc" />
<None Include="projectgenerator_win32_2010.inc" />
<None Include="projectgenerator_xbox360.inc" />
<None Include="projectgenerator_xbox360_2010.inc" />
<None Include="vpc.opensdf" />
<None Include="vpc.vpc" />
</ItemGroup>
<ItemGroup>
<Library Include="..\..\lib\common\debug\libclient.lib">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</Library>
<Library Include="..\..\lib\common\debug\libp4sslstub.lib">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</Library>
<Library Include="..\..\lib\common\debug\librpc.lib">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</Library>
<Library Include="..\..\lib\common\debug\libsupp.lib">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</Library>
<Library Include="..\..\lib\common\libclient.lib">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</Library>
<Library Include="..\..\lib\common\libp4sslstub.lib">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</Library>
<Library Include="..\..\lib\common\librpc.lib">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</Library>
<Library Include="..\..\lib\common\libsupp.lib">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</Library>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,393 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="VPC">
<UniqueIdentifier>{46bac1ee-3374-43a2-9761-f79ee2691007}</UniqueIdentifier>
</Filter>
<Filter Include="VPC\Header Files">
<UniqueIdentifier>{38599379-561b-43c5-bdc9-e84eee3ab186}</UniqueIdentifier>
</Filter>
<Filter Include="VPC\Source Files">
<UniqueIdentifier>{13ae58f1-21cb-4159-82ae-3d2dbd5238a7}</UniqueIdentifier>
</Filter>
<Filter Include="Dependencies">
<UniqueIdentifier>{e86543a4-b232-42c1-91e4-ddd9dd9c36a8}</UniqueIdentifier>
</Filter>
<Filter Include="Dependencies\Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Dependencies\Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="VPC\definitions">
<UniqueIdentifier>{f5d738f6-132d-42e7-9f03-05388b11b408}</UniqueIdentifier>
</Filter>
<Filter Include="VPC\VPCCRCCheck">
<UniqueIdentifier>{90afaed2-cb09-4747-bb13-2186c417c0f2}</UniqueIdentifier>
</Filter>
<Filter Include="P4 Libs">
<UniqueIdentifier>{7bc720f7-b058-4998-9fa5-03df7999beef}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\interfaces\interfaces.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\assert_dialog.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\commandline.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\cpu.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\dbg.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\fasttimer.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\logging.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\mem.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\mem_helpers.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\memdbg.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\memstd.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\memvalidate.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\minidump.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\pch_tier0.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\threadtools.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\tier0_strtools.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\valobject.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\vprof.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\win32consoleio.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\characterset.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\checksum_crc.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\checksum_md5.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\convar.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\exprevaluator.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\generichash.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\interface.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\keyvalues.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\mempool.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\memstack.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\splitstring.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\stringpool.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\strtools.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\tier1.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\utlbuffer.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\utlstring.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier1\utlsymbol.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vstdlib\cvar.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vstdlib\keyvaluessystem.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vstdlib\random.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vstdlib\vstrtools.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\platform.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\cputopology.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\stacktools.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\pme.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tier0\pmelib.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
<ClCompile Include="baseprojectdatacollector.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="conditionals.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="configuration.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="dependencies.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="exprsimplifier.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="generatordefinition.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="groupscript.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="macros.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="p4sln.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="projectgenerator_makefile.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="projectgenerator_ps3.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="projectgenerator_vcproj.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="projectgenerator_win32.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="projectgenerator_win32_2010.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="projectgenerator_xbox360.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="projectgenerator_xbox360_2010.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="projectscript.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="scriptsource.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="solutiongenerator_makefile.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="solutiongenerator_win32.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="solutiongenerator_xcode.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="sys_utils.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\vpccrccheck\crccheck_shared.cpp">
<Filter>VPC\VPCCRCCheck</Filter>
</ClCompile>
<ClCompile Include="projectgenerator_codelite.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="solutiongenerator_codelite.cpp">
<Filter>VPC\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\p4lib\p4.cpp">
<Filter>Dependencies\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tier0\mem_helpers.h">
<Filter>Dependencies\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\tier0\mem_impl_type.h">
<Filter>Dependencies\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\tier0\memstd.h">
<Filter>Dependencies\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\tier0\pch_tier0.h">
<Filter>Dependencies\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\tier0\resource.h">
<Filter>Dependencies\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\tier0\tier0_strtools.h">
<Filter>Dependencies\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vstdlib\concommandhash.h">
<Filter>Dependencies\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\tier0\cputopology.h">
<Filter>Dependencies\Header Files</Filter>
</ClInclude>
<ClInclude Include="baseprojectdatacollector.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="dependencies.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="generatordefinition.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="ibaseprojectgenerator.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="ibasesolutiongenerator.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="p4sln.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="projectgenerator_ps3.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="projectgenerator_vcproj.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="projectgenerator_win32.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="projectgenerator_win32_2010.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="projectgenerator_xbox360.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="projectgenerator_xbox360_2010.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="projectgenerator_xcode.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="scriptsource.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="sys_utils.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="vpc.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\vpccrccheck\crccheck_shared.h">
<Filter>VPC\VPCCRCCheck</Filter>
</ClInclude>
<ClInclude Include="projectgenerator_codelite.h">
<Filter>VPC\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Makefile" />
<None Include="vpc.opensdf" />
<None Include="vpc.vpc" />
<None Include="projectgenerator_ps3.inc">
<Filter>VPC\Header Files</Filter>
</None>
<None Include="projectgenerator_win32.inc">
<Filter>VPC\Header Files</Filter>
</None>
<None Include="projectgenerator_win32_2010.inc">
<Filter>VPC\Header Files</Filter>
</None>
<None Include="projectgenerator_xbox360.inc">
<Filter>VPC\Header Files</Filter>
</None>
<None Include="projectgenerator_xbox360_2010.inc">
<Filter>VPC\Header Files</Filter>
</None>
<None Include="..\..\vpc_scripts\definitions\ps3.def">
<Filter>VPC\definitions</Filter>
</None>
<None Include="..\..\vpc_scripts\definitions\win32_2005.def">
<Filter>VPC\definitions</Filter>
</None>
<None Include="..\..\vpc_scripts\definitions\win32_2010.def">
<Filter>VPC\definitions</Filter>
</None>
<None Include="..\..\vpc_scripts\definitions\xbox360.def">
<Filter>VPC\definitions</Filter>
</None>
<None Include="..\..\vpc_scripts\definitions\xbox360_2010.def">
<Filter>VPC\definitions</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Library Include="..\..\lib\common\libsupp.lib">
<Filter>P4 Libs</Filter>
</Library>
<Library Include="..\..\lib\common\libclient.lib">
<Filter>P4 Libs</Filter>
</Library>
<Library Include="..\..\lib\common\librpc.lib">
<Filter>P4 Libs</Filter>
</Library>
<Library Include="..\..\lib\common\libp4sslstub.lib">
<Filter>P4 Libs</Filter>
</Library>
<Library Include="..\..\lib\common\debug\libclient.lib">
<Filter>P4 Libs</Filter>
</Library>
<Library Include="..\..\lib\common\debug\libp4sslstub.lib">
<Filter>P4 Libs</Filter>
</Library>
<Library Include="..\..\lib\common\debug\librpc.lib">
<Filter>P4 Libs</Filter>
</Library>
<Library Include="..\..\lib\common\debug\libsupp.lib">
<Filter>P4 Libs</Filter>
</Library>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,529 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
976DE7B71239412500E8D60A /* crccheck_shared.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976DE7B51239412500E8D60A /* crccheck_shared.cpp */; };
976DE7BA1239423E00E8D60A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 976DE7B91239423E00E8D60A /* Foundation.framework */; };
976DE7BC1239424500E8D60A /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 976DE7BB1239424500E8D60A /* CoreServices.framework */; };
976DE7BE1239424E00E8D60A /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 976DE7BD1239424E00E8D60A /* libiconv.dylib */; };
977F706212393A2A008D8433 /* baseprojectdatacollector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705012393A2A008D8433 /* baseprojectdatacollector.cpp */; };
977F706312393A2A008D8433 /* configuration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705212393A2A008D8433 /* configuration.cpp */; };
977F706412393A2A008D8433 /* dependencies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705312393A2A008D8433 /* dependencies.cpp */; };
977F706512393A2A008D8433 /* ExprSimplifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705512393A2A008D8433 /* ExprSimplifier.cpp */; };
977F706612393A2A008D8433 /* GroupScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705612393A2A008D8433 /* GroupScript.cpp */; };
977F706712393A2A008D8433 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705912393A2A008D8433 /* main.cpp */; };
977F706812393A2A008D8433 /* projectgenerator_makefile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705A12393A2A008D8433 /* projectgenerator_makefile.cpp */; };
977F706912393A2A008D8433 /* projectgenerator_xcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705B12393A2A008D8433 /* projectgenerator_xcode.cpp */; };
977F706A12393A2A008D8433 /* ProjectScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705D12393A2A008D8433 /* ProjectScript.cpp */; };
977F706B12393A2A008D8433 /* solutiongenerator_makefile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705E12393A2A008D8433 /* solutiongenerator_makefile.cpp */; };
977F706C12393A2A008D8433 /* solutiongenerator_xcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F705F12393A2A008D8433 /* solutiongenerator_xcode.cpp */; };
977F706D12393A2A008D8433 /* sys_utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F706012393A2A008D8433 /* sys_utils.cpp */; };
977F708912393ADD008D8433 /* assert_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707212393ADD008D8433 /* assert_dialog.cpp */; };
977F708A12393ADD008D8433 /* cpu_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707312393ADD008D8433 /* cpu_posix.cpp */; };
977F708B12393ADD008D8433 /* cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707412393ADD008D8433 /* cpu.cpp */; };
977F708C12393ADD008D8433 /* dbg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707512393ADD008D8433 /* dbg.cpp */; };
977F708D12393ADD008D8433 /* fasttimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707612393ADD008D8433 /* fasttimer.cpp */; };
977F708E12393ADD008D8433 /* mem_helpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707712393ADD008D8433 /* mem_helpers.cpp */; };
977F708F12393ADD008D8433 /* memblockhdr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707812393ADD008D8433 /* memblockhdr.cpp */; };
977F709012393ADD008D8433 /* memdbg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707912393ADD008D8433 /* memdbg.cpp */; };
977F709112393ADD008D8433 /* memstd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707A12393ADD008D8433 /* memstd.cpp */; };
977F709212393ADD008D8433 /* memvalidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707B12393ADD008D8433 /* memvalidate.cpp */; };
977F709312393ADD008D8433 /* minidump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707C12393ADD008D8433 /* minidump.cpp */; };
977F709412393ADD008D8433 /* pch_tier0.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707D12393ADD008D8433 /* pch_tier0.cpp */; };
977F709512393ADD008D8433 /* platform_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707E12393ADD008D8433 /* platform_posix.cpp */; };
977F709612393ADD008D8433 /* pme_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F707F12393ADD008D8433 /* pme_posix.cpp */; };
977F709712393ADD008D8433 /* pmelib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F708012393ADD008D8433 /* pmelib.cpp */; };
977F709812393ADD008D8433 /* testthread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F708112393ADD008D8433 /* testthread.cpp */; };
977F709912393ADD008D8433 /* thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F708212393ADD008D8433 /* thread.cpp */; };
977F709A12393ADD008D8433 /* threadtools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F708312393ADD008D8433 /* threadtools.cpp */; };
977F709B12393ADD008D8433 /* tier0.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F708412393ADD008D8433 /* tier0.cpp */; };
977F709C12393ADD008D8433 /* validator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F708512393ADD008D8433 /* validator.cpp */; };
977F709D12393ADD008D8433 /* valobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F708612393ADD008D8433 /* valobject.cpp */; };
977F709E12393ADD008D8433 /* vcrmode_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F708712393ADD008D8433 /* vcrmode_posix.cpp */; };
977F709F12393ADD008D8433 /* vprof.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F708812393ADD008D8433 /* vprof.cpp */; };
977F70AB12393B10008D8433 /* checksum_crc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A012393B10008D8433 /* checksum_crc.cpp */; };
977F70AC12393B10008D8433 /* checksum_md5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A112393B10008D8433 /* checksum_md5.cpp */; };
977F70AD12393B10008D8433 /* convar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A212393B10008D8433 /* convar.cpp */; };
977F70AE12393B10008D8433 /* generichash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A312393B10008D8433 /* generichash.cpp */; };
977F70AF12393B10008D8433 /* interface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A412393B10008D8433 /* interface.cpp */; };
977F70B012393B10008D8433 /* KeyValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A512393B10008D8433 /* KeyValues.cpp */; };
977F70B112393B10008D8433 /* mempool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A612393B10008D8433 /* mempool.cpp */; };
977F70B212393B10008D8433 /* memstack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A712393B10008D8433 /* memstack.cpp */; };
977F70B312393B10008D8433 /* stringpool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A812393B10008D8433 /* stringpool.cpp */; };
977F70B412393B10008D8433 /* utlbuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70A912393B10008D8433 /* utlbuffer.cpp */; };
977F70B512393B10008D8433 /* utlsymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70AA12393B10008D8433 /* utlsymbol.cpp */; };
977F70BF12393B49008D8433 /* commandline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70B612393B49008D8433 /* commandline.cpp */; };
977F70C012393B49008D8433 /* cvar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70B712393B49008D8433 /* cvar.cpp */; };
977F70C112393B49008D8433 /* keyvaluessystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70B812393B49008D8433 /* keyvaluessystem.cpp */; };
977F70C212393B49008D8433 /* osversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70B912393B49008D8433 /* osversion.cpp */; };
977F70C312393B49008D8433 /* qsort_s.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70BA12393B49008D8433 /* qsort_s.cpp */; };
977F70C412393B49008D8433 /* random.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70BB12393B49008D8433 /* random.cpp */; };
977F70C512393B49008D8433 /* splitstring.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70BC12393B49008D8433 /* splitstring.cpp */; };
977F70C612393B49008D8433 /* stringnormalize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70BD12393B49008D8433 /* stringnormalize.cpp */; };
977F70C712393B49008D8433 /* strtools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 977F70BE12393B49008D8433 /* strtools.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
977F703E12393174008D8433 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
976DE7B51239412500E8D60A /* crccheck_shared.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = crccheck_shared.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpccrccheck/crccheck_shared.cpp; sourceTree = "<absolute>"; };
976DE7B61239412500E8D60A /* crccheck_shared.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crccheck_shared.h; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpccrccheck/crccheck_shared.h; sourceTree = "<absolute>"; };
976DE7B91239423E00E8D60A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Xcode4/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
976DE7BB1239424500E8D60A /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = Xcode4/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
976DE7BD1239424E00E8D60A /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = Xcode4/SDKs/MacOSX10.5.sdk/usr/lib/libiconv.dylib; sourceTree = SDKROOT; };
977F704012393174008D8433 /* vpc_osx */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = vpc_osx; sourceTree = BUILT_PRODUCTS_DIR; };
977F705012393A2A008D8433 /* baseprojectdatacollector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = baseprojectdatacollector.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/baseprojectdatacollector.cpp; sourceTree = "<absolute>"; };
977F705112393A2A008D8433 /* baseprojectdatacollector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = baseprojectdatacollector.h; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/baseprojectdatacollector.h; sourceTree = "<absolute>"; };
977F705212393A2A008D8433 /* configuration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = configuration.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/configuration.cpp; sourceTree = "<absolute>"; };
977F705312393A2A008D8433 /* dependencies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dependencies.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/dependencies.cpp; sourceTree = "<absolute>"; };
977F705412393A2A008D8433 /* dependencies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dependencies.h; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/dependencies.h; sourceTree = "<absolute>"; };
977F705512393A2A008D8433 /* ExprSimplifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExprSimplifier.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/ExprSimplifier.cpp; sourceTree = "<absolute>"; };
977F705612393A2A008D8433 /* GroupScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GroupScript.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/GroupScript.cpp; sourceTree = "<absolute>"; };
977F705712393A2A008D8433 /* ibaseprojectgenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ibaseprojectgenerator.h; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/ibaseprojectgenerator.h; sourceTree = "<absolute>"; };
977F705812393A2A008D8433 /* ibasesolutiongenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ibasesolutiongenerator.h; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/ibasesolutiongenerator.h; sourceTree = "<absolute>"; };
977F705912393A2A008D8433 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/main.cpp; sourceTree = "<absolute>"; };
977F705A12393A2A008D8433 /* projectgenerator_makefile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = projectgenerator_makefile.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/projectgenerator_makefile.cpp; sourceTree = "<absolute>"; };
977F705B12393A2A008D8433 /* projectgenerator_xcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = projectgenerator_xcode.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/projectgenerator_xcode.cpp; sourceTree = "<absolute>"; };
977F705C12393A2A008D8433 /* projectgenerator_xcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = projectgenerator_xcode.h; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/projectgenerator_xcode.h; sourceTree = "<absolute>"; };
977F705D12393A2A008D8433 /* ProjectScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProjectScript.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/ProjectScript.cpp; sourceTree = "<absolute>"; };
977F705E12393A2A008D8433 /* solutiongenerator_makefile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = solutiongenerator_makefile.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/solutiongenerator_makefile.cpp; sourceTree = "<absolute>"; };
977F705F12393A2A008D8433 /* solutiongenerator_xcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = solutiongenerator_xcode.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/solutiongenerator_xcode.cpp; sourceTree = "<absolute>"; };
977F706012393A2A008D8433 /* sys_utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sys_utils.cpp; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/sys_utils.cpp; sourceTree = "<absolute>"; };
977F706112393A2A008D8433 /* sys_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sys_utils.h; path = /Users/dberger/P4Clients/steam3_main/src/utils/vpc/sys_utils.h; sourceTree = "<absolute>"; };
977F707212393ADD008D8433 /* assert_dialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = assert_dialog.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/assert_dialog.cpp; sourceTree = "<absolute>"; };
977F707312393ADD008D8433 /* cpu_posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpu_posix.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/cpu_posix.cpp; sourceTree = "<absolute>"; };
977F707412393ADD008D8433 /* cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpu.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/cpu.cpp; sourceTree = "<absolute>"; };
977F707512393ADD008D8433 /* dbg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dbg.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/dbg.cpp; sourceTree = "<absolute>"; };
977F707612393ADD008D8433 /* fasttimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fasttimer.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/fasttimer.cpp; sourceTree = "<absolute>"; };
977F707712393ADD008D8433 /* mem_helpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mem_helpers.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/mem_helpers.cpp; sourceTree = "<absolute>"; };
977F707812393ADD008D8433 /* memblockhdr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = memblockhdr.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/memblockhdr.cpp; sourceTree = "<absolute>"; };
977F707912393ADD008D8433 /* memdbg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = memdbg.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/memdbg.cpp; sourceTree = "<absolute>"; };
977F707A12393ADD008D8433 /* memstd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = memstd.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/memstd.cpp; sourceTree = "<absolute>"; };
977F707B12393ADD008D8433 /* memvalidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = memvalidate.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/memvalidate.cpp; sourceTree = "<absolute>"; };
977F707C12393ADD008D8433 /* minidump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = minidump.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/minidump.cpp; sourceTree = "<absolute>"; };
977F707D12393ADD008D8433 /* pch_tier0.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pch_tier0.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/pch_tier0.cpp; sourceTree = "<absolute>"; };
977F707E12393ADD008D8433 /* platform_posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = platform_posix.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/platform_posix.cpp; sourceTree = "<absolute>"; };
977F707F12393ADD008D8433 /* pme_posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pme_posix.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/pme_posix.cpp; sourceTree = "<absolute>"; };
977F708012393ADD008D8433 /* pmelib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pmelib.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/pmelib.cpp; sourceTree = "<absolute>"; };
977F708112393ADD008D8433 /* testthread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testthread.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/testthread.cpp; sourceTree = "<absolute>"; };
977F708212393ADD008D8433 /* thread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = thread.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/thread.cpp; sourceTree = "<absolute>"; };
977F708312393ADD008D8433 /* threadtools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = threadtools.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/threadtools.cpp; sourceTree = "<absolute>"; };
977F708412393ADD008D8433 /* tier0.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tier0.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/tier0.cpp; sourceTree = "<absolute>"; };
977F708512393ADD008D8433 /* validator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = validator.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/validator.cpp; sourceTree = "<absolute>"; };
977F708612393ADD008D8433 /* valobject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = valobject.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/valobject.cpp; sourceTree = "<absolute>"; };
977F708712393ADD008D8433 /* vcrmode_posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = vcrmode_posix.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/vcrmode_posix.cpp; sourceTree = "<absolute>"; };
977F708812393ADD008D8433 /* vprof.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = vprof.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier0/vprof.cpp; sourceTree = "<absolute>"; };
977F70A012393B10008D8433 /* checksum_crc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = checksum_crc.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/checksum_crc.cpp; sourceTree = "<absolute>"; };
977F70A112393B10008D8433 /* checksum_md5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = checksum_md5.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/checksum_md5.cpp; sourceTree = "<absolute>"; };
977F70A212393B10008D8433 /* convar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = convar.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/convar.cpp; sourceTree = "<absolute>"; };
977F70A312393B10008D8433 /* generichash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = generichash.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/generichash.cpp; sourceTree = "<absolute>"; };
977F70A412393B10008D8433 /* interface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = interface.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/interface.cpp; sourceTree = "<absolute>"; };
977F70A512393B10008D8433 /* KeyValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KeyValues.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/KeyValues.cpp; sourceTree = "<absolute>"; };
977F70A612393B10008D8433 /* mempool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mempool.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/mempool.cpp; sourceTree = "<absolute>"; };
977F70A712393B10008D8433 /* memstack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = memstack.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/memstack.cpp; sourceTree = "<absolute>"; };
977F70A812393B10008D8433 /* stringpool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = stringpool.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/stringpool.cpp; sourceTree = "<absolute>"; };
977F70A912393B10008D8433 /* utlbuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = utlbuffer.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/utlbuffer.cpp; sourceTree = "<absolute>"; };
977F70AA12393B10008D8433 /* utlsymbol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = utlsymbol.cpp; path = /Users/dberger/P4Clients/steam3_main/src/tier1/utlsymbol.cpp; sourceTree = "<absolute>"; };
977F70B612393B49008D8433 /* commandline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = commandline.cpp; path = /Users/dberger/P4Clients/steam3_main/src/vstdlib/commandline.cpp; sourceTree = "<absolute>"; };
977F70B712393B49008D8433 /* cvar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cvar.cpp; path = /Users/dberger/P4Clients/steam3_main/src/vstdlib/cvar.cpp; sourceTree = "<absolute>"; };
977F70B812393B49008D8433 /* keyvaluessystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = keyvaluessystem.cpp; path = /Users/dberger/P4Clients/steam3_main/src/vstdlib/keyvaluessystem.cpp; sourceTree = "<absolute>"; };
977F70B912393B49008D8433 /* osversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = osversion.cpp; path = /Users/dberger/P4Clients/steam3_main/src/vstdlib/osversion.cpp; sourceTree = "<absolute>"; };
977F70BA12393B49008D8433 /* qsort_s.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = qsort_s.cpp; path = /Users/dberger/P4Clients/steam3_main/src/vstdlib/qsort_s.cpp; sourceTree = "<absolute>"; };
977F70BB12393B49008D8433 /* random.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = random.cpp; path = /Users/dberger/P4Clients/steam3_main/src/vstdlib/random.cpp; sourceTree = "<absolute>"; };
977F70BC12393B49008D8433 /* splitstring.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = splitstring.cpp; path = /Users/dberger/P4Clients/steam3_main/src/vstdlib/splitstring.cpp; sourceTree = "<absolute>"; };
977F70BD12393B49008D8433 /* stringnormalize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = stringnormalize.cpp; path = /Users/dberger/P4Clients/steam3_main/src/vstdlib/stringnormalize.cpp; sourceTree = "<absolute>"; };
977F70BE12393B49008D8433 /* strtools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = strtools.cpp; path = /Users/dberger/P4Clients/steam3_main/src/vstdlib/strtools.cpp; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
977F703D12393174008D8433 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
976DE7BE1239424E00E8D60A /* libiconv.dylib in Frameworks */,
976DE7BC1239424500E8D60A /* CoreServices.framework in Frameworks */,
976DE7BA1239423E00E8D60A /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
976DE7B41239411300E8D60A /* crccheck_shared */ = {
isa = PBXGroup;
children = (
976DE7B51239412500E8D60A /* crccheck_shared.cpp */,
976DE7B61239412500E8D60A /* crccheck_shared.h */,
);
name = crccheck_shared;
sourceTree = "<group>";
};
976DE7BF1239425600E8D60A /* Libs */ = {
isa = PBXGroup;
children = (
976DE7BD1239424E00E8D60A /* libiconv.dylib */,
976DE7BB1239424500E8D60A /* CoreServices.framework */,
976DE7B91239423E00E8D60A /* Foundation.framework */,
);
name = Libs;
sourceTree = "<group>";
};
977F703312393173008D8433 = {
isa = PBXGroup;
children = (
977F703A12393174008D8433 /* Source */,
976DE7BF1239425600E8D60A /* Libs */,
977F704112393174008D8433 /* Products */,
);
sourceTree = "<group>";
};
977F703A12393174008D8433 /* Source */ = {
isa = PBXGroup;
children = (
977F706F12393A45008D8433 /* tier0 */,
977F707012393A4D008D8433 /* tier1 */,
977F707112393A56008D8433 /* vstdlib */,
976DE7B41239411300E8D60A /* crccheck_shared */,
977F706E12393A3D008D8433 /* vpc */,
);
path = Source;
sourceTree = "<group>";
};
977F704112393174008D8433 /* Products */ = {
isa = PBXGroup;
children = (
977F704012393174008D8433 /* vpc_osx */,
);
name = Products;
sourceTree = "<group>";
};
977F706E12393A3D008D8433 /* vpc */ = {
isa = PBXGroup;
children = (
977F705012393A2A008D8433 /* baseprojectdatacollector.cpp */,
977F705112393A2A008D8433 /* baseprojectdatacollector.h */,
977F705212393A2A008D8433 /* configuration.cpp */,
977F705312393A2A008D8433 /* dependencies.cpp */,
977F705412393A2A008D8433 /* dependencies.h */,
977F705512393A2A008D8433 /* ExprSimplifier.cpp */,
977F705612393A2A008D8433 /* GroupScript.cpp */,
977F705712393A2A008D8433 /* ibaseprojectgenerator.h */,
977F705812393A2A008D8433 /* ibasesolutiongenerator.h */,
977F705912393A2A008D8433 /* main.cpp */,
977F705A12393A2A008D8433 /* projectgenerator_makefile.cpp */,
977F705B12393A2A008D8433 /* projectgenerator_xcode.cpp */,
977F705C12393A2A008D8433 /* projectgenerator_xcode.h */,
977F705D12393A2A008D8433 /* ProjectScript.cpp */,
977F705E12393A2A008D8433 /* solutiongenerator_makefile.cpp */,
977F705F12393A2A008D8433 /* solutiongenerator_xcode.cpp */,
977F706012393A2A008D8433 /* sys_utils.cpp */,
977F706112393A2A008D8433 /* sys_utils.h */,
);
name = vpc;
sourceTree = "<group>";
};
977F706F12393A45008D8433 /* tier0 */ = {
isa = PBXGroup;
children = (
977F707212393ADD008D8433 /* assert_dialog.cpp */,
977F707312393ADD008D8433 /* cpu_posix.cpp */,
977F707412393ADD008D8433 /* cpu.cpp */,
977F707512393ADD008D8433 /* dbg.cpp */,
977F707612393ADD008D8433 /* fasttimer.cpp */,
977F707712393ADD008D8433 /* mem_helpers.cpp */,
977F707812393ADD008D8433 /* memblockhdr.cpp */,
977F707912393ADD008D8433 /* memdbg.cpp */,
977F707A12393ADD008D8433 /* memstd.cpp */,
977F707B12393ADD008D8433 /* memvalidate.cpp */,
977F707C12393ADD008D8433 /* minidump.cpp */,
977F707D12393ADD008D8433 /* pch_tier0.cpp */,
977F707E12393ADD008D8433 /* platform_posix.cpp */,
977F707F12393ADD008D8433 /* pme_posix.cpp */,
977F708012393ADD008D8433 /* pmelib.cpp */,
977F708112393ADD008D8433 /* testthread.cpp */,
977F708212393ADD008D8433 /* thread.cpp */,
977F708312393ADD008D8433 /* threadtools.cpp */,
977F708412393ADD008D8433 /* tier0.cpp */,
977F708512393ADD008D8433 /* validator.cpp */,
977F708612393ADD008D8433 /* valobject.cpp */,
977F708712393ADD008D8433 /* vcrmode_posix.cpp */,
977F708812393ADD008D8433 /* vprof.cpp */,
);
name = tier0;
sourceTree = "<group>";
};
977F707012393A4D008D8433 /* tier1 */ = {
isa = PBXGroup;
children = (
977F70A012393B10008D8433 /* checksum_crc.cpp */,
977F70A112393B10008D8433 /* checksum_md5.cpp */,
977F70A212393B10008D8433 /* convar.cpp */,
977F70A312393B10008D8433 /* generichash.cpp */,
977F70A412393B10008D8433 /* interface.cpp */,
977F70A512393B10008D8433 /* KeyValues.cpp */,
977F70A612393B10008D8433 /* mempool.cpp */,
977F70A712393B10008D8433 /* memstack.cpp */,
977F70A812393B10008D8433 /* stringpool.cpp */,
977F70A912393B10008D8433 /* utlbuffer.cpp */,
977F70AA12393B10008D8433 /* utlsymbol.cpp */,
);
name = tier1;
sourceTree = "<group>";
};
977F707112393A56008D8433 /* vstdlib */ = {
isa = PBXGroup;
children = (
977F70B612393B49008D8433 /* commandline.cpp */,
977F70B712393B49008D8433 /* cvar.cpp */,
977F70B812393B49008D8433 /* keyvaluessystem.cpp */,
977F70B912393B49008D8433 /* osversion.cpp */,
977F70BA12393B49008D8433 /* qsort_s.cpp */,
977F70BB12393B49008D8433 /* random.cpp */,
977F70BC12393B49008D8433 /* splitstring.cpp */,
977F70BD12393B49008D8433 /* stringnormalize.cpp */,
977F70BE12393B49008D8433 /* strtools.cpp */,
);
name = vstdlib;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
977F703F12393174008D8433 /* vpc */ = {
isa = PBXNativeTarget;
buildConfigurationList = 977F704812393174008D8433 /* Build configuration list for PBXNativeTarget "vpc" */;
buildPhases = (
977F703C12393174008D8433 /* Sources */,
977F703D12393174008D8433 /* Frameworks */,
977F703E12393174008D8433 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = vpc;
productName = vpc;
productReference = 977F704012393174008D8433 /* vpc_osx */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
977F703512393173008D8433 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 977F703812393173008D8433 /* Build configuration list for PBXProject "vpc" */;
compatibilityVersion = "Xcode 3.2";
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 977F703312393173008D8433;
productRefGroup = 977F704112393174008D8433 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
977F703F12393174008D8433 /* vpc */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
977F703C12393174008D8433 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
977F706212393A2A008D8433 /* baseprojectdatacollector.cpp in Sources */,
977F706312393A2A008D8433 /* configuration.cpp in Sources */,
977F706412393A2A008D8433 /* dependencies.cpp in Sources */,
977F706512393A2A008D8433 /* ExprSimplifier.cpp in Sources */,
977F706612393A2A008D8433 /* GroupScript.cpp in Sources */,
977F706712393A2A008D8433 /* main.cpp in Sources */,
977F706812393A2A008D8433 /* projectgenerator_makefile.cpp in Sources */,
977F706912393A2A008D8433 /* projectgenerator_xcode.cpp in Sources */,
977F706A12393A2A008D8433 /* ProjectScript.cpp in Sources */,
977F706B12393A2A008D8433 /* solutiongenerator_makefile.cpp in Sources */,
977F706C12393A2A008D8433 /* solutiongenerator_xcode.cpp in Sources */,
977F706D12393A2A008D8433 /* sys_utils.cpp in Sources */,
977F708912393ADD008D8433 /* assert_dialog.cpp in Sources */,
977F708A12393ADD008D8433 /* cpu_posix.cpp in Sources */,
977F708B12393ADD008D8433 /* cpu.cpp in Sources */,
977F708C12393ADD008D8433 /* dbg.cpp in Sources */,
977F708D12393ADD008D8433 /* fasttimer.cpp in Sources */,
977F708E12393ADD008D8433 /* mem_helpers.cpp in Sources */,
977F708F12393ADD008D8433 /* memblockhdr.cpp in Sources */,
977F709012393ADD008D8433 /* memdbg.cpp in Sources */,
977F709112393ADD008D8433 /* memstd.cpp in Sources */,
977F709212393ADD008D8433 /* memvalidate.cpp in Sources */,
977F709312393ADD008D8433 /* minidump.cpp in Sources */,
977F709412393ADD008D8433 /* pch_tier0.cpp in Sources */,
977F709512393ADD008D8433 /* platform_posix.cpp in Sources */,
977F709612393ADD008D8433 /* pme_posix.cpp in Sources */,
977F709712393ADD008D8433 /* pmelib.cpp in Sources */,
977F709812393ADD008D8433 /* testthread.cpp in Sources */,
977F709912393ADD008D8433 /* thread.cpp in Sources */,
977F709A12393ADD008D8433 /* threadtools.cpp in Sources */,
977F709B12393ADD008D8433 /* tier0.cpp in Sources */,
977F709C12393ADD008D8433 /* validator.cpp in Sources */,
977F709D12393ADD008D8433 /* valobject.cpp in Sources */,
977F709E12393ADD008D8433 /* vcrmode_posix.cpp in Sources */,
977F709F12393ADD008D8433 /* vprof.cpp in Sources */,
977F70AB12393B10008D8433 /* checksum_crc.cpp in Sources */,
977F70AC12393B10008D8433 /* checksum_md5.cpp in Sources */,
977F70AD12393B10008D8433 /* convar.cpp in Sources */,
977F70AE12393B10008D8433 /* generichash.cpp in Sources */,
977F70AF12393B10008D8433 /* interface.cpp in Sources */,
977F70B012393B10008D8433 /* KeyValues.cpp in Sources */,
977F70B112393B10008D8433 /* mempool.cpp in Sources */,
977F70B212393B10008D8433 /* memstack.cpp in Sources */,
977F70B312393B10008D8433 /* stringpool.cpp in Sources */,
977F70B412393B10008D8433 /* utlbuffer.cpp in Sources */,
977F70B512393B10008D8433 /* utlsymbol.cpp in Sources */,
977F70BF12393B49008D8433 /* commandline.cpp in Sources */,
977F70C012393B49008D8433 /* cvar.cpp in Sources */,
977F70C112393B49008D8433 /* keyvaluessystem.cpp in Sources */,
977F70C212393B49008D8433 /* osversion.cpp in Sources */,
977F70C312393B49008D8433 /* qsort_s.cpp in Sources */,
977F70C412393B49008D8433 /* random.cpp in Sources */,
977F70C512393B49008D8433 /* splitstring.cpp in Sources */,
977F70C612393B49008D8433 /* stringnormalize.cpp in Sources */,
977F70C712393B49008D8433 /* strtools.cpp in Sources */,
976DE7B71239412500E8D60A /* crccheck_shared.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
977F704612393174008D8433 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.5;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.5;
STRIP_INSTALLED_PRODUCT = NO;
};
name = Debug;
};
977F704712393174008D8433 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.5;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.5;
STRIP_INSTALLED_PRODUCT = NO;
};
name = Release;
};
977F704912393174008D8433 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = YES;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_MODEL_TUNING = G5;
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = (
_POSIX,
TIER0_DLL_EXPORT,
GNUC,
POSIX,
OSX,
_OSX,
COMPILER_GCC,
STEAM,
);
GCC_VERSION = com.apple.compilers.llvmgcc42;
INSTALL_PATH = ../../devtools/bin/;
OTHER_CFLAGS = "-fpermissive";
PRODUCT_NAME = vpc_osx;
SDKROOT = macosx10.5;
USER_HEADER_SEARCH_PATHS = "../../public ../../common ../../public/tier0 ../../public/tier1 ../../public/vstdlib";
};
name = Debug;
};
977F704A12393174008D8433 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_MODEL_TUNING = G5;
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = (
_POSIX,
TIER0_DLL_EXPORT,
GNUC,
POSIX,
OSX,
_OSX,
COMPILER_GCC,
STEAM,
);
GCC_VERSION = com.apple.compilers.llvmgcc42;
INSTALL_PATH = ../../devtools/bin/;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-fpermissive";
PRODUCT_NAME = vpc_osx;
SDKROOT = macosx10.5;
USER_HEADER_SEARCH_PATHS = "../../public ../../common ../../public/tier0 ../../public/tier1 ../../public/vstdlib";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
977F703812393173008D8433 /* Build configuration list for PBXProject "vpc" */ = {
isa = XCConfigurationList;
buildConfigurations = (
977F704612393174008D8433 /* Debug */,
977F704712393174008D8433 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
977F704812393174008D8433 /* Build configuration list for PBXNativeTarget "vpc" */ = {
isa = XCConfigurationList;
buildConfigurations = (
977F704912393174008D8433 /* Debug */,
977F704A12393174008D8433 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 977F703512393173008D8433 /* Project object */;
}

View File

@@ -0,0 +1,590 @@
#include "../vpc/vpc.h"
#include "crccheck_shared.h"
#include "tier1/checksum_crc.h"
#include "tier1/strtools.h"
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#ifdef _WIN32
#include <process.h>
#else
#include <stdlib.h>
#define stricmp strcasecmp
#endif
#pragma warning( disable : 4996 )
#pragma warning( disable : 4127 )
#define MAX_INCLUDE_STACK_DEPTH 10
static bool IsValidPathChar( char token )
{
// does it look like a file? If this ends up too tight, can probably just check that it's not '[' or '{'
// cause conditional blocks are what we really want to avoid.
return isalpha(token) || isdigit(token) || (token == '.') || (token == '\\') || (token == '/');
}
extern const char *g_szArrPlatforms[];
static void BuildReplacements( const char *token, char *szReplacements )
{
// Now go pickup the any files that exist, but were non-matches
*szReplacements = '\0';
for ( int i = 0; g_szArrPlatforms[i] != NULL; i++ )
{
char szPath[MAX_PATH];
char szPathExpanded[MAX_PATH];
V_strncpy( szPath, token, sizeof(szPath) );
Sys_ReplaceString( szPath, "$os", g_szArrPlatforms[i], szPathExpanded, sizeof(szPathExpanded) );
V_FixSlashes( szPathExpanded );
V_RemoveDotSlashes( szPathExpanded );
V_FixDoubleSlashes( szPathExpanded );
// this fopen is probably using a relative path, but that's ok, as everything in
// the crc code is opening relative paths and assuming the cwd is set ok.
FILE *f = fopen( szPathExpanded, "rb" );
if ( f )
{
fclose(f);
// strcat - blech
strcat( szReplacements, g_szArrPlatforms[i] ); // really just need to stick the existing platforms seen in
strcat( szReplacements, ";" );
}
}
}
static const char * GetToken( const char *ln, char *token )
{
*token = '\0';
while ( *ln && isspace(*ln) )
ln++;
if (!ln[0])
return NULL;
if ( ln[0] == '"' )
{ // does vpc allow \" inside the filename string - shouldn't matter, but we're going to assume no.
ln++;
while (*ln)
{
if ( ln[0] == '"' )
break;
*token++ = *ln++;
}
*token = '\0';
}
else if ( IsValidPathChar( *ln ) )
{
while (*ln)
{
if ( isspace(*ln) )
break;
*token++ = *ln++;
}
*token = '\0';
}
else
{
token[0] = ln[0];
token[1] = '\0';
}
return ln;
}
static void PerformFileSubstitions( char * line, int linelen )
{
static bool bFindFilePending = false;
const char *ln = line;
if ( !bFindFilePending )
{
ln = V_stristr( ln, "$file " );
if ( ln )
bFindFilePending = true;
}
if ( bFindFilePending )
{
char token[1024];
ln = GetToken( ln, token );
if ( !ln )
return; // no more tokens on line, we should try the next line
bFindFilePending = false;
if ( V_stristr(token, "$os") )
{
if ( !IsValidPathChar( *token ) )
fprintf( stderr, "Warning: can't expand %s for crc calculation. Changes to this file set won't trigger automatic rebuild\n", token );
char szReplacements[2048];
char buffer[4096];
BuildReplacements( token, szReplacements );
Sys_ReplaceString( line, "$os", szReplacements, buffer, sizeof(buffer) );
V_strncpy( line, buffer, linelen );
}
}
static bool bFindFilePatternPending = false;
ln = line;
if ( !bFindFilePatternPending )
{
ln = V_stristr( ln, "$filepattern" );
while ( ln )
{
ln += 13;
if ( isspace( ln[-1] ) )
{
bFindFilePatternPending = true;
break;
}
}
}
if ( bFindFilePatternPending )
{
char token[1024];
ln = GetToken( ln, token );
if ( !ln )
return; // no more tokens on line, we should try the next line
bFindFilePatternPending = false;
char szReplacements[2048]; szReplacements[0] = '\0';
char buffer[4096];
CUtlVector< CUtlString > vecResults;
Sys_ExpandFilePattern( token, vecResults );
if ( vecResults.Count() )
{
for ( int i= 0; i < vecResults.Count(); i++ )
{
V_strncat( szReplacements, CFmtStr( "%s;", vecResults[i].String() ).Access(), V_ARRAYSIZE( szReplacements ) );
}
CRC32_t nCRC = CRC32_ProcessSingleBuffer( szReplacements, V_strlen( szReplacements ) );
Sys_ReplaceString( line, token, CFmtStr( "%s:%u", token, nCRC ).Access(), buffer, sizeof(buffer) );
V_strncpy( line, buffer, linelen );
}
else
{
if ( !IsValidPathChar( *token ) )
fprintf( stderr, "Warning: %s couldn't be expanded during crc calculation. Changes to this file set won't trigger automatic project rebuild\n", token );
}
}
}
//-----------------------------------------------------------------------------
// Sys_Error
//
//-----------------------------------------------------------------------------
void Sys_Error( const char* format, ... )
{
va_list argptr;
va_start( argptr,format );
vfprintf( stderr, format, argptr );
va_end( argptr );
exit( 1 );
}
void SafeSnprintf( char *pOut, int nOutLen, const char *pFormat, ... )
{
va_list marker;
va_start( marker, pFormat );
V_vsnprintf( pOut, nOutLen, pFormat, marker );
va_end( marker );
pOut[nOutLen-1] = 0;
}
// for linked lists of strings
struct StringNode_t
{
StringNode_t *m_pNext;
char m_Text[1]; // the string data
};
static StringNode_t *MakeStrNode( char const *pStr )
{
size_t nLen = strlen( pStr );
StringNode_t *nRet = ( StringNode_t * ) new unsigned char[sizeof( StringNode_t ) + nLen ];
strcpy( nRet->m_Text, pStr );
return nRet;
}
//-----------------------------------------------------------------------------
// Sys_LoadTextFileWithIncludes
//-----------------------------------------------------------------------------
int Sys_LoadTextFileWithIncludes( const char* filename, char** bufferptr, bool bInsertFileMacroExpansion )
{
FILE *pFileStack[MAX_INCLUDE_STACK_DEPTH];
int nSP = MAX_INCLUDE_STACK_DEPTH;
StringNode_t *pFileLines = NULL; // tail ptr for fast adds
size_t nTotalFileBytes = 0;
FILE *handle = fopen( filename, "r" );
if ( !handle )
return -1;
pFileStack[--nSP] = handle; // push
while ( nSP < MAX_INCLUDE_STACK_DEPTH )
{
// read lines
for (;;)
{
char lineBuffer[4096];
char *ln = fgets( lineBuffer, sizeof( lineBuffer ), pFileStack[nSP] );
if ( !ln )
break; // out of text
ln += strspn( ln, "\t " ); // skip white space
// Need to insert actual files to make sure crc changes if disk-matched files match
if ( bInsertFileMacroExpansion )
PerformFileSubstitions( ln, sizeof(lineBuffer) - (ln-lineBuffer) );
if ( memcmp( ln, "#include", 8 ) == 0 )
{
// omg, an include
ln += 8;
ln += strspn( ln, " \t\"<" ); // skip whitespace, ", and <
size_t nPathNameLength = strcspn( ln, " \t\">\n" );
if ( !nPathNameLength )
{
Sys_Error( "bad include %s via %s\n", lineBuffer, filename );
}
ln[nPathNameLength] = 0; // kill everything after end of filename
FILE *inchandle = fopen( ln, "r" );
if ( !inchandle )
{
Sys_Error( "can't open #include of %s\n", ln );
}
if ( !nSP )
{
Sys_Error( "include nesting too deep via %s", filename );
}
pFileStack[--nSP] = inchandle;
}
else
{
size_t nLen = strlen( ln );
nTotalFileBytes += nLen;
StringNode_t *pNewLine = MakeStrNode( ln );
pNewLine->m_pNext = pFileLines;
pFileLines = pNewLine;
}
}
fclose( pFileStack[nSP] );
nSP++; // pop stack
}
// Reverse the pFileLines list so it goes the right way.
StringNode_t *pPrev = NULL;
StringNode_t *pCur;
for( pCur = pFileLines; pCur; )
{
StringNode_t *pNext = pCur->m_pNext;
pCur->m_pNext = pPrev;
pPrev = pCur;
pCur = pNext;
}
pFileLines = pPrev;
// Now dump all the lines out into a single buffer.
char *buffer = new char[nTotalFileBytes + 1]; // and null
*bufferptr = buffer; // tell caller
// copy all strings and null terminate
int nLine = 0;
StringNode_t *pNext;
for( pCur=pFileLines; pCur; pCur=pNext )
{
pNext = pCur->m_pNext;
size_t nLen = strlen( pCur->m_Text );
memcpy( buffer, pCur->m_Text, nLen );
buffer += nLen;
nLine++;
// Cleanup the line..
//delete [] (unsigned char*)pCur;
}
*( buffer++ ) = 0; // null
return (int)nTotalFileBytes;
}
// Just like fgets() but it removes trailing newlines.
char* ChompLineFromFile( char *pOut, int nOutBytes, FILE *fp )
{
char *pReturn = fgets( pOut, nOutBytes, fp );
if ( pReturn )
{
int len = (int)strlen( pReturn );
if ( len > 0 && pReturn[len-1] == '\n' )
{
pReturn[len-1] = 0;
if ( len > 1 && pReturn[len-2] == '\r' )
pReturn[len-2] = 0;
}
}
return pReturn;
}
bool CheckSupplementalString( const char *pSupplementalString, const char *pReferenceSupplementalString )
{
// The supplemental string is only checked while VPC is determining if a project file is stale or not.
// It's not used by the pre-build event's CRC check.
// The supplemental string contains various options that tell how the project was built. It's generated in VPC_GenerateCRCOptionString.
//
// If there's no reference supplemental string (which is the case if we're running vpccrccheck.exe), then we ignore it and continue.
if ( !pReferenceSupplementalString )
return true;
return ( pSupplementalString && pReferenceSupplementalString && stricmp( pSupplementalString, pReferenceSupplementalString ) == 0 );
}
bool CheckVPCExeCRC( char *pVPCCRCCheckString, const char *szFilename, char *pErrorString, int nErrorStringLength )
{
if ( pVPCCRCCheckString == NULL )
{
SafeSnprintf( pErrorString, nErrorStringLength, "Unexpected end-of-file in %s", szFilename );
return false;
}
char *pSpace = strchr( pVPCCRCCheckString, ' ' );
if ( !pSpace )
{
SafeSnprintf( pErrorString, nErrorStringLength, "Invalid line ('%s') in %s", pVPCCRCCheckString, szFilename );
return false;
}
// Null-terminate it so we have the CRC by itself and the filename follows the space.
*pSpace = 0;
const char *pVPCFilename = pSpace + 1;
// Parse the CRC out.
unsigned int nReferenceCRC;
sscanf( pVPCCRCCheckString, "%x", &nReferenceCRC );
char *pBuffer;
int cbVPCExe = Sys_LoadFile( pVPCFilename, (void**)&pBuffer );
if ( !pBuffer )
{
SafeSnprintf( pErrorString, nErrorStringLength, "Unable to load %s for comparison.", pVPCFilename );
return false;
}
if ( cbVPCExe < 0 )
{
SafeSnprintf( pErrorString, nErrorStringLength, "Could not load file '%s' to check CRC", pVPCFilename );
return false;
}
// Calculate the CRC from the contents of the file.
CRC32_t nCRCFromFileContents = CRC32_ProcessSingleBuffer( pBuffer, cbVPCExe );
delete [] pBuffer;
// Compare them.
if ( nCRCFromFileContents != nReferenceCRC )
{
SafeSnprintf( pErrorString, nErrorStringLength, "VPC executable has changed since the project was generated." );
return false;
}
return true;
}
bool VPC_CheckProjectDependencyCRCs( const char *pProjectFilename, const char *pReferenceSupplementalString, char *pErrorString, int nErrorStringLength )
{
// Build the xxxxx.vcproj.vpc_crc filename
char szFilename[512];
SafeSnprintf( szFilename, sizeof( szFilename ), "%s.%s", pProjectFilename, VPCCRCCHECK_FILE_EXTENSION );
// Open it up.
FILE *fp = fopen( szFilename, "rt" );
if ( !fp )
{
SafeSnprintf( pErrorString, nErrorStringLength, "Unable to load %s to check CRC strings", szFilename );
return false;
}
bool bReturnValue = false;
char lineBuffer[2048];
// Check the version of the CRC file.
const char *pVersionString = ChompLineFromFile( lineBuffer, sizeof( lineBuffer ), fp );
if ( pVersionString && stricmp( pVersionString, VPCCRCCHECK_FILE_VERSION_STRING ) == 0 )
{
char *pVPCExeCRCString = ChompLineFromFile( lineBuffer, sizeof( lineBuffer ), fp );
if ( CheckVPCExeCRC( pVPCExeCRCString, szFilename, pErrorString, nErrorStringLength ) )
{
// Check the supplemental CRC string.
const char *pSupplementalString = ChompLineFromFile( lineBuffer, sizeof( lineBuffer ), fp );
if ( CheckSupplementalString( pSupplementalString, pReferenceSupplementalString ) )
{
// Now read each line. Each line has a CRC and a filename on it.
while ( 1 )
{
char *pLine = ChompLineFromFile( lineBuffer, sizeof( lineBuffer ), fp );
if ( !pLine )
{
// We got all the way through the file without a CRC error, so all's well.
bReturnValue = true;
break;
}
char *pSpace = strchr( pLine, ' ' );
if ( !pSpace )
{
SafeSnprintf( pErrorString, nErrorStringLength, "Invalid line ('%s') in %s", pLine, szFilename );
break;
}
// Null-terminate it so we have the CRC by itself and the filename follows the space.
*pSpace = 0;
const char *pVPCFilename = pSpace + 1;
// Parse the CRC out.
unsigned int nReferenceCRC;
sscanf( pLine, "%x", &nReferenceCRC );
// Calculate the CRC from the contents of the file.
char *pBuffer;
int nTotalFileBytes = Sys_LoadTextFileWithIncludes( pVPCFilename, &pBuffer, true );
if ( nTotalFileBytes == -1 )
{
SafeSnprintf( pErrorString, nErrorStringLength, "Unable to load %s for CRC comparison.", pVPCFilename );
break;
}
CRC32_t nCRCFromTextContents = CRC32_ProcessSingleBuffer( pBuffer, nTotalFileBytes );
delete [] pBuffer;
// Compare them.
if ( nCRCFromTextContents != nReferenceCRC )
{
SafeSnprintf( pErrorString, nErrorStringLength, "This VCPROJ is out of sync with its VPC scripts.\n %s mismatches (0x%x vs 0x%x).\n Please use VPC to re-generate!\n \n", pVPCFilename, nReferenceCRC, nCRCFromTextContents );
break;
}
}
}
else
{
SafeSnprintf( pErrorString, nErrorStringLength, "Supplemental string mismatch." );
}
}
}
else
{
SafeSnprintf( pErrorString, nErrorStringLength, "CRC file %s has an invalid version string ('%s')", szFilename, pVersionString ? pVersionString : "[null]" );
}
fclose( fp );
return bReturnValue;
}
int VPC_OldeStyleCRCChecks( int argc, char **argv )
{
for ( int i=1; (i+2) < argc; )
{
const char *pTestArg = argv[i];
if ( stricmp( pTestArg, "-crc" ) != 0 )
{
++i;
continue;
}
const char *pVPCFilename = argv[i+1];
// Get the CRC value on the command line.
const char *pTestCRC = argv[i+2];
unsigned int nCRCFromCommandLine;
sscanf( pTestCRC, "%x", &nCRCFromCommandLine );
// Calculate the CRC from the contents of the file.
char *pBuffer;
int nTotalFileBytes = Sys_LoadTextFileWithIncludes( pVPCFilename, &pBuffer, true );
if ( nTotalFileBytes == -1 )
{
Sys_Error( "Unable to load %s for CRC comparison.", pVPCFilename );
}
CRC32_t nCRCFromTextContents = CRC32_ProcessSingleBuffer( pBuffer, nTotalFileBytes );
delete [] pBuffer;
// Compare them.
if ( nCRCFromTextContents != nCRCFromCommandLine )
{
Sys_Error( " \n This VCPROJ is out of sync with its VPC scripts.\n %s mismatches (0x%x vs 0x%x).\n Please use VPC to re-generate!\n \n", pVPCFilename, nCRCFromCommandLine, nCRCFromTextContents );
}
i += 2;
}
return 0;
}
int VPC_CommandLineCRCChecks( int argc, char **argv )
{
if ( argc < 2 )
{
fprintf( stderr, "Invalid arguments to " VPCCRCCHECK_EXE_FILENAME ". Format: " VPCCRCCHECK_EXE_FILENAME " [project filename]\n" );
return 1;
}
const char *pFirstCRC = argv[1];
// If the first argument starts with -crc but is not -crc2, then this is an old CRC check command line with all the CRCs and filenames
// directly on the command line. The new format puts all that in a separate file.
if ( pFirstCRC[0] == '-' && pFirstCRC[1] == 'c' && pFirstCRC[2] == 'r' && pFirstCRC[3] == 'c' && pFirstCRC[4] != '2' )
{
return VPC_OldeStyleCRCChecks( argc, argv );
}
if ( stricmp( pFirstCRC, "-crc2" ) != 0 )
{
fprintf( stderr, "Missing -crc2 parameter on vpc CRC check command line." );
return 1;
}
const char *pProjectFilename = argv[2];
char errorString[1024];
bool bCRCsValid = VPC_CheckProjectDependencyCRCs( pProjectFilename, NULL, errorString, sizeof( errorString ) );
if ( bCRCsValid )
{
return 0;
}
else
{
fprintf( stderr, "%s", errorString );
return 1;
}
}

View File

@@ -0,0 +1,34 @@
//===================== Copyright (c) Valve Corporation. All Rights Reserved. ======================
//
//
//
//==================================================================================================
#ifndef CRCCHECK_SHARED_H
#define CRCCHECK_SHARED_H
#ifdef _WIN32
#pragma once
#endif
#ifdef STANDALONE_VPC
#define VPCCRCCHECK_EXE_FILENAME "vpc.exe"
#else
#define VPCCRCCHECK_EXE_FILENAME "vpccrccheck.exe"
#endif
// The file extension for the file that contains the CRCs that a vcproj depends on.
#define VPCCRCCHECK_FILE_EXTENSION "vpc_crc"
#define VPCCRCCHECK_FILE_VERSION_STRING "[vpc crc file version 2]"
void Sys_Error( const char *format, ... );
int Sys_LoadTextFileWithIncludes( const char* filename, char** bufferptr, bool bInsertFileMacroExpansion );
bool VPC_CheckProjectDependencyCRCs( const char *pProjectFilename, const char *pReferenceSupplementalString, char *pErrorString, int nErrorStringLength );
// Used by vpccrccheck.exe or by vpc.exe to do the CRC check that's initiated in the pre-build steps.
int VPC_CommandLineCRCChecks( int argc, char **argv );
#endif // CRCCHECK_SHARED_H

View File

@@ -0,0 +1,16 @@
#include "tier1/checksum_crc.h"
#include "crccheck_shared.h"
#include <stdio.h>
#include <string.h>
int main( int argc, char **argv )
{
return VPC_CommandLineCRCChecks( argc, argv );
}

View File

@@ -0,0 +1,33 @@
//-----------------------------------------------------------------------------
// VPCCRCCHECK.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro OUTBINDIR "$SRCDIR\devtools\bin"
$Include "$SRCDIR\vpc_scripts\source_exe_con_base.vpc"
$Configuration
{
$Compiler
{
}
}
$Project "vpccrccheck"
{
$Folder "Source Files"
{
-$File "$SRCDIR\public\tier0\memoverride.cpp"
$File "vpccrccheck.cpp"
$File "crccheck_shared.cpp"
$File "$SRCDIR/tier1/checksum_crc.cpp"
}
$Folder "Link Libraries"
{
-$Implib "$LIBPUBLIC\vstdlib"
}
}