Skip to content
Draft
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
154 changes: 154 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: Multiplatform Build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
runner: [ubuntu-26.04, windows-2025-vs2026]
build_type: [Release]
c_compiler: [gcc-15, clang-22, cl]
include:
- runner: windows-2025-vs2026
os: Windows
c_compiler: cl
cpp_compiler: cl
- runner: ubuntu-26.04
c_compiler: gcc-15
cpp_compiler: g++-15
- runner: ubuntu-26.04
c_compiler: clang-22
cpp_compiler: clang++-22
exclude:
- runner: windows-2025-vs2026
c_compiler: gcc-15
- runner: windows-2025-vs2026
c_compiler: clang-22
- runner: ubuntu-26.04
c_compiler: cl

steps:
- uses: actions/checkout@v5

- name: Install libc++ for Clang
if: matrix.c_compiler == 'clang-22'
run: |
sudo apt-get update
sudo apt-get install -y clang-22 clang-tools-22 libc++-22-dev libc++abi-22-dev

- uses: ilammy/msvc-dev-cmd@v1
if: matrix.c_compiler == 'cl'
with:
arch: x64

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

case "${{ matrix.c_compiler }}" in
gcc*)
conan_compiler=gcc
;;
clang*)
conan_compiler=clang
;;
cl)
conan_compiler=msvc
;;
esac
echo "conan_compiler=$conan_compiler" >> "$GITHUB_OUTPUT"

case "${{ matrix.c_compiler }}" in
gcc*)
conan_compiler_version=$(${{ matrix.c_compiler }} -dumpversion | cut -d. -f1)
;;
clang*)
conan_compiler_version=$(${{ matrix.c_compiler }} -dumpversion | cut -d. -f1)
;;
cl)
conan_compiler_version=195
;;
esac
echo "conan_compiler_version=$conan_compiler_version" >> "$GITHUB_OUTPUT"

- name: Create Conan Dependencies Profile
shell: bash
run: |
cat << EOF > profile.txt
[settings]
arch=x86_64
os=$RUNNER_OS
compiler=${{ steps.strings.outputs.conan_compiler }}
compiler.version=${{ steps.strings.outputs.conan_compiler_version }}
compiler.cppstd=23
$([[ "${{ steps.strings.outputs.conan_compiler }}" == "gcc" ]] && echo "compiler.libcxx=libstdc++11")
$([[ "${{ steps.strings.outputs.conan_compiler }}" == "clang" ]] && echo "compiler.libcxx=libc++")
$([[ "${{ steps.strings.outputs.conan_compiler }}" == "msvc" ]] && echo "compiler.runtime=static")

[buildenv]
CC=${{ matrix.c_compiler }}
CXX=${{ matrix.cpp_compiler }}

[conf]
tools.cmake.cmaketoolchain:generator=Ninja Multi-Config
tools.cmake.cmake_layout:build_folder_vars=['settings.compiler', 'settings.arch']
EOF

- name: Install Conan
shell: bash
run: |
pip install conan==2.31.2
conan profile detect

- name: Configure Conan Dependencies
shell: bash
run: >
conan install
-of build
-s build_type=${{ matrix.build_type }}
-b=missing
-pr:a=profile.txt
.

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
shell: bash
run: >
cmake
-B build
--preset=conan-${{ steps.strings.outputs.conan_compiler }}-x86_64
.

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: >
cmake
--build ${{ steps.strings.outputs.build-output-dir }}
--config ${{ matrix.build_type }}

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --preset=conan-${{ steps.strings.outputs.conan_compiler }}-x86_64-release
38 changes: 19 additions & 19 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: Docker Image CI
# name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]

