-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.justfile
More file actions
81 lines (70 loc) · 2.49 KB
/
.justfile
File metadata and controls
81 lines (70 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Like GNU `make`, but `just` rustier.
# https://just.systems/
# run `just` from this directory to see available commands
alias r := run
alias b := build
alias w := web
alias c := clean
alias ch := check
alias d := docs
alias t := test
alias f := format
# Default command when 'just' is run without arguments
default:
@just --list
# Get the number of cores
CORES := if os() == "macos" { `sysctl -n hw.ncpu` } else if os() == "linux" { `nproc` } else { "1" }
# Run a package
run *package='bunny':
@./target/release/{{package}}
# Build the project
build *build_type='Release':
@mkdir -p build
@echo "Configuring the build system..."
@cd build && cmake -S .. -B . -DCMAKE_BUILD_TYPE={{build_type}} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
@echo "Building the project..."
@cd build && cmake --build . -j{{CORES}}
# Build the project for the web
web *build_type='Release':
@mkdir -p build
@if [ -n "${EM_CACHE-}" ]; then mkdir -p "$EM_CACHE" && mkdir -p "$EM_CACHE/tmp"; fi
@echo "Configuring the build system..."
@cd build && emcmake cmake -S .. -B . -DCMAKE_BUILD_TYPE={{build_type}}
@echo "Building the project..."
@cd build && cmake --build . -j{{CORES}}
@mkdir -p public/assets/
@# Find and copy WASM, JS and data files to the public directory
@find target/release/web -name "*.wasm" -exec cp {} ./public/ \;
@find target/release/web -name "*.js" -exec cp {} ./public/ \;
@find target/release/web -name "*.data" -exec cp {} ./public/ \;
@find assets/ -name "*.obj" -exec cp {} ./public/assets/ \;
@find assets/ -name "*.mesh" -exec cp {} ./public/assets/ \;
# Remove build artifacts and non-essential files
clean:
@echo "Cleaning..."
@rm -rf build
@rm -rf target
@if [ -n "${EM_CACHE-}" ]; then rm -rf "$EM_CACHE"; fi
check:
@echo "Running code quality tools..."
@cppcheck --error-exitcode=1 --project=build/compile_commands.json -i build/_deps/
# Run code quality tools
test:
@echo "Running tests..."
@./target/release/tests/test_library
# Format the project
format:
@echo "Formatting..."
@chmod +x ./scripts/format.sh
@./scripts/format.sh format
@cmake-format -i $(find . -name "CMakeLists.txt")
@find . -name "*.nix" -type f -exec nixfmt {} \;
# Generate documentation
docs:
@echo "Generating documentation..."
rm -rf website
./docs/doxygen/m.css/documentation/doxygen.py --debug docs/doxygen/conf.py
mkdir website
cp -r docs/doxygen/html/* website
cp -r docs/images website
rm -rf docs/doxygen/latex docs/doxygen/xml docs/doxygen/html docs/doxygen/__pycache__