CMAKE Conditional compilation against DirectX and OpenGL targets
...just don't enable both, okay?
This commit is contained in:
+9
-3
@@ -4,7 +4,6 @@ project(daydream)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/deps/include")
|
||||
|
||||
|
||||
if(MINGW)
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/deps/lib/mingw/x64")
|
||||
elseif(MSVC)
|
||||
@@ -23,10 +22,17 @@ endif()
|
||||
|
||||
set(BUILD_SHARED_LIBS FALSE)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
option(BUILD_RENDERER_OPENGL "Build with OpenGL 4.4 renderer" ON)
|
||||
option(BUILD_RENDERER_DIRECTX "Build with DirectX 11 renderer" OFF)
|
||||
# Compiling for OpenGL target
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include/Rendering/OpenGL)
|
||||
if(BUILD_RENDERER_OPENGL)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include/Rendering/OpenGL)
|
||||
endif()
|
||||
# Compiling for DirectX target
|
||||
#include_directories(${PROJECT_SOURCE_DIR}/include/Rendering/DirectX)
|
||||
if(BUILD_RENDERER_DIRECTX)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include/Rendering/DirectX)
|
||||
endif()
|
||||
|
||||
#set(GLEW_INCLUDE_DIR ${daydream_SOURCE_DIR}/libs/glew-1.11.0/include)
|
||||
#set(GLEW_LIBRARY ${daydream_SOURCE_DIR}/libs/glew-1.11.0/lib/Release/glew32.lib)
|
||||
|
||||
+13
-2
@@ -104,8 +104,6 @@ set(SOURCE_FILES
|
||||
${SOURCE_FILES_Core_Util}
|
||||
${SOURCE_FILES_Input}
|
||||
${SOURCE_FILES_Rendering}
|
||||
${SOURCE_FILES_Rendering_OpenGL}
|
||||
#${SOURCE_FILES_Rendering_DirectX}
|
||||
${SOURCE_FILES_Transform}
|
||||
${SOURCE_FILES_Physics}
|
||||
${SOURCE_FILES_Game}
|
||||
@@ -114,6 +112,19 @@ set(SOURCE_FILES
|
||||
${SOURCE_FILES_GUI}
|
||||
)
|
||||
|
||||
|
||||
if(BUILD_RENDERER_OPENGL)
|
||||
set(SOURCE_FILES ${SOURCE_FILES}
|
||||
${SOURCE_FILES_Rendering_OpenGL}
|
||||
)
|
||||
endif()
|
||||
# Compiling for DirectX target
|
||||
if(BUILD_RENDERER_DIRECTX)
|
||||
set(SOURCE_FILES ${SOURCE_FILES}
|
||||
${SOURCE_FILES_Rendering_DirectX}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
|
||||
|
||||
@@ -45,7 +45,7 @@ void dd::Renderer::Initialize()
|
||||
glGetIntegerv(GL_MINOR_VERSION, &m_GLVersion[1]);
|
||||
m_GLVendor = (GLchar*)glGetString(GL_VENDOR);
|
||||
std::stringstream ss;
|
||||
ss << m_GLVendor << " OpenGL " << m_GLVersion[0] << "." << m_GLVersion[1];
|
||||
ss << "Squidout! (" << m_GLVendor << " OpenGL " << m_GLVersion[0] << "." << m_GLVersion[1] << ")";
|
||||
#ifdef DEBUG
|
||||
ss << " DEBUG";
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user