Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[module] import standard module support #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
fail-fast: false
matrix:
include:
- { os: 'ubuntu-24.04', cxx: 'clang++-18', cc: 'clang-18', generator: 'Unix Makefiles', packages: 'clang-18' }
- { os: 'ubuntu-24.04', cxx: 'g++-14', cc: 'gcc-14', generator: 'Unix Makefiles', packages: 'g++-14' }
- { os: 'ubuntu-24.04', cxx: 'clang++-18', cc: 'clang-18', generator: 'Ninja', packages: 'clang-18' }
- { os: 'ubuntu-24.04', cxx: 'clang++-19', cc: 'clang-19', generator: 'Ninja', packages: 'clang-19' }
- { os: 'ubuntu-24.04', cxx: 'g++-14', cc: 'gcc-14', generator: 'Ninja', packages: 'g++-14' }
- { os: 'windows-latest', cxx: 'cl', cc: 'cl', generator: 'Ninja', config: 'Debug' }
- { os: 'windows-latest', cxx: 'cl', cc: 'cl', generator: 'Ninja', config: 'Release' }
name: '${{ matrix.os }} / ${{ matrix.cxx }} / ${{ matrix.generator }} / ${{ matrix.config }}'
Expand All @@ -32,6 +33,15 @@ jobs:
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: 'Install: MSVC'
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: 'Install Ninja'
if: ${{ matrix.os == 'ubuntu-24.04' }}
run: sudo apt install ninja-build
- name: 'Install: Clang 19'
if: ${{ matrix.cxx == 'clang++-19' }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19 all
- name: 'Configure'
env:
CXX: '${{ matrix.cxx }}'
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ project(
VERSION "0.4.0")

set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_MODULE_STD ON)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
set(CPACK_PACKAGE_CHECKSUM "SHA512")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
Expand Down
5 changes: 2 additions & 3 deletions benchmark/baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ For more information, please refer to <https://unlicense.org> */

#include "benchmark.hpp"

#include <benchmark/benchmark.h>
import std;

#include <algorithm>
#include <chrono>
#include <benchmark/benchmark.h>

namespace fcarouge::benchmark {
namespace {
Expand Down
3 changes: 1 addition & 2 deletions benchmark/include/benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ For more information, please refer to <https://unlicense.org> */
//! @file
//! @brief Benchmarking support.

#include <chrono>
#include <type_traits>
import std;

namespace fcarouge::benchmark {
//! @brief Type of the platform steady benchmark clock.
Expand Down
3 changes: 1 addition & 2 deletions benchmark/predict_1x1x0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ For more information, please refer to <https://unlicense.org> */

#include <benchmark/benchmark.h>

#include <algorithm>
#include <chrono>
import std;

namespace fcarouge::benchmark {
namespace {
Expand Down
4 changes: 1 addition & 3 deletions benchmark/predict_1x1x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ For more information, please refer to <https://unlicense.org> */

#include <benchmark/benchmark.h>

#include <algorithm>
#include <chrono>
#include <random>
import std;

namespace fcarouge::benchmark {
namespace {
Expand Down
8 changes: 1 addition & 7 deletions benchmark/predict_linalg_x1x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ For more information, please refer to <https://unlicense.org> */

#include <benchmark/benchmark.h>

#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <random>
import std;

namespace fcarouge::benchmark {
namespace {
Expand Down
4 changes: 1 addition & 3 deletions benchmark/update_1x1x0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ For more information, please refer to <https://unlicense.org> */

#include <benchmark/benchmark.h>

#include <algorithm>
#include <chrono>
#include <random>
import std;

namespace fcarouge::benchmark {
namespace {
Expand Down
4 changes: 1 addition & 3 deletions benchmark/update_1x1x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ For more information, please refer to <https://unlicense.org> */

#include <benchmark/benchmark.h>

#include <algorithm>
#include <chrono>
#include <random>
import std;

namespace fcarouge::benchmark {
namespace {
Expand Down
8 changes: 1 addition & 7 deletions benchmark/update_linalg_xx0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ For more information, please refer to <https://unlicense.org> */

#include <benchmark/benchmark.h>

#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <random>
import std;

template <typename Numerator, fcarouge::algebraic Denominator>
constexpr auto fcarouge::operator/(const Numerator &lhs, const Denominator &rhs)
Expand Down
3 changes: 1 addition & 2 deletions include/fcarouge/internal/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ For more information, please refer to <https://unlicense.org> */

#include "fcarouge/utility.hpp"

#include <format>
#include <type_traits>
import std;

namespace fcarouge {
template <typename> class kalman;
Expand Down
2 changes: 1 addition & 1 deletion include/fcarouge/internal/function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ For more information, please refer to <https://unlicense.org> */
#ifndef FCAROUGE_INTERNAL_FUNCTION_HPP
#define FCAROUGE_INTERNAL_FUNCTION_HPP

#include <memory>
import std;

namespace fcarouge::internal {
// Compile-time `std::function` partial drop-in.
Expand Down
3 changes: 1 addition & 2 deletions include/fcarouge/internal/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ For more information, please refer to <https://unlicense.org> */
#ifndef FCAROUGE_INTERNAL_UTILITY_HPP
#define FCAROUGE_INTERNAL_UTILITY_HPP

#include <concepts>
#include <type_traits>
import std;

namespace fcarouge::internal {
template <typename Type>
Expand Down
6 changes: 1 addition & 5 deletions include/fcarouge/kalman.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ For more information, please refer to <https://unlicense.org> */
#include "internal/format.hpp"
#include "utility.hpp"

#include <concepts>
#include <cstddef>
#include <functional>
#include <type_traits>
#include <utility>
import std;

namespace fcarouge {
//! @name Types
Expand Down
9 changes: 1 addition & 8 deletions linalg/lazy/fcarouge/linalg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,7 @@ For more information, please refer to <https://unlicense.org> */

#include "fcarouge/utility.hpp"

#include <algorithm>
#include <array>
#include <concepts>
#include <coroutine>
#include <generator>
#include <ranges>
#include <type_traits>
#include <utility>
import std;

namespace fcarouge {
// Semantic? Guarantees? to_generator? std::ranges::to overload? make_generator?
Expand Down
3 changes: 2 additions & 1 deletion sample/ekf_4x1x0_soaring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#include "fcarouge/linalg.hpp"

#include <cassert>
#include <cmath>

import std;

namespace fcarouge::sample {
namespace {
Expand Down
3 changes: 2 additions & 1 deletion sample/kf_1x1x0_building_height.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "fcarouge/kalman.hpp"

#include <cassert>
#include <cmath>

import std;

namespace fcarouge::sample {
namespace {
Expand Down
3 changes: 2 additions & 1 deletion sample/kf_1x1x0_liquid_temperature.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "fcarouge/kalman.hpp"

#include <cassert>
#include <cmath>

import std;

namespace fcarouge::sample {
namespace {
Expand Down
3 changes: 2 additions & 1 deletion sample/kf_1x1x1_dog_position.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "fcarouge/kalman.hpp"

#include <cassert>
#include <cmath>

import std;

namespace fcarouge::sample {
namespace {
Expand Down
4 changes: 2 additions & 2 deletions sample/kf_2x1x1_rocket_altitude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include "fcarouge/linalg.hpp"

#include <cassert>
#include <chrono>
#include <cmath>

import std;

namespace fcarouge::sample {
namespace {
Expand Down
3 changes: 2 additions & 1 deletion sample/kf_6x2x0_vehicle_location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#include "fcarouge/linalg.hpp"

#include <cassert>
#include <cmath>

import std;

template <typename Numerator, fcarouge::algebraic Denominator>
constexpr auto fcarouge::operator/(const Numerator &lhs, const Denominator &rhs)
Expand Down
3 changes: 2 additions & 1 deletion sample/kf_8x4x0_deep_sort_bounding_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#include "fcarouge/linalg.hpp"

#include <cassert>
#include <cmath>

import std;

template <typename Numerator, fcarouge::algebraic Denominator>
constexpr auto fcarouge::operator/(const Numerator &lhs, const Denominator &rhs)
Expand Down
4 changes: 3 additions & 1 deletion support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_options(kalman_options INTERFACE "LINKER:-pie"
"LINKER:-z,relro,-z,now")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(kalman_options INTERFACE "/EHsc" "/W4")
target_compile_options(
kalman_options INTERFACE "/EHsc" "/W4" "/experimental:module"
"/std:c++latest")
endif()
3 changes: 2 additions & 1 deletion test/kalman_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ For more information, please refer to <https://unlicense.org> */
#include "fcarouge/kalman.hpp"

#include <cassert>
#include <format>

import std;

namespace fcarouge::test {
namespace {
Expand Down
3 changes: 2 additions & 1 deletion test/kalman_format_arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ For more information, please refer to <https://unlicense.org> */
#include "fcarouge/kalman.hpp"

#include <cassert>
#include <format>

import std;

namespace fcarouge::test {
namespace {
Expand Down
3 changes: 2 additions & 1 deletion test/kalman_format_float_1x1x1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ For more information, please refer to <https://unlicense.org> */
#include "fcarouge/kalman.hpp"

#include <cassert>
#include <format>

import std;

namespace fcarouge::test {
namespace {
Expand Down
3 changes: 2 additions & 1 deletion test/linalg_identity_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ For more information, please refer to <https://unlicense.org> */
#include "fcarouge/linalg.hpp"

#include <cassert>
#include <type_traits>

import std;

namespace fcarouge::test {
namespace {
Expand Down
3 changes: 2 additions & 1 deletion test/linalg_zero_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ For more information, please refer to <https://unlicense.org> */
#include "fcarouge/linalg.hpp"

#include <cassert>
#include <type_traits>

import std;

namespace fcarouge::test {
namespace {
Expand Down
Loading