Skip to content

Commit 0c6fd6f

Browse files
Merge branch 'feature/uv-migration' into develop
2 parents 1eefe22 + 739d074 commit 0c6fd6f

File tree

5 files changed

+781
-963
lines changed

5 files changed

+781
-963
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Default build directory
12
_build/
2-
# PAckages installed by vcpkg in manifest mode
3+
# Packages installed by vcpkg in manifest mode
34
vcpkg_installed/
5+
# Python virtualenv created by uv automatically
6+
.venv/

Makefile

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,56 @@
11
.SILENT:
2+
.PHONY: docs-html docs-serve default build test format format-check packages
23

3-
.PHONY: poetry-install docs-html docs-serve default build test format format-check packages
4-
5-
default: docs-html
4+
# If given no other target, runs the build
5+
default: build
66

7+
# The absolute path that refers to this Makefile
78
THIS_FILE := $(realpath $(lastword $(MAKEFILE_LIST)))
9+
# The directory that contains this Makefile (the repository root directory)
810
THIS_DIR := $(shell dirname $(THIS_FILE))
9-
POETRY := poetry -C $(THIS_DIR)
1011

11-
BUILD_DIR := $(THIS_DIR)/_build/auto
12-
_poetry_stamp := $(BUILD_DIR)/.poetry-install.stamp
13-
poetry-install: $(_poetry_stamp)
14-
$(_poetry_stamp): $(THIS_DIR)/poetry.lock $(THIS_DIR)/pyproject.toml
15-
$(POETRY) install --with=dev
16-
mkdir -p $(BUILD_DIR)
17-
touch $@
12+
# Directory where we will scribble build files
13+
BUILD_DIR ?= $(THIS_DIR)/_build/auto
14+
15+
# uv commands used in this file
16+
UV_RUN := uv run
17+
DOCS_RUN := $(UV_RUN) --isolated --group=docs
18+
FORMAT_RUN := $(UV_RUN) --isolated --group=format
19+
# Build is not isolated, because CMake caches paths to certain files
20+
BUILD_RUN := $(UV_RUN) --group=build
21+
# Run CMake within the uv environment
22+
CMAKE_RUN := $(BUILD_RUN) cmake
1823

1924
SPHINX_JOBS ?= auto
2025
SPHINX_ARGS := -W -j "$(SPHINX_JOBS)" -aT -b dirhtml
2126

2227
DOCS_SRC := $(THIS_DIR)/docs
2328
DOCS_OUT := $(BUILD_DIR)/docs/dev/html
24-
docs-html: poetry-install
25-
$(POETRY) run sphinx-build $(SPHINX_ARGS) $(DOCS_SRC) $(DOCS_OUT)
29+
docs-html:
30+
$(DOCS_RUN) sphinx-build $(SPHINX_ARGS) $(DOCS_SRC) $(DOCS_OUT)
2631

27-
docs-serve: poetry-install
28-
$(POETRY) run sphinx-autobuild $(SPHINX_ARGS) $(DOCS_SRC) $(DOCS_OUT)
32+
docs-serve:
33+
$(DOCS_RUN) sphinx-autobuild $(SPHINX_ARGS) $(DOCS_SRC) $(DOCS_OUT)
2934

30-
CONFIG ?= RelWithDebInfo
3135
build:
32-
cmake -S . -B "$(BUILD_DIR)" -G "Ninja" -D CMAKE_BUILD_TYPE=$(CONFIG)
33-
cmake --build "$(BUILD_DIR)" --config $(CONFIG)
36+
$(CMAKE_RUN) \
37+
-S "$(THIS_DIR)" \
38+
-B "$(BUILD_DIR)" \
39+
--fresh \
40+
-D CMAKE_CROSS_CONFIGS="Debug" \
41+
-D CMAKE_DEFAULT_CONFIGS=all \
42+
-G "Ninja Multi-Config"
43+
$(CMAKE_RUN) --build "$(BUILD_DIR)"
3444

3545
test: build
36-
cmake -E chdir "$(BUILD_DIR)" ctest -C "$(CONFIG)" --output-on-failure -j8
37-
38-
all_sources := $(shell find $(THIS_DIR)/src/ $(THIS_DIR)/include/ $(THIS_DIR)/tests/ $(THIS_DIR)/docs/ -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp')
39-
format-check: poetry-install
40-
$(POETRY) run python tools/include-fixup.py --check
41-
$(POETRY) run $(MAKE) _format-check
42-
_format-check:
43-
$(POETRY) run clang-format --dry-run $(all_sources)
44-
45-
format: poetry-install
46-
$(POETRY) run $(MAKE) _format
47-
_format:
48-
$(POETRY) run python tools/include-fixup.py
49-
$(POETRY) run clang-format --verbose -i $(all_sources)
46+
$(CMAKE_RUN) -E chdir "$(BUILD_DIR)" \
47+
ctest -C Debug -j4 --output-on-failure
48+
49+
format-check:
50+
$(UV_RUN) --group format tools/format.py --mode=check
51+
52+
format:
53+
$(UV_RUN) --group format tools/format.py
5054

5155
packages:
5256
bash $(THIS_DIR)/tools/earthly.sh -a +build-multi/ _build/pkgs

0 commit comments

Comments
 (0)