Skip to content

Commit

Permalink
Continue major restructure of the project
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinzii committed Mar 17, 2024
1 parent ba50c78 commit 3fe1727
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 15 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ option(CCMATH_BUILD_EXAMPLES "Build ccmath examples" ${is_root_project})
option(CCMATH_BUILD_BENCHMARKS "Build ccmath benchmarks" ${is_root_project})
option(CCMATH_INSTALL "Setup install and package steps" ${is_root_project})
option(CCMATH_USE_SIMD "Use SIMD instructions" OFF) # SIMD is not yet implemented.
option(CCMATH_ENABLE_EXTENSIONS "Enable the extended ccmath library that adds helpful additional methods that are not defined by the standard" ON)

# include the global configuration file
include(cmake/GlobalConfig.cmake)
Expand All @@ -31,12 +32,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
-Wall -Wextra -Wpedantic -Wconversion -Werror=return-type
)
# TODO: Remove this later.
# Some variables have been provided but are not currently being used, but it would not atm make sense to remove them.
# So to clean up the warnings we are just silencing these specific cases.
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
-Wno-unused-but-set-variable -Wno-unused-value
)
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
Expand All @@ -52,6 +47,11 @@ add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

target_sources(${PROJECT_NAME} INTERFACE "$<BUILD_INTERFACE:${ccmath_headers}>")

if (CCMATH_ENABLE_EXTENSIONS)
include(ccmath_extensions_headers.cmake)
target_sources(${PROJECT_NAME} INTERFACE "$<BUILD_INTERFACE:${ccmath_extensions_headers}>")
endif()

target_include_directories(${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>)
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)

Expand Down
6 changes: 6 additions & 0 deletions ccmath_extensions_headers.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


set(ccmath_extensions_headers
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/extensions/slerp.hpp

)
9 changes: 0 additions & 9 deletions include/ccmath/extensions/slerp.h

This file was deleted.

31 changes: 31 additions & 0 deletions include/ccmath/extensions/slerp.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024-Present Ian Pike
* Copyright (c) 2024-Present ccmath contributors
*
* This library is provided under the MIT License.
* See LICENSE for more information.
*/

#pragma once

#include "ccmath/math/exponential/exp2.hpp"

namespace ccm::ext
{
/**
* @brief Frame rate independent linear interpolation smoothing.
* @tparam T Type of the input and output.
* @param a Current value.
* @param b Target value.
* @param t Delta time, in seconds.
* @param h Half-life, time until halfway, in seconds.
* @return The smoothed value.
*
* @warning Currently waiting on ccm::exp2 to be implemented. Till then this will NOT work.
*/
template<typename T>
inline constexpr T slerp(T a, T b, T t, T h)
{
return b + (a - b) * ccm::exp2<T>(-t / h);
}
} // namespace ccm::ext
5 changes: 5 additions & 0 deletions include/ccmath/math/exponential/exp2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@

namespace ccm
{
template<typename T>
inline constexpr T exp2(T x)
{
return 0;
}

} // namespace ccm

0 comments on commit 3fe1727

Please sign in to comment.