-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
131 lines (100 loc) · 3.65 KB
/
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#
# Utility to inspect FBX files.
#
# 2021-∞ (c) blurryroots innovation qanat OÜ. All rights reserved.
# See license.md for details.
#
# https://think-biq.com
FILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_DIR := $(shell dirname $(FILE_PATH))
PROJECT_NAME := $(notdir $(patsubst %/,%,$(dir $(FILE_PATH))))
DEBUG_FLAG :=
BUILD_PATH = "${PROJECT_DIR}/build"
ifeq '$(findstring ;,$(PATH))' ';'
OS = "win"
VENV_BIN_DIR = Scripts
STD_FLAG = "/std:c++17 /EHa"
EXE_NAME = Verwandlung.exe
BUILD_PATH_RELEASE = "${BUILD_PATH}/Release"
EXE_PATH_RELEASE = "${BUILD_PATH_RELEASE}/${EXE_NAME}"
BUILD_PATH_DEBUG = "${BUILD_PATH}/Debug"
EXE_PATH_DEBUG = "${BUILD_PATH_DEBUG}/${EXE_NAME}"
LLDB = lldb
PYTHON = python
PYTHON_EXECUTABLE := "${shell $(PYTHON) -c "import sys; print(sys.executable)"}"
else
OS = "unix-y"
VENV_BIN_DIR = bin
STD_FLAG = "--std=c++17"
EXE_NAME = Verwandlung
BUILD_PATH_RELEASE = "${BUILD_PATH}"
EXE_PATH_RELEASE = "${BUILD_PATH_RELEASE}/${EXE_NAME}"
BUILD_PATH_DEBUG = "${BUILD_PATH}"
EXE_PATH_DEBUG = "${BUILD_PATH_DEBUG}/${EXE_NAME}"
LLDB = lldb
PYTHON := python3
PYTHON_EXECUTABLE := $(shell which $(PYTHON))
endif
CMD_ACTIVATE_VENV = . "$(PROJECT_DIR)/$(VENV_BIN_DIR)/activate"
SMALLFBX_VERSION = $(shell dirname $(FILE_PATH))
default: build
$(VENV_BIN_DIR): # creates target which only gets triggered if directory does not exist
@echo "Creating venv ..."
@$(PYTHON) -m venv "$(PROJECT_DIR)"
venv-upgrade: $(VENV_BIN_DIR)
@echo "Upgrading venv ..."
@$(PYTHON) -m venv --upgrade "$(PROJECT_DIR)"
@$(CMD_ACTIVATE_VENV); $(PYTHON) -m pip install -U -r "$(PROJECT_DIR)/requirements.txt"
venv-remove:
@echo "Removing venv ..."
@rm -rf "$(PROJECT_DIR)/bin"
@rm -rf "$(PROJECT_DIR)/include"
@rm -rf "$(PROJECT_DIR)/lib"
@rm -rf "$(PROJECT_DIR)/pyvenv.cfg"
list-venv-version:
@$(CMD_ACTIVATE_VENV); $(PYTHON) -V
list-venv-packages:
@$(CMD_ACTIVATE_VENV); $(PYTHON) -m pip list
setup-env: venv-upgrade
mkdir -p ./tmp ./bin
mkdir -p ./build
@echo PROJECT_DIR:$(PROJECT_DIR)
@echo OS:$(OS)
@echo STD_FLAG:$(STD_FLAG)
@echo EXE_PATH: $(EXE_PATH)
@echo PYTHON_EXECUTABLE: $(PYTHON_EXECUTABLE)
setup-cmake-release:
pushd ${BUILD_PATH}; $(CMD_ACTIVATE_VENV); cmake -DCMAKE_BUILD_TYPE="Release" \
-DPYTHON=$(PYTHON) \
-DPYTHON_EXECUTABLE=$(PYTHON_EXECUTABLE) \
-DCMAKE_CXX_FLAGS=$(STD_FLAG) ..
setup-cmake-debug:
pushd ${BUILD_PATH}; $(CMD_ACTIVATE_VENV); cmake -DCMAKE_BUILD_TYPE="Debug" \
-DPYTHON=$(PYTHON) \
-DPYTHON_EXECUTABLE=$(PYTHON_EXECUTABLE) \
-DCMAKE_CXX_FLAGS=$(STD_FLAG) ..
setup-release: setup-env setup-cmake-release
setup-debug: setup-env setup-cmake-debug
build-release: setup-release
pushd ${BUILD_PATH}; $(CMD_ACTIVATE_VENV); cmake --build . --config Release
build-debug: setup-debug
pushd ${BUILD_PATH}; $(CMD_ACTIVATE_VENV); cmake --build . --config Debug
clean:
@echo "Removing build artefacts ..."
@rm -rf "$(PROJECT_DIR)/tmp"
@rm -rf "$(PROJECT_DIR)/build"
clean-all: venv-remove clean
build: build-release
debug: build-debug
$(LLDB) -- $(EXE_PATH_RAW) --list ./etc/fbx/Gunan_animiated.fbx
test-smallfbx-release:
$(CMD_ACTIVATE_VENV); cmake --build ${BUILD_PATH} --config "Release" --target python_smallfbx_test
test-wandel-release:
$(CMD_ACTIVATE_VENV); cmake --build ${BUILD_PATH} --config "Release" --target python_wandel_test
test-release: test-smallfbx-release test-wandel-release
test-smallfbx-debug:
$(CMD_ACTIVATE_VENV); cmake --build ${BUILD_PATH} --config "Debug" --target python_smallfbx_test
test-wandel-debug:
$(CMD_ACTIVATE_VENV); cmake --build ${BUILD_PATH} --config "Debug" --target python_wandel_test
test-deubg: test-smallfbx-debug test-wandel-debug
test: test-release