fixup! CMAKE Conditional compilation against DirectX and OpenGL targets

This commit is contained in:
2015-10-20 15:39:12 +02:00
parent d197ec07ad
commit 14b4fd9813
3 changed files with 21 additions and 25 deletions
+1
View File
@@ -31,6 +31,7 @@ if(BUILD_RENDERER_OPENGL)
endif() endif()
# Compiling for DirectX target # Compiling for DirectX target
if(BUILD_RENDERER_DIRECTX) if(BUILD_RENDERER_DIRECTX)
add_definitions(-DBUILD_RENDERER_DIRECTX)
include_directories(${PROJECT_SOURCE_DIR}/include/Rendering/DirectX) include_directories(${PROJECT_SOURCE_DIR}/include/Rendering/DirectX)
endif() endif()
+5 -3
View File
@@ -29,9 +29,11 @@
#define GLFW_INCLUDE_GLU #define GLFW_INCLUDE_GLU
#define NOMINMAX #define NOMINMAX
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32 #ifdef BUILD_RENDERER_DIRECTX
#define GLFW_EXPOSE_NATIVE_WGL #define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h> #define GLFW_EXPOSE_NATIVE_WGL
#include <GLFW/glfw3native.h>
#endif
#include <glext.h> #include <glext.h>
#include "Core/Util/GLError.h" #include "Core/Util/GLError.h"
+15 -22
View File
@@ -112,6 +112,17 @@ set(SOURCE_FILES
${SOURCE_FILES_GUI} ${SOURCE_FILES_GUI}
) )
set(LIBRARIES
${OPENGL_LIBRARIES}
${GLEW_LIBRARIES}
${GLFW_LIBRARIES}
${Boost_LIBRARIES}
${assimp_LIBRARIES}
${PNG_LIBRARIES}
${X11_LIBRARIES}
${OPENAL_LIBRARY}
${liquidfun_LIBRARIES}
)
if(BUILD_RENDERER_OPENGL) if(BUILD_RENDERER_OPENGL)
set(SOURCE_FILES ${SOURCE_FILES} set(SOURCE_FILES ${SOURCE_FILES}
@@ -123,6 +134,9 @@ if(BUILD_RENDERER_DIRECTX)
set(SOURCE_FILES ${SOURCE_FILES} set(SOURCE_FILES ${SOURCE_FILES}
${SOURCE_FILES_Rendering_DirectX} ${SOURCE_FILES_Rendering_DirectX}
) )
set(LIBRARIES ${LIBRARIES}
${CMAKE_LIBRARY_PATH}/DirectXTK.lib
)
endif() endif()
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
@@ -132,33 +146,12 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif() endif()
add_library(game ${SOURCE_FILES}) add_library(game ${SOURCE_FILES})
target_link_libraries(game
${OPENGL_LIBRARIES}
${GLEW_LIBRARIES}
${GLFW_LIBRARIES}
${Boost_LIBRARIES}
${assimp_LIBRARIES}
${PNG_LIBRARIES}
${X11_LIBRARIES}
${OPENAL_LIBRARY}
${liquidfun_LIBRARIES}
${CMAKE_LIBRARY_PATH}/DirectXTK.lib
)
add_executable(breakout add_executable(breakout
main.cpp main.cpp
) )
target_link_libraries(breakout target_link_libraries(breakout
game game
${OPENGL_LIBRARIES} ${LIBRARIES}
${GLEW_LIBRARIES}
${GLFW_LIBRARIES}
${Boost_LIBRARIES}
${assimp_LIBRARIES}
${PNG_LIBRARIES}
${X11_LIBRARIES}
${OPENAL_LIBRARY}
${liquidfun_LIBRARIES}
${CMAKE_LIBRARY_PATH}/DirectXTK.lib
) )