Skip to content

Commit

Permalink
Feature/c++23 (#76)
Browse files Browse the repository at this point in the history
* Make separate branch for C++23

* Fix merge errors from develop

* ci: update to clang-18 via pkgx

This should resolve the build failure for updating to C++23. clang-17 didn't support std::expected, but clang-18 should.

* ci: Fix checking twice on PRs and pushes

* ci: Fix Travis and AppVeyor

* ci: Fix clang on Travis-CI

* ci: Don't double build PR pushes on Travis-CI
  • Loading branch information
acgetchell authored Sep 24, 2024
1 parent cc17bc1 commit a79eed9
Show file tree
Hide file tree
Showing 21 changed files with 114 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

concurrency:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: clang-format Check
on: [push, pull_request]
on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop

jobs:
formatting-check:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ on:
- main
- develop
pull_request:
branches:
- develop
schedule:
- cron: '26 7 * * 0'
workflow_dispatch:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/cpp-linter.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: cpp-linter

on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

jobs:
cpp-linter:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Cppcheck

on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/linux-clang.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Linux Clang

on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/linux-gcc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Linux GCC

on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lsan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/msan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

concurrency:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- develop
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tsan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

concurrency:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/whitespace.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Whitespace

on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop
workflow_dispatch:

jobs:
whitespace:
Expand Down
20 changes: 15 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ cache:
- $TRAVIS_BUILD_DIR/vcpkg
- $HOME/.cache/vcpkg/archives

# Don't double build branch PRs
branches:
except:
- /^pr\..*/

addons:
apt:
update: true
Expand All @@ -21,21 +26,21 @@ addons:
- yasm
- gcc-12
- g++-12
- clang-15
- ninja-build
- cppcheck
- doxygen
- graphviz
- lcov
- valgrind
- ccache
- wget

os:
- linux

compiler:
- g++-12
- clang-15
- clang-19

jobs:
fast_finish: true
Expand Down Expand Up @@ -141,9 +146,14 @@ before_install:
fi
- |
if [[ "$CXX" == "clang++" ]]; then
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 90
sudo update-alternatives --config clang
export CXX="clang++-15" CC="clang-15"
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-19 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100
export CXX="clang++-19" CC="clang-19"
clang --version
clang++ --version
fi
install:
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ set(ENV{CGAL_DATA_DIR} CMAKE_BINARY_DIR/Data)
# add_compile_options(/DNOMINMAX)
#endif()

if (MSVC)
# Add /utf-8 flag for MSVC
add_compile_options(/utf-8)
endif()

# Project vcpkg dependencies

# https://github.com/CGAL/cgal
Expand Down Expand Up @@ -109,9 +114,6 @@ find_package(spdlog CONFIG REQUIRED)
# https://github.com/intel/tbb
find_package(TBB CONFIG REQUIRED)

# https://github.com/TartanLlama/expected
find_package(tl-expected CONFIG REQUIRED)

# https://github.com/TartanLlama/function_ref
find_package(tl-function-ref CONFIG REQUIRED)

Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_CXX_EXTENSIONS": "OFF",
"CMAKE_CXX_STANDARD": "20",
"CMAKE_CXX_STANDARD": "23",
"CMAKE_CXX_STANDARD_REQUIRED": "ON"
}
},
Expand Down
2 changes: 1 addition & 1 deletion cmake/StandardProjectSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ endif()
set(BOOST_MIN_VERSION "1.75.0")

# Use C++20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down
24 changes: 12 additions & 12 deletions include/Apply_move.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@

#include <spdlog/spdlog.h>

Check failure on line 14 in include/Apply_move.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/Apply_move.hpp:14:10 [clang-diagnostic-error]

'spdlog/spdlog.h' file not found

#include <expected>
#include <string>
#include <tl/expected.hpp>
#include <tl/function_ref.hpp>

/// @brief An applicative function similar to std::apply, but on manifolds
/// @tparam ManifoldType The type (topology, dimensionality) of manifold
/// @tparam ExpectedType The result of the move on the manifold
/// @tparam FunctionType The type of move applied to the manifold
/// @param t_manifold The manifold on which to make the Pachner move
/// @param t_move The Pachner move
/// @returns The expected or unexpected result in a tl::expected<T,E>
/// @see https://tl.tartanllama.xyz/en/latest/api/function_ref.html
/// @see https://tl.tartanllama.xyz/en/latest/api/expected.html
/**
* \brief An applicative function similar to std::apply on a manifold
* \tparam ManifoldType The type (topology, dimensionality) of manifold
* \tparam ExpectedType The result type of the move on the manifold
* \tparam FunctionType The type of move applied to the manifold
* \param t_manifold The manifold on which to make the Pachner move
* \param t_move The Pachner move
* \return The expected or unexpected result in a std::expected<T,E>
*/
template <typename ManifoldType,
typename ExpectedType = tl::expected<ManifoldType, std::string>,
typename ExpectedType = std::expected<ManifoldType, std::string>,
typename FunctionType = tl::function_ref<ExpectedType(ManifoldType&)>>
auto constexpr apply_move(ManifoldType&& t_manifold,
FunctionType t_move) noexcept -> decltype(auto)
{
if (auto result = std::invoke(t_move, std::forward<ManifoldType>(t_manifold));

Check failure on line 35 in include/Apply_move.hpp

View workflow job for this annotation

GitHub Actions / build

Syntax Error: AST broken, 'if' doesn't have two operands. [internalAstError]

Check failure on line 35 in include/Apply_move.hpp

View workflow job for this annotation

GitHub Actions / build

Syntax Error: AST broken, 'if' doesn't have two operands. [internalAstError]

Check failure on line 35 in include/Apply_move.hpp

View workflow job for this annotation

GitHub Actions / build

Syntax Error: AST broken, 'if' doesn't have two operands. [internalAstError]

Check failure on line 35 in include/Apply_move.hpp

View workflow job for this annotation

GitHub Actions / build

Syntax Error: AST broken, 'if' doesn't have two operands. [internalAstError]
result)
result.has_value())
{
return result;
}
Expand Down
Loading

0 comments on commit a79eed9

Please sign in to comment.