forked from dongjing3309/minisam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (55 loc) · 1.94 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
PROJECT_SOURCE_DIR ?= $(abspath ./)
PROJECT_NAME ?= $(shell basename $(PROJECT_SOURCE_DIR))
BUILD_DIR ?= $(PROJECT_SOURCE_DIR)/build
INSTALL_DIR ?= $(BUILD_DIR)/install
NUM_JOBS ?= 8
PYTHON_EXECUTABLE ?= $(shell which python3)
all:
@echo nothing special
clean:
rm -rf $(BUILD_DIR)
build:
mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && \
cmake $(PROJECT_SOURCE_DIR) -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) && \
make -j$(NUM_JOBS)
.PHONY: build
PYTHON ?= python3
python_install:
$(PYTHON) setup.py install
python_build:
$(PYTHON) setup.py bdist_wheel
python_sdist:
$(PYTHON) setup.py sdist
python_test:
python3 -m pip install pytest
pytest tests
.PHONY: python_install python_build python_sdist python_test
docs_build:
mkdocs build
docs_serve:
mkdocs serve -a 0.0.0.0:8088
DOCKER_TAG_WINDOWS ?= ghcr.io/cubao/build-env-windows-x64:v0.0.1
DOCKER_TAG_LINUX ?= ghcr.io/cubao/build-env-manylinux2014-x64:v0.0.4
DOCKER_TAG_MACOS ?= ghcr.io/cubao/build-env-macos-arm64:v0.0.1
test_in_win:
docker run --rm -w `pwd` -v `pwd`:`pwd` -v `pwd`/build/win:`pwd`/build -it $(DOCKER_TAG_WINDOWS) bash
test_in_mac:
docker run --rm -w `pwd` -v `pwd`:`pwd` -v `pwd`/build/mac:`pwd`/build -it $(DOCKER_TAG_MACOS) bash
test_in_linux:
docker run --rm -w `pwd` -v `pwd`:`pwd` -v `pwd`/build/linux:`pwd`/build -it $(DOCKER_TAG_LINUX) bash
DEV_CONTAINER_NAME ?= $(USER)_$(subst /,_,$(PROJECT_NAME)____$(PROJECT_SOURCE_DIR))
DEV_CONTAINER_IMAG ?= $(DOCKER_TAG_LINUX)
test_in_dev_container:
docker ps | grep $(DEV_CONTAINER_NAME) \
&& docker exec -it $(DEV_CONTAINER_NAME) bash \
|| docker run --rm --name $(DEV_CONTAINER_NAME) \
--network host --security-opt seccomp=unconfined \
-v `pwd`:`pwd` -w `pwd` -it $(DEV_CONTAINER_IMAG) bash
tar.gz:
tar -cvz --exclude .git -f ../$(PROJECT_NAME).tar.gz .
ls -alh ../$(PROJECT_NAME).tar.gz
# https://stackoverflow.com/a/25817631
echo-% : ; @echo -n $($*)
Echo-% : ; @echo $($*)
ECHO-% : ; @echo $* = $($*)
echo-Tab: ; @echo -n ' '