From e6549908f650f2470980f324c00655aed95ca94a Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Sun, 13 Jul 2025 07:32:36 +0200 Subject: [PATCH 1/3] Ugraded to xtensor 0.27.0 --- CMakeLists.txt | 2 +- environment-dev.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c4f5c5..e4d809b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ message(STATUS "xtensor-blas v${${PROJECT_NAME}_VERSION}") # Dependencies # ============ -set(xtensor_REQUIRED_VERSION 0.26.0) +set(xtensor_REQUIRED_VERSION 0.27.0) if(TARGET xtensor) set(xtensor_VERSION ${XTENSOR_VERSION_MAJOR}.${XTENSOR_VERSION_MINOR}.${XTENSOR_VERSION_PATCH}) # Note: This is not SEMVER compatible comparison diff --git a/environment-dev.yml b/environment-dev.yml index 525fbf9..34fee6a 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -3,5 +3,5 @@ channels: - conda-forge dependencies: - cmake -- xtensor>=0.26.0,<0.27 +- xtensor>=0.27.0,<0.28 - doctest From ae8005c984d0c0651714cf7959f29ed4a1347546 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Sun, 13 Jul 2025 07:36:46 +0200 Subject: [PATCH 2/3] Enabled C++20 --- CMakeLists.txt | 4 ++++ test/CMakeLists.txt | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4d809b..781b62c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,8 @@ target_include_directories(xtensor-blas $ $) +target_compile_features(xtensor-blas INTERFACE cxx_std_20) + OPTION(CXXBLAS_DEBUG "print cxxblas debug information" OFF) OPTION(XTENSOR_USE_FLENS_BLAS "use FLENS generic implementation instead of cblas" OFF) # Decide whether to use OpenBLAS or not. @@ -101,6 +103,8 @@ endif() OPTION(BUILD_TESTS "xtensor-blas test suite" OFF) OPTION(BUILD_BENCHMARK "xtensor-blas test suite" OFF) +OPTION(CPP23 "enables C++23 (experimental)" OFF) + if(BUILD_TESTS) enable_testing() include_directories(${XTENSOR_BLAS_INCLUDE_DIR}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9445f66..ce9ada7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -36,27 +36,27 @@ string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE) include(set_compiler_flag.cmake) -if(CPP20) +if(CPP23) # User requested C++20, but compiler might not oblige. set_compiler_flag( _cxx_std_flag CXX - "-std=c++20" # this should work with GNU, Intel, PGI - "/std:c++20" # this should work with MSVC + "-std=c++23" # this should work with GNU, Intel, PGI + "/std:c++23" # this should work with MSVC ) if(_cxx_std_flag) - message(STATUS "Building with C++20") + message(STATUS "Building with C++23") endif() else() set_compiler_flag( _cxx_std_flag CXX REQUIRED - "-std=c++17" # this should work with GNU, Intel, PGI - "/std:c++17" # this should work with MSVC + "-std=c++20" # this should work with GNU, Intel, PGI + "/std:c++20" # this should work with MSVC ) - message(STATUS "Building with C++17") + message(STATUS "Building with C++20") endif() if(NOT _cxx_std_flag) - message(FATAL_ERROR "xtensor-blas needs a C++17-compliant compiler.") + message(FATAL_ERROR "xtensor-blas needs a C++20-compliant compiler.") endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND NOT WIN32)) From 4b2fa22405387b16fdff377c5791965313329f55 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Wed, 16 Jul 2025 09:33:08 +0200 Subject: [PATCH 3/3] Fixed OSX build --- .github/workflows/osx.yml | 2 +- CMakeLists.txt | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index b4e8ca2..7b95f10 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -39,7 +39,7 @@ jobs: run: micromamba install 'openblas==0.3.29=openmp*' blas-devel - name: Configure using CMake - run: cmake -Bbuild -DCMAKE_CXX_STANDARD=17 -DBUILD_TESTS=ON -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib + run: cmake -Bbuild -DBUILD_TESTS=ON -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib - name: Build working-directory: build diff --git a/CMakeLists.txt b/CMakeLists.txt index 781b62c..ab0aea7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,19 @@ ############################################################################ cmake_minimum_required(VERSION 3.29) + +# Otherwise adds std=gnu++17 on OSX ... +set(CMAKE_CXX_EXTENSIONS OFF) + project(xtensor-blas) +# Otherwise adds flags for C++11 standard on OSX ... +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 20) +endif() +message(STATUS "🔧 C++ standard: ${CMAKE_CXX_STANDARD}") + + set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) set(XTENSOR_BLAS_INCLUDE_DIR ${INCLUDE_DIR})