Fix included glm target

This commit is contained in:
Stephen Seo 2021-08-25 11:18:22 +09:00
parent bb6a05f191
commit 8c554fece8
3 changed files with 13 additions and 19 deletions

View file

@ -31,7 +31,13 @@ find_package(Threads REQUIRED)
target_link_libraries(Example02 PUBLIC ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(Example02 PUBLIC ${CMAKE_THREAD_LIBS_INIT})
find_package(glm REQUIRED) find_package(glm REQUIRED)
if(TARGET glm::glm)
get_target_property(GLM_INCLUDE_DIRS glm::glm INTERFACE_INCLUDE_DIRECTORIES)
elseif(TARGET glm)
get_target_property(GLM_INCLUDE_DIRS glm INTERFACE_INCLUDE_DIRECTORIES) get_target_property(GLM_INCLUDE_DIRS glm INTERFACE_INCLUDE_DIRECTORIES)
else()
message(FATAL_ERROR "Failed to set up glm for project")
endif()
target_include_directories(Example02 PUBLIC ${GLM_INCLUDE_DIRS}) target_include_directories(Example02 PUBLIC ${GLM_INCLUDE_DIRS})
find_program(CLANG_FORMAT "clang-format") find_program(CLANG_FORMAT "clang-format")

View file

@ -5,15 +5,9 @@
#include <fstream> #include <fstream>
#include <thread> #include <thread>
#ifdef __MINGW32__
# include "/usr/include/glm/ext/matrix_transform.hpp"
# include "/usr/include/glm/gtc/matrix_transform.hpp"
# include "/usr/include/glm/matrix.hpp"
#else
#include <glm/ext/matrix_transform.hpp> #include <glm/ext/matrix_transform.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/matrix.hpp> #include <glm/matrix.hpp>
#endif
const float PI = std::acos(-1.0F); const float PI = std::acos(-1.0F);

View file

@ -12,15 +12,9 @@ constexpr float EX02_RAY_TRACER_GRAY_SPHERE_RADIUS = 1.5F;
#include <tuple> #include <tuple>
#include <vector> #include <vector>
#ifdef __MINGW32__
# include "/usr/include/glm/mat4x4.hpp"
# include "/usr/include/glm/matrix.hpp"
# include "/usr/include/glm/vec3.hpp"
#else
#include <glm/mat4x4.hpp> #include <glm/mat4x4.hpp>
#include <glm/matrix.hpp> #include <glm/matrix.hpp>
#include <glm/vec3.hpp> #include <glm/vec3.hpp>
#endif
namespace Ex02::RT { namespace Ex02::RT {