From a735b3ceb91a72006ca92f51ef5b001a1a98f543 Mon Sep 17 00:00:00 2001 From: Darius Neatu Date: Wed, 17 Jul 2024 18:48:17 +0300 Subject: [PATCH] Temporary remove make build support --- Makefile | 115 ------------------------------------------------------ README.md | 24 ++++-------- 2 files changed, 8 insertions(+), 131 deletions(-) delete mode 100755 Makefile diff --git a/Makefile b/Makefile deleted file mode 100755 index 7e639d86..00000000 --- a/Makefile +++ /dev/null @@ -1,115 +0,0 @@ -#! /usr/bin/make -f -# cmake-format: off -# /Makefile -*-makefile-*- -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# cmake-format: on - -# This Makefile is a thin wrapper around CMake. It is intended to be used. - -# Default target. -PROJECT?=$(shell basename $(CURDIR)) - -# Default install prefix. -INSTALL_PREFIX?=.install/ -# Default build directory. -BUILD_DIR?=.build -# Default destination directory. -DEST?=$(INSTALL_PREFIX) -# Default toolchain: missing => c++ sytem tool. -TOOLCHAIN?= -# Default configuration: missing => Asan. -BUILD_CONFIG?=Asan -# Default CMake flags. -CMAKE_FLAGS?= - -# Default targets. -TARGETS := test clean all ctest - -export - -.update-submodules: - git submodule update --init --recursive - touch .update-submodules - -.gitmodules: .update-submodules - - -export - -ifeq ($(strip $(TOOLCHAIN)),) - # Default build configuration. - _build_name?=toolchain/c++-system - _build_dir?=$(BUILD_DIR) - _configuration_types?="RelWithDebInfo;Debug;Tsan;Asan" - _cmake_args=-DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/etc/toolchain.cmake -else - # Custom toolchain. - _build_name?=toolchain/$(TOOLCHAIN) - _build_dir?=$(BUILD_DIR) - _configuration_types?="RelWithDebInfo;Debug;Tsan;Asan" - _cmake_args=-DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/etc/$(TOOLCHAIN)-toolchain.cmake -endif - -# Build path. -_build_path?=$(_build_dir)/$(_build_name) - -# CMake command wrapper. -define run_cmake = - cmake \ - -G "Ninja Multi-Config" \ - -DCMAKE_CONFIGURATION_TYPES=$(_configuration_types) \ - -DCMAKE_INSTALL_PREFIX=$(abspath $(INSTALL_PREFIX)) \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ - $(_cmake_args) \ - $(CMAKE_FLAGS) \ - $(CURDIR) -endef - -# Default target. -default: build test - -$(_build_path): - mkdir -p $(_build_path) - -$(_build_path)/CMakeCache.txt: | $(_build_path) .gitmodules - cd $(_build_path) && $(run_cmake) - -rm compile_commands.json - ln -s $(_build_path)/compile_commands.json - -build: $(_build_path)/CMakeCache.txt ## Compile the project. - cmake $(CMAKE_FLAGS) -DCMAKE_TOOLCHAIN_FILE=etc/$(TOOLCHAIN)-toolchain.cmake -B $(_build_path) -S . - cmake --build $(_build_path) --config $(BUILD_CONFIG) --target all -- -k 0 - -install: $(_build_path)/CMakeCache.txt ## Install the project. - DESTDIR=$(abspath $(DEST)) ninja -C $(_build_path) -k 0 install - -ctest: $(_build_path)/CMakeCache.txt ## Run CTest on current build. - ctest --build-config $(BUILD_CONFIG) --output-on-failure --test-dir $(_build_path) - -ctest_ : build - ctest --build-config $(BUILD_CONFIG) --output-on-failure --test-dir $(_build_path) - -test: ctest_ ## Rebuild and run tests. - -cmake: | $(_build_path) - cd $(_build_path) && ${run_cmake} - -clean: $(_build_path)/CMakeCache.txt ## Clean the build artifacts, but don't delete the build directory. - cmake --build $(_build_path) --config $(BUILD_CONFIG) --target clean - -realclean: ## Delete the entire build directory. - rm -rf $(_build_path) - -env: - $(foreach v, $(.VARIABLES), $(info $(v) = $($(v)))) - -.PHONY : build install ctest ctest_ test cmake clean realclean env - -.PHONY: papers -papers: - $(MAKE) -C papers papers - -# Help target -.PHONY: help -help: ## Show this help. - @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort diff --git a/README.md b/README.md index ca7050cc..6bcc4b9c 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,10 @@ This repository implements `std::optional` extensions targeting C++26. The `Bema * [Compiler Support](#compiler-support) * [Dependencies](#dependencies) * [Instructions](#instructions) - * [Default Build and Test Flow](#default-build-and-test-flow) - * [More Complex Cases](#more-complex-cases) - * [Step by Step Build: Build and Run Tests](#step-by-step-build-build-and-run-tests) - * [Step by Step Build: Build Production and Skip Tests](#step-by-step-build-build-production-and-skip-tests) + * [Preset CMake Flows](#preset-cmake-flows) + * [Custom CMake Flows](#custom-cmake-flows) + * [Build and Run Tests](#build-and-run-tests) + * [Build Production, but Skip Tests](#build-production-but-skip-tests) * [Papers](#papers) ## License @@ -141,7 +141,7 @@ apt-get install \ Full set of supported toolchains can be found in [.github/workflows/ci.yml](.github/workflows/ci.yml). -#### Default Build and Test Flow +#### Preset CMake Flows This project strives to be as normal and simple a CMake project as possible. This build workflow in particular will work, producing a static `beman_optional26` library, ready to package: @@ -186,17 +186,9 @@ Total Test time (real) = 0.09 sec This should build and run the tests with GCC 14 with the address and undefined behavior sanitizers enabled. -#### More Complex Cases +#### Custom CMake Flows -The CMake preset system suffers from combinitorial explosion. There is a makefile in the root of the repository to aid in running more configurations. - -```shell -make -k TOOLCHAIN=clang-18 CONFIG=Tsan VERBOSE=1 -``` - -The makefile will use your system compiler, `c++`, if no toolchain name is provided, otherwise it will use the toolchain in the etc/ directory to perform the build. The Ninja multi config generator is used, with configurations for `RelWithDebugInfo`, `Debug`, `Tsan`, and `Asan` configured by default. - -#### Step by Step Build: Build and Run Tests +##### Build and Run Tests CI current build and test flows: @@ -222,7 +214,7 @@ Test project /path/to/Optional26/.build Total Test time (real) = 0.67 sec ``` -#### Step by Step Build: Build Production and Skip Tests +##### Build Production, but Skip Tests By default, we build and run tests. You can provide `-DBUILD_TESTING=OFF` and completely disable building tests: