Restructured solution. "Escape-The-Dawn" now links into a .lib, which is used in "Executable" to facilitate easier unit testing.

This commit is contained in:
2014-03-06 18:57:12 +01:00
parent 5a15491573
commit b87b1f5704
10 changed files with 271 additions and 72 deletions
+6
View File
@@ -5,6 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Escape-the-Dawn", "Escape-t
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tests", "Tests\Tests.vcxproj", "{B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Executable", "Executable\Executable.vcxproj", "{A9755CAA-62DC-442D-B82C-F548546CFD38}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -19,6 +21,10 @@ Global
{B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}.Debug|Win32.Build.0 = Debug|Win32
{B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}.Release|Win32.ActiveCfg = Release|Win32
{B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}.Release|Win32.Build.0 = Release|Win32
{A9755CAA-62DC-442D-B82C-F548546CFD38}.Debug|Win32.ActiveCfg = Debug|Win32
{A9755CAA-62DC-442D-B82C-F548546CFD38}.Debug|Win32.Build.0 = Debug|Win32
{A9755CAA-62DC-442D-B82C-F548546CFD38}.Release|Win32.ActiveCfg = Release|Win32
{A9755CAA-62DC-442D-B82C-F548546CFD38}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+63
View File
@@ -0,0 +1,63 @@
#include <string>
#include <sstream>
#include <GL/glew.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <glext.h>
#include "logging.h"
#include "glerror.h"
#include "World.h"
class Engine
{
public:
Engine(int argc, char* argv[])
{
// Initialize GLFW
if (!glfwInit()) {
LOG_ERROR("GLFW: Initialization failed");
exit(EXIT_FAILURE);
}
// Create a window
m_Window = glfwCreateWindow(1280, 720, "OpenGL", nullptr, nullptr);
if (!m_Window) {
LOG_ERROR("GLFW: Failed to create window");
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(m_Window);
// GL version info
glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]);
glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]);
glVendor = (GLchar*)glGetString(GL_VENDOR);
std::stringstream ss;
ss << glVendor << " OpenGL " << glVersion[0] << "." << glVersion[1];
#ifdef DEBUG
ss << " DEBUG";
#endif
LOG_INFO(ss.str().c_str());
glfwSetWindowTitle(m_Window, ss.str().c_str());
// Initialize GLEW
if (glewInit() != GLEW_OK) {
LOG_ERROR("GLEW: Initialization failed");
exit(EXIT_FAILURE);
}
}
bool Running() const { return !glfwWindowShouldClose(m_Window); }
void Tick()
{
glfwPollEvents();
}
private:
GLFWwindow* m_Window;
GLint glVersion[2];
GLchar* glVendor;
};
+14 -4
View File
@@ -16,13 +16,13 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
@@ -42,7 +42,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LibraryPath>$(SolutionDir)\Libraries\glew-1.10.0\lib\Debug\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Debug;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)bin\</OutDir>
<IntDir>$(SolutionDir)build\$(Configuration)\</IntDir>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
<TargetName>$(ProjectName)-$(Configuration)</TargetName>
<IncludePath>$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
</PropertyGroup>
@@ -52,7 +52,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(SolutionDir)\Libraries\glew-1.10.0\lib\Release\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Release;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)bin\</OutDir>
<IntDir>$(SolutionDir)build\$(Configuration)\</IntDir>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
<TargetName>$(ProjectName)-$(Configuration)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -69,6 +69,12 @@
</Link>
<PostBuildEvent />
<PostBuildEvent />
<Lib>
<AdditionalDependencies>opengl32.lib;glu32.lib;glew32sd.lib;glfw3.lib</AdditionalDependencies>
<ForceSymbolReferences>
</ForceSymbolReferences>
</Lib>
<ProjectReference />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -86,8 +92,12 @@
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>opengl32.lib;glu32.lib;glew32s.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Lib>
<AdditionalDependencies>opengl32.lib;glu32.lib;glew32s.lib;glfw3.lib;</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Engine.h" />
<ClCompile Include="main.cpp" />
<ClCompile Include="Model.cpp" />
<ClCompile Include="Renderer\Renderer.cpp" />
@@ -26,6 +26,7 @@
<Filter>Systems</Filter>
</ClCompile>
<ClCompile Include="Model.cpp" />
<ClCompile Include="Engine.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Component.h" />
+62 -62
View File
@@ -1,62 +1,62 @@
#include <string>
#include <sstream>
#include <GL/glew.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <glext.h>
#include "logging.h"
#include "glerror.h"
#include "World.h"
GLFWwindow* window;
GLint glVersion[2];
GLchar* glVendor;
int main(int argc, char* argv[])
{
// Initialize GLFW
if (!glfwInit())
{
LOG_ERROR("GLFW: Initialization failed");
return 1;
}
// Create a window
window = glfwCreateWindow(1280, 720, "OpenGL", nullptr, nullptr);
if (!window)
{
LOG_ERROR("GLFW: Failed to create window");
return 1;
}
glfwMakeContextCurrent(window);
// GL version info
glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]);
glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]);
glVendor = (GLchar*)glGetString(GL_VENDOR);
std::stringstream ss;
ss << glVendor << " OpenGL " << glVersion[0] << "." << glVersion[1];
#ifdef DEBUG
ss << " DEBUG";
#endif
LOG_INFO(ss.str().c_str());
glfwSetWindowTitle(window, ss.str().c_str());
// Initialize GLEW
if (glewInit() != GLEW_OK)
{
LOG_ERROR("GLEW: Initialization failed");
return 1;
}
// Main loop
while (!glfwWindowShouldClose(window))
{
glfwPollEvents();
}
return 0;
}
//#include <string>
//#include <sstream>
//
//#include <GL/glew.h>
//#define GLFW_INCLUDE_GLU
//#include <GLFW/glfw3.h>
//#include <glext.h>
//
//#include "logging.h"
//#include "glerror.h"
//
//#include "World.h"
//
//GLFWwindow* window;
//GLint glVersion[2];
//GLchar* glVendor;
//
//int main(int argc, char* argv[])
//{
// // Initialize GLFW
// if (!glfwInit())
// {
// LOG_ERROR("GLFW: Initialization failed");
// return 1;
// }
//
// // Create a window
// window = glfwCreateWindow(1280, 720, "OpenGL", nullptr, nullptr);
// if (!window)
// {
// LOG_ERROR("GLFW: Failed to create window");
// return 1;
// }
// glfwMakeContextCurrent(window);
//
// // GL version info
// glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]);
// glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]);
// glVendor = (GLchar*)glGetString(GL_VENDOR);
// std::stringstream ss;
// ss << glVendor << " OpenGL " << glVersion[0] << "." << glVersion[1];
//#ifdef DEBUG
// ss << " DEBUG";
//#endif
// LOG_INFO(ss.str().c_str());
// glfwSetWindowTitle(window, ss.str().c_str());
//
// // Initialize GLEW
// if (glewInit() != GLEW_OK)
// {
// LOG_ERROR("GLEW: Initialization failed");
// return 1;
// }
//
// // Main loop
// while (!glfwWindowShouldClose(window))
// {
// glfwPollEvents();
// }
//
// return 0;
//}
+90
View File
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A9755CAA-62DC-442D-B82C-F548546CFD38}</ProjectGuid>
<RootNamespace>Executable</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<TargetName>$(SolutionName)-$(Configuration)</TargetName>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<TargetName>$(SolutionName)-$(Configuration)</TargetName>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>GLEW_STATIC;DEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>GLEW_STATIC;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Escape-the-Dawn\Escape-the-Dawn.vcxproj">
<Project>{fe405cfa-8fce-4867-92cf-797e73b36482}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
+10
View File
@@ -0,0 +1,10 @@
#include "Engine.h"
int main(int argc, char* argv[])
{
Engine engine(argc, argv);
while (engine.Running())
engine.Tick();
return EXIT_SUCCESS;
}
+2 -5
View File
@@ -42,11 +42,13 @@
<IncludePath>$(SolutionDir)\Escape-the-Dawn\;$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(BOOST_ROOT);$(IncludePath)</IncludePath>
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath)</LibraryPath>
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)\Escape-the-Dawn\;$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(BOOST_ROOT);$(IncludePath)</IncludePath>
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath)</LibraryPath>
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@@ -83,11 +85,6 @@
<ItemGroup>
<ProjectReference Include="..\Escape-the-Dawn\Escape-the-Dawn.vcxproj">
<Project>{fe405cfa-8fce-4867-92cf-797e73b36482}</Project>
<Private>true</Private>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+1 -1
View File
@@ -1,5 +1,5 @@
#include "World.h"
#include "Components/Transform.h"
#include "Components/TransformComponent.h"
#define BOOST_TEST_MODULE World
#define BOOST_TEST_DYN_LINK