mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Merge pull request #49 from orange-cpp/feature/legacy_option
Adds option to enable legacy classes
This commit is contained in:
@@ -14,6 +14,8 @@ option(OMATH_BUILD_EXAMPLES "Build example projects with you can learn & play" O
|
||||
option(OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OFF)
|
||||
option(OMATH_SUPRESS_SAFETY_CHECKS "Supress some safety checks in release build to improve general performance" ON)
|
||||
option(OMATH_USE_UNITY_BUILD "Will enable unity build to speed up compilation" ON)
|
||||
option(OMATH_ENABLE_LEGACY "Will enable legacy classes that MUST be used ONLY for backward compatibility" OFF)
|
||||
|
||||
|
||||
file(GLOB_RECURSE OMATH_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")
|
||||
file(GLOB_RECURSE OMATH_HEADERS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp")
|
||||
@@ -56,6 +58,10 @@ if (OMATH_SUPRESS_SAFETY_CHECKS)
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC OMATH_SUPRESS_SAFETY_CHECKS)
|
||||
endif ()
|
||||
|
||||
if (OMATH_ENABLE_LEGACY)
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC OMATH_ENABLE_LEGACY)
|
||||
endif ()
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef OMATH_ENABLE_LEGACY
|
||||
|
||||
#include "omath/vector3.hpp"
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
@@ -106,3 +109,4 @@ namespace omath
|
||||
std::unique_ptr<float[]> m_data;
|
||||
};
|
||||
} // namespace omath
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#ifdef OMATH_ENABLE_LEGACY
|
||||
|
||||
#include "omath/matrix.hpp"
|
||||
#include "omath/angles.hpp"
|
||||
#include "omath/vector3.hpp"
|
||||
@@ -359,3 +361,4 @@ namespace omath
|
||||
m_data = nullptr;
|
||||
}
|
||||
} // namespace omath
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//
|
||||
// Created by vlad on 5/18/2024.
|
||||
//
|
||||
|
||||
#ifdef OMATH_ENABLE_LEGACY
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <omath/matrix.hpp>
|
||||
#include "omath/vector3.hpp"
|
||||
@@ -177,4 +180,5 @@ TEST_F(UnitTestMatrix, AssignmentOperator_Move)
|
||||
EXPECT_FLOAT_EQ(m3.at(0, 0), 1.0f);
|
||||
EXPECT_EQ(m2.row_count(), 0); // m2 should be empty after the move
|
||||
EXPECT_EQ(m2.columns_count(), 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user