Skip to content

Commit

Permalink
[format] replace fmtlib by std format
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisCarouge committed Oct 7, 2023
1 parent b48309c commit 693a86d
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 187 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/clang_tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
egress-policy: audit
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: "Tool: Clang 16"
- name: "Install: Clang"
run: |
sudo apt update
sudo apt upgrade
sudo apt upgrade
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16 all
sudo ./llvm.sh 17 all
- name: "Configure"
env:
CXX: "clang++-16"
CXX: "clang++-17"
run: |
cmake -S . -B "build" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Verify
Expand All @@ -42,4 +42,4 @@ jobs:
-type f -path "./source/*.cpp" -o \
-type f -path "./test/*.cpp"`
echo $FILES
clang-tidy-16 -p "build" $FILES
clang-tidy-17 -p "build" $FILES
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: github/codeql-action/init@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9
with:
languages: ${{ matrix.language }}
- name: "Tool: GCC-13"
- name: "Install"
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
Expand Down
42 changes: 23 additions & 19 deletions .github/workflows/deploy_test_coverage_coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,42 @@ jobs:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: "Install"
run: sudo apt install lcov
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt upgrade
sudo apt install g++-13 lcov
- name: "Configure"
env:
CXX: "g++-12"
CXX: "g++-13"
CXXFLAGS: "-O0 -g --coverage -fno-inline -fno-exceptions"
run: cmake -S . -B "build"
- name: "Build"
run: cmake --build "build" --verbose --parallel 4
- name: "Coverage: Base"
run: |
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --capture --initial --directory . --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove base.info '*/benchmark/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove base.info '*/build/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove base.info '*/sample/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove base.info '*/source/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove base.info '*/test/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove base.info '/usr/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove base.info '10' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --capture --initial --directory . --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove base.info '*/benchmark/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove base.info '*/build/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove base.info '*/sample/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove base.info '*/source/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove base.info '*/test/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove base.info '/usr/*' --output-file base.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove base.info '10' --output-file base.info
- name: "Test"
run: ctest --test-dir "build" --tests-regex "kalman_(test|sample|benchmark)" --verbose --parallel 4
- name: "Coverage: Test"
run: |
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --capture --directory . --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove test.info '*/benchmark/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove test.info '*/build/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove test.info '*/sample/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove test.info '*/source/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove test.info '*/test/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove test.info '/usr/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --remove test.info '10' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --capture --directory . --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove test.info '*/benchmark/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove test.info '*/build/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove test.info '*/sample/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove test.info '*/source/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove test.info '*/test/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove test.info '/usr/*' --output-file test.info
lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --remove test.info '10' --output-file test.info
- name: "Coverage: Results"
run: lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-12 --rc lcov_branch_coverage=1 --add-tracefile base.info --add-tracefile test.info --output-file coverage.info
run: lcov --rc lcov_branch_coverage=1 --gcov-tool gcov-13 --rc lcov_branch_coverage=1 --add-tracefile base.info --add-tracefile test.info --output-file coverage.info
- name: Coveralls
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2.2.3
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
run: |
sudo apt update
sudo apt upgrade
pip install cmakelang
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16 all
sudo ./llvm.sh 17 all
pip install cmakelang
- name: "Test"
run: |
find . \
Expand All @@ -39,7 +39,7 @@ jobs:
-o -iwholename "./support/generator" \
-o -iwholename "./support/print" \
| xargs \
clang-format-16 --Werror --dry-run --verbose -style=file
clang-format-17 --Werror --dry-run --verbose -style=file
find . \
-iname "CMakeLists.txt" \
-o -iname "*.cmake.in" \
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/memory_valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ jobs:
egress-policy: audit
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Install
- name: "Install"
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install valgrind
sudo apt upgrade
sudo apt install g++-13 valgrind
- name: Build
env:
CXX: "g++-12"
CXX: "g++-13"
run: |
cmake -B "build" .
cmake --build "build" --parallel 4
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ jobs:
fail-fast: false
matrix:
include:
- { os: "ubuntu-latest", compiler: "clang++-15", generator: "Unix Makefiles", package: "clang-15" }
- { os: "ubuntu-latest", compiler: "clang++-16", generator: "Unix Makefiles", package: "clang-16" }
- { os: "ubuntu-latest", compiler: "g++-12", generator: "Unix Makefiles", package: "g++-12" }
- { os: "ubuntu-latest", compiler: "clang++-17", generator: "Unix Makefiles", package: "clang-16" }
- { os: "ubuntu-latest", compiler: "g++-13", generator: "Unix Makefiles", package: "g++-13" }
- { os: "windows-latest", compiler: "cl", generator: "Ninja", config: "Debug" }
- { os: "windows-latest", compiler: "cl", generator: "Ninja", config: "Release" }
Expand All @@ -32,25 +30,23 @@ jobs:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: "Tool: Microsoft Windows"
- name: "Tool: MSVC"
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1
- name: "Tool: Ubuntu"
if: ${{ matrix.package == 'g++-12' ||
matrix.package == 'g++-13' ||
matrix.package == 'clang-15' }}
- name: "Tool: GCC"
if: ${{ matrix.package == 'g++-13' }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt upgrade
sudo apt install "${{ matrix.package }}"
- name: "Tool: Clang 16"
if: ${{ matrix.package == 'clang-16' }}
- name: "Tool: Clang"
if: ${{ matrix.package == 'clang-17' }}
run: |
sudo apt update
sudo apt upgrade
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16 all
sudo ./llvm.sh 17 all
- name: "Configure"
env:
CXX: "${{ matrix.compiler }}"
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ jobs:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: "Install"
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt upgrade
sudo apt install g++-13
- name: "Configure"
env:
CXX: "g++-12"
CXX: "g++-13"
run: cmake -S . -B "build"
- name: "Build"
run: cmake --build "build" --verbose --parallel 4
Expand Down
1 change: 0 additions & 1 deletion include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ target_sources(
"fcarouge/internal/utility.hpp"
"fcarouge/kalman.hpp"
"fcarouge/utility.hpp")
target_link_libraries(kalman INTERFACE kalman_format)
install(
TARGETS kalman
EXPORT "kalman-target"
Expand Down
36 changes: 1 addition & 35 deletions support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
"-fstrict-aliasing"
"-ftrivial-auto-var-init=pattern"
"-pedantic"
"-stdlib=libc++"
"-Wall"
"-Wcast-align"
"-Wdouble-promotion"
Expand Down Expand Up @@ -109,41 +110,6 @@ endif()
include(CheckSourceCompiles)
include(FetchContent)

add_library(kalman_format INTERFACE)

check_source_compiles(
CXX
"
#include <format>
int main() {}
"
CPP_LIB_FORMAT)

if(NOT CPP_LIB_FORMAT)
FetchContent_Declare(
fmt
GIT_REPOSITORY "https://github.com/fmtlib/fmt"
FIND_PACKAGE_ARGS NAMES fmt)
FetchContent_MakeAvailable(fmt)

target_sources(
kalman_format
INTERFACE FILE_SET
"kalman_format_headers"
TYPE
"HEADERS"
FILES
"format"
"print")
target_link_libraries(kalman_format INTERFACE fmt::fmt)
endif()

install(
TARGETS kalman_format
EXPORT "kalman-target"
FILE_SET "kalman_format_headers"
DESTINATION "include/fcarouge")

add_library(kalman_generator INTERFACE)

check_source_compiles(
Expand Down
108 changes: 0 additions & 108 deletions support/format

This file was deleted.

0 comments on commit 693a86d

Please sign in to comment.