forked from bemanproject/optional
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from steve-downey/fix-issues
Fix issues
- Loading branch information
Showing
17 changed files
with
1,764 additions
and
590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#! /usr/bin/make -f | ||
# cmake-format: off | ||
# /Makefile -*-makefile-*- | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# cmake-format: on | ||
|
||
INSTALL_PREFIX?=.install/ | ||
PROJECT?=$(shell basename $(CURDIR)) | ||
BUILD_DIR?=.build | ||
DEST?=$(INSTALL_PREFIX) | ||
CMAKE_FLAGS?= | ||
|
||
TARGETS := test clean all ctest | ||
|
||
export | ||
|
||
.update-submodules: | ||
git submodule update --init --recursive | ||
touch .update-submodules | ||
|
||
.gitmodules: .update-submodules | ||
|
||
CONFIG?=Asan | ||
|
||
export | ||
|
||
ifeq ($(strip $(TOOLCHAIN)),) | ||
_build_name?=build-system/ | ||
_build_dir?=.build/ | ||
_configuration_types?="RelWithDebInfo;Debug;Tsan;Asan" | ||
_cmake_args=-DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/etc/toolchain.cmake | ||
else | ||
_build_name?=build-$(TOOLCHAIN) | ||
_build_dir?=.build/ | ||
_configuration_types?="RelWithDebInfo;Debug;Tsan;Asan" | ||
_cmake_args=-DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/etc/$(TOOLCHAIN)-toolchain.cmake | ||
endif | ||
|
||
|
||
_build_path?=$(_build_dir)/$(_build_name) | ||
|
||
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) \ | ||
$(CURDIR) | ||
endef | ||
|
||
default: 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 | ||
|
||
compile: $(_build_path)/CMakeCache.txt ## Compile the project | ||
cmake --build $(_build_path) --config $(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 | ||
cd $(_build_path) && ctest --output-on-failure | ||
|
||
ctest_ : compile | ||
cd $(_build_path) && ctest -C $(CONFIG) --output-on-failure | ||
|
||
test: ctest_ ## Rebuild and run tests | ||
|
||
cmake: | $(_build_path) | ||
cd $(_build_path) && ${run_cmake} | ||
|
||
clean: $(_build_path)/CMakeCache.txt ## Clean the build artifacts | ||
cmake --build $(_build_path) --config $(CONFIG) --target clean | ||
|
||
realclean: ## Delete the build directory | ||
rm -rf $(_build_path) | ||
|
||
env: | ||
$(foreach v, $(.VARIABLES), $(info $(v) = $($(v)))) | ||
|
||
.PHONY : compile 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) targets.mk | sort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include_guard(GLOBAL) | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/gcc-flags.cmake") | ||
|
||
set(CMAKE_C_COMPILER gcc-15) | ||
set(CMAKE_CXX_COMPILER g++-15) |
Oops, something went wrong.