From 42db7ccd933174db637aa25098bf02c6f3010d0d Mon Sep 17 00:00:00 2001 From: Francois Carouge Date: Wed, 21 Dec 2022 21:58:04 -0800 Subject: [PATCH] [cmake] fix format target and document usage --- INSTALL.md | 27 ++++++++++++++++++++------- README.md | 7 ++++++- include/CMakeLists.txt | 3 ++- support/CMakeLists.txt | 3 +-- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 99e223905..356064262 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,16 +1,29 @@ # Installation -## From Repository Sources - -Install and use the library in your projects by cloning the repository, configuring, and installing the project on all platforms: +Download and install the [latest release package](https://github.com/FrancoisCarouge/Kalman/releases). Alternatively, you may install and use the library in your projects by cloning the repository, configuring, and installing the project: ```shell -git clone --depth 1 "https://github.com/FrancoisCarouge/Kalman.git" "kalman" +git clone --depth 1 "https://github.com/FrancoisCarouge/kalman.git" cmake -S "kalman" -B "build" cmake --build "build" --parallel sudo cmake --install "build" ``` +The standard shared CMake configuration file provides the library target to use in your own target: + +```cmake +find_package(kalman) +target_link_libraries(your_target PRIVATE kalman::kalman) +``` + +In your sources, include the library header and use the filter. See [the samples](https://github.com/FrancoisCarouge/Kalman/tree/develop/sample) for more. + +```cpp +#include "fcarouge/kalman.hpp" + +fcarouge::kalman filter; +``` + # Development Build & Run ## Tests & Samples @@ -18,7 +31,7 @@ sudo cmake --install "build" Build and run the tests and samples: ```shell -git clone --depth 1 "https://github.com/FrancoisCarouge/Kalman.git" "kalman" +git clone --depth 1 "https://github.com/FrancoisCarouge/kalman.git" cmake -S "kalman" -B "build" cmake --build "build" --config "Debug" --parallel ctest --test-dir "build" --build-config "Debug" --tests-regex "kalman_(test|sample)" --output-on-failure --parallel @@ -33,7 +46,7 @@ See the [Benchmark](benchmark/) section. ### Linux ```shell -git clone --depth 1 "https://github.com/FrancoisCarouge/Kalman.git" "kalman" +git clone --depth 1 "https://github.com/FrancoisCarouge/kalman.git" cmake -S "kalman" -B "build" cmake --build "build" --target "package" --parallel cmake --build "build" --target "package_source" --parallel @@ -42,7 +55,7 @@ cmake --build "build" --target "package_source" --parallel ### Windows ```shell -git clone --depth 1 "https://github.com/FrancoisCarouge/Kalman.git" "kalman" +git clone --depth 1 "https://github.com/FrancoisCarouge/kalman.git" cmake -S "kalman" -B "build" cmake --build "build" --target "package" --parallel --config "Release" cmake --build "build" --target "package_source" --parallel --config "Release" diff --git a/README.md b/README.md index 4f7bf68a1..47668cfef 100644 --- a/README.md +++ b/README.md @@ -150,12 +150,17 @@ filter.update(position_x, position_y, variometer); # Installation ```shell -git clone --depth 1 https://github.com/FrancoisCarouge/Kalman.git "kalman" +git clone --depth 1 https://github.com/FrancoisCarouge/kalman.git cmake -S "kalman" -B "build" cmake --build "build" --parallel sudo cmake --install "build" ``` +```cmake +find_package(kalman) +target_link_libraries(your_target PRIVATE kalman::kalman) +``` + [For more, see installation instructions](INSTALL.md). # Reference diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index fa47ce37b..09918ff18 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -78,7 +78,8 @@ target_sources( "fcarouge/kalman.hpp") target_compile_options(kalman INTERFACE ${OPTIONS}) target_compile_features(kalman INTERFACE cxx_std_23) -target_link_libraries(kalman INTERFACE $<$>:kalman_format>) +target_link_libraries( + kalman INTERFACE $>:kalman_format>>) install( TARGETS kalman EXPORT kalmanTargets diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt index 6f303a942..c6309e196 100644 --- a/support/CMakeLists.txt +++ b/support/CMakeLists.txt @@ -49,8 +49,7 @@ else() TARGETS kalman_format EXPORT kalmanTargets FILE_SET "kalman_format_headers" - DESTINATION "include/fcarouge" - ARCHIVE DESTINATION "lib/fcarouge") + DESTINATION "include/fcarouge") install( EXPORT kalmanTargets NAMESPACE kalman::