portability/Makefile

171 lines
6.2 KiB
Makefile
Raw Normal View History

2017-09-07 12:01:58 +10:00
VULKAN_DIR=modules/vulkan-docs/src
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
NATIVE_DIR=target/native
NATIVE_TARGET=$(NATIVE_DIR)/test
NATIVE_OBJECTS=$(NATIVE_DIR)/test.o $(NATIVE_DIR)/window.o
2018-03-02 14:04:47 +11:00
LIB_EXTENSION=
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=
2018-08-29 12:46:43 +10:00
GIT_TAG=$(shell git describe --abbrev=0 --tags)
OS_NAME=
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_disable_occlusion_queries
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++
2017-12-08 08:29:14 +11:00
CFLAGS=-std=c++11 -ggdb -O0 -I$(VULKAN_DIR)
2017-09-07 12:01:58 +10:00
DEPS=
2018-03-02 14:04:47 +11:00
LDFLAGS=
ifeq ($(OS),Windows_NT)
LDFLAGS=
BACKEND=dx12
LIB_EXTENSION=dll
OS_NAME=windows
2018-03-02 14:04:47 +11:00
else
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
LDFLAGS=-lpthread -ldl -lm -lX11 -lxcb
BACKEND=vulkan
LIB_EXTENSION=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 --
2018-03-02 14:04:47 +11:00
LIB_EXTENSION=dylib
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
2018-03-02 14:04:47 +11:00
LIBRARY=target/debug/libportability.$(LIB_EXTENSION)
2018-04-23 06:07:39 +10:00
LIBRARY_FAST=target/release/libportability.$(LIB_EXTENSION)
2017-09-07 12:01:58 +10:00
2018-08-29 12:46:43 +10:00
.PHONY: all 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 package
2017-09-13 02:27:01 +10:00
all: $(NATIVE_TARGET)
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
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)
2017-09-07 12:01:58 +10:00
$(BINDING): $(VULKAN_DIR)/vulkan/*.h
bindgen --no-layout-tests --rustfmt-bindings $(VULKAN_DIR)/vulkan/vulkan.h -o $(BINDING)
2018-04-12 23:24:47 +10:00
$(LIBRARY): libportability*/src/*.rs libportability*/Cargo.toml Cargo.lock
2018-03-02 14:04:47 +11:00
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND)
2018-04-12 23:24:47 +10:00
cargo build --manifest-path libportability-icd/Cargo.toml --features $(BACKEND)
2017-09-07 11:34:41 +10:00
mkdir -p target/native
2018-04-23 06:07:39 +10:00
$(LIBRARY_FAST): libportability*/src/*.rs libportability*/Cargo.toml Cargo.lock
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
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
2018-08-29 12:46:43 +10:00
package: version-debug version-release
2018-08-29 12:59:45 +10:00
cd target && cp ../.git/refs/heads/master commit-sha && zip ../gfx-portability-$(OS_NAME)-$(GIT_TAG).zip */libportability.$(LIB_EXTENSION) commit-sha
target/debug/libvulkan.$(LIB_EXTENSION):
cd target/debug && ln -sf libportability.$(LIB_EXTENSION) libvulkan.$(LIB_EXTENSION)
cherry: $(LIBRARY) target/debug/libvulkan.$(LIB_EXTENSION)
cd $(CHERRY_DIR) && rm -f Cherry.db && RUST_LOG=warn LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) go run server.go