Commit fa6c9f2b authored by Florian Oetke's avatar Florian Oetke
Browse files

added using the system SDL2 as an option; fixed some scan-build warnings

parent 166f5700
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
SET(BUILD_SHARED_LIBS FALSE CACHE BOOL "" FORCE)
add_subdirectory(asyncplusplus)
......@@ -24,7 +24,33 @@ include(plog_interface.cmake)
include(robin-map_interface.cmake)
include(doctest_interface.cmake)
add_subdirectory(SDL)
if (WIN32)
option(MIRRAGE_PREFER_SYSTEM_SDL "Try to find an already installed SDL2 on the system before building our own" OFF)
else()
option(MIRRAGE_PREFER_SYSTEM_SDL "Try to find an already installed SDL2 on the system before building our own" ON)
endif()
if(MIRRAGE_PREFER_SYSTEM_SDL)
find_package(SDL2 2.0.6)
if(SDL2_FOUND)
if(TARGET SDL2::SDL2)
set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_GLOBAL TRUE)
set_target_properties(SDL2::SDL2main PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(mirrage::deps::SDL2 ALIAS SDL2::SDL2)
add_library(mirrage::deps::SDL2main ALIAS SDL2::SDL2main)
else()
add_library(mirrage::deps::SDL2 INTERFACE IMPORTED)
set_property(TARGET mirrage::deps::SDL2 PROPERTY INTERFACE_LINK_LIBRARIES ${SDL2_LIBRARY})
set_property(TARGET mirrage::deps::SDL2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR})
endif()
endif()
endif()
if(NOT TARGET mirrage::deps::SDL2)
add_subdirectory(SDL)
add_library(mirrage::deps::SDL2 ALIAS SDL2-static)
add_library(mirrage::deps::SDL2main ALIAS SDL2main)
endif()
add_subdirectory(sf2)
......
......@@ -42,7 +42,7 @@ if (WIN32)
endif()
target_link_libraries(demo
PRIVATE
SDL2main
mirrage::deps::SDL2main
)
endif()
......
......@@ -45,7 +45,7 @@ target_include_directories(mirrage PUBLIC
target_link_libraries(mirrage
PUBLIC
mirrage::utils
SDL2-static
mirrage::deps::SDL2
mirrage::asset
mirrage::ecs
mirrage::graphic
......
......@@ -100,7 +100,7 @@ namespace mirrage::ecs {
h.revision(static_cast<uint8_t>(rev & ~Entity_handle::free_rev)); // mark as used
auto success = true;
auto cas = expected_rev;
auto cas = uint8_t(0);
do {
cas = expected_rev;
success = rev.compare_exchange_strong(cas, h.revision());
......
......@@ -47,7 +47,7 @@ target_link_libraries(mirrage_graphic
gsl
mirrage::asset
sf2
SDL2-static
mirrage::deps::SDL2
Vulkan::Vulkan
)
......
......@@ -30,7 +30,7 @@ target_link_libraries(mirrage_input
gsl
glm::glm
mirrage::asset
SDL2-static
mirrage::deps::SDL2
sf2
)
......
......@@ -134,18 +134,17 @@ namespace mirrage::renderer {
void to_dualquat(Final_bone_transform& inout)
{
// TODO: optimize
auto m2 = glm::mat4();
auto m2 = glm::mat4(1.f);
m2[0] = inout.lbs[0];
m2[1] = inout.lbs[1];
m2[2] = inout.lbs[2];
m2[3] = glm::vec4(0, 0, 0, 1);
m2[3] = glm::vec4(0.f, 0.f, 0.f, 1.f);
glm::vec3 scale;
glm::quat orientation;
glm::vec3 translation;
glm::vec3 skew;
glm::vec4 perspective;
auto scale = glm::vec3(1.f, 1.f, 1.f);
auto orientation = glm::quat(1.f, 0.f, 0.f, 0.f);
auto translation = glm::vec3(0.f, 0.f, 0.f);
auto skew = glm::vec3(0.f, 0.f, 0.f);
auto perspective = glm::vec4(0.f, 0.f, 0.f, 0.f);
glm::decompose(glm::transpose(m2), scale, orientation, translation, skew, perspective);
inout.dqs.dq = glm::dualquat(orientation, translation);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment