diff --git a/samples/vs2008/CppExe/CppExe.vcproj b/samples/vs2008/CppExe/CppExe.vcproj
new file mode 100644
index 00000000..41f914cf
--- /dev/null
+++ b/samples/vs2008/CppExe/CppExe.vcproj
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/vs2008/MySolution.sln b/samples/vs2008/MySolution.sln
new file mode 100644
index 00000000..eaa9dea0
--- /dev/null
+++ b/samples/vs2008/MySolution.sln
@@ -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
diff --git a/src/action/action.c b/src/action/action.c
index b407dc64..609a3e35 100644
--- a/src/action/action.c
+++ b/src/action/action.c
@@ -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 }
};
diff --git a/src/action/action.h b/src/action/action.h
index f2f5b301..f022d963 100644
--- a/src/action/action.h
+++ b/src/action/action.h
@@ -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
diff --git a/src/action/make/gmake.c b/src/action/make/gmake.c
index 4958731c..6664fa93 100644
--- a/src/action/make/gmake.c
+++ b/src/action/make/gmake.c
@@ -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);
}
diff --git a/src/action/vs200x/tests/vs2002_solution_tests.cpp b/src/action/vs200x/tests/vs2002_solution_tests.cpp
index 0796782e..97c352f8 100644
--- a/src/action/vs200x/tests/vs2002_solution_tests.cpp
+++ b/src/action/vs200x/tests/vs2002_solution_tests.cpp
@@ -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(
diff --git a/src/action/vs200x/tests/vs2003_solution_tests.cpp b/src/action/vs200x/tests/vs2003_solution_tests.cpp
index d8818240..ee4fa2be 100644
--- a/src/action/vs200x/tests/vs2003_solution_tests.cpp
+++ b/src/action/vs200x/tests/vs2003_solution_tests.cpp
@@ -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(
diff --git a/src/action/vs200x/tests/vs2005_solution_tests.cpp b/src/action/vs200x/tests/vs2005_solution_tests.cpp
index 70243f15..416572a2 100644
--- a/src/action/vs200x/tests/vs2005_solution_tests.cpp
+++ b/src/action/vs200x/tests/vs2005_solution_tests.cpp
@@ -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(
diff --git a/src/action/vs200x/tests/vs2008_solution_tests.cpp b/src/action/vs200x/tests/vs2008_solution_tests.cpp
new file mode 100644
index 00000000..87202d4c
--- /dev/null
+++ b/src/action/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 "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);
+ }
+
+}
\ No newline at end of file
diff --git a/src/action/vs200x/tests/vs200x_tests.cpp b/src/action/vs200x/tests/vs200x_tests.cpp
index 6643970d..857aa9a1 100644
--- a/src/action/vs200x/tests/vs200x_tests.cpp
+++ b/src/action/vs200x/tests/vs200x_tests.cpp
@@ -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);
diff --git a/src/action/vs200x/tests/vs200x_tests.h b/src/action/vs200x/tests/vs200x_tests.h
deleted file mode 100644
index b9676541..00000000
--- a/src/action/vs200x/tests/vs200x_tests.h
+++ /dev/null
@@ -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);
- }
-};
diff --git a/src/action/vs200x/vs2002.c b/src/action/vs200x/vs2002.c
index 8c0c8a96..32b433e4 100644
--- a/src/action/vs200x/vs2002.c
+++ b/src/action/vs200x/vs2002.c
@@ -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);
}
diff --git a/src/action/vs200x/vs2003.c b/src/action/vs200x/vs2003.c
index 4bc026ad..e63f98d8 100644
--- a/src/action/vs200x/vs2003.c
+++ b/src/action/vs200x/vs2003.c
@@ -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);
}
diff --git a/src/action/vs200x/vs2005.c b/src/action/vs200x/vs2005.c
index 975d0f6c..4501e38f 100644
--- a/src/action/vs200x/vs2005.c
+++ b/src/action/vs200x/vs2005.c
@@ -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);
}
diff --git a/src/action/vs200x/vs2008.c b/src/action/vs200x/vs2008.c
new file mode 100644
index 00000000..2ff40d7f
--- /dev/null
+++ b/src/action/vs200x/vs2008.c
@@ -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
+#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);
+}
+
diff --git a/src/action/vs200x/vs2008_solution.c b/src/action/vs200x/vs2008_solution.c
new file mode 100644
index 00000000..73e4e8ec
--- /dev/null
+++ b/src/action/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/action/vs200x/vs200x_solution.h b/src/action/vs200x/vs200x_solution.h
index 1d926d4d..03d8d52c 100644
--- a/src/action/vs200x/vs200x_solution.h
+++ b/src/action/vs200x/vs200x_solution.h
@@ -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