Added initial support for Visual Studio 2008 solutions.

This commit is contained in:
starkos 2008-04-22 14:58:30 +00:00
parent 86ddb7c0a0
commit cb88b243b8
17 changed files with 381 additions and 81 deletions

View File

@ -0,0 +1,225 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="CppExe"
ProjectGUID="{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}"
RootNamespace="CppExe"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\CppExe.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\targetver.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppExe", "CppExe\CppExe.vcproj", "{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}.Debug|Win32.ActiveCfg = Debug|Win32
{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}.Debug|Win32.Build.0 = Debug|Win32
{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}.Release|Win32.ActiveCfg = Release|Win32
{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -14,5 +14,6 @@ SessionAction Actions[] =
{ "vs2002", "Microsoft Visual Studio 2002", vs2002_action },
{ "vs2003", "Microsoft Visual Studio 2003", vs2003_action },
{ "vs2005", "Microsoft Visual Studio 2005 (includes Express editions)", vs2005_action },
{ "vs2008", "Microsoft Visual Studio 2008 (includes Express editions)", vs2008_action },
{ 0, 0, 0 }
};

View File

@ -14,5 +14,6 @@ int gmake_action(Session sess);
int vs2002_action(Session sess);
int vs2003_action(Session sess);
int vs2005_action(Session sess);
int vs2008_action(Session sess);
#endif

View File

@ -11,7 +11,7 @@
/** The GNU make solution writing process, for session_enumerate_objects() */
static SessionSolutionCallback GmakeSolutionCallbacks[] =
static SessionSolutionCallback SolutionCallbacks[] =
{
make_solution_create,
gmake_solution_signature,
@ -24,7 +24,7 @@ static SessionSolutionCallback GmakeSolutionCallbacks[] =
};
/** The GNU make project writing process, for session_enumerate_objects() */
static SessionProjectCallback GmakeProjectCallbacks[] =
static SessionProjectCallback ProjectCallbacks[] =
{
NULL
};
@ -38,6 +38,6 @@ static SessionProjectCallback GmakeProjectCallbacks[] =
int gmake_action(Session sess)
{
stream_writeline(Console, "Generating project files for GNU make...");
return session_enumerate_objects(sess, GmakeSolutionCallbacks, GmakeProjectCallbacks);
return session_enumerate_objects(sess, SolutionCallbacks, ProjectCallbacks);
}

View File