jobs:
build-gnu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Build the GNU Docker image
run: docker build . --file docker/Dockerfile-gcc --tag cmake-cpp-modules-template-gcc:$(date +%s)
build-clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Build the Clang Docker image
run: docker build . --file docker/Dockerfile-clang --tag cmake-cpp-modules-template-clang:$(date +%s)
# jobs:
# build-gnu:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v5
# - name: Build the GNU Docker image
# run: docker build . --file docker/Dockerfile-gcc --tag cmake-cpp-modules-template-gcc:$(date +%s)
# build-clang:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v5
# - name: Build the Clang Docker image
# run: docker build . --file docker/Dockerfile-clang --tag cmake-cpp-modules-template-clang:$(date +%s)
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ if (CMAKE_VERSION VERSION_LESS "4.0.3")
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "a9e1cf81-9932-4810-974b-6eccaf14e457")
elseif (CMAKE_VERSION VERSION_LESS "4.3.0")
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")
else()
elseif (CMAKE_VERSION VERSION_LESS "4.4.0")
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "451f2fe2-a8a2-47c3-bc32-94786d8fc91b")
else()
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "f35a9ac6-8463-4d38-8eec-5d6008153e7d")
endif()

# Project + Language
Expand All @@ -22,12 +24,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Disable linking to compiler included std library module
# will instead link std to libcxx wrapper
set(CMAKE_CXX_MODULE_STD OFF)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# problematic in github CI
set(CMAKE_CXX_MODULE_STD OFF)
else()
set(CMAKE_CXX_MODULE_STD ON)
endif()

# Options
option(ENABLE_EIGEN "Add Eigen support?" ON)
option(ENABLE_EIGEN "Add Eigen support?" OFF)
option(ENABLE_CUDA "Add Cuda support?" OFF)
option(BUILD_TESTING "Enable Testing?" ON)

Expand All @@ -39,7 +44,9 @@ include(cmake/cpp_modules.cmake)

