Skip to content

Commit 8e41177

Browse files
committed
Adds option to enable legacy classes
Introduces a CMake option to enable legacy classes, allowing for backward compatibility with older code. This ensures that older codebases can still function while new development can utilize updated classes.
1 parent d65852d commit 8e41177

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ option(OMATH_BUILD_EXAMPLES "Build example projects with you can learn & play" O
1414
option(OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OFF)
1515
option(OMATH_SUPRESS_SAFETY_CHECKS "Supress some safety checks in release build to improve general performance" ON)
1616
option(OMATH_USE_UNITY_BUILD "Will enable unity build to speed up compilation" ON)
17+
option(OMATH_ENABLE_LEGACY "Will enable legacy classes that MUST be used ONLY for backward compatibility" OFF)
18+
1719

1820
file(GLOB_RECURSE OMATH_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")
1921
file(GLOB_RECURSE OMATH_HEADERS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp")
@@ -56,6 +58,10 @@ if (OMATH_SUPRESS_SAFETY_CHECKS)
5658
target_compile_definitions(${PROJECT_NAME} PUBLIC OMATH_SUPRESS_SAFETY_CHECKS)
5759
endif ()
5860

61+
if (OMATH_ENABLE_LEGACY)
62+
target_compile_options(${PROJECT_NAME} PUBLIC OMATH_ENABLE_LEGACY)
63+
endif ()
64+
5965
set_target_properties(${PROJECT_NAME} PROPERTIES
6066
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
6167
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"

include/omath/matrix.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#pragma once
2+
3+
#ifdef OMATH_ENABLE_LEGACY
4+
25
#include "omath/vector3.hpp"
36
#include <initializer_list>
47
#include <memory>
@@ -106,3 +109,4 @@ namespace omath
106109
std::unique_ptr<float[]> m_data;
107110
};
108111
} // namespace omath
112+
#endif

source/matrix.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifdef OMATH_ENABLE_LEGACY
2+
13
#include "omath/matrix.hpp"
24
#include "omath/angles.hpp"
35
#include "omath/vector3.hpp"
@@ -359,3 +361,4 @@ namespace omath
359361
m_data = nullptr;
360362
}
361363
} // namespace omath
364+
#endif

0 commit comments

Comments
 (0)