Skip to content

Commit

Permalink
[cmake] experimental modules
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisCarouge committed Oct 21, 2023
1 parent 57b36a9 commit 399c686
Show file tree
Hide file tree
Showing 54 changed files with 83 additions and 69 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org> ]]

cmake_minimum_required(VERSION "3.24")
cmake_minimum_required(VERSION "3.28")

project(
kalman
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ 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/master/sample) for more.

```cpp
#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

fcarouge::kalman filter;
```
Expand Down
2 changes: 1 addition & 1 deletion benchmark/predict_1x1x0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "benchmark.hpp"
#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <benchmark/benchmark.h>

Expand Down
2 changes: 1 addition & 1 deletion benchmark/predict_1x1x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "benchmark.hpp"
#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <benchmark/benchmark.h>

Expand Down
4 changes: 2 additions & 2 deletions benchmark/predict_linalg_x1x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ For more information, please refer to <https://unlicense.org> */

#include "benchmark.hpp"
#include "fcarouge/internal/utility.hpp"
#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <benchmark/benchmark.h>

Expand Down
2 changes: 1 addition & 1 deletion benchmark/update_1x1x0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "benchmark.hpp"
#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <benchmark/benchmark.h>

Expand Down
2 changes: 1 addition & 1 deletion benchmark/update_1x1x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "benchmark.hpp"
#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <benchmark/benchmark.h>

Expand Down
4 changes: 2 additions & 2 deletions benchmark/update_linalg_xx0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ For more information, please refer to <https://unlicense.org> */

#include "benchmark.hpp"
#include "fcarouge/internal/utility.hpp"
#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <benchmark/benchmark.h>

Expand Down
10 changes: 10 additions & 0 deletions cmake/gcc_modules.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
string(
CONCAT
CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE
"<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E -x c++ <SOURCE> -MT"
" <DYNDEP_FILE> -MD -MF <DEP_FILE> -fmodules-ts -fdep-file=<DYNDEP_FILE>"
" -fdep-output=<OBJECT> -fdep-format=trtbd -o <PREPROCESSED_SOURCE>")
set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "gcc")
set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG
"-fmodules-ts -fmodule-mapper=<MODULE_MAP_FILE> -fdep-format=trtbd -x c++")
6 changes: 5 additions & 1 deletion include/fcarouge/kalman.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ For more information, please refer to <https://unlicense.org> */
//! utilities, and documentation. Only this header file is intended for
//! inclusion in third party software.

module;

#include "algorithm.hpp"
#include "internal/format.hpp"
#include "internal/kalman.hpp"
Expand All @@ -57,6 +59,8 @@ For more information, please refer to <https://unlicense.org> */
#include <type_traits>
#include <utility>

export module fcarouge.kalman;

namespace fcarouge {
//! @brief A generic Kalman filter.
//!
Expand Down Expand Up @@ -160,7 +164,7 @@ namespace fcarouge {
//! @todo Can we implement Temporal Parallelization of Bayesian Smoothers, Simo
//! Sarkka, Senior Member, IEEE, Angel F. Garc ıa-Fernandez,
//! https://arxiv.org/pdf/1905.13002.pdf ?
template <typename State = double, typename Output = double,
export template <typename State = double, typename Output = double,
typename Input = void, typename UpdateTypes = empty_pack,
typename PredictionTypes = empty_pack>
class kalman final {
Expand Down
4 changes: 2 additions & 2 deletions sample/ekf_4x1x0_soaring.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion sample/kf_1x1x0_building_height.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "fcarouge/kalman.hpp"
import kalman;

#include <cassert>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion sample/kf_1x1x0_liquid_temperature.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <cassert>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion sample/kf_1x1x1_dog_position.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <cassert>
#include <cmath>
Expand Down
4 changes: 2 additions & 2 deletions sample/kf_2x1x1_rocket_altitude.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>
#include <chrono>
Expand Down
4 changes: 2 additions & 2 deletions sample/kf_6x2x0_vehicle_location.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>
#include <cmath>
Expand Down
4 changes: 2 additions & 2 deletions sample/kf_8x4x0_deep_sort_bounding_box.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion test/kalman_constructor_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_constructor_default_1x1x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_constructor_default_1x4x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_constructor_default_1x4x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_constructor_default_5x1x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_constructor_default_5x1x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_constructor_default_5x4x0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_constructor_default_5x4x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_constructor_default_5x4x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/kalman_constructor_default_float_1x1x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/kalman_f.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_f_5x4x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/kalman_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <cassert>
#include <format>
Expand Down
2 changes: 1 addition & 1 deletion test/kalman_format_arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <cassert>
#include <format>
Expand Down
2 changes: 1 addition & 1 deletion test/kalman_format_float_1x1x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <cassert>
#include <format>
Expand Down
2 changes: 1 addition & 1 deletion test/kalman_h.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
import fcarouge.kalman;

#include <cassert>

Expand Down
4 changes: 2 additions & 2 deletions test/kalman_h_5x4x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/kalman.hpp"
#include "fcarouge/linalg.hpp"
import fcarouge.kalman;
import fcarouge.linalg;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/linalg_addition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/linalg.hpp"
import fcarouge.linalg;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/linalg_assign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/linalg.hpp"
import fcarouge.linalg;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/linalg_constructor_1x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/linalg.hpp"
import fcarouge.linalg;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/linalg_constructor_1x1_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/linalg.hpp"
import fcarouge.linalg;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/linalg_constructor_1xn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/linalg.hpp"
import fcarouge.linalg;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/linalg_constructor_1xn_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/linalg.hpp"
import fcarouge.linalg;

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion test/linalg_constructor_initializer_lists.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */

#include "fcarouge/linalg.hpp"
import fcarouge.linalg;

#include <cassert>

Expand Down
Loading

0 comments on commit 399c686

Please sign in to comment.