@ -5,13 +5,11 @@
*/
#include "premake.h"
#include "testing/testing.h"
#include "action/tests/action_tests.h"
extern "C" {
#include "action/vs200x/vs200x_solution.h"
}
#include "vs200x_tests.h"
SUITE(action)
{
@ -19,7 +17,7 @@ SUITE(action)
* Signature tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Vs2002_Signature_IsCorrect)
TEST_FIXTURE(FxAction, Vs2002_Signature_IsCorrect)
{
vs2002_solution_signature(sess, sln, strm);
CHECK_EQUAL(
@ -32,7 +30,7 @@ SUITE(action)
* Project entry tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Vs2002_ProjectEntry_UsesRelativePath)
TEST_FIXTURE(FxAction, Vs2002_ProjectEntry_UsesRelativePath)
{
vs2002_solution_projects(sess, sln, strm);
CHECK_EQUAL(
@ -46,7 +44,7 @@ SUITE(action)
* Solution configuration tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Vs2002_SolutionConfiguration_IsCorrect)
TEST_FIXTURE(FxAction, Vs2002_SolutionConfiguration_IsCorrect)
{
vs2002_solution_configuration(sess, sln, strm);
CHECK_EQUAL(
@ -63,7 +61,7 @@ SUITE(action)
* Project dependencies tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Vs2002_ProjectDependencies_IsCorrect)
TEST_FIXTURE(FxAction, Vs2002_ProjectDependencies_IsCorrect)
{
vs2002_solution_dependencies(sess, sln, strm);
CHECK_EQUAL(
@ -77,7 +75,7 @@ SUITE(action)
* Project configuration tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Vs2002_ProjectConfiguration_IsCorrect)
TEST_FIXTURE(FxAction, Vs2002_ProjectConfiguration_IsCorrect)
{
vs2002_solution_project_configuration(sess, sln, strm);
CHECK_EQUAL(
@ -95,7 +93,7 @@ SUITE(action)
* Solution extensibility tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Vs2002_Extensibility_IsCorrect)
TEST_FIXTURE(FxAction, Vs2002_Extensibility_IsCorrect)
{
vs2002_solution_extensibility(sess, sln, strm);
CHECK_EQUAL(

View File

@ -5,13 +5,11 @@
*/
#include "premake.h"
#include "testing/testing.h"
#include "action/tests/action_tests.h"
extern "C" {
#include "action/vs200x/vs200x_solution.h"
}
#include "vs200x_tests.h"
SUITE(action)
{
@ -19,7 +17,7 @@ SUITE(action)
* Signature tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Vs2003_Signature_IsCorrect)
TEST_FIXTURE(FxAction, Vs2003_Signature_IsCorrect)
{
vs2003_solution_signature(sess, sln, strm);
CHECK_EQUAL(
@ -32,7 +30,7 @@ SUITE(action)
* Solution configuration tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Vs2003_SolutionConfiguration_IsCorrect)
TEST_FIXTURE(FxAction, Vs2003_SolutionConfiguration_IsCorrect)
{
vs2003_solution_configuration(sess, sln, strm);
CHECK_EQUAL(

View File

@ -5,13 +5,11 @@
*/
#include "premake.h"
#include "testing/testing.h"
#include "action/tests/action_tests.h"
extern "C" {
#include "action/vs200x/vs200x_solution.h"
}
#include "vs200x_tests.h"
SUITE(action)
{
@ -19,7 +17,7 @@ SUITE(action)
* Signature tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Vs2005_Signature_IsCorrect)
TEST_FIXTURE(FxAction, Vs2005_Signature_IsCorrect)
{
vs2005_solution_signature(sess, sln, strm);
CHECK_EQUAL(
@ -34,7 +32,7 @@ SUITE(action)
* Solution Configuration Platforms tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Platforms_IsCorrect)
TEST_FIXTURE(FxAction, Platforms_IsCorrect)
{
vs2005_solution_platforms(sess, sln, strm);
CHECK_EQUAL(
@ -51,7 +49,7 @@ SUITE(action)
* Project Configuration Platforms tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, ProjectPlatforms_IsCorrect)
TEST_FIXTURE(FxAction, ProjectPlatforms_IsCorrect)
{
vs2005_solution_project_platforms(sess, sln, strm);
CHECK_EQUAL(
@ -69,7 +67,7 @@ SUITE(action)
* Solution Project tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, Properties_IsCorrect)
TEST_FIXTURE(FxAction, Properties_IsCorrect)
{
vs2005_solution_properties(sess, sln, strm);
CHECK_EQUAL(

View File

@ -0,0 +1,30 @@
/**
* \file vs2008_solution_tests.cpp
* \brief Automated tests for VS2008 solution processing.
* \author Copyright (c) 2008 Jason Perkins and the Premake project
*/
#include "premake.h"
#include "action/tests/action_tests.h"
extern "C" {
#include "action/vs200x/vs200x_solution.h"
}
SUITE(action)
{
/**********************************************************************
* Signature tests
**********************************************************************/
TEST_FIXTURE(FxAction, Vs2008_Signature_IsCorrect)
{
vs2008_solution_signature(sess, sln, strm);
CHECK_EQUAL(
"\357\273\277\r\n"
"Microsoft Visual Studio Solution File, Format Version 10.00\r\n"
"# Visual Studio 2008\r\n",
buffer);
}
}

View File

@ -5,13 +5,11 @@
*/
#include "premake.h"
#include "testing/testing.h"
#include "action/tests/action_tests.h"
extern "C" {
#include "action/vs200x/vs200x.h"
}
#include "vs200x_tests.h"
SUITE(action)
{
@ -19,21 +17,21 @@ SUITE(action)
* Version identification tests
**********************************************************************/
TEST_FIXTURE(FxVs200x, GetTargetVersion_Returns2002_OnVs2002)
TEST_FIXTURE(FxAction, GetTargetVersion_Returns2002_OnVs2002)
{
session_set_action(sess, "vs2002");
int result = vs200x_get_target_version(sess);
CHECK(result == 2002);
}
TEST_FIXTURE(FxVs200x, GetTargetVersion_Returns2003_OnVs2003)
TEST_FIXTURE(FxAction, GetTargetVersion_Returns2003_OnVs2003)
{
session_set_action(sess, "vs2003");
int result = vs200x_get_target_version(sess);
CHECK(result == 2003);
}
TEST_FIXTURE(FxVs200x, GetTargetVersion_Returns2005_OnVs2005)
TEST_FIXTURE(FxAction, GetTargetVersion_Returns2005_OnVs2005)
{
session_set_action(sess, "vs2005");
int result = vs200x_get_target_version(sess);

View File

@ -1,42 +0,0 @@
/**
* \file vs200x_tests.h
* \brief Standard test fixtures for Visual Studio.
* \author Copyright (c) 2008 Jason Perkins and the Premake project
*/
struct FxVs200x
{
Session sess;
Stream strm;
Solution sln;
Project prj;
char buffer[8192];
FxVs200x()
{
sess = session_create();
strm = stream_create_null();
stream_set_buffer(strm, buffer);
sln = solution_create();
solution_set_name(sln, "MySolution");
solution_set_base_dir(sln, "/Root");
solution_add_config_name(sln, "Debug");
solution_add_config_name(sln, "Release");
prj = project_create();
project_set_name(prj, "MyProject");
project_set_base_dir(prj, "/Root");
project_set_location(prj, "ProjectFolder");
project_set_guid(prj, "AE2461B7-236F-4278-81D3-F0D476F9A4C0");
solution_add_project(sln, prj);
}
~FxVs200x()
{
solution_destroy(sln);
stream_destroy(strm);
session_destroy(sess);
}
};

View File

@ -11,7 +11,7 @@
/** The VS2002 solution writing process, for session_enumerate_objects() */
static SessionSolutionCallback Vs2002SolutionCallbacks[] =
static SessionSolutionCallback SolutionCallbacks[] =
{
vs2002_solution_create,
vs2002_solution_signature,
@ -24,7 +24,7 @@ static SessionSolutionCallback Vs2002SolutionCallbacks[] =
};
/** The VS2002 project writing process, for session_enumerate_objects() */
static SessionProjectCallback Vs2002ProjectCallbacks[] =
static SessionProjectCallback ProjectCallbacks[] =
{
NULL
};
@ -38,6 +38,6 @@ static SessionProjectCallback Vs2002ProjectCallbacks[] =
int vs2002_action(Session sess)
{
stream_writeline(Console, "Generating project files for Visual Studio 2002...");
return session_enumerate_objects(sess, Vs2002SolutionCallbacks, Vs2002ProjectCallbacks);
return session_enumerate_objects(sess, SolutionCallbacks, ProjectCallbacks);
}

View File

@ -11,7 +11,7 @@
/** The VS2003 solution writing process, for session_enumerate_objects() */
static SessionSolutionCallback Vs2003SolutionCallbacks[] =
static SessionSolutionCallback SolutionCallbacks[] =
{
vs2002_solution_create,
vs2003_solution_signature,
@ -23,7 +23,7 @@ static SessionSolutionCallback Vs2003SolutionCallbacks[] =
};
/** The VS2003 project writing process, for session_enumerate_objects() */
static SessionProjectCallback Vs2003ProjectCallbacks[] =
static SessionProjectCallback ProjectCallbacks[] =
{
NULL
};
@ -37,5 +37,5 @@ static SessionProjectCallback Vs2003ProjectCallbacks[] =
int vs2003_action(Session sess)
{
stream_writeline(Console, "Generating project files for Visual Studio 2003...");
return session_enumerate_objects(sess, Vs2003SolutionCallbacks, Vs2003ProjectCallbacks);
return session_enumerate_objects(sess, SolutionCallbacks, ProjectCallbacks);
}

View File

@ -11,7 +11,7 @@
/** The VS2005 solution writing process, for session_enumerate_objects() */
static SessionSolutionCallback Vs2005SolutionCallbacks[] =
static SessionSolutionCallback SolutionCallbacks[] =
{
vs2002_solution_create,
vs2005_solution_signature,
@ -23,7 +23,7 @@ static SessionSolutionCallback Vs2005SolutionCallbacks[] =
};
/** The VS2005 project writing process, for session_enumerate_objects() */
static SessionProjectCallback Vs2005ProjectCallbacks[] =
static SessionProjectCallback ProjectCallbacks[] =
{
NULL
};
@ -37,6 +37,6 @@ static SessionProjectCallback Vs2005ProjectCallbacks[] =
int vs2005_action(Session sess)
{
stream_writeline(Console, "Generating project files for Visual Studio 2005...");
return session_enumerate_objects(sess, Vs2005SolutionCallbacks, Vs2005ProjectCallbacks);
return session_enumerate_objects(sess, SolutionCallbacks, ProjectCallbacks);
}

View File

@ -0,0 +1,42 @@
/**
* \file vs2008.c
* \brief Visual Studio 2008 project file generation action.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
#include "action/action.h"
#include "vs200x_solution.h"
/** The VS2008 solution writing process, for session_enumerate_objects() */
static SessionSolutionCallback SolutionCallbacks[] =
{
vs2002_solution_create,
vs2008_solution_signature,
vs2002_solution_projects,
vs2005_solution_platforms,
vs2005_solution_project_platforms,
vs2005_solution_properties,
NULL
};
/** The VS2008 project writing process, for session_enumerate_objects() */
static SessionProjectCallback ProjectCallbacks[] =
{
NULL
};
/**
* The Visual Studio 2008 action handler.
* \param sess The active session object.
* \returns OKAY if successful.
*/
int vs2008_action(Session sess)
{
stream_writeline(Console, "Generating project files for Visual Studio 2008...");
return session_enumerate_objects(sess, SolutionCallbacks, ProjectCallbacks);
}

View File

@ -0,0 +1,29 @@
/**
* \file vs2008_solution.c
* \brief Visual Studio 2008 solution generation functions.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include "premake.h"
#include "vs200x_solution.h"
/**
* Write the Visual Studio 2008 solution file signature.
* \param sess The execution session context.
* \param sln The current solution.
* \param strm The currently active stream; set with session_set_active_stream().
* \returns OKAY if successful.
*/
int vs2008_solution_signature(Session sess, Solution sln, Stream strm)
{
int z;
UNUSED(sess);
UNUSED(sln);
stream_set_newline(strm, "\r\n");
z = stream_write_unicode_marker(strm);
z |= stream_writeline(strm, "");
z |= stream_writeline(strm, "Microsoft Visual Studio Solution File, Format Version 10.00");
z |= stream_writeline(strm, "# Visual Studio 2008");
return z;
}

View File

@ -24,4 +24,6 @@ int vs2005_solution_project_platforms(Session sess, Solution sln, Stream strm);
int vs2005_solution_properties(Session sess, Solution sln, Stream strm);
int vs2005_solution_signature(Session sess, Solution sln, Stream strm);
int vs2008_solution_signature(Session sess, Solution sln, Stream strm);
#endif