Skip to content

Commit

Permalink
[units] add mp-units library
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisCarouge committed Dec 25, 2024
1 parent bd5e406 commit 3dc50d4
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ jobs:
-I support/eigen \
-I support/generator \
-I support/lazy \
-I support/mp_units \
-I support/naive \
.
1 change: 1 addition & 0 deletions support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ For more information, please refer to <https://unlicense.org> ]]

add_subdirectory("eigen")
add_subdirectory("main")
add_subdirectory("mp_units")
add_subdirectory("naive")

add_library(kalman_options INTERFACE)
Expand Down
71 changes: 71 additions & 0 deletions support/mp_units/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#[[ __ _ __ __ _ _
| |/ / /\ | | | \/ | /\ | \ | |
| ' / / \ | | | \ / | / \ | \| |
| < / /\ \ | | | |\/| | / /\ \ | . ` |
| . \ / ____ \| |____| | | |/ ____ \| |\ |
|_|\_\/_/ \_\______|_| |_/_/ \_\_| \_|
Kalman Filter
Version 0.4.0
https://github.com/FrancoisCarouge/Kalman
SPDX-License-Identifier: Unlicense
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> ]]

include(FetchContent)

FetchContent_Declare(
fmt
GIT_REPOSITORY "https://github.com/fmtlib/fmt"
GIT_SHALLOW TRUE
FIND_PACKAGE_ARGS NAMES fmt)
FetchContent_MakeAvailable(fmt)

FetchContent_Declare(
gsl-lite
GIT_REPOSITORY "https://github.com/gsl-lite/gsl-lite"
GIT_SHALLOW TRUE
FIND_PACKAGE_ARGS NAMES gsl-lite)
FetchContent_MakeAvailable(gsl-lite)

FetchContent_Declare(
mp-units
GIT_REPOSITORY "https://github.com/mpusz/mp-units"
GIT_SHALLOW TRUE
SOURCE_SUBDIR "src" FIND_PACKAGE_ARGS NAMES mp-units)
FetchContent_MakeAvailable(mp-units)

target_compile_options(mp-units INTERFACE $<IF:$<CXX_COMPILER_ID:MSVC>, ,
-Wno-double-promotion>)
target_compile_options(mp-units INTERFACE $<IF:$<CXX_COMPILER_ID:MSVC>, ,
-Wno-undef>)

add_library(kalman_unit_mp_units INTERFACE)
target_sources(
kalman_unit_mp_units INTERFACE FILE_SET "unit_headers" TYPE "HEADERS" FILES
"fcarouge/unit.hpp")
target_link_libraries(kalman_unit_mp_units INTERFACE mp-units::mp-units)
55 changes: 55 additions & 0 deletions support/mp_units/fcarouge/unit.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* __ _ __ __ _ _
| |/ / /\ | | | \/ | /\ | \ | |
| ' / / \ | | | \ / | / \ | \| |
| < / /\ \ | | | |\/| | / /\ \ | . ` |
| . \ / ____ \| |____| | | |/ ____ \| |\ |
|_|\_\/_/ \_\______|_| |_/_/ \_\_| \_|
Kalman Filter
Version 0.4.0
https://github.com/FrancoisCarouge/Kalman
SPDX-License-Identifier: Unlicense
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#ifndef FCAROUGE_UNIT_HPP
#define FCAROUGE_UNIT_HPP

//! @file
//! @brief Quantities and units facade for mp-units third party implementation.
//!
//! @details Supporting quantities, values, and functions.

#include <mp-units/framework/quantity.h>

namespace fcarouge {
//! @brief The physical unit quantity.
template <auto Reference, typename Representation>
using quantity = mp_units::quantity<Reference, Representation>;
} // namespace fcarouge

#endif // FCAROUGE_UNIT_HPP

0 comments on commit 3dc50d4

Please sign in to comment.