portability/Makefile

202 lines
7.4 KiB
Makefile
Raw Permalink Normal View History

2018-04-02 11:45:52 +10:00
CTS_DIR=../VK-GL-CTS
2018-04-27 07:55:06 +10:00
CHERRY_DIR=../cherry
2017-09-07 11:34:41 +10:00
BINDING=target/vulkan.rs
LIB_FILE_NAME=
LIB_VULKAN_NAME=
2017-09-07 11:34:41 +10:00
NATIVE_DIR=target/native
NATIVE_TARGET=$(NATIVE_DIR)/test
NATIVE_OBJECTS=$(NATIVE_DIR)/test.o $(NATIVE_DIR)/window.o
2018-05-04 11:04:33 +10:00
TEST_LIST=$(CURDIR)/conformance/deqp.txt
TEST_LIST_SOURCE=$(CTS_DIR)/external/vulkancts/mustpass/1.0.2/vk-default.txt
2018-05-04 11:04:33 +10:00
DEQP_DIR=$(CTS_DIR)/build/external/vulkancts/modules/vulkan/
DEQP=cd $(DEQP_DIR) && RUST_LOG=debug LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) ./deqp-vk
2018-08-28 22:59:39 +10:00
CLINK_ARGS=
GIT_TAG_FULL=$(shell git describe --tags)
OS_NAME=
2020-08-26 09:51:56 +10:00
ZIP_COMMAND=
2018-07-25 01:14:58 +10:00
2018-06-13 00:59:20 +10:00
DOTA_DIR=../dota2/bin/osx64
DOTA_EXE=$(DOTA_DIR)/dota2.app/Contents/MacOS/dota2
2018-07-24 23:33:10 +10:00
#possible command lines are : -vulkan_disable_occlusion_queries -vulkan_scene_system_job_cost 2 +vulkan_batch_submits 1 +vulkan_batch_size 500
DOTA_PARAMS:=-vulkan -vulkan_disable_occlusion_queries -vulkan_descriptor_sets_per_pool 256
2018-07-25 01:14:58 +10:00
DOTA_DEMO_PHORONIX= "$(CURDIR)/../dota2/demos/dota2-pts-1971360796.dem"
DOTA_BENCHMARK=+timedemoquit +timedemo $(DOTA_DEMO_PHORONIX) +timedemo_start 40000 +timedemo_end 50000 +fps_max 0 -novconsole -high -autoconfig_level 3
2018-07-25 01:14:58 +10:00
DOTA_BENCH_RESULTS=../dota2/dota/Source2Bench.csv
2018-03-02 14:04:47 +11:00
RUST_BACKTRACE:=1
BACKEND:=gl
2018-04-19 05:30:31 +10:00
DEBUGGER=rust-gdb --args
GFX_METAL_RECORDING:=immediate
2017-12-01 10:50:59 +11:00
CC=g++
2020-08-26 09:51:56 +10:00
CFLAGS=-std=c++11 -ggdb -O0 -Iheaders
2017-09-07 12:01:58 +10:00
DEPS=
2018-03-02 14:04:47 +11:00
LDFLAGS=
2020-09-20 13:12:12 +10:00
ifeq ($(CARGO_BUILD_TARGET),)
JSON_SUFFIX=$(OS_NAME)-*
else
JSON_SUFFIX=$(CARGO_BUILD_TARGET)
endif
2018-03-02 14:04:47 +11:00
ifeq ($(OS),Windows_NT)
LDFLAGS=
BACKEND=dx12
2020-08-26 09:51:56 +10:00
LIB_FILE_NAME=portability.dll
LIB_VULKAN_NAME=vulkan.dll
OS_NAME=windows
2020-08-26 09:51:56 +10:00
ZIP_COMMAND=7z a -tzip
2018-03-02 14:04:47 +11:00
else
UNAME_S:=$(shell uname -s)
2020-08-26 09:51:56 +10:00
ZIP_COMMAND=zip
2018-03-02 14:04:47 +11:00
ifeq ($(UNAME_S),Linux)
LDFLAGS=-lpthread -ldl -lm -lX11 -lxcb
BACKEND=vulkan
2020-08-26 09:51:56 +10:00
LIB_FILE_NAME=libportability.so
LIB_VULKAN_NAME=libvulkan.so
OS_NAME=linux
2018-03-02 14:04:47 +11:00
endif
ifeq ($(UNAME_S),Darwin)
LDFLAGS=-lpthread -ldl -lm
BACKEND=metal
2018-04-19 05:30:31 +10:00
DEBUGGER=rust-lldb --
2020-08-26 09:51:56 +10:00
LIB_FILE_NAME=libportability.dylib
LIB_VULKAN_NAME=libvulkan.dylib
2020-09-20 13:12:12 +10:00
#TODO: find a more idiomatic way to pass this arguments!
2018-08-28 22:59:39 +10:00
CLINK_ARGS=-- -Clink-arg="-current_version 1.0.0" -Clink-arg="-compatibility_version 1.0.0"
OS_NAME=macos
2018-03-02 14:04:47 +11:00
endif
endif
2018-04-02 11:45:52 +10:00
FULL_LIBRARY_PATH=$(CURDIR)/target/debug
2020-08-26 09:51:56 +10:00
LIBRARY=target/debug/$(LIB_FILE_NAME)
LIBRARY_FAST=target/release/$(LIB_FILE_NAME)
2017-09-07 12:01:58 +10:00
2020-08-26 09:51:56 +10:00
.PHONY: all dummy check-target rebuild debug release version-debug version-release binding run-native cts clean cherry dota-debug dota-release dota-orig dota-bench-gfx dota-bench-orig dota-bench-gl memcpy-report
2017-09-13 02:27:01 +10:00
all: $(NATIVE_TARGET)
2020-04-11 14:25:18 +10:00
dummy:
2018-04-27 07:55:06 +10:00
rebuild:
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND)
2018-04-26 02:00:50 +10:00
debug:
2018-06-13 00:59:20 +10:00
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND),debug
release: $(LIBRARY_FAST)
2018-04-26 02:00:50 +10:00
2018-06-25 12:27:10 +10:00
version-debug:
2018-08-28 22:59:39 +10:00
cargo rustc --manifest-path libportability/Cargo.toml --features $(BACKEND),portability-gfx/env_logger $(CLINK_ARGS)
2018-06-06 12:54:02 +10:00
2018-06-25 12:27:10 +10:00
version-release:
2018-08-28 22:59:39 +10:00
cargo rustc --release --manifest-path libportability/Cargo.toml --features $(BACKEND) $(CLINK_ARGS)
2018-06-13 00:59:20 +10:00
2020-08-26 09:51:56 +10:00
check-target:
cargo check --manifest-path libportability/Cargo.toml --target $(TARGET) --features $(BACKEND)
cargo check --manifest-path libportability-icd/Cargo.toml --target $(TARGET) --features $(BACKEND),portability-gfx/env_logger
2018-07-25 01:14:58 +10:00
2018-06-25 12:27:10 +10:00
dota-debug: version-debug $(DOTA_EXE)
2018-08-25 06:52:54 +10:00
DYLD_LIBRARY_PATH=$(CURDIR)/target/debug:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS)
dota-debugger: version-debug $(DOTA_EXE)
2018-06-30 04:04:11 +10:00
echo "env DYLD_LIBRARY_PATH=$(CURDIR)/target/debug:$(CURDIR)/$(DOTA_DIR)" >.lldbinit
2018-08-25 06:52:54 +10:00
DYLD_LIBRARY_PATH=$(CURDIR)/target/debug:$(CURDIR)/$(DOTA_DIR) $(DEBUGGER) $(DOTA_EXE) $(DOTA_PARAMS)
2018-06-13 00:59:20 +10:00
2018-06-25 12:27:10 +10:00
dota-release: version-release $(DOTA_EXE)
2018-08-25 06:52:54 +10:00
DYLD_LIBRARY_PATH=$(CURDIR)/target/release:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS)
2018-07-25 01:14:58 +10:00
dota-molten: $(DOTA_EXE)
2018-08-25 06:52:54 +10:00
DYLD_LIBRARY_PATH=$(CURDIR)/../MoltenVK/Package/Release/MoltenVK/macOS:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS)
2018-07-25 01:14:58 +10:00
dota-orig: $(DOTA_EXE)
2018-08-25 06:52:54 +10:00
DYLD_LIBRARY_PATH=$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS)
2018-07-25 01:14:58 +10:00
dota-orig-gl: $(DOTA_EXE)
2018-07-24 23:33:10 +10:00
DYLD_LIBRARY_PATH=$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) -gl
2018-04-23 06:07:39 +10:00
2018-07-25 01:14:58 +10:00
dota-bench-gfx: version-release $(DOTA_EXE)
2018-08-25 06:52:54 +10:00
DYLD_LIBRARY_PATH=$(CURDIR)/target/release:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_BENCHMARK) $(DOTA_PARAMS)
2018-07-25 01:14:58 +10:00
dota-bench-orig: $(DOTA_EXE)
2018-08-25 06:52:54 +10:00
DYLD_LIBRARY_PATH=$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_BENCHMARK) $(DOTA_PARAMS)
2018-07-25 01:14:58 +10:00
dota-bench-gl: $(DOTA_EXE)
DYLD_LIBRARY_PATH=$(CURDIR)/target/release:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_BENCHMARK) -gl
ifeq ($(UNAME_S),Darwin)
target/debug/libMoltenVK.dylib: version-debug
cd target/debug && ln -sf libportability.dylib libMoltenVK.dylib
target/release/libMoltenVK.dylib: version-release
cd target/release && ln -sf libportability.dylib libMoltenVK.dylib
molten-links: target/debug/libMoltenVK.dylib target/release/libMoltenVK.dylib
endif
2018-07-25 01:14:58 +10:00
2017-09-13 02:27:01 +10:00
binding: $(BINDING)
2020-08-26 09:51:56 +10:00
$(BINDING): headers/vulkan/*.h
bindgen --no-layout-tests --rustfmt-bindings headers/vulkan/vulkan.h -o $(BINDING)
2020-04-11 14:25:18 +10:00
$(LIBRARY): dummy
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND),debug
cargo build --manifest-path libportability-icd/Cargo.toml --features $(BACKEND),debug
2017-09-07 11:34:41 +10:00
2020-04-11 14:25:18 +10:00
$(LIBRARY_FAST): dummy
2018-04-23 06:07:39 +10:00
cargo build --release --manifest-path libportability/Cargo.toml --features $(BACKEND)
cargo build --release --manifest-path libportability-icd/Cargo.toml --features $(BACKEND)
2017-12-01 10:50:59 +11:00
$(NATIVE_DIR)/%.o: native/%.cpp $(DEPS) Makefile
-mkdir $(NATIVE_DIR)
2017-09-07 11:34:41 +10:00
$(CC) -c -o $@ $< $(CFLAGS)
$(NATIVE_TARGET): $(LIBRARY) $(NATIVE_OBJECTS) Makefile
$(CC) -o $(NATIVE_TARGET) $(NATIVE_OBJECTS) $(LIBRARY) $(LDFLAGS)
run-native: $(NATIVE_TARGET)
$(NATIVE_TARGET)
$(TEST_LIST): $(TEST_LIST_SOURCE)
cat $(TEST_LIST_SOURCE) | grep -v -e ".event" -e "query" >$(TEST_LIST)
2018-05-31 11:27:34 +10:00
ifdef pick
cts:
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND),portability-gfx/env_logger
($(DEQP) -n $(pick))
else
ifdef debug
cts: $(LIBRARY)
2018-06-30 04:04:11 +10:00
echo "env LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH)" >.lldbinit
2018-05-31 11:27:34 +10:00
#(cd $(DEQP_DIR) && LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(DEBUGGER) ./deqp-vk -n $(debug))
LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(DEBUGGER) $(DEQP_DIR)/deqp-vk -n $(debug)
else
cts: $(LIBRARY) $(TEST_LIST)
2018-05-04 11:04:33 +10:00
($(DEQP) --deqp-caselist-file=$(TEST_LIST))
2018-04-02 11:45:52 +10:00
python $(CTS_DIR)/scripts/log/log_to_xml.py TestResults.qpa conformance/last.xml
mv TestResults.qpa conformance/last.qpa
firefox conformance/last.xml
2018-05-31 11:27:34 +10:00
endif #debug
endif #pick
2018-04-07 00:42:38 +10:00
clean:
rm -f $(NATIVE_OBJECTS) $(NATIVE_TARGET) $(BINDING)
2017-09-07 11:34:41 +10:00
cargo clean
2018-04-27 07:55:06 +10:00
2020-08-26 09:51:56 +10:00
gfx-portability.zip: version-debug version-release
2018-09-06 06:58:52 +10:00
cargo build --manifest-path libportability-icd/Cargo.toml --features $(BACKEND)
cargo build --manifest-path libportability-icd/Cargo.toml --features $(BACKEND) --release
echo "$(GIT_TAG_FULL)" > commit-sha
2020-09-20 13:12:12 +10:00
$(ZIP_COMMAND) gfx-portability.zip target/$(CARGO_BUILD_TARGET)/*/$(LIB_FILE_NAME) libportability-icd/portability-$(JSON_SUFFIX).json commit-sha
gfx-portability-custom.zip:
cargo build -Z build-std --manifest-path libportability/Cargo.toml --features $(BACKEND)
cargo build -Z build-std=std,panic_abort --manifest-path libportability/Cargo.toml --features $(BACKEND) --release
echo "$(GIT_TAG_FULL)" > commit-sha
$(ZIP_COMMAND) gfx-portability-custom.zip target/$(CARGO_BUILD_TARGET)/*/$(LIB_FILE_NAME) commit-sha
2020-08-26 09:51:56 +10:00
target/debug/$(LIB_VULKAN_NAME):
cd target/debug && ln -sf $(LIB_FILE_NAME) $(LIB_VULKAN_NAME)
2020-08-26 09:51:56 +10:00
cherry: $(LIBRARY) $(LIB_VULKAN_NAME)
cd $(CHERRY_DIR) && rm -f Cherry.db && RUST_LOG=warn LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) go run server.go
memcpy-report:
RUSTFLAGS='-g --emit=llvm-ir' cd libportability && cargo build --release --features $(BACKEND)
../memcpy-find/memcpy-find target/release/deps/portability.ll | rustfilt >etc/portability-memcpy.txt