diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6b95c9222dfc3e7b61ee84f4d54058f15598690b..ec36cf329342b27d551fa2553167600ea3959836 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -172,8 +172,7 @@ test:linux:gcc4.9.2: - build:linux:gcc4.9.2 script: - cd build - - make test - + - make test test:linux:gcc5.3.1: stage: test tags: diff --git a/CMakeLists.txt b/CMakeLists.txt index 051e945ae6664a3d0b3c9e6084ee15b7622634fb..a3773b907c971c58ea42b33e468d5619c4839802 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ project(ProjectPhoenix) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) set(CMAKE_CXX_STANDARD 14) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/lib) # needs to be first since other scripts might rely on this include(ConanHelpers) diff --git a/cmake/Testing.cmake b/cmake/Testing.cmake index b80bab2232c0aac8b51177182ec51be6d7b28d0f..b10da87d4cca86664ac6ac12cbdb98b86f32edd8 100644 --- a/cmake/Testing.cmake +++ b/cmake/Testing.cmake @@ -36,7 +36,7 @@ function(CONFIGURE_MSVC_USERFILE TARGET_NAME PATH_TO_ADD) "${CMAKE_SOURCE_DIR}/cmake/VisualStudio2013.vcxproj.user.in") set(DESTINATION_USER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.vcxproj.user") - message("DESTINATION_USER_FILE: ${DESTINATION_USER_FILE}") + message(STATUS "DESTINATION_USER_FILE: ${DESTINATION_USER_FILE}") configure_file(${SOURCE_USER_FILE} ${DESTINATION_USER_FILE} @ONLY) endfunction() diff --git a/conanfile.py b/conanfile.py index 56a20dca056913e1b2051bcc56e0abc544fb8d56..21c3754e42c90869b3474d87fbc612aa3d097633 100644 --- a/conanfile.py +++ b/conanfile.py @@ -34,3 +34,20 @@ class ProjectPhoenix(ConanFile): ("SDL2/2.0.5@RWTH-VR/thirdparty"), ("trompeloeil/v25@rollbear/stable")) # comma separated list of requirements generators = "cmake" + + def configure(self): + self.options["glew"].shared = True + + def imports(self): + self.copy("*.dll", dst="lib", src="bin") + #since cmake cannot easily tell Visual Studio where to find the dlls we have to do the following + self.copy("*.dll", dst="tests/Debug", src="bin") + self.copy("*.dll", dst="tests/Release", src="bin") + self.copy("*.dll", dst="demos/viewer/Debug", src="bin") + self.copy("*.dll", dst="demos/viewer/Release", src="bin") + self.copy("*.so", dst="lib", src="lib") + if self.settings.os == "Linux": + self.run("ln -s libGLEW.so lib/libGLEW.so.2.1") + + + diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index a46f99a6a551f46325346ae1327f60c239b57992..b294c7fb5ae25455b66a7952c4da227a9bb9e8ce 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -26,18 +26,18 @@ add_library(phoenix ${PHOENIX_SOURCES} ${PHOENIX_HEADERS} ) + target_include_directories(phoenix PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_BINARY_DIR} - PUBLIC ${GLEW_INCLUDE_DIRS} - PUBLIC ${OPENGL_INCLUDE_DIR} + PUBLIC ${OPENGL_INCLUDE_DIR} ) target_link_libraries(phoenix ${CONAN_OR_CMAKE_glm} ${CONAN_OR_CMAKE_SDL2} - ${CONAN_OR_CMAKE_glew} ${OPENGL_LIBRARIES} + ${CONAN_OR_CMAKE_glew} ) generate_export_header(phoenix diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9869f325637ff8973ba9273fa136392227ae383b..088567dff006e493bee8ab03516ab2fe1f1007f9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -46,13 +46,20 @@ add_test_cpplint(NAME "phoenix-tests--cpplint" ${PHOENIX_TEST_UTILITIES_HEADERS} ) +#get the include directories +get_target_property(glew_include_directories + ${CONAN_OR_CMAKE_glew} INTERFACE_INCLUDE_DIRECTORIES) +get_target_property(phoenix_include_directories + phoenix INCLUDE_DIRECTORIES) +get_target_property(sdl2_include_directories + ${CONAN_OR_CMAKE_SDL2} INTERFACE_INCLUDE_DIRECTORIES) + +# generate opengl_mock add_library(opengl_mock SHARED src/mocks/open_gl_mock.cpp src/mocks/open_gl_mock.hpp ) -get_target_property(glew_include_directories - ${CONAN_OR_CMAKE_glew} INTERFACE_INCLUDE_DIRECTORIES) target_include_directories(opengl_mock PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src PUBLIC ${glew_include_directories}) @@ -91,9 +98,6 @@ add_test_cpplint(NAME "test_clear_pass--cpplint" set_warning_levels_rwth(test_clear_pass) # make shure linker dependency injection works -get_target_property(phoenix_include_directories phoenix INCLUDE_DIRECTORIES) -get_target_property(glew_include_directories - ${CONAN_OR_CMAKE_glew} INTERFACE_INCLUDE_DIRECTORIES) target_include_directories(test_clear_pass PRIVATE ${phoenix_include_directories} PRIVATE ${glew_include_directories} @@ -127,9 +131,6 @@ add_test_cpplint(NAME "test_geometry_pass--cpplint" set_warning_levels_rwth(test_geometry_pass) # make shure linker dependency injection works -get_target_property(phoenix_include_directories phoenix INCLUDE_DIRECTORIES) -get_target_property(glew_include_directories - ${CONAN_OR_CMAKE_glew} INTERFACE_INCLUDE_DIRECTORIES) target_include_directories(test_geometry_pass PRIVATE ${phoenix_include_directories} PRIVATE ${glew_include_directories} @@ -165,10 +166,6 @@ add_test_cpplint(NAME "rendering_system--cpplint" set_warning_levels_rwth(test_rendering_system) # make shure linker dependency injection works -get_target_property(phoenix_include_directories phoenix INCLUDE_DIRECTORIES) -get_target_property(glew_include_directories - ${CONAN_OR_CMAKE_glew} INTERFACE_INCLUDE_DIRECTORIES) -get_target_property(sdl2_include_directories ${CONAN_OR_CMAKE_SDL2} INTERFACE_INCLUDE_DIRECTORIES) target_include_directories(test_rendering_system PRIVATE ${phoenix_include_directories} PRIVATE ${glew_include_directories} @@ -206,17 +203,11 @@ add_test_cpplint(NAME "test_window--cpplint" set_warning_levels_rwth(test_window) # make shure linker dependency injection works -get_target_property(phoenix_include_directories__test_window phoenix INCLUDE_DIRECTORIES) -if(TARGET ${CONAN_OR_CMAKE_SDL2}) - get_target_property(sdl2_include_directories__test_window ${CONAN_OR_CMAKE_SDL2} INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(test_window - PRIVATE ${sdl2_include_directories__test_window} -) -endif() target_include_directories(test_window - PRIVATE ${phoenix_include_directories__test_window} + PRIVATE ${phoenix_include_directories} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - PRIVATE ${CONAN_OR_CMAKE_SDL2}) + PRIVATE ${CONAN_OR_CMAKE_SDL2} + PRIVATE ${sdl2_include_directories}) get_target_property(phoenix_link_libraries__test_window phoenix LINK_LIBRARIES) list(REMOVE_ITEM phoenix_link_libraries__test_window ${CONAN_OR_CMAKE_SDL2}) diff --git a/tests/src/test_geometry_pass.cpp b/tests/src/test_geometry_pass.cpp index b743d88e216826f289f4b5ef6aabc73637e64e93..f292403e307173e28cd048029fabbeb498f31e65 100644 --- a/tests/src/test_geometry_pass.cpp +++ b/tests/src/test_geometry_pass.cpp @@ -26,13 +26,12 @@ SUPPRESS_WARNINGS_BEGIN #include "GL/glew.h" -SUPPRESS_WARNINGS_END - -#include "phx/geometry_pass.hpp" #include "trompeloeil.hpp" +SUPPRESS_WARNINGS_END #include "mocks/open_gl_mock.hpp" +#include "phx/geometry_pass.hpp" extern template struct trompeloeil::reporter<trompeloeil::specialized>; @@ -40,9 +39,9 @@ SCENARIO( "The geometry pass collects all vertices in one vector and draws them.", "[phx][phx::GeometryPass]") { OPENGL_MOCK_ALLOW_ANY_CALL - const GLuint vertex_buffer_id = 1; - const GLuint normal_buffer_id = 2; - const GLuint index_buffer_id = 3; + const GLuint vertex_buffer_id = 1u; + const GLuint normal_buffer_id = 2u; + const GLuint index_buffer_id = 3u; GIVEN("A geometry pass") { phx::GeometryPass geometryPass; @@ -161,7 +160,9 @@ SCENARIO( } THEN("it creates one vertex array, three buffers, and assigns them") { - REQUIRE_CALL(open_gl_mock, glCreateVertexArrays(1, _)).TIMES(1); + REQUIRE_CALL(open_gl_mock, glCreateVertexArrays(1, _)) + .TIMES(1) + .SIDE_EFFECT(*_2 = 1); trompeloeil::sequence seq; REQUIRE_CALL(open_gl_mock, glCreateBuffers(1, _)) .TIMES(1)