diff --git a/.github/workflows/clp-core-build-macos.yaml b/.github/workflows/clp-core-build-macos.yaml index a51d9b268b..12f2023024 100644 --- a/.github/workflows/clp-core-build-macos.yaml +++ b/.github/workflows/clp-core-build-macos.yaml @@ -45,6 +45,7 @@ jobs: strategy: matrix: os: + - "macos-14" - "macos-15" use_shared_libs: - true diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index d758a8ffa2..ceec57d5ce 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -1,13 +1,11 @@ # ystdlib requires CMake v3.23 or higher cmake_minimum_required(VERSION 3.23) -# Toolchain setup must come before the first project() call in the entire CMake buildsystem. -# If CLP is not the top-level project, the following setup has no effect. -include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchains/utils.cmake") -setup_toolchains() - project(CLP LANGUAGES CXX C) +# Toolchain validation +include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchains/utils.cmake") + validate_compiler_versions() # Include options for CLP build @@ -295,8 +293,8 @@ endif() # Add ystdlib if(CLP_NEED_YSTDLIB) - set(YSTDLIB_CPP_BUILD_TESTING OFF) - add_subdirectory("${CLP_YSTDLIB_SOURCE_DIRECTORY}" "${CMAKE_BINARY_DIR}/ystdlib" EXCLUDE_FROM_ALL) + find_package(ystdlib REQUIRED) + message(STATUS "Found ystdlib-cpp ${ystdlib_VERSION}") endif() if(CLP_NEED_ZSTD) diff --git a/components/core/cmake/Toolchains/llvm-clang-16-toolchain.cmake b/components/core/cmake/Toolchains/llvm-clang-16-toolchain.cmake deleted file mode 100644 index 583e044652..0000000000 --- a/components/core/cmake/Toolchains/llvm-clang-16-toolchain.cmake +++ /dev/null @@ -1,21 +0,0 @@ -message(STATUS "Setting up LLVM v16 toolchain...") - -execute_process( - COMMAND - "brew" "--prefix" "llvm@16" - RESULT_VARIABLE BREW_RESULT - OUTPUT_VARIABLE LLVM_TOOLCHAIN_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE -) -if(NOT 0 EQUAL BREW_RESULT) - message( - FATAL_ERROR - "Failed to locate LLVM v16 using Homebrew. Please ensure llvm@16 is installed: 'brew \ - install llvm@16'" - ) -endif() - -set(CMAKE_C_COMPILER "${LLVM_TOOLCHAIN_PREFIX}/bin/clang") -set(CMAKE_CXX_COMPILER "${LLVM_TOOLCHAIN_PREFIX}/bin/clang++") -set(CMAKE_AR "${LLVM_TOOLCHAIN_PREFIX}/bin/llvm-ar") -set(CMAKE_RANLIB "${LLVM_TOOLCHAIN_PREFIX}/bin/llvm-ranlib") diff --git a/components/core/cmake/Toolchains/utils.cmake b/components/core/cmake/Toolchains/utils.cmake index 660002c5f4..47a1e8168e 100644 --- a/components/core/cmake/Toolchains/utils.cmake +++ b/components/core/cmake/Toolchains/utils.cmake @@ -1,36 +1,13 @@ -# This file contains utility functions for setting up toolchains and validating toolchain versions -# to ensure compatibility with the C++20 features required by the project. - -# Sets up the appropriate toolchain file based on the host system. -function(setup_toolchains) - # For macOS versions below 15, use the LLVM 16 Clang toolchain. - if("Darwin" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}") - execute_process( - COMMAND - "sw_vers" "--productVersion" - OUTPUT_VARIABLE MACOS_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if("${MACOS_VERSION}" VERSION_LESS "15") - set(CMAKE_TOOLCHAIN_FILE - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchains/llvm-clang-16-toolchain.cmake" - CACHE STRING - "Toolchain file" - ) - endif() - endif() -endfunction() +# This file contains utility functions for validating toolchain versions to ensure compatibility +# with the C++20 features required by the project. # Checks if the compiler ID and version meet the minimum requirements to support C++20 features -# required by the project: -# - AppleClang: version 16+ -# - Clang: version 16+ -# - GNU: version 11+ +# required by the project. function(validate_compiler_versions) if("AppleClang" STREQUAL "${CMAKE_CXX_COMPILER_ID}") - set(CXX_COMPILER_MIN_VERSION "16") + set(CXX_COMPILER_MIN_VERSION "15") elseif("Clang" STREQUAL "${CMAKE_CXX_COMPILER_ID}") - set(CXX_COMPILER_MIN_VERSION "16") + set(CXX_COMPILER_MIN_VERSION "15") elseif("GNU" STREQUAL "${CMAKE_CXX_COMPILER_ID}") set(CXX_COMPILER_MIN_VERSION "11") else() diff --git a/docs/src/dev-docs/components-core/index.md b/docs/src/dev-docs/components-core/index.md index b86e4fa44b..1e6966bb85 100644 --- a/docs/src/dev-docs/components-core/index.md +++ b/docs/src/dev-docs/components-core/index.md @@ -8,7 +8,6 @@ CLP core is the low-level component that performs compression, decompression, an * If you have trouble building for another OS, file an issue, and we may be able to help. * A recent compiler that fully supports C++20 features such as * std::span - * std::source_location * [CMake] >= 3.23.0 and < 4.0.0 * Minimum version 3.23.0 is required for [yscope-dev-utils]. * We constrain the version to < 4.0.0 due to [y-scope/clp#795]. @@ -58,7 +57,7 @@ The task will download, build, and install (within the build directory) the foll | [utfcpp](https://github.com/nemtrif/utfcpp) | v4.0.6 | | [yaml-cpp](https://github.com/jbeder/yaml-cpp) | v0.7.0 | | [yscope-log-viewer](https://github.com/y-scope/yscope-log-viewer) | 3abe4cc | -| [ystdlib-cpp](https://github.com/y-scope/ystdlib-cpp) | d80cf86 | +| [ystdlib-cpp](https://github.com/y-scope/ystdlib-cpp) | 9ed78cd | | [zlib](https://github.com/madler/zlib) | v1.3.1 | | [zstd](https://github.com/facebook/zstd) | v1.5.7 | diff --git a/taskfiles/deps/main.yaml b/taskfiles/deps/main.yaml index ee687a5590..308e3c119b 100644 --- a/taskfiles/deps/main.yaml +++ b/taskfiles/deps/main.yaml @@ -512,23 +512,20 @@ tasks: ystdlib: internal: true - vars: - LIB_NAME: "ystdlib" - YSTDLIB_OUTPUT_DIR: "{{.G_DEPS_CORE_DIR}}/{{.LIB_NAME}}-src" run: "once" deps: - - task: "utils:init" + - task: "boost" cmds: - - task: "yscope-dev-utils:remote:download-and-extract-tar" + - task: "utils:install-remote-cmake-lib" vars: - CHECKSUM_FILE: "{{.G_DEPS_CORE_CHECKSUMS_DIR}}/{{.LIB_NAME}}.md5" - FILE_SHA256: "36fa0e9d96b7307ca92482343d6ba1091c5576370676e6d423cce32c20e34a3d" - OUTPUT_DIR: "{{.YSTDLIB_OUTPUT_DIR}}" - URL: "https://github.com/y-scope/ystdlib-cpp/archive/d80cf86.tar.gz" - - >- - echo "set( - CLP_YSTDLIB_SOURCE_DIRECTORY \"{{.YSTDLIB_OUTPUT_DIR}}\" - )" > "{{.G_DEPS_CORE_CMAKE_SETTINGS_DIR}}/{{.LIB_NAME}}.cmake" + CMAKE_GEN_ARGS: + - "-C {{.G_DEPS_CORE_CMAKE_SETTINGS_DIR}}/{{.G_BOOST_LIB_NAME}}.cmake" + - "-DCMAKE_BUILD_TYPE=Release" + - "-DCMAKE_INSTALL_MESSAGE=LAZY" + - "-Dystdlib_BUILD_TESTING=OFF" + LIB_NAME: "ystdlib" + TARBALL_SHA256: "65990dc2bcc4a355c2181bfe31a7800f492309d1bcd340f52a34e85047e61bc8" + TARBALL_URL: "https://github.com/y-scope/ystdlib-cpp/archive/9ed78cd.tar.gz" zlib: internal: true