diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5f00f27d..6883fce3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: # CMake linting and formatting - repo: https://github.com/BlankSpruce/gersemi - rev: 0.20.0 + rev: 0.20.1 hooks: - id: gersemi name: CMake linting diff --git a/CMakePresets.json b/CMakePresets.json index bd35911e..ef41c147 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -102,6 +102,11 @@ ], "cacheVariables": { "CMAKE_TOOLCHAIN_FILE": "infra/cmake/msvc-toolchain.cmake" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } }, { @@ -113,6 +118,11 @@ ], "cacheVariables": { "CMAKE_TOOLCHAIN_FILE": "infra/cmake/msvc-toolchain.cmake" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } } ], diff --git a/Makefile b/Makefile index bcfbe28c..9a5abb1c 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,8 @@ BUILDROOT = build SYSTEM = $(shell uname -s) BUILD = $(BUILDROOT)/$(SYSTEM)/$(SANITIZER) EXAMPLE = beman.execution.examples.stop_token -CMAKE_CXX_COMPILER=$(COMPILER) + +export CXX=$(COMPILER) ifeq ($(SANITIZER),release) CXX_FLAGS = -O3 -Wpedantic -Wall -Wextra -Wno-shadow -Werror @@ -79,9 +80,10 @@ doc: # $(MAKE) SANITIZER=$@ build: - CC=$(CXX) cmake --fresh -G Ninja -S $(SOURCEDIR) -B $(BUILD) $(TOOLCHAIN) $(SYSROOT) \ + cmake --fresh -G Ninja -S $(SOURCEDIR) -B $(BUILD) $(TOOLCHAIN) $(SYSROOT) \ -D CMAKE_EXPORT_COMPILE_COMMANDS=1 \ -D CMAKE_SKIP_INSTALL_RULES=1 \ + -D CMAKE_CXX_STANDARD=23 \ -D CMAKE_CXX_COMPILER=$(CXX) # XXX -D CMAKE_CXX_FLAGS="$(CXX_FLAGS) $(SAN_FLAGS)" cmake --build $(BUILD) @@ -92,11 +94,16 @@ test: build install: test cmake --install $(BUILD) --prefix /opt/local -release: - cmake --workflow --preset $@ --fresh +CMakeUserPresets.json: cmake/CMakeUserPresets.json + ln -s $< $@ + +release: CMakeUserPresets.json + cmake --preset $@ --fresh --log-level=TRACE + cmake --workflow --preset $@ -debug: - cmake --workflow --preset $@ --fresh +debug: CMakeUserPresets.json + cmake --preset $@ --fresh --log-level=TRACE + cmake --workflow --preset $@ ce: @mkdir -p $(BUILD) diff --git a/README.md b/README.md index 910db208..dae4b267 100644 --- a/README.md +++ b/README.md @@ -52,19 +52,36 @@ contains some links for general information about the sender/receivers and `std: ## Build +## Precondisions + +- cmake v3.30 or newer +- ninja v1.11.1 or newer +- A compiler that supports at least C++23 + + | Library | Linux | MacOS | Windows | | ------- | ----- | ----- | ------- | | build | ![Linux build status](https://github.com/bemanproject/execution/actions/workflows/linux.yml/badge.svg) | ![MacOS build status](https://github.com/bemanproject/execution/actions/workflows/macos.yml/badge.svg) | ![Window build status](https://github.com/bemanproject/execution/actions/workflows/windows.yml/badge.svg) | The following instructions build the library and the examples: + ln -s cmake/CMakeUserPresets.json . cmake --workflow --list-presets Available workflow presets: "debug" "release" + "gcc-debug" + "gcc-release" + "llvm-debug" + "llvm-release" + "appleclang-debug" + "appleclang-release" + "msvc-debug" + "msvc-release" + - cmake --workflow --preset release + CXX=g++-15 cmake --workflow --preset release The implementation compiles and passes tests using [clang](https://clang.llvm.org/), [gcc](http://gcc.gnu.org), and [MSVC++](https://visualstudio.microsoft.com/vs/features/cplusplus/). diff --git a/cmake/presets/CMakeGenericPresets.json b/cmake/presets/CMakeGenericPresets.json index 44fd4775..2f6711b7 100644 --- a/cmake/presets/CMakeGenericPresets.json +++ b/cmake/presets/CMakeGenericPresets.json @@ -17,6 +17,17 @@ "CMAKE_CXX_STANDARD_REQUIRED": true, "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false + }, + "warnings": { + "dev": true, + "deprecated": true, + "uninitialized": true, + "unusedCli": true, + "systemVars": false + }, + "errors": { + "dev": false, + "deprecated": true } } ] diff --git a/src/beman/execution/CMakeLists.txt b/src/beman/execution/CMakeLists.txt index a39c18c5..18d719dd 100644 --- a/src/beman/execution/CMakeLists.txt +++ b/src/beman/execution/CMakeLists.txt @@ -199,13 +199,6 @@ source_group("Header Files\\detail" FILES ${DETAIL_HEADER_FILES}) set_target_properties(${TARGET_NAME} PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON) -target_compile_features( - ${TARGET_NAME} - PUBLIC - "$<$:cxx_std_26>" - "$<$>:cxx_std_23>" -) - if(NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES) return() endif()