-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBazel_Makefile
92 lines (74 loc) · 2.53 KB
/
Bazel_Makefile
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
82
83
84
85
86
87
88
89
90
91
92
TARGET = VenomEngine
DOXYGEN = doxygen
DOC_FOLDER = docs
DOXYFILE = Doxyfile
EXTERNAL_LIBS = lib/external
DIRECTXSHADERCOMPILER = $(EXTERNAL_LIBS)/DirectXShaderCompiler
# Detect the platform
ifeq ($(OS),Windows_NT)
MKDIR_CMD = cmd /c mkdir
else
MKDIR_CMD = mkdir -p
endif
all: fast_run
debug:
bazel build //:$(TARGET) --compilation_mode=dbg
release:
bazel build //:$(TARGET) --compilation_mode=opt
debug_run: debug
bazel run //:$(TARGET) --compilation_mode=dbg
release_run: release
bazel run //:$(TARGET) --compilation_mode=opt
fast:
bazel build //:$(TARGET) --compilation_mode=fastbuild
fast_run: fast
bazel run //:$(TARGET) --compilation_mode=fastbuild
# Generates and open doc for visualization
docs:
cd $(DOC_FOLDER) && $(DOXYGEN) $(DOXYFILE)
dxc:
-$(MKDIR_CMD) cmake_build/dxc
# You can ignore the generator flag if you want to use the default one
cd cmake_build/dxc && \
cmake ../$(DIRECTXSHADERCOMPILER) -C ../$(DIRECTXSHADERCOMPILER)/cmake/caches/PredefinedParams.cmake -DCMAKE_BUILD_TYPE=Release -DDXC_USE_LIT=On -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS="-v" && \
cmake --build . --target dxc --config Release
check_ruby:
@echo "Checking Ruby..."
@ruby -v > /dev/null 2>&1 || make __install_ruby
__install_ruby:
@echo "Installing Ruby..."
ifeq ($(OS),Windows_NT)
# Windows: Using RubyInstaller
@echo "Installing Ruby on Windows..."
@powershell -Command "Invoke-WebRequest -Uri 'https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.2.5-1/rubyinstaller-devkit-3.2.5-1-x64.exe' -OutFile 'rubyinstaller.exe'"
@powershell -Command "Start-Process -Wait -FilePath 'rubyinstaller.exe'"
@powershell -Command "Remove-Item 'rubyinstaller.exe'"
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
# Linux: Using apt-get
@sudo apt-get update && sudo apt-get install -y ruby-full
else ifeq ($(UNAME_S),Darwin)
# macOS: Using Homebrew
@brew install ruby
endif
endif
compile_shaders_glsl: check_ruby
ruby ./resources/compile_shaders.rb compile_glsl
compile_shaders: check_ruby
ruby ./resources/compile_shaders.rb compile
compile_shaders_debug: check_ruby
ruby ./resources/compile_shaders.rb compile_debug
validate_shaders:
@echo "Validating all SPIR-V shaders..."
@echo "If no output is shown, the shaders are valid."
@for spv in ./resources/shaders/compiled/*.spv; do \
spirv-val $$spv; \
done
clean_shaders:
@ruby ./resources/compile_shaders.rb clean
clean:
@echo "Cleaning bazel solution..."
bazel clean
make clean_shaders
.PHONY: debug release debug_run release_run fast fast_run clean docs