# Ninja has a bug where color terminal isnt detected when piping
if (CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
endif()
endif()

if(ENABLE_CUDA)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ cmake -B build/clang --preset=conan-clang-x86_64
# build
cmake --build build/clang --config Release -j8
# test
ctest -C Release --test-dir build/clang --no-compress-output --verbose
ctest -preset=${CONAN_PROFILE} --no-compress-output --verbose
```

### GNU
Expand All @@ -115,7 +115,7 @@ cmake -B build/gcc --preset=conan-gcc-x86_64
# build
cmake --build build/gcc --config Release -j8
# test
ctest -C Release --test-dir build/gcc --no-compress-output --verbose
ctest -preset=${CONAN_PROFILE} --no-compress-output --verbose
```

## Dockerfile
Expand Down
14 changes: 0 additions & 14 deletions targets/cpp-deps-modules/eigen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@ target_sources(eigen-modules PUBLIC
# cppm is non-standard by gcc
set_source_files_properties(${SRCS} PROPERTIES LANGUAGE CXX)


# PATCHES
# conan list "eigen/5.0.1:*" -fp=profile-clang-manjaro.txt
# patch -f -d $(conan cache path eigen/5.0.1:da39a3ee5e6b4b0d3255bfef95601890afd80709) -p0 < patches/patch_eigen_5_0_1_static.patch

# set(CONAN_REF "eigen/5.0.1:da39a3ee5e6b4b0d3255bfef95601890afd80709")

# execute_process(
# COMMAND conan cache path ${CONAN_REF}
# OUTPUT_VARIABLE EIGEN_CACHE_PATH
# OUTPUT_STRIP_TRAILING_WHITESPACE
# COMMAND_ERROR_IS_FATAL ANY
# )

# HEADER PATCHES
set(EIGEN_PATCH
${CMAKE_CURRENT_SOURCE_DIR}/patches/patch_eigen_5_0_1_static.patch
Expand Down
1 change: 0 additions & 1 deletion targets/cpp-deps-modules/libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ target_compile_definitions(${TARGET_NAME} PRIVATE _LIBCPP_HAS_WIDE_CHARACTERS=1)
target_compile_definitions(${TARGET_NAME} PRIVATE _LIBCPP_HAS_THREADS=1)
target_compile_definitions(${TARGET_NAME} PRIVATE _LIBCPP_HAS_RANDOM_DEVICE=1)

FILE(GLOB_RECURSE SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cppm)
target_sources(${TARGET_NAME} PUBLIC
FILE_SET CXX_MODULES
BASE_DIRS
Expand Down
2 changes: 1 addition & 1 deletion targets/cpp-deps-modules/libcxx/std/algorithm.inc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export namespace std {
}

namespace ranges {
#if _LIBCPP_STD_VER >= 23
#if _LIBCPP_STD_VER >= 26
# if !__GNUC__
// [alg.starts.with], starts with
using std::ranges::starts_with;
Expand Down
8 changes: 5 additions & 3 deletions targets/cpp-deps-modules/libcxx/std/iterator.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//

#ifdef __GNUC__
#if defined(__GNUC__) && !defined(__clang__)
export namespace __gnu_cxx {
using __gnu_cxx::operator-;
using __gnu_cxx::operator==;
Expand Down Expand Up @@ -198,6 +198,7 @@ export namespace std {
using std::insert_iterator;
using std::inserter;

#if not defined(__clang__)
// [const.iterators], constant iterators and sentinels
// [const.iterators.alias], alias templates
using std::const_iterator;
Expand All @@ -207,9 +208,10 @@ export namespace std {
// [const.iterators.iterator], class template basic_const_iterator
using std::basic_const_iterator;

using std::common_type;

using std::make_const_iterator;
#endif

using std::common_type;

// [move.iterators], move iterators and sentinels
using std::move_iterator;
Expand Down
2 changes: 1 addition & 1 deletion targets/cpp-deps-modules/libcxx/std/ranges.inc
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export namespace std {
}
#endif

#if _LIBCPP_STD_VER >= 23
#if _LIBCPP_STD_VER >= 26
// [range.chunk.by], chunk by view
using std::ranges::chunk_by_view;

Expand Down
6 changes: 5 additions & 1 deletion targets/cpp-deps-modules/unifex/src/unifex.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ module;
#include <unifex/with_scheduler_affinity.hpp>
#include <unifex/with_query_value.hpp>

#if defined(__linux__)
#include "io_uring_context.hpp"
//#include <unifex/linux/io_uring_context.hpp>
// #include <unifex/linux/io_uring_context.hpp>
#endif // __linux__

export module unifex;

Expand Down Expand Up @@ -116,8 +118,10 @@ export namespace unifex {
using unifex::_wsa::_wsa_sender_wrapper;
}

#if defined(__linux)
namespace linuxos {
using unifex::linuxos::io_uring_context;
}
#endif // __linux__

} // namespace unifex
2 changes: 1 addition & 1 deletion targets/cpp-deps-modules/ut/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ add_library(${TARGET_NAME})

# set_property(TARGET ${TARGET_NAME} PROPERTY CXX_MODULE_STD ON)
target_link_libraries(${TARGET_NAME} PRIVATE libcxx)
target_link_libraries(${TARGET_NAME} PUBLIC Boost::ut)
# target_link_libraries(${TARGET_NAME} PUBLIC Boost::ut)

# target_include_directories(${TARGET_NAME} PRIVATE src)
# target_include_directories(${TARGET_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/resources/ut/include)
Expand Down
6 changes: 6 additions & 0 deletions targets/cpp-deps-modules/ut/src/boost/custom_ut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,9 @@ class reporter_junit {
ss_out_ << "Running test \"" << test_event.name << "\" ... ";
}
ss_out_ << color_.pass << "PASSED " << color_.none;
#if !defined(_MSC_VER)
print_duration(ss_out_);
#endif // !defined(_MSC_VER)
lcout_ << ss_out_.str();
}
}
Expand Down Expand Up @@ -1777,7 +1779,9 @@ class reporter_junit {
lcout_ << getLeadingSpace();
lcout_ << "Running test \"" << current_node_->test_name << "\"... ";
lcout_ << color_.fail << "FAILED " << color_.none;
#if !defined(_MSC_VER)
print_duration(lcout_);
#endif // !defined(_MSC_VER)
lcout_ << '\n';
lcout_ << current_node_->report_string << '\n';
}
Expand All @@ -1801,7 +1805,9 @@ class reporter_junit {
if (report_type_ == CONSOLE) {
ss << getLeadingSpace();
ss << color_.fail << "FAILED " << color_.none;
#if !defined(_MSC_VER)
print_duration(ss);
#endif // !defined(_MSC_VER)
}
ss << "in: " << assertion.location.file_name() << ':'
<< assertion.location.line();
Expand Down
Loading
Loading