Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/vs200x')
-rw-r--r--src/actions/vs200x/tests/vs2002_solution_tests.cpp108
-rw-r--r--src/actions/vs200x/tests/vs2003_solution_tests.cpp45
-rw-r--r--src/actions/vs200x/tests/vs2005_solution_tests.cpp80
-rw-r--r--src/actions/vs200x/tests/vs2008_solution_tests.cpp30
-rw-r--r--src/actions/vs200x/tests/vs200x_compiler_tests.cpp102
-rw-r--r--src/actions/vs200x/tests/vs200x_config_tests.cpp67
-rw-r--r--src/actions/vs200x/tests/vs200x_linker_tests.cpp80
-rw-r--r--src/actions/vs200x/tests/vs200x_project_tests.cpp467
-rw-r--r--src/actions/vs200x/tests/vs200x_tests.cpp56
-rw-r--r--src/actions/vs200x/tests/vs200x_xml_tests.cpp120
-rw-r--r--src/actions/vs200x/vs2002.c85
-rw-r--r--src/actions/vs200x/vs2002_solution.c169
-rw-r--r--src/actions/vs200x/vs2003.c84
-rw-r--r--src/actions/vs200x/vs2003_solution.c55
-rw-r--r--src/actions/vs200x/vs2005.c92
-rw-r--r--src/actions/vs200x/vs2005_solution.c110
-rw-r--r--src/actions/vs200x/vs2008.c91
-rw-r--r--src/actions/vs200x/vs2008_solution.c29
-rw-r--r--src/actions/vs200x/vs200x.c190
-rw-r--r--src/actions/vs200x/vs200x.h21
-rw-r--r--src/actions/vs200x/vs200x_config.c64
-rw-r--r--src/actions/vs200x/vs200x_config.h17
-rw-r--r--src/actions/vs200x/vs200x_project.c475
-rw-r--r--src/actions/vs200x/vs200x_project.h41
-rw-r--r--src/actions/vs200x/vs200x_solution.c33
-rw-r--r--src/actions/vs200x/vs200x_solution.h30
26 files changed, 2741 insertions, 0 deletions
diff --git a/src/actions/vs200x/tests/vs2002_solution_tests.cpp b/src/actions/vs200x/tests/vs2002_solution_tests.cpp
new file mode 100644
index 0000000..1605ef9
--- /dev/null
+++ b/src/actions/vs200x/tests/vs2002_solution_tests.cpp
@@ -0,0 +1,108 @@
+/**
+ * \file vs2002_solution_tests.cpp
+ * \brief Automated tests for VS2002 solution processing.
+ * \author Copyright (c) 2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/vs200x/vs200x_solution.h"
+}
+
+
+SUITE(action)
+{
+ /**********************************************************************
+ * Signature tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs2002_Signature_IsCorrect)
+ {
+ vs2002_solution_signature(sess, sln, strm);
+ CHECK_EQUAL(
+ "Microsoft Visual Studio Solution File, Format Version 7.00\r\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Project entry tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs2002_ProjectEntry_UsesRelativePath)
+ {
+ vs2002_solution_projects(sess, sln, strm);
+ CHECK_EQUAL(
+ "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"MyProject\", \"ProjectFolder\\MyProject.vcproj\", \"{AE2461B7-236F-4278-81D3-F0D476F9A4C0}\"\n"
+ "EndProject\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Solution configuration tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs2002_SolutionConfiguration_IsCorrect)
+ {
+ vs2002_solution_configuration(sess, sln, strm);
+ CHECK_EQUAL(
+ "Global\n"
+ "\tGlobalSection(SolutionConfiguration) = preSolution\n"
+ "\t\tConfigName.0 = Debug\n"
+ "\t\tConfigName.1 = Release\n"
+ "\tEndGlobalSection\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Project dependencies tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs2002_ProjectDependencies_IsCorrect)
+ {
+ vs2002_solution_dependencies(sess, sln, strm);
+ CHECK_EQUAL(
+ "\tGlobalSection(ProjectDependencies) = postSolution\n"
+ "\tEndGlobalSection\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Project configuration tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs2002_ProjectConfiguration_IsCorrect)
+ {
+ vs2002_solution_project_configuration(sess, sln, strm);
+ CHECK_EQUAL(
+ "\tGlobalSection(ProjectConfiguration) = postSolution\n"
+ "\t\t{AE2461B7-236F-4278-81D3-F0D476F9A4C0}.Debug.ActiveCfg = Debug|Win32\n"
+ "\t\t{AE2461B7-236F-4278-81D3-F0D476F9A4C0}.Debug.Build.0 = Debug|Win32\n"
+ "\t\t{AE2461B7-236F-4278-81D3-F0D476F9A4C0}.Release.ActiveCfg = Release|Win32\n"
+ "\t\t{AE2461B7-236F-4278-81D3-F0D476F9A4C0}.Release.Build.0 = Release|Win32\n"
+ "\tEndGlobalSection\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Solution extensibility tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs2002_Extensibility_IsCorrect)
+ {
+ vs2002_solution_extensibility(sess, sln, strm);
+ CHECK_EQUAL(
+ "\tGlobalSection(ExtensibilityGlobals) = postSolution\n"
+ "\tEndGlobalSection\n"
+ "\tGlobalSection(ExtensibilityAddIns) = postSolution\n"
+ "\tEndGlobalSection\n"
+ "EndGlobal\n",
+ buffer);
+ }
+
+}
diff --git a/src/actions/vs200x/tests/vs2003_solution_tests.cpp b/src/actions/vs200x/tests/vs2003_solution_tests.cpp
new file mode 100644
index 0000000..8ee8614
--- /dev/null
+++ b/src/actions/vs200x/tests/vs2003_solution_tests.cpp
@@ -0,0 +1,45 @@
+/**
+ * \file vs2003_solution_tests.cpp
+ * \brief Automated tests for VS2003 solution processing.
+ * \author Copyright (c) 2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/vs200x/vs200x_solution.h"
+}
+
+
+SUITE(action)
+{
+ /**********************************************************************
+ * Signature tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs2003_Signature_IsCorrect)
+ {
+ vs2003_solution_signature(sess, sln, strm);
+ CHECK_EQUAL(
+ "Microsoft Visual Studio Solution File, Format Version 8.00\r\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Solution configuration tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs2003_SolutionConfiguration_IsCorrect)
+ {
+ vs2003_solution_configuration(sess, sln, strm);
+ CHECK_EQUAL(
+ "Global\n"
+ "\tGlobalSection(SolutionConfiguration) = preSolution\n"
+ "\t\tDebug = Debug\n"
+ "\t\tRelease = Release\n"
+ "\tEndGlobalSection\n",
+ buffer);
+ }
+
+}
diff --git a/src/actions/vs200x/tests/vs2005_solution_tests.cpp b/src/actions/vs200x/tests/vs2005_solution_tests.cpp
new file mode 100644
index 0000000..e50edcb
--- /dev/null
+++ b/src/actions/vs200x/tests/vs2005_solution_tests.cpp
@@ -0,0 +1,80 @@
+/**
+ * \file vs2005_solution_tests.cpp
+ * \brief Automated tests for VS2005 solution processing.
+ * \author Copyright (c) 2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/vs200x/vs200x_solution.h"
+}
+
+
+SUITE(action)
+{
+ /**********************************************************************
+ * Signature tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs2005_Signature_IsCorrect)
+ {
+ vs2005_solution_signature(sess, sln, strm);
+ CHECK_EQUAL(
+ "\357\273\277\r\n"
+ "Microsoft Visual Studio Solution File, Format Version 9.00\r\n"
+ "# Visual Studio 2005\r\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Solution Configuration Platforms tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Platforms_IsCorrect)
+ {
+ vs2005_solution_platforms(sess, sln, strm);
+ CHECK_EQUAL(
+ "Global\n"
+ "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"
+ "\t\tDebug|Win32 = Debug|Win32\n"
+ "\t\tRelease|Win32 = Release|Win32\n"
+ "\tEndGlobalSection\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Project Configuration Platforms tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, ProjectPlatforms_IsCorrect)
+ {
+ vs2005_solution_project_platforms(sess, sln, strm);
+ CHECK_EQUAL(
+ "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n"
+ "\t\t{AE2461B7-236F-4278-81D3-F0D476F9A4C0}.Debug|Win32.ActiveCfg = Debug|Win32\n"
+ "\t\t{AE2461B7-236F-4278-81D3-F0D476F9A4C0}.Debug|Win32.Build.0 = Debug|Win32\n"
+ "\t\t{AE2461B7-236F-4278-81D3-F0D476F9A4C0}.Release|Win32.ActiveCfg = Release|Win32\n"
+ "\t\t{AE2461B7-236F-4278-81D3-F0D476F9A4C0}.Release|Win32.Build.0 = Release|Win32\n"
+ "\tEndGlobalSection\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Solution Project tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Properties_IsCorrect)
+ {
+ vs2005_solution_properties(sess, sln, strm);
+ CHECK_EQUAL(
+ "\tGlobalSection(SolutionProperties) = preSolution\n"
+ "\t\tHideSolutionNode = FALSE\n"
+ "\tEndGlobalSection\n"
+ "EndGlobal\n",
+ buffer);
+ }
+}
diff --git a/src/actions/vs200x/tests/vs2008_solution_tests.cpp b/src/actions/vs200x/tests/vs2008_solution_tests.cpp
new file mode 100644
index 0000000..7495b97
--- /dev/null
+++ b/src/actions/vs200x/tests/vs2008_solution_tests.cpp
@@ -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 "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/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);
+ }
+
+}
diff --git a/src/actions/vs200x/tests/vs200x_compiler_tests.cpp b/src/actions/vs200x/tests/vs200x_compiler_tests.cpp
new file mode 100644
index 0000000..167ad30
--- /dev/null
+++ b/src/actions/vs200x/tests/vs200x_compiler_tests.cpp
@@ -0,0 +1,102 @@
+/**
+ * \file vs200x_compiler_tests.cpp
+ * \brief Automated tests for VS200x compiler block processing.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/vs200x/vs200x_project.h"
+}
+
+SUITE(action)
+{
+ /**********************************************************************
+ * Default settings
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, VCCLCompilerTool_Defaults_OnVs2002)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_cl_compiler_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ "\t\t\t\tOptimization=\"0\"\n"
+ "\t\t\t\tMinimalRebuild=\"TRUE\"\n"
+ "\t\t\t\tBasicRuntimeChecks=\"3\"\n"
+ "\t\t\t\tRuntimeLibrary=\"3\"\n"
+ "\t\t\t\tRuntimeTypeInfo=\"TRUE\"\n"
+ "\t\t\t\tUsePrecompiledHeader=\"2\"\n"
+ "\t\t\t\tWarningLevel=\"3\"\n"
+ "\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\n"
+ "\t\t\t\tDebugInformationFormat=\"4\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VCCLCompilerTool_Defaults_OnVs2005)
+ {
+ session_set_action(sess, "vs2005");
+ vs200x_project_vc_cl_compiler_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ "\t\t\t\tOptimization=\"0\"\n"
+ "\t\t\t\tMinimalRebuild=\"true\"\n"
+ "\t\t\t\tBasicRuntimeChecks=\"3\"\n"
+ "\t\t\t\tRuntimeLibrary=\"3\"\n"
+ "\t\t\t\tUsePrecompiledHeader=\"0\"\n"
+ "\t\t\t\tWarningLevel=\"3\"\n"
+ "\t\t\t\tDetect64BitPortabilityProblems=\"true\"\n"
+ "\t\t\t\tDebugInformationFormat=\"4\"\n"
+ "\t\t\t/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VCCLCompilerTool_Defaults_OnVs2008)
+ {
+ session_set_action(sess, "vs2008");
+ vs200x_project_vc_cl_compiler_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ "\t\t\t\tOptimization=\"0\"\n"
+ "\t\t\t\tMinimalRebuild=\"true\"\n"
+ "\t\t\t\tBasicRuntimeChecks=\"3\"\n"
+ "\t\t\t\tRuntimeLibrary=\"3\"\n"
+ "\t\t\t\tUsePrecompiledHeader=\"0\"\n"
+ "\t\t\t\tWarningLevel=\"3\"\n"
+ "\t\t\t\tDebugInformationFormat=\"4\"\n"
+ "\t\t\t/>\n",
+ buffer);
+ }
+
+
+
+ /**********************************************************************
+ * Defines tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, VCCLCompilerTool_WithDefines)
+ {
+ session_set_action(sess, "vs2002");
+ char* defines[] = { "DEFINE0", "DEFINE1", NULL };
+ SetConfigField(prj, BlockDefines, defines);
+ vs200x_project_vc_cl_compiler_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ "\t\t\t\tOptimization=\"0\"\n"
+ "\t\t\t\tPreprocessorDefinitions=\"DEFINE0;DEFINE1\"\n"
+ "\t\t\t\tMinimalRebuild=\"TRUE\"\n"
+ "\t\t\t\tBasicRuntimeChecks=\"3\"\n"
+ "\t\t\t\tRuntimeLibrary=\"3\"\n"
+ "\t\t\t\tRuntimeTypeInfo=\"TRUE\"\n"
+ "\t\t\t\tUsePrecompiledHeader=\"2\"\n"
+ "\t\t\t\tWarningLevel=\"3\"\n"
+ "\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\n"
+ "\t\t\t\tDebugInformationFormat=\"4\"/>\n",
+ buffer);
+ }
+}
diff --git a/src/actions/vs200x/tests/vs200x_config_tests.cpp b/src/actions/vs200x/tests/vs200x_config_tests.cpp
new file mode 100644
index 0000000..7a8fbe9
--- /dev/null
+++ b/src/actions/vs200x/tests/vs200x_config_tests.cpp
@@ -0,0 +1,67 @@
+/**
+ * \file vs200x_config_tests.cpp
+ * \brief Automated tests for VS200x configuration settings processing.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/vs200x/vs200x_config.h"
+}
+
+SUITE(action)
+{
+ /*************************************************************************
+ * Character set tests
+ *************************************************************************/
+
+ TEST_FIXTURE(FxAction, VsCharacterSet_Defaults_OnVs2002)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_config_character_set(sess, strm);
+ CHECK_EQUAL("\n\t\t\tCharacterSet=\"2\"", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsCharacterSet_Defaults_OnVs2003)
+ {
+ session_set_action(sess, "vs2003");
+ vs200x_config_character_set(sess, strm);
+ CHECK_EQUAL("\n\t\t\tCharacterSet=\"2\"", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsCharacterSet_Defaults_OnVs2005)
+ {
+ session_set_action(sess, "vs2005");
+ vs200x_config_character_set(sess, strm);
+ CHECK_EQUAL("\n\t\t\tCharacterSet=\"1\"", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsCharacterSet_Defaults_OnVs2008)
+ {
+ session_set_action(sess, "vs2008");
+ vs200x_config_character_set(sess, strm);
+ CHECK_EQUAL("\n\t\t\tCharacterSet=\"1\"", buffer);
+ }
+
+
+ /*************************************************************************
+ * Defines tests
+ *************************************************************************/
+
+ TEST_FIXTURE(FxAction, VsDefines_Empty_OnNoSymbols)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_config_defines(sess, strm, prj);
+ CHECK_EQUAL("", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsDefines_SemiSplitList)
+ {
+ session_set_action(sess, "vs2002");
+ char* values[] = { "DEFINE0", "DEFINE1", "DEFINE2", NULL };
+ SetConfigField(prj, BlockDefines, values);
+ vs200x_config_defines(sess, strm, prj);
+ CHECK_EQUAL("\n\t\t\t\tPreprocessorDefinitions=\"DEFINE0;DEFINE1;DEFINE2\"", buffer);
+ }
+}
diff --git a/src/actions/vs200x/tests/vs200x_linker_tests.cpp b/src/actions/vs200x/tests/vs200x_linker_tests.cpp
new file mode 100644
index 0000000..10b8e01
--- /dev/null
+++ b/src/actions/vs200x/tests/vs200x_linker_tests.cpp
@@ -0,0 +1,80 @@
+/**
+ * \file vs200x_linker_tests.cpp
+ * \brief Automated tests for VS200x linker block processing.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/vs200x/vs200x_project.h"
+}
+
+SUITE(action)
+{
+ /**********************************************************************
+ * Default settings
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, VCLinkerTool_Defaults_OnVs2002)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_linker_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCLinkerTool\"\n"
+ "\t\t\t\tLinkIncremental=\"2\"\n"
+ "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"
+ "\t\t\t\tSubSystem=\"1\"\n"
+ "\t\t\t\tEntryPointSymbol=\"mainCRTStartup\"\n"
+ "\t\t\t\tTargetMachine=\"1\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VCLinkerTool_Defaults_OnVs2003)
+ {
+ session_set_action(sess, "vs2003");
+ vs200x_project_vc_linker_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCLinkerTool\"\n"
+ "\t\t\t\tLinkIncremental=\"2\"\n"
+ "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"
+ "\t\t\t\tSubSystem=\"1\"\n"
+ "\t\t\t\tEntryPointSymbol=\"mainCRTStartup\"\n"
+ "\t\t\t\tTargetMachine=\"1\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VCLinkerTool_Defaults_OnVs2005)
+ {
+ session_set_action(sess, "vs2005");
+ vs200x_project_vc_linker_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCLinkerTool\"\n"
+ "\t\t\t\tLinkIncremental=\"2\"\n"
+ "\t\t\t\tGenerateDebugInformation=\"true\"\n"
+ "\t\t\t\tSubSystem=\"1\"\n"
+ "\t\t\t\tEntryPointSymbol=\"mainCRTStartup\"\n"
+ "\t\t\t\tTargetMachine=\"1\"\n"
+ "\t\t\t/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VCLinkerTool_Defaults_OnVs2008)
+ {
+ session_set_action(sess, "vs2008");
+ vs200x_project_vc_linker_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCLinkerTool\"\n"
+ "\t\t\t\tLinkIncremental=\"2\"\n"
+ "\t\t\t\tGenerateDebugInformation=\"true\"\n"
+ "\t\t\t\tSubSystem=\"1\"\n"
+ "\t\t\t\tEntryPointSymbol=\"mainCRTStartup\"\n"
+ "\t\t\t\tTargetMachine=\"1\"\n"
+ "\t\t\t/>\n",
+ buffer);
+ }
+}
diff --git a/src/actions/vs200x/tests/vs200x_project_tests.cpp b/src/actions/vs200x/tests/vs200x_project_tests.cpp
new file mode 100644
index 0000000..ff14eb9
--- /dev/null
+++ b/src/actions/vs200x/tests/vs200x_project_tests.cpp
@@ -0,0 +1,467 @@
+/**
+ * \file vs200x_project_tests.cpp
+ * \brief Automated tests for Visual Studio project processing.
+ * \author Copyright (c) 2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/vs200x/vs200x_project.h"
+}
+
+
+SUITE(action)
+{
+ /**********************************************************************
+ * Encoding tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs200x_Encoding)
+ {
+ vs200x_project_encoding(sess, prj, strm);
+ CHECK_EQUAL(
+ "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Project element tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, VsProject_OnVs2002)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_element(sess, prj, strm);
+ CHECK_EQUAL(
+ "<VisualStudioProject\n"
+ "\tProjectType=\"Visual C++\"\n"
+ "\tVersion=\"7.00\"\n"
+ "\tName=\"MyProject\"\n"
+ "\tProjectGUID=\"{AE2461B7-236F-4278-81D3-F0D476F9A4C0}\"\n"
+ "\tKeyword=\"Win32Proj\">\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsProject_OnVs2003)
+ {
+ session_set_action(sess, "vs2003");
+ vs200x_project_element(sess, prj, strm);
+ CHECK_EQUAL(
+ "<VisualStudioProject\n"
+ "\tProjectType=\"Visual C++\"\n"
+ "\tVersion=\"7.10\"\n"
+ "\tName=\"MyProject\"\n"
+ "\tProjectGUID=\"{AE2461B7-236F-4278-81D3-F0D476F9A4C0}\"\n"
+ "\tKeyword=\"Win32Proj\">\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsProject_OnVs2005)
+ {
+ session_set_action(sess, "vs2005");
+ vs200x_project_element(sess, prj, strm);
+ CHECK_EQUAL(
+ "<VisualStudioProject\n"
+ "\tProjectType=\"Visual C++\"\n"
+ "\tVersion=\"8.00\"\n"
+ "\tName=\"MyProject\"\n"
+ "\tProjectGUID=\"{AE2461B7-236F-4278-81D3-F0D476F9A4C0}\"\n"
+ "\tRootNamespace=\"MyProject\"\n"
+ "\tKeyword=\"Win32Proj\"\n"
+ "\t>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsProject_OnVs2008)
+ {
+ session_set_action(sess, "vs2008");
+ vs200x_project_element(sess, prj, strm);
+ CHECK_EQUAL(
+ "<VisualStudioProject\n"
+ "\tProjectType=\"Visual C++\"\n"
+ "\tVersion=\"9.00\"\n"
+ "\tName=\"MyProject\"\n"
+ "\tProjectGUID=\"{AE2461B7-236F-4278-81D3-F0D476F9A4C0}\"\n"
+ "\tRootNamespace=\"MyProject\"\n"
+ "\tKeyword=\"Win32Proj\"\n"
+ "\tTargetFrameworkVersion=\"196613\"\n"
+ "\t>\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Platforms tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs200x_Platforms)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_platforms(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<Platforms>\n"
+ "\t\t<Platform\n"
+ "\t\t\tName=\"Win32\"/>\n"
+ "\t</Platforms>\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Tool files tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, VsToolFiles_Defaults_OnVs2002)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_tool_files(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<Configurations>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsToolFiles_Defaults_OnVs2003)
+ {
+ session_set_action(sess, "vs2003");
+ vs200x_project_tool_files(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<Configurations>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsToolFiles_Defaults_OnVs2005)
+ {
+ session_set_action(sess, "vs2005");
+ vs200x_project_tool_files(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<ToolFiles>\n"
+ "\t</ToolFiles>\n"
+ "\t<Configurations>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsToolFiles_Defaults_OnVs2008)
+ {
+ session_set_action(sess, "vs2008");
+ vs200x_project_tool_files(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<ToolFiles>\n"
+ "\t</ToolFiles>\n"
+ "\t<Configurations>\n",
+ buffer);
+ }
+
+
+
+ /**********************************************************************
+ * Configuration element tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs200x_Configuration)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_config_element(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t<Configuration\n"
+ "\t\t\tName=\"Debug|Win32\"\n"
+ "\t\t\tOutputDirectory=\"$(SolutionDir)$(ConfigurationName)\"\n"
+ "\t\t\tIntermediateDirectory=\"$(ConfigurationName)\"\n"
+ "\t\t\tConfigurationType=\"1\"\n"
+ "\t\t\tCharacterSet=\"2\">\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Tool element tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs200x_VCALinkTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_alink_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCALinkTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCAppVerifierTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_app_verifier_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCAppVerifierTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCBscMakeTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_bsc_make_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCBscMakeTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCCustomBuildTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_custom_build_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCCustomBuildTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCFxCopTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_fx_cop_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCFxCopTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCManagedResourceCompilerTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_managed_resource_compiler_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCManagedResourceCompilerTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCManifestTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_manifest_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCManifestTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCMIDLTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_midl_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCMIDLTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCPreBuildEventTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_pre_build_event_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCPreBuildEventTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCPreLinkEventTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_pre_link_event_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCPreLinkEventTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCPostBuildEventTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_post_build_event_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCPostBuildEventTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCResourceCompilerTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_resource_compiler_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCResourceCompilerTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCWebDeploymentTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_web_deployment_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCWebDeploymentTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCWebServiceProxyGeneratorTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_web_service_proxy_generator_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCXDCMakeTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_xdc_make_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCXDCMakeTool\"/>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_VCXMLDataGeneratorTool)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_vc_xml_data_generator_tool(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * References section tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, VsReferences_Defaults_OnVs2002)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_references(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t</Configurations>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsReferences_Defaults_OnVs2003)
+ {
+ session_set_action(sess, "vs2003");
+ vs200x_project_references(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t</Configurations>\n"
+ "\t<References>\n"
+ "\t</References>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsReferences_Defaults_OnVs2005)
+ {
+ session_set_action(sess, "vs2005");
+ vs200x_project_references(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t</Configurations>\n"
+ "\t<References>\n"
+ "\t</References>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, VsReferences_Defaults_OnVs2008)
+ {
+ session_set_action(sess, "vs2008");
+ vs200x_project_references(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t</Configurations>\n"
+ "\t<References>\n"
+ "\t</References>\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Files section tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs200x_Files_OnNoFiles)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_files(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<Files>\n"
+ "\t</Files>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_Files_OnSingleCppFile)
+ {
+ session_set_action(sess, "vs2002");
+ char* values[] = { "Hello.cpp", 0 };
+ SetField(prj, ProjectFiles, values);
+ vs200x_project_files(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<Files>\n"
+ "\t\t<File\n"
+ "\t\t\tRelativePath=\".\\Hello.cpp\">\n"
+ "\t\t</File>\n"
+ "\t</Files>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_Files_OnUpperDirectory)
+ {
+ session_set_action(sess, "vs2002");
+ char* values[] = { "../../Hello.cpp", 0 };
+ SetField(prj, ProjectFiles, values);
+ vs200x_project_files(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<Files>\n"
+ "\t\t<File\n"
+ "\t\t\tRelativePath=\"..\\..\\Hello.cpp\">\n"
+ "\t\t</File>\n"
+ "\t</Files>\n",
+ buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Vs200x_Files_OnGroupedCppFile)
+ {
+ session_set_action(sess, "vs2002");
+ char* values[] = { "Src/Hello.cpp", 0 };
+ SetField(prj, ProjectFiles, values);
+ vs200x_project_files(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<Files>\n"
+ "\t\t<Filter\n"
+ "\t\t\tName=\"Src\"\n"
+ "\t\t\tFilter=\"\">\n"
+ "\t\t\t<File\n"
+ "\t\t\t\tRelativePath=\".\\Src\\Hello.cpp\">\n"
+ "\t\t\t</File>\n"
+ "\t\t</Filter>\n"
+ "\t</Files>\n",
+ buffer);
+ }
+
+
+ /**********************************************************************
+ * Globals section tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Vs200x_Globals)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_project_globals(sess, prj, strm);
+ CHECK_EQUAL(
+ "\t<Globals>\n"
+ "\t</Globals>\n"
+ "</VisualStudioProject>\n",
+ buffer);
+ }
+}
diff --git a/src/actions/vs200x/tests/vs200x_tests.cpp b/src/actions/vs200x/tests/vs200x_tests.cpp
new file mode 100644
index 0000000..a41a071
--- /dev/null
+++ b/src/actions/vs200x/tests/vs200x_tests.cpp
@@ -0,0 +1,56 @@
+/**
+ * \file vs200x_tests.cpp
+ * \brief Automated tests for VS200x support functions.
+ * \author Copyright (c) 2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/vs200x/vs200x.h"
+}
+
+
+SUITE(action)
+{
+ /**********************************************************************
+ * Language GUID tests
+ **********************************************************************/
+
+ TEST(ToolGuid_ReturnsCorrectGUID_OnC)
+ {
+ const char* result = vs200x_tool_guid("c");
+ CHECK_EQUAL("8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942", result);
+ }
+
+ TEST(ToolGuid_ReturnsCorrectGUID_OnCpp)
+ {
+ const char* result = vs200x_tool_guid("c++");
+ CHECK_EQUAL("8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942", result);
+ }
+
+ TEST(ToolGuid_ReturnsCorrectGUID_OnCSharp)
+ {
+ const char* result = vs200x_tool_guid("c#");
+ CHECK_EQUAL("FAE04EC0-301F-11D3-BF4B-00C04F79EFBC", result);
+ }
+
+
+ /**********************************************************************
+ * Language file extensions
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, ProjectExtension_IsVcproj_ForC)
+ {
+ project_set_language(prj, "c");
+ const char* result = vs200x_project_file_extension(prj);
+ CHECK_EQUAL(".vcproj", result);
+ }
+
+ TEST_FIXTURE(FxAction, ProjectExtension_IsVcproj_ForCpp)
+ {
+ project_set_language(prj, "c++");
+ const char* result = vs200x_project_file_extension(prj);
+ CHECK_EQUAL(".vcproj", result);
+ }
+}
diff --git a/src/actions/vs200x/tests/vs200x_xml_tests.cpp b/src/actions/vs200x/tests/vs200x_xml_tests.cpp
new file mode 100644
index 0000000..9616b99
--- /dev/null
+++ b/src/actions/vs200x/tests/vs200x_xml_tests.cpp
@@ -0,0 +1,120 @@
+/**
+ * \file vs200x_xml_tests.cpp
+ * \brief Automated tests for Visual Studio XML output functions.
+ * \author Copyright (c) 2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "actions/tests/action_tests.h"
+extern "C" {
+#include "actions/vs200x/vs200x.h"
+}
+
+
+SUITE(action)
+{
+ /**********************************************************************
+ * Element end tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, ElementEnd_SlashBracket_Vs2002)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_element_end(sess, strm, 0, "/>");
+ CHECK_EQUAL("/>\n", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, ElementEnd_SlashBracket_Vs2003)
+ {
+ session_set_action(sess, "vs2003");
+ vs200x_element_end(sess, strm, 0, "/>");
+ CHECK_EQUAL("/>\n", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, ElementEnd_SlashBracket_Vs2005)
+ {
+ session_set_action(sess, "vs2005");
+ vs200x_element_end(sess, strm, 0, "/>");
+ CHECK_EQUAL("\n/>\n", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, ElementEnd_SlashBracket_Vs2008)
+ {
+ session_set_action(sess, "vs2008");
+ vs200x_element_end(sess, strm, 0, "/>");
+ CHECK_EQUAL("\n/>\n", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, ElementEnd_Bracket_Vs2002)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_element_end(sess, strm, 0, ">");
+ CHECK_EQUAL(">\n", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, ElementEnd_Bracket_Vs2003)
+ {
+ session_set_action(sess, "vs2003");
+ vs200x_element_end(sess, strm, 0, ">");
+ CHECK_EQUAL(">\n", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, ElementEnd_Bracket_Vs2005)
+ {
+ session_set_action(sess, "vs2005");
+ vs200x_element_end(sess, strm, 0, ">");
+ CHECK_EQUAL("\n\t>\n", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, ElementEnd_Bracket_Vs2008)
+ {
+ session_set_action(sess, "vs2008");
+ vs200x_element_end(sess, strm, 0, ">");
+ CHECK_EQUAL("\n\t>\n", buffer);
+ }
+
+
+ /**********************************************************************
+ * Attribute tests
+ **********************************************************************/
+
+ TEST_FIXTURE(FxAction, Attribute_OnLevel0)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_attribute(strm, 0, "ProjectType", "Visual C++");
+ CHECK_EQUAL("\nProjectType=\"Visual C++\"", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Attribute_OnLevel3)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_attribute(strm, 3, "ProjectType", "Visual C++");
+ CHECK_EQUAL("\n\t\t\tProjectType=\"Visual C++\"", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, Attribute_IsEscaped)
+ {
+ session_set_action(sess, "vs2002");
+ vs200x_attribute(strm, 1, "PreprocessorSymbols", "DEBUG;MSG=\"Hello\";TRACE");
+ CHECK_EQUAL("\n\tPreprocessorSymbols=\"DEBUG;MSG=&quot;Hello&quot;;TRACE\"", buffer);
+ }
+
+ TEST_FIXTURE(FxAction, AttributeList_OnLevel0)
+ {
+ const char* values[] = { "VALUE0", "VALUE1", "VALUE2", NULL };
+ Strings strs = strings_create_from_array(values);
+ vs200x_list_attribute(strm, 0, "Values", strs);
+ CHECK_EQUAL("\nValues=\"VALUE0;VALUE1;VALUE2\"", buffer);
+ strings_destroy(strs);
+ }
+
+ TEST_FIXTURE(FxAction, AttributeList_IsEscaped)
+ {
+ const char* values[] = { "VALUE0", "VALUE1=\"Hello\"", "VALUE2", NULL };
+ Strings strs = strings_create_from_array(values);
+ vs200x_list_attribute(strm, 0, "Values", strs);
+ CHECK_EQUAL("\nValues=\"VALUE0;VALUE1=&quot;Hello&quot;;VALUE2\"", buffer);
+ strings_destroy(strs);
+ }
+
+}
diff --git a/src/actions/vs200x/vs2002.c b/src/actions/vs200x/vs2002.c
new file mode 100644
index 0000000..8abc23b
--- /dev/null
+++ b/src/actions/vs200x/vs2002.c
@@ -0,0 +1,85 @@
+/**
+ * \file vs2002.c
+ * \brief Visual Studio 2002 project file generation action.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include <stdlib.h>
+#include "premake.h"
+#include "actions/actions.h"
+#include "vs200x.h"
+#include "vs200x_solution.h"
+#include "vs200x_project.h"
+
+
+/** The project features supported by this action */
+static SessionFeatures Features =
+{
+ { "c", "c++", NULL },
+};
+
+
+/** The VS2002 solution writing process, for session_enumerate_objects() */
+static SessionSolutionCallback SolutionCallbacks[] =
+{
+ vs200x_solution_create,
+ vs2002_solution_signature,
+ vs2002_solution_projects,
+ vs2002_solution_configuration,
+ vs2002_solution_dependencies,
+ vs2002_solution_project_configuration,
+ vs2002_solution_extensibility,
+ NULL
+};
+
+/** The VS2002 project writing process, for session_enumerate_objects() */
+static SessionProjectCallback ProjectCallbacks[] =
+{
+ vs200x_project_create,
+ vs200x_project_encoding,
+ vs200x_project_element,
+ vs200x_project_platforms,
+ vs200x_project_tool_files,
+ session_enumerate_configurations,
+ vs200x_project_references,
+ vs200x_project_files,
+ vs200x_project_globals,
+ NULL
+};
+
+/** The VS2002 configuration writing process, for session_enumerate_configurations() */
+static SessionProjectCallback ConfigCallbacks[] =
+{
+ vs200x_project_config_element,
+ vs200x_project_vc_cl_compiler_tool,
+ vs200x_project_vc_custom_build_tool,
+ vs200x_project_vc_linker_tool,
+ vs200x_project_vc_midl_tool,
+ vs200x_project_vc_post_build_event_tool,
+ vs200x_project_vc_pre_build_event_tool,
+ vs200x_project_vc_pre_link_event_tool,
+ vs200x_project_vc_resource_compiler_tool,
+ vs200x_project_vc_web_service_proxy_generator_tool,
+ vs200x_project_vc_web_deployment_tool,
+ vs200x_project_config_end,
+ NULL
+};
+
+
+/**
+ * The Visual Studio 2002 action handler.
+ * \param sess The active session object.
+ * \returns OKAY if successful.
+ */
+int vs2002_action(Session sess)
+{
+ /* make sure I can support all of the features used in the session */
+ if (session_validate(sess, &Features) != OKAY)
+ {
+ return !OKAY;
+ }
+
+ stream_writeline(Console, "Generating project files for Visual Studio 2002...");
+ return session_enumerate_objects(sess, SolutionCallbacks, ProjectCallbacks, ConfigCallbacks);
+}
+
diff --git a/src/actions/vs200x/vs2002_solution.c b/src/actions/vs200x/vs2002_solution.c
new file mode 100644
index 0000000..7274eb7
--- /dev/null
+++ b/src/actions/vs200x/vs2002_solution.c
@@ -0,0 +1,169 @@
+/**
+ * \file vs2002_solution.c
+ * \brief Visual Studio 2002 solution generation functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include "premake.h"
+#include "vs200x.h"
+#include "vs200x_solution.h"
+#include "vs200x_project.h"
+#include "base/path.h"
+
+
+/**
+ * Create the Visual Studio 2002 solution configuration block.
+ * \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 vs2002_solution_configuration(Session sess, Solution sln, Stream strm)
+{
+ int i, n, z;
+ UNUSED(sess);
+
+ z = stream_writeline(strm, "Global");
+ z |= stream_writeline(strm, "\tGlobalSection(SolutionConfiguration) = preSolution");
+
+ n = solution_num_configs(sln);
+ for (i = 0; i < n; ++i)
+ {
+ const char* config_name = solution_get_config(sln, i);
+ z |= stream_writeline(strm, "\t\tConfigName.%d = %s", i, config_name);
+ }
+
+ z |= stream_writeline(strm, "\tEndGlobalSection");
+ return z;
+}
+
+
+/**
+ * Create the Visual Studio 2002 project dependencies block.
+ * \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 vs2002_solution_dependencies(Session sess, Solution sln, Stream strm)
+{
+ int z;
+ UNUSED(sess);
+ UNUSED(sln);
+ z = stream_writeline(strm, "\tGlobalSection(ProjectDependencies) = postSolution");
+ z |= stream_writeline(strm, "\tEndGlobalSection");
+ return z;
+}
+
+
+/**
+ * Write out the Visual Studio 2002 solution extensibility block.
+ * \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 vs2002_solution_extensibility(Session sess, Solution sln, Stream strm)
+{
+ int z;
+ UNUSED(sess);
+ UNUSED(sln);
+ z = stream_writeline(strm, "\tGlobalSection(ExtensibilityGlobals) = postSolution");
+ z |= stream_writeline(strm, "\tEndGlobalSection");
+ z |= stream_writeline(strm, "\tGlobalSection(ExtensibilityAddIns) = postSolution");
+ z |= stream_writeline(strm, "\tEndGlobalSection");
+ z |= stream_writeline(strm, "EndGlobal");
+ return z;
+}
+
+
+/**
+ * Write out the Visual Studio 2002 project configurations block.
+ * \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 vs2002_solution_project_configuration(Session sess, Solution sln, Stream strm)
+{
+ int pi, pn, z;
+ UNUSED(sess);
+ z = stream_writeline(strm, "\tGlobalSection(ProjectConfiguration) = postSolution");
+ pn = solution_num_projects(sln);
+ for (pi = 0; pi < pn; ++pi)
+ {
+ int ci, cn;
+ Project prj = solution_get_project(sln, pi);
+ const char* prj_id = project_get_guid(prj);
+
+ cn = solution_num_configs(sln);
+ for (ci = 0; ci < cn; ++ci)
+ {
+ const char* config_name = solution_get_config(sln, ci);
+ z |= stream_writeline(strm, "\t\t{%s}.%s.ActiveCfg = %s|Win32", prj_id, config_name, config_name);
+ z |= stream_writeline(strm, "\t\t{%s}.%s.Build.0 = %s|Win32", prj_id, config_name, config_name);
+ }
+ }
+ z |= stream_writeline(strm, "\tEndGlobalSection");
+ return z;
+}
+
+
+/**
+ * Write out the list of projects contained by the solution.
+ * \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 vs2002_solution_projects(Session sess, Solution sln, Stream strm)
+{
+ const char* sln_path;
+ int i, n, z = OKAY;
+
+ UNUSED(sess);
+
+ /* project file paths are specified relative to the solution */
+ sln_path = path_directory(solution_get_filename(sln, NULL, NULL));
+
+ n = solution_num_projects(sln);
+ for (i = 0; i < n; ++i)
+ {
+ Project prj = solution_get_project(sln, i);
+ const char* prj_name = project_get_name(prj);
+ const char* prj_id = project_get_guid(prj);
+ const char* prj_lang = project_get_language(prj);
+ const char* prj_ext = vs200x_project_file_extension(prj);
+ const char* prj_file = project_get_filename(prj, prj_name, prj_ext);
+ const char* tool_id = vs200x_tool_guid(prj_lang);
+
+ /* convert absolute project file name to be relative to solution */
+ prj_file = path_relative(sln_path, prj_file);
+ prj_file = path_translate(prj_file, "\\");
+
+ z |= stream_writeline(strm, "Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"", tool_id, prj_name, prj_file, prj_id);
+ z |= stream_writeline(strm, "EndProject");
+ }
+
+ return z;
+}
+
+
+/**
+ * Write the Visual Studio 2002 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 vs2002_solution_signature(Session sess, Solution sln, Stream strm)
+{
+ int z;
+ UNUSED(sess);
+ UNUSED(sln);
+ stream_set_newline(strm, "\r\n");
+ z = stream_writeline(strm, "Microsoft Visual Studio Solution File, Format Version 7.00");
+ return z;
+}
diff --git a/src/actions/vs200x/vs2003.c b/src/actions/vs200x/vs2003.c
new file mode 100644
index 0000000..db83666
--- /dev/null
+++ b/src/actions/vs200x/vs2003.c
@@ -0,0 +1,84 @@
+/**
+ * \file vs2003.c
+ * \brief Visual Studio 2003 project file generation action.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include <stdlib.h>
+#include "premake.h"
+#include "actions/actions.h"
+#include "vs200x.h"
+#include "vs200x_solution.h"
+#include "vs200x_project.h"
+
+
+/** The project features supported by this action */
+static SessionFeatures Features =
+{
+ { "c", "c++", NULL },
+};
+
+
+/** The VS2003 solution writing process, for session_enumerate_objects() */
+static SessionSolutionCallback SolutionCallbacks[] =
+{
+ vs200x_solution_create,
+ vs2003_solution_signature,
+ vs2002_solution_projects,
+ vs2003_solution_configuration,
+ vs2002_solution_project_configuration,
+ vs2002_solution_extensibility,
+ NULL
+};
+
+/** The VS2003 project writing process, for session_enumerate_objects() */
+static SessionProjectCallback ProjectCallbacks[] =
+{
+ vs200x_project_create,
+ vs200x_project_encoding,
+ vs200x_project_element,
+ vs200x_project_platforms,
+ vs200x_project_tool_files,
+ session_enumerate_configurations,
+ vs200x_project_references,
+ vs200x_project_files,
+ vs200x_project_globals,
+ NULL
+};
+
+/** The VS2003 configuration writing process, for session_enumerate_configurations() */
+static SessionProjectCallback ConfigCallbacks[] =
+{
+ vs200x_project_config_element,
+ vs200x_project_vc_cl_compiler_tool,
+ vs200x_project_vc_custom_build_tool,
+ vs200x_project_vc_linker_tool,
+ vs200x_project_vc_midl_tool,
+ vs200x_project_vc_post_build_event_tool,
+ vs200x_project_vc_pre_build_event_tool,
+ vs200x_project_vc_pre_link_event_tool,
+ vs200x_project_vc_resource_compiler_tool,
+ vs200x_project_vc_web_service_proxy_generator_tool,
+ vs200x_project_vc_xml_data_generator_tool,
+ vs200x_project_vc_web_deployment_tool,
+ vs200x_project_config_end,
+ NULL
+};
+
+
+/**
+ * The Visual Studio 2003 action handler.
+ * \param sess The active session object.
+ * \returns OKAY if successful.
+ */
+int vs2003_action(Session sess)
+{
+ /* make sure I can support all of the features used in the session */
+ if (session_validate(sess, &Features) != OKAY)
+ {
+ return !OKAY;
+ }
+
+ stream_writeline(Console, "Generating project files for Visual Studio 2003...");
+ return session_enumerate_objects(sess, SolutionCallbacks, ProjectCallbacks, ConfigCallbacks);
+}
diff --git a/src/actions/vs200x/vs2003_solution.c b/src/actions/vs200x/vs2003_solution.c
new file mode 100644
index 0000000..1c1517c
--- /dev/null
+++ b/src/actions/vs200x/vs2003_solution.c
@@ -0,0 +1,55 @@
+/**
+ * \file vs2003_solution.c
+ * \brief Visual Studio 2003 solution generation functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include "premake.h"
+#include "vs200x_solution.h"
+
+
+/**
+ * Create the Visual Studio 2003 solution configuration block.
+ * \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 vs2003_solution_configuration(Session sess, Solution sln, Stream strm)
+{
+ int i, n, z;
+ UNUSED(sess);
+
+ z = stream_writeline(strm, "Global");
+ z |= stream_writeline(strm, "\tGlobalSection(SolutionConfiguration) = preSolution");
+
+ n = solution_num_configs(sln);
+ for (i = 0; i < n; ++i)
+ {
+ const char* config_name = solution_get_config(sln, i);
+ z |= stream_writeline(strm, "\t\t%s = %s", config_name, config_name);
+ }
+
+ z |= stream_writeline(strm, "\tEndGlobalSection");
+ return z;
+}
+
+
+/**
+ * Write the Visual Studio 2003 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 vs2003_solution_signature(Session sess, Solution sln, Stream strm)
+{
+ int z;
+ UNUSED(sess);
+ UNUSED(sln);
+ stream_set_newline(strm, "\r\n");
+ z = stream_writeline(strm, "Microsoft Visual Studio Solution File, Format Version 8.00");
+ return z;
+}
diff --git a/src/actions/vs200x/vs2005.c b/src/actions/vs200x/vs2005.c
new file mode 100644
index 0000000..47e835c
--- /dev/null
+++ b/src/actions/vs200x/vs2005.c
@@ -0,0 +1,92 @@
+/**
+ * \file vs2005.c
+ * \brief Visual Studio 2005 project file generation action.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include <stdlib.h>
+#include "premake.h"
+#include "actions/actions.h"
+#include "vs200x.h"
+#include "vs200x_solution.h"
+#include "vs200x_project.h"
+
+
+/** The project features supported by this action */
+static SessionFeatures Features =
+{
+ { "c", "c++", NULL },
+};
+
+
+/** The VS2005 solution writing process, for session_enumerate_objects() */
+static SessionSolutionCallback SolutionCallbacks[] =
+{
+ vs200x_solution_create,
+ vs2005_solution_signature,
+ vs2002_solution_projects,
+ vs2005_solution_platforms,
+ vs2005_solution_project_platforms,
+ vs2005_solution_properties,
+ NULL
+};
+
+/** The VS2005 project writing process, for session_enumerate_objects() */
+static SessionProjectCallback ProjectCallbacks[] =
+{
+ vs200x_project_create,
+ vs200x_project_encoding,
+ vs200x_project_element,
+ vs200x_project_platforms,
+ vs200x_project_tool_files,
+ session_enumerate_configurations,
+ vs200x_project_references,
+ vs200x_project_files,
+ vs200x_project_globals,
+ NULL
+};
+
+/** The VS2005 configuration writing process, for session_enumerate_configurations() */
+static SessionProjectCallback ConfigCallbacks[] =
+{
+ vs200x_project_config_element,
+ vs200x_project_vc_pre_build_event_tool,
+ vs200x_project_vc_custom_build_tool,
+ vs200x_project_vc_xml_data_generator_tool,
+ vs200x_project_vc_web_service_proxy_generator_tool,
+ vs200x_project_vc_midl_tool,
+ vs200x_project_vc_cl_compiler_tool,
+ vs200x_project_vc_managed_resource_compiler_tool,
+ vs200x_project_vc_resource_compiler_tool,
+ vs200x_project_vc_pre_link_event_tool,
+ vs200x_project_vc_linker_tool,
+ vs200x_project_vc_alink_tool,
+ vs200x_project_vc_manifest_tool,
+ vs200x_project_vc_xdc_make_tool,
+ vs200x_project_vc_bsc_make_tool,
+ vs200x_project_vc_fx_cop_tool,
+ vs200x_project_vc_app_verifier_tool,
+ vs200x_project_vc_web_deployment_tool,
+ vs200x_project_vc_post_build_event_tool,
+ vs200x_project_config_end,
+ NULL
+};
+
+
+/**
+ * The Visual Studio 2005 action handler.
+ * \param sess The active session object.
+ * \returns OKAY if successful.
+ */
+int vs2005_action(Session sess)
+{
+ /* make sure I can support all of the features used in the session */
+ if (session_validate(sess, &Features) != OKAY)
+ {
+ return !OKAY;
+ }
+
+ stream_writeline(Console, "Generating project files for Visual Studio 2005...");
+ return session_enumerate_objects(sess, SolutionCallbacks, ProjectCallbacks, ConfigCallbacks);
+}
+
diff --git a/src/actions/vs200x/vs2005_solution.c b/src/actions/vs200x/vs2005_solution.c
new file mode 100644
index 0000000..6f589ea
--- /dev/null
+++ b/src/actions/vs200x/vs2005_solution.c
@@ -0,0 +1,110 @@
+/**
+ * \file vs2005_solution.c
+ * \brief Visual Studio 2005 solution generation functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include "premake.h"
+#include "vs200x_solution.h"
+
+
+/**
+ * Write out the Visual Studio solution-level platform configuration block.
+ * \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 vs2005_solution_platforms(Session sess, Solution sln, Stream strm)
+{
+ int i, n, z;
+ UNUSED(sess);
+
+ z = stream_writeline(strm, "Global");
+ z |= stream_writeline(strm, "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
+
+ n = solution_num_configs(sln);
+ for (i = 0; i < n; ++i)
+ {
+ const char* config_name = solution_get_config(sln, i);
+ z |= stream_writeline(strm, "\t\t%s|Win32 = %s|Win32", config_name, config_name);
+ }
+
+ z |= stream_writeline(strm, "\tEndGlobalSection");
+ return z;
+}
+
+
+/**
+ * Write out the Visual Studio 2005 project-level platform configurations block.
+ * \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 vs2005_solution_project_platforms(Session sess, Solution sln, Stream strm)
+{
+ int pi, pn, z;
+ UNUSED(sess);
+ z = stream_writeline(strm, "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
+ pn = solution_num_projects(sln);
+ for (pi = 0; pi < pn; ++pi)
+ {
+ int ci, cn;
+ Project prj = solution_get_project(sln, pi);
+ const char* prj_id = project_get_guid(prj);
+
+ cn = solution_num_configs(sln);
+ for (ci = 0; ci < cn; ++ci)
+ {
+ const char* config_name = solution_get_config(sln, ci);
+ z |= stream_writeline(strm, "\t\t{%s}.%s|Win32.ActiveCfg = %s|Win32", prj_id, config_name, config_name);
+ z |= stream_writeline(strm, "\t\t{%s}.%s|Win32.Build.0 = %s|Win32", prj_id, config_name, config_name);
+ }
+ }
+ z |= stream_writeline(strm, "\tEndGlobalSection");
+ return z;
+}
+
+
+/**
+ * Write out the Visual Studio 2005 solution properties block.
+ * \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 vs2005_solution_properties(Session sess, Solution sln, Stream strm)
+{
+ int z;
+ UNUSED(sess);
+ UNUSED(sln);
+ z = stream_writeline(strm, "\tGlobalSection(SolutionProperties) = preSolution");
+ z |= stream_writeline(strm, "\t\tHideSolutionNode = FALSE");
+ z |= stream_writeline(strm, "\tEndGlobalSection");
+ z |= stream_writeline(strm, "EndGlobal");
+ return z;
+}
+
+
+/**
+ * Write the Visual Studio 2005 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 vs2005_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 9.00");
+ z |= stream_writeline(strm, "# Visual Studio 2005");
+ return z;
+}
diff --git a/src/actions/vs200x/vs2008.c b/src/actions/vs200x/vs2008.c
new file mode 100644
index 0000000..9af42ad
--- /dev/null
+++ b/src/actions/vs200x/vs2008.c
@@ -0,0 +1,91 @@
+/**
+ * \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 "actions/actions.h"
+#include "vs200x.h"
+#include "vs200x_solution.h"
+#include "vs200x_project.h"
+
+
+/** The project features supported by this action */
+static SessionFeatures Features =
+{
+ { "c", "c++", NULL },
+};
+
+
+/** The VS2008 solution writing process, for session_enumerate_objects() */
+static SessionSolutionCallback SolutionCallbacks[] =
+{
+ vs200x_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[] =
+{
+ vs200x_project_create,
+ vs200x_project_encoding,
+ vs200x_project_element,
+ vs200x_project_platforms,
+ vs200x_project_tool_files,
+ session_enumerate_configurations,
+ vs200x_project_references,
+ vs200x_project_files,
+ vs200x_project_globals,
+ NULL
+};
+
+/** The VS2008 configuration writing process, for session_enumerate_configurations() */
+static SessionProjectCallback ConfigCallbacks[] =
+{
+ vs200x_project_config_element,
+ vs200x_project_vc_pre_build_event_tool,
+ vs200x_project_vc_custom_build_tool,
+ vs200x_project_vc_xml_data_generator_tool,
+ vs200x_project_vc_web_service_proxy_generator_tool,
+ vs200x_project_vc_midl_tool,
+ vs200x_project_vc_cl_compiler_tool,
+ vs200x_project_vc_managed_resource_compiler_tool,
+ vs200x_project_vc_resource_compiler_tool,
+ vs200x_project_vc_pre_link_event_tool,
+ vs200x_project_vc_linker_tool,
+ vs200x_project_vc_alink_tool,
+ vs200x_project_vc_manifest_tool,
+ vs200x_project_vc_xdc_make_tool,
+ vs200x_project_vc_bsc_make_tool,
+ vs200x_project_vc_fx_cop_tool,
+ vs200x_project_vc_app_verifier_tool,
+ vs200x_project_vc_post_build_event_tool,
+ vs200x_project_config_end,
+ NULL
+};
+
+
+/**
+ * The Visual Studio 2008 action handler.
+ * \param sess The active session object.
+ * \returns OKAY if successful.
+ */
+int vs2008_action(Session sess)
+{
+ /* make sure I can support all of the features used in the session */
+ if (session_validate(sess, &Features) != OKAY)
+ {
+ return !OKAY;
+ }
+
+ stream_writeline(Console, "Generating project files for Visual Studio 2008...");
+ return session_enumerate_objects(sess, SolutionCallbacks, ProjectCallbacks, ConfigCallbacks);
+}
+
diff --git a/src/actions/vs200x/vs2008_solution.c b/src/actions/vs200x/vs2008_solution.c
new file mode 100644
index 0000000..856bd51
--- /dev/null
+++ b/src/actions/vs200x/vs2008_solution.c
@@ -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;
+}
diff --git a/src/actions/vs200x/vs200x.c b/src/actions/vs200x/vs200x.c
new file mode 100644
index 0000000..91b4cfb
--- /dev/null
+++ b/src/actions/vs200x/vs200x.c
@@ -0,0 +1,190 @@
+/**
+ * \file vs200x.c
+ * \brief General purpose Visual Studio support functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "premake.h"
+#include "vs200x.h"
+#include "base/buffers.h"
+#include "base/cstr.h"
+#include "base/error.h"
+
+
+/**
+ * Write an XML attribute, adjusting for the differing Visual Studio formats.
+ * \param strm The output stream, the attribute will be written here.
+ * \param indent_size How far to indent (with tabs) the attribute.
+ * \param name The attribute name.
+ * \param value The attribute value; may contain printf-style formatting codes.
+ * \returns OKAY if successful.
+ */
+int vs200x_attribute(Stream strm, int indent_size, const char* name, const char* value, ...)
+{
+ va_list args;
+ char* buffer;
+ int z = OKAY;
+
+ z |= stream_writeline(strm, "");
+ z |= stream_write_n(strm, "\t", indent_size);
+ z |= stream_write(strm, "%s=\"", name);
+
+ buffer = buffers_next();
+ va_start(args, value);
+ vsprintf(buffer, value, args);
+ z |= stream_write_escaped(strm, buffer);
+ va_end(args);
+
+ z |= stream_write(strm, "\"");
+ return z;
+}
+
+
+/**
+ * Write an XML attribute containing a list of values, adjusting for the differing Visual Studio formats.
+ * \param strm The output stream, the attribute will be written here.
+ * \param indent_size How far to indent (with tabs) the attribute.
+ * \param name The attribute name.
+ * \param values The attribute list value.
+ * \returns OKAY if successful.
+ */
+int vs200x_list_attribute(Stream strm, int indent_size, const char* name, Strings values)
+{
+ int z = OKAY;
+
+ z |= stream_writeline(strm, "");
+ z |= stream_write_n(strm, "\t", indent_size);
+ z |= stream_write(strm, "%s=", name);
+ z |= stream_write_strings(strm, values, "\"", "", "", ";", "\"", stream_write_escaped);
+ return z;
+}
+
+
+/**
+ * Write the ending part of an XML tag, adjust for the differing Visual Studio formats.
+ * \param sess The current execution session.
+ * \param strm The output stream.
+ * \param level The XML element nesting level.
+ * \param markup The end tag markup.
+ * \returns OKAY if successful.
+ */
+int vs200x_element_end(Session sess, Stream strm, int level, const char* markup)
+{
+ int z;
+ int version = vs200x_get_target_version(sess);
+ if (version >= 2005)
+ {
+ z = stream_writeline(strm, "");
+ if (markup[0] == '>')
+ {
+ level++;
+ }
+ z |= stream_write_n(strm, "\t", level);
+ z |= stream_writeline(strm, "%s", markup);
+ }
+ else
+ {
+ z = stream_writeline(strm, markup);
+ }
+ return z;
+}
+
+
+/**
+ * Return the Visual Studio version appropriate version of the string for a false
+ * value. Before 2005 this was "FALSE", after it is "false".
+ */
+const char* vs200x_false(Session sess)
+{
+ int version = vs200x_get_target_version(sess);
+ return (version < 2005) ? "FALSE" : "false";
+}
+
+
+/**
+ * Converts the session action string to a Visual Studio version number.
+ * \param sess The current execution session.
+ * \returns The Visual Studio version number corresponding to the current action.
+ */
+int vs200x_get_target_version(Session sess)
+{
+ const char* action = session_get_action(sess);
+ if (cstr_eq(action, "vs2002"))
+ {
+ return 2002;
+ }
+ else if (cstr_eq(action, "vs2003"))
+ {
+ return 2003;
+ }
+ else if (cstr_eq(action, "vs2005"))
+ {
+ return 2005;
+ }
+ else if (cstr_eq(action, "vs2008"))
+ {
+ return 2008;
+ }
+ else
+ {
+ assert(0);
+ return 0;
+ }
+}
+
+
+/**
+ * Return the appropriate file extension for a particular project.
+ * \param prj The project object.
+ * \returns The appropriate project file extension, based on the project settings.
+ */
+const char* vs200x_project_file_extension(Project prj)
+{
+ const char* language = project_get_language(prj);
+ if (cstr_eq(language, "c") || cstr_eq(language, "c++"))
+ {
+ return ".vcproj";
+ }
+ else
+ {
+ error_set("unsupported language '%s'", language);
+ return NULL;
+ }
+}
+
+
+/**
+ * Returns the Visual Studio GUID for a particular project type.
+ * \param language The programming language used in the project.
+ * \returns The GUID corresponding the programming language.
+ */
+const char* vs200x_tool_guid(const char* language)
+{
+ if (cstr_eq(language, "c") || cstr_eq(language, "c++"))
+ {
+ return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942";
+ }
+ else if (cstr_eq(language, "c#"))
+ {
+ return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC";
+ }
+ else
+ {
+ error_set("unsupported language '%s'", language);
+ return NULL;
+ }
+}
+
+
+/**
+ * Return the Visual Studio version appropriate version of the string for a true
+ * value. Before 2005 this was "TRUE", after it is "true".
+ */
+const char* vs200x_true(Session sess)
+{
+ int version = vs200x_get_target_version(sess);
+ return (version < 2005) ? "TRUE" : "true";
+}
diff --git a/src/actions/vs200x/vs200x.h b/src/actions/vs200x/vs200x.h
new file mode 100644
index 0000000..b99c2f5
--- /dev/null
+++ b/src/actions/vs200x/vs200x.h
@@ -0,0 +1,21 @@
+/**
+ * \file vs200x.h
+ * \brief General purpose Visual Studio support functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+#if !defined(PREMAKE_VS200X_H)
+#define PREMAKE_VS200X_H
+
+#include "session/session.h"
+
+int vs200x_attribute(Stream strm, int indent_size, const char* name, const char* value, ...);
+int vs200x_list_attribute(Stream strm, int indent_size, const char* name, Strings values);
+int vs200x_element_end(Session sess, Stream strm, int level, const char* markup);
+const char* vs200x_false(Session sess);
+int vs200x_get_target_version(Session sess);
+const char* vs200x_project_file_extension(Project prj);
+const char* vs200x_tool_guid(const char* language);
+const char* vs200x_true(Session sess);
+
+#endif
+
diff --git a/src/actions/vs200x/vs200x_config.c b/src/actions/vs200x/vs200x_config.c
new file mode 100644
index 0000000..3e94305
--- /dev/null
+++ b/src/actions/vs200x/vs200x_config.c
@@ -0,0 +1,64 @@
+/**
+ * \file vs200x_config.c
+ * \brief Visual Studio 200x configuration generation functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "vs200x.h"
+#include "vs200x_config.h"
+
+
+int vs200x_config_character_set(Session sess, Stream strm)
+{
+ int version = vs200x_get_target_version(sess);
+ return vs200x_attribute(strm, 3, "CharacterSet", version > 2003 ? "1" : "2");
+}
+
+
+/**
+ * Write out the list of preprocessor symbols as defined by the configuration.
+ * This entry is only written if there are values to write.
+ */
+int vs200x_config_defines(Session sess, Stream strm, Project prj)
+{
+ Strings values = project_get_config_values(prj, BlockDefines);
+ UNUSED(sess);
+ if (strings_size(values) > 0)
+ {
+ return vs200x_list_attribute(strm, 4, "PreprocessorDefinitions", values);
+ }
+ return OKAY;
+}
+
+
+int vs200x_config_detect_64bit_portability(Session sess, Stream strm, Project prj)
+{
+ int version = vs200x_get_target_version(sess);
+ UNUSED(prj);
+ if (version < 2008)
+ {
+ return vs200x_attribute(strm, 4, "Detect64BitPortabilityProblems", vs200x_true(sess));
+ }
+ return OKAY;
+}
+
+
+int vs200x_config_runtime_type_info(Session sess, Stream strm, Project prj)
+{
+ int version = vs200x_get_target_version(sess);
+ UNUSED(prj);
+ if (version < 2005)
+ {
+ return vs200x_attribute(strm, 4, "RuntimeTypeInfo", vs200x_true(sess));
+ }
+ return OKAY;
+}
+
+
+int vs200x_config_use_precompiled_header(Session sess, Stream strm, Project prj)
+{
+ int version = vs200x_get_target_version(sess);
+ UNUSED(prj);
+ return vs200x_attribute(strm, 4, "UsePrecompiledHeader", (version > 2003) ? "0" : "2");
+}
diff --git a/src/actions/vs200x/vs200x_config.h b/src/actions/vs200x/vs200x_config.h
new file mode 100644
index 0000000..53172e9
--- /dev/null
+++ b/src/actions/vs200x/vs200x_config.h
@@ -0,0 +1,17 @@
+/**
+ * \file vs200x_config.h
+ * \brief Visual Studio 200x configuration generation functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+#if !defined(PREMAKE_VS200X_CONFIG_H)
+#define PREMAKE_VS200X_CONFIG_H
+
+#include "session/session.h"
+
+int vs200x_config_character_set(Session sess, Stream strm);
+int vs200x_config_defines(Session sess, Stream strm, Project prj);
+int vs200x_config_detect_64bit_portability(Session sess, Stream strm, Project prj);
+int vs200x_config_runtime_type_info(Session sess, Stream strm, Project prj);
+int vs200x_config_use_precompiled_header(Session sess, Stream strm, Project prj);
+
+#endif
diff --git a/src/actions/vs200x/vs200x_project.c b/src/actions/vs200x/vs200x_project.c
new file mode 100644
index 0000000..0c48255
--- /dev/null
+++ b/src/actions/vs200x/vs200x_project.c
@@ -0,0 +1,475 @@
+/**
+ * \file vs200x_project.c
+ * \brief Visual Studio multiple-version project generation functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "premake.h"
+#include "vs200x.h"
+#include "vs200x_project.h"
+#include "vs200x_config.h"
+#include "actions/support/sourcetree.h"
+#include "base/cstr.h"
+#include "base/path.h"
+
+
+/**
+ * Write the opening [Configuration] element and attributes.
+ */
+int vs200x_project_config_element(Session sess, Project prj, Stream strm)
+{
+ int z = OKAY;
+ const char* cfg_name = project_get_configuration_filter(prj);
+ z |= stream_write(strm, "\t\t<Configuration");
+ z |= vs200x_attribute(strm, 3, "Name", "%s|Win32", cfg_name);
+ z |= vs200x_attribute(strm, 3, "OutputDirectory", "$(SolutionDir)$(ConfigurationName)");
+ z |= vs200x_attribute(strm, 3, "IntermediateDirectory", "$(ConfigurationName)");
+ z |= vs200x_attribute(strm, 3, "ConfigurationType", "1");
+ z |= vs200x_config_character_set(sess, strm);
+ z |= vs200x_element_end(sess, strm, 2, ">");
+ return z;
+}
+
+
+/**
+ * Write the closing [Configuration] element.
+ */
+int vs200x_project_config_end(Session sess, Project prj, Stream strm)
+{
+ UNUSED(sess);
+ UNUSED(prj);
+ return stream_writeline(strm, "\t\t</Configuration>");
+}
+
+
+/**
+ * Create a new output stream for a project, and make it active for subsequent writes.
+ */
+int vs200x_project_create(Session sess, Project prj, Stream strm)
+{
+ /* create the project file */
+ const char* extension = vs200x_project_file_extension(prj);
+ const char* filename = project_get_filename(prj, NULL, extension);
+ strm = stream_create_file(filename);
+ if (!strm)
+ {
+ return !OKAY;
+ }
+
+ /* make the stream active for the functions that come after */
+ session_set_active_stream(sess, strm);
+ return OKAY;
+}
+
+
+/**
+ * Write the root [VisualStudioProject] element and attributes.
+ */
+int vs200x_project_element(Session sess, Project prj, Stream strm)
+{
+ int version, z;
+ const char* prj_ver;
+ const char* prj_name = project_get_name(prj);
+ const char* prj_guid = project_get_guid(prj);
+
+ version = vs200x_get_target_version(sess);
+ switch (version)
+ {
+ default:
+ prj_ver = "7.00"; break;
+ case 2003:
+ prj_ver = "7.10"; break;
+ case 2005:
+ prj_ver = "8.00"; break;
+ case 2008:
+ prj_ver = "9.00"; break;
+ }
+
+ z = stream_write(strm, "<VisualStudioProject");
+ z |= vs200x_attribute(strm, 1, "ProjectType", "Visual C++");
+ z |= vs200x_attribute(strm, 1, "Version", prj_ver);
+ z |= vs200x_attribute(strm, 1, "Name", prj_name);
+ z |= vs200x_attribute(strm, 1, "ProjectGUID", "{%s}", prj_guid);
+ if (version > 2003)
+ {
+ z |= vs200x_attribute(strm, 1, "RootNamespace", prj_name);
+ }
+ z |= vs200x_attribute(strm, 1, "Keyword", "Win32Proj");
+ if (version > 2005)
+ {
+ z |= vs200x_attribute(strm, 1, "TargetFrameworkVersion", "196613");
+ }
+ z |= vs200x_element_end(sess, strm, 0, ">");
+ return z;
+}
+
+
+/**
+ * Write the file encoding at the start of the project file.
+ */
+int vs200x_project_encoding(Session sess, Project prj, Stream strm)
+{
+ int z;
+ UNUSED(sess);
+ UNUSED(prj);
+
+ stream_set_newline(strm, "\r\n");
+ z = stream_writeline(strm, "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>");
+ return z;
+}
+
+
+/**
+ * Write an individual file entry to the project file; callback for sourcetree_walk().
+ * \param sess The current execution session context.
+ * \param prj The current project; contains the file being enumerated.
+ * \param strm The active output stream; for writing the file markup.
+ * \param filename The name of the file to process.
+ * \param state One of the ActionSourceStates, enabling file grouping.
+ * \returns OKAY if successful.
+ */
+int vs200x_project_file(Session sess, Project prj, Stream strm, const char* filename, int state)
+{
+ const char* name;
+ const char* ptr;
+ int depth, z = OKAY;
+
+ /* figure out the grouping depth, skipping over any leading dot directories */
+ depth = 2;
+
+ ptr = filename;
+ while (cstr_starts_with(ptr, "../"))
+ {
+ ptr += 3;
+ }
+
+ ptr = strchr(ptr, '/');
+ while (ptr != NULL)
+ {
+ depth++;
+ ptr = strchr(ptr + 1, '/');
+ }
+
+ /* group name is just the last bit of the path */
+ name = path_filename(filename);
+
+ /* use the Windows path separator */
+ filename = path_translate(filename, "\\");
+
+ switch (state)
+ {
+ case GroupStart:
+ if (strlen(filename) > 0 && !cstr_eq(name, ".."))
+ {
+ z |= stream_write_n(strm, "\t", depth);
+ z |= stream_write(strm, "<Filter");
+ z |= vs200x_attribute(strm, depth + 1, "Name", name);
+ z |= vs200x_attribute(strm, depth + 1, "Filter", "");
+ z |= vs200x_element_end(sess, strm, depth, ">");
+ }
+ break;
+
+ case GroupEnd:
+ if (strlen(filename) > 0 && !cstr_eq(name, ".."))
+ {
+ z |= stream_write_n(strm, "\t", depth);
+ z |= stream_writeline(strm, "</Filter>");
+ }
+ break;
+
+ case SourceFile:
+ z |= stream_write_n(strm, "\t", depth);
+ z |= stream_write(strm, "<File");
+ ptr = (filename[0] == '.') ? "" : ".\\";
+ z |= vs200x_attribute(strm, depth + 1, "RelativePath", "%s%s", ptr, filename);
+ z |= vs200x_element_end(sess, strm, depth, ">");
+ z |= stream_write_n(strm, "\t", depth);
+ z |= stream_writeline(strm, "</File>");
+ break;
+ }
+
+ UNUSED(prj);
+ return z;
+}
+
+
+/**
+ * Write out the [Files] element.
+ */
+int vs200x_project_files(Session sess, Project prj, Stream strm)
+{
+ int z = OKAY;
+ z |= stream_writeline(strm, "\t<Files>");
+ z |= sourcetree_walk(sess, prj, strm, vs200x_project_file);
+ z |= stream_writeline(strm, "\t</Files>");
+ return z;
+}
+
+
+/**
+ * Write out the [Globals] element.
+ */
+int vs200x_project_globals(Session sess, Project prj, Stream strm)
+{
+ int z = OKAY;
+ UNUSED(sess);
+ UNUSED(prj);
+ z |= stream_writeline(strm, "\t<Globals>");
+ z |= stream_writeline(strm, "\t</Globals>");
+ z |= stream_writeline(strm, "</VisualStudioProject>");
+ return z;
+}
+
+
+/**
+ * Write out the platforms section of a project file.
+ */
+int vs200x_project_platforms(Session sess, Project prj, Stream strm)
+{
+ int z = OKAY;
+ UNUSED(prj);
+ z |= stream_writeline(strm, "\t<Platforms>");
+ z |= stream_write(strm, "\t\t<Platform");
+ z |= vs200x_attribute(strm, 3, "Name", "Win32");
+ z |= vs200x_element_end(sess, strm, 2, "/>");
+ z |= stream_writeline(strm, "\t</Platforms>");
+ return OKAY;
+}
+
+
+/**
+ * Write out the [References] element and attributes.
+ */
+int vs200x_project_references(Session sess, Project prj, Stream strm)
+{
+ int z;
+ UNUSED(prj);
+ z = stream_writeline(strm, "\t</Configurations>");
+ if (vs200x_get_target_version(sess) > 2002)
+ {
+ z |= stream_writeline(strm, "\t<References>");
+ z |= stream_writeline(strm, "\t</References>");
+ }
+ return z;
+}
+
+
+/**
+ * Write out the [ToolFiles] section of a Visual Studio project.
+ */
+int vs200x_project_tool_files(Session sess, Project prj, Stream strm)
+{
+ int version, z = OKAY;
+ UNUSED(prj);
+
+ version = vs200x_get_target_version(sess);
+ if (version > 2003)
+ {
+ z |= stream_writeline(strm, "\t<ToolFiles>");
+ z |= stream_writeline(strm, "\t</ToolFiles>");
+ }
+ z |= stream_writeline(strm, "\t<Configurations>");
+ return z;
+}
+
+
+/**
+ * Common function to write an empty [Tool] element.
+ */
+static int vs200x_project_vc_empty_tool(Session sess, Project prj, Stream strm, const char* name)
+{
+ int z;
+ UNUSED(prj);
+ z = stream_write(strm, "\t\t\t<Tool");
+ z |= vs200x_attribute(strm, 4, "Name", name);
+ z |= vs200x_element_end(sess, strm, 3, "/>");
+ return z;
+}
+
+
+/**
+ * Write the VCALinkTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_alink_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCALinkTool");
+}
+
+
+/**
+ * Write the VCAppVerifierTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_app_verifier_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCAppVerifierTool");
+}
+
+
+/**
+ * Write the VCBscMakeTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_bsc_make_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCBscMakeTool");
+}
+
+
+/**
+ * Write the VCCLCompilerTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_cl_compiler_tool(Session sess, Project prj, Stream strm)
+{
+ int z = OKAY;
+ z |= stream_write(strm, "\t\t\t<Tool");
+ z |= vs200x_attribute(strm, 4, "Name", "VCCLCompilerTool");
+ z |= vs200x_attribute(strm, 4, "Optimization", "0");
+ z |= vs200x_config_defines(sess, strm, prj);
+ z |= vs200x_attribute(strm, 4, "MinimalRebuild", vs200x_true(sess));
+ z |= vs200x_attribute(strm, 4, "BasicRuntimeChecks", "3");
+ z |= vs200x_attribute(strm, 4, "RuntimeLibrary", "3");
+ z |= vs200x_config_runtime_type_info(sess, strm, prj);
+ z |= vs200x_config_use_precompiled_header(sess, strm, prj);
+ z |= vs200x_attribute(strm, 4, "WarningLevel", "3");
+ z |= vs200x_config_detect_64bit_portability(sess, strm, prj);
+ z |= vs200x_attribute(strm, 4, "DebugInformationFormat", "4");
+ z |= vs200x_element_end(sess, strm, 3, "/>");
+ return z;
+}
+
+
+/**
+ * Write the VCCustomBuildTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_custom_build_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCCustomBuildTool");
+}
+
+
+/**
+ * Write the VCFxCopTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_fx_cop_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCFxCopTool");
+}
+
+
+/**
+ * Write the VCLinkerTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_linker_tool(Session sess, Project prj, Stream strm)
+{
+ int z;
+ UNUSED(prj);
+ z = stream_write(strm, "\t\t\t<Tool");
+ z |= vs200x_attribute(strm, 4, "Name", "VCLinkerTool");
+ z |= vs200x_attribute(strm, 4, "LinkIncremental", "2");
+ z |= vs200x_attribute(strm, 4, "GenerateDebugInformation", vs200x_true(sess));
+ z |= vs200x_attribute(strm, 4, "SubSystem", "1");
+ z |= vs200x_attribute(strm, 4, "EntryPointSymbol", "mainCRTStartup");
+ z |= vs200x_attribute(strm, 4, "TargetMachine", "1");
+ z |= vs200x_element_end(sess, strm, 3, "/>");
+ return z;
+}
+
+
+/**
+ * Write the VCManagedResourceCompilerTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_managed_resource_compiler_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCManagedResourceCompilerTool");
+}
+
+
+/**
+ * Write the VCManifestTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_manifest_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCManifestTool");
+}
+
+
+/**
+ * Write the VCMIDLTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_midl_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCMIDLTool");
+}
+
+
+/**
+ * Write the VCPreBuildEventTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_pre_build_event_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCPreBuildEventTool");
+}
+
+
+/**
+ * Write the VCPreLinkEventTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_pre_link_event_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCPreLinkEventTool");
+}
+
+
+/**
+ * Write the VCPostBuildEventTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_post_build_event_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCPostBuildEventTool");
+}
+
+
+/**
+ * Write the VCResourceCompiler [Tool] element and attributes.
+ */
+int vs200x_project_vc_resource_compiler_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCResourceCompilerTool");
+}
+
+
+/**
+ * Write the VCWebDeploymentTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_web_deployment_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCWebDeploymentTool");
+}
+
+
+/**
+ * Write the VCWebServiceProxyGeneratorTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_web_service_proxy_generator_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCWebServiceProxyGeneratorTool");
+}
+
+
+/**
+ * Write the VCXDCMakeTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_xdc_make_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCXDCMakeTool");
+}
+
+
+/**
+ * Write the VCXMLDataGeneratorTool [Tool] element and attributes.
+ */
+int vs200x_project_vc_xml_data_generator_tool(Session sess, Project prj, Stream strm)
+{
+ return vs200x_project_vc_empty_tool(sess, prj, strm, "VCXMLDataGeneratorTool");
+}
diff --git a/src/actions/vs200x/vs200x_project.h b/src/actions/vs200x/vs200x_project.h
new file mode 100644
index 0000000..a4950f9
--- /dev/null
+++ b/src/actions/vs200x/vs200x_project.h
@@ -0,0 +1,41 @@
+/**
+ * \file vs200x_project.h
+ * \brief Visual Studio 200x project generation functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+#if !defined(PREMAKE_VS200X_PROJECT_H)
+#define PREMAKE_VS200X_PROJECT_H
+
+#include "session/session.h"
+
+int vs200x_project_config_element(Session sess, Project prj, Stream strm);
+int vs200x_project_config_end(Session sess, Project prj, Stream strm);
+int vs200x_project_create(Session sess, Project prj, Stream strm);
+int vs200x_project_element(Session sess, Project prj, Stream strm);
+int vs200x_project_encoding(Session sess, Project prj, Stream strm);
+int vs200x_project_file(Session sess, Project prj, Stream strm, const char* filename, int state);
+int vs200x_project_files(Session sess, Project prj, Stream strm);
+int vs200x_project_globals(Session sess, Project prj, Stream strm);
+int vs200x_project_platforms(Session sess, Project prj, Stream strm);
+int vs200x_project_references(Session sess, Project prj, Stream strm);
+int vs200x_project_tool_files(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_alink_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_app_verifier_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_bsc_make_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_cl_compiler_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_custom_build_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_fx_cop_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_midl_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_linker_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_managed_resource_compiler_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_manifest_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_pre_build_event_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_pre_link_event_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_post_build_event_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_resource_compiler_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_web_deployment_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_web_service_proxy_generator_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_xdc_make_tool(Session sess, Project prj, Stream strm);
+int vs200x_project_vc_xml_data_generator_tool(Session sess, Project prj, Stream strm);
+
+#endif
diff --git a/src/actions/vs200x/vs200x_solution.c b/src/actions/vs200x/vs200x_solution.c
new file mode 100644
index 0000000..6578bd4
--- /dev/null
+++ b/src/actions/vs200x/vs200x_solution.c
@@ -0,0 +1,33 @@
+/**
+ * \file vs200x_solution.c
+ * \brief Visual Studio multiple-version solution generation functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include <stdlib.h>
+#include "premake.h"
+#include "vs200x.h"
+#include "vs200x_solution.h"
+
+
+/**
+ * Create a new output stream for a solution, and make it active for subsequent writes.
+ * \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 vs200x_solution_create(Session sess, Solution sln, Stream strm)
+{
+ /* create the solution file */
+ const char* filename = solution_get_filename(sln, NULL, ".sln");
+ strm = stream_create_file(filename);
+ if (!strm)
+ {
+ return !OKAY;
+ }
+
+ /* make the stream active for the functions that come after */
+ session_set_active_stream(sess, strm);
+ return OKAY;
+}
diff --git a/src/actions/vs200x/vs200x_solution.h b/src/actions/vs200x/vs200x_solution.h
new file mode 100644
index 0000000..18683c4
--- /dev/null
+++ b/src/actions/vs200x/vs200x_solution.h
@@ -0,0 +1,30 @@
+/**
+ * \file vs200x_solution.h
+ * \brief Visual Studio 200x solution generation functions.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+#if !defined(PREMAKE_VS200X_SOLUTION_H)
+#define PREMAKE_VS200X_SOLUTION_H
+
+#include "session/session.h"
+
+int vs2002_solution_configuration(Session sess, Solution sln, Stream strm);
+int vs2002_solution_dependencies(Session sess, Solution sln, Stream strm);
+int vs2002_solution_extensibility(Session sess, Solution sln, Stream strm);
+int vs2002_solution_project_configuration(Session sess, Solution sln, Stream strm);
+int vs2002_solution_projects(Session sess, Solution sln, Stream strm);
+int vs2002_solution_signature(Session sess, Solution sln, Stream strm);
+
+int vs2003_solution_configuration(Session sess, Solution sln, Stream strm);
+int vs2003_solution_signature(Session sess, Solution sln, Stream strm);
+
+int vs2005_solution_platforms(Session sess, Solution sln, Stream strm);
+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);
+
+int vs200x_solution_create(Session sess, Solution sln, Stream strm);
+
+#endif