vs2022 support

and fixed a stupid bug
This commit is contained in:
Fisual
2021-11-10 09:53:24 +07:00
parent d27f95b766
commit 2c6cc45450
6 changed files with 38 additions and 18 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -157,7 +157,7 @@ bool CVPC::Init( int argc, const char **argv )
m_nArgc--;
}
Log_Msg( LOG_VPC, "CPC - Cool Project Creator For " );
Log_Msg( LOG_VPC, "cVPC - cool Volve Project Creator For " );
Log_Msg( LOG_VPC, "Visual Studio " );
Log_Msg( LOG_VPC, "(Build: %s %s)\n", __DATE__, __TIME__ );
Log_Msg( LOG_VPC, "(C) Copyright 2021, LOLOLOL, All rights reserved.\n" );
@@ -650,6 +650,7 @@ void CVPC::SpewUsage( void )
Log_Msg( LOG_VPC, "[/srcctl]: Enable P4SCC source control integration - can also set environment variable VPC_SRCCTL to 1\n" );
#endif
Log_Msg( LOG_VPC, "[/mirror]: <path> - Mirror output files to specified path. Used for A:B testing.\n" );
Log_Msg( LOG_VPC, "[/2022]: Generate projects and solutions for Visual Studio 2022\n");
Log_Msg( LOG_VPC, "[/2019]: Generate projects and solutions for Visual Studio 2019 [default]\n" );
Log_Msg( LOG_VPC, "[/2015]: Generate projects and solutions for Visual Studio 2015\n" );
Log_Msg( LOG_VPC, "[/2013]: Generate projects and solutions for Visual Studio 2013\n" );
@@ -1024,6 +1025,11 @@ void CVPC::HandleSingleCommandLineArg( const char *pArg )
{
m_eVSVersion = k_EVSVersion_2019;
m_ExtraOptionsCRCString += pArgName;
}
else if ( !V_stricmp( pArgName, "2022" ) )
{
m_eVSVersion = k_EVSVersion_2022;
m_ExtraOptionsCRCString += pArgName;
}
else if ( !V_stricmp( pArgName, "nounity" ) )
{
@@ -1847,52 +1853,50 @@ void CVPC::SetMacrosAndConditionals()
// VS2010 is strictly win32/xbox360
switch ( m_eVSVersion )
{
case k_EVSVersion_2022:
m_ExtraOptionsCRCString += "VS2022";
SetConditional("VS2022", true);
// temporarily allow VS2013 conditionals also as there are many. Will fix.
SetConditional("VS2013", true);
m_bUseVS2010FileFormat = true;
break;
case k_EVSVersion_2019:
m_ExtraOptionsCRCString += "VS2019";
SetConditional("VS2019", true);
// temporarily allow VS2013 conditionals also as there are many. Will fix.
SetConditional("VS2013", true);
m_bUseVS2010FileFormat = true;
break;
case k_EVSVersion_2015:
m_ExtraOptionsCRCString += "VS2015";
SetConditional( "VS2015", true );
// temporarily allow VS2013 conditionals also as there are many. Will fix.
SetConditional( "VS2013", true );
m_bUseVS2010FileFormat = true;
break;
case k_EVSVersion_2013:
m_ExtraOptionsCRCString += "VS2013";
SetConditional( "VS2013", true );
m_bUseVS2010FileFormat = true;
break;
case k_EVSVersion_2012:
m_ExtraOptionsCRCString += "VS2012";
SetConditional( "VS2012", true );
m_bUseVS2010FileFormat = true;
break;
case k_EVSVersion_2010:
m_ExtraOptionsCRCString += "VS2010";
SetConditional( "VS2010", true );
m_bUseVS2010FileFormat = true;
break;
case k_EVSVersion_2008:
m_ExtraOptionsCRCString += "VS2008";
SetConditional( "VS2005", true ); // use 2005 defines
m_bUseVS2010FileFormat = false;
break;
default:
m_ExtraOptionsCRCString += "VS2005";
SetConditional( "VS2005", true );
m_ExtraOptionsCRCString += "VS2022";
SetConditional( "VS2013", true );
m_bUseVS2010FileFormat = false;
break;
}
@@ -2393,7 +2397,9 @@ void CVPC::SetupGenerators()
{
// spew what we are generating
const char *pchLogLine = "Generating for Visual Studio 2005.\n";
if ( m_eVSVersion == k_EVSVersion_2019 )
if ( m_eVSVersion == k_EVSVersion_2022 )
pchLogLine = "Generating for Visual Studio 2022.\n";
else if (m_eVSVersion == k_EVSVersion_2019)
pchLogLine = "Generating for Visual Studio 2019.\n";
else if (m_eVSVersion == k_EVSVersion_2015)
pchLogLine = "Generating for Visual Studio 2015.\n";

View File

@@ -35,7 +35,7 @@ public:
{
HKEY hKey;
int firstVer = 8;
const int lastVer = 14; // Handle up to VS 14, AKA VS 2015
const int lastVer = 17; // Handle up to VS 17, AKA VS 2022
if ( g_pVPC->Is2010() )
{
firstVer = 10;
@@ -46,6 +46,7 @@ public:
}
for ( int vsVer = firstVer; vsVer <= lastVer; ++vsVer )
{
/*
// Handle both VisualStudio and VCExpress (used by some SourceSDK customers)
RegStartPoint searchPoints[] =
{
@@ -92,6 +93,13 @@ public:
RegCloseKey( hKey );
}
*/
{
char szKeyName[MAX_PATH];
DWORD dwKeyNameSize = sizeof(szKeyName);
V_strncpy(szSolutionGUID, szKeyName, ARRAYSIZE(szSolutionGUID));
return;
}
}
g_pVPC->VPCError( "Unable to find RegKey for .vcproj or .vcxproj files in solutions." );
}
@@ -106,7 +114,7 @@ public:
pSolutionFilename = szTmpSolutionFilename;
}
Msg( "\nWriting solution file %s.\n\n", pSolutionFilename );
ConColorMsg(Color(104,224,18,255), "\nWriting solution file %s.\n\n", pSolutionFilename);
char szSolutionGUID[256];
GetVCPROJSolutionGUID( szSolutionGUID );
@@ -119,13 +127,17 @@ public:
if ( !fp )
g_pVPC->VPCError( "Can't open %s for writing.", pSolutionFilename );
if ( g_pVPC->Is2019() )
if (g_pVPC->Is2022())
{
fprintf( fp, "\xef\xbb\xbf\nMicrosoft Visual Studio Solution File, Format Version 12.00\n" ); // anddddd still on 12
fprintf( fp, "# Visual Studio 2022\n" );
}
else if ( g_pVPC->Is2019() )
{
fprintf( fp, "\xef\xbb\xbf\nMicrosoft Visual Studio Solution File, Format Version 12.00\n" ); // still on 12
fprintf( fp, "# Visual Studio 2019\n" );
}
if ( g_pVPC->Is2015() )
else 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" );

View File

@@ -182,6 +182,7 @@ enum EVSVersion
k_EVSVersion_2013,
k_EVSVersion_2015,
k_EVSVersion_2019,
k_EVSVersion_2022,
};
class CVPC
@@ -219,6 +220,7 @@ public:
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 Is2019() { return m_eVSVersion == k_EVSVersion_2019; } // When this returns true so does Is2010() because of the file format similarities
bool Is2022() { return m_eVSVersion == k_EVSVersion_2022; } // 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; }