-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
56 lines (47 loc) · 2.08 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
default_target: compile
.PHONY: clean_venv clean_cpp clean_cython clean_compile clean install
clean_venv:
@echo "Removing virtual Python environment..."
rm -rf venv/
clean_cpp:
@echo "Removing C++ compilation files..."
rm -rf cpp/build/
clean_cython:
@echo "Removing Cython compilation files..."
find python/ -type f -name "*.o" -delete
find python/ -type f -name "*.so" -delete
find python/ -type f -name "*.c" -delete
find python/ -type f -name "*.cpp" -delete
find python/ -type f -name "*.pyd" -delete
find python/ -type f -name "*.pyc" -delete
find python/ -type f -name "*.html" -delete
clean_compile: clean_cpp clean_cython
clean: clean_compile clean_venv
venv:
@echo "Creating virtual Python environment..."
python3 -m venv venv
@echo "Installing compile-time dependency \"numpy\" into virtual environment..."
venv/bin/pip install numpy
@echo "Installing compile-time dependency \"scipy\" into virtual environment..."
venv/bin/pip install scipy
@echo "Installing compile-time dependency \"Cython\" into virtual environment..."
venv/bin/pip install Cython
@echo "Installing compile-time dependency \"meson\" into virtual environment..."
venv/bin/pip install meson
@echo "Installing compile-time dependency \"ninja\" into virtual environment..."
venv/bin/pip install ninja
@echo "Installing compile-time dependency \"wheel\" into virtual environment..."
venv/bin/pip install wheel
compile: venv
@echo "Compiling C++ code..."
cd cpp/ && PATH=$$PATH:../venv/bin/ ../venv/bin/meson setup build/ -Doptimization=3
cd cpp/build/ && PATH=$$PATH:../../venv/bin/ ../../venv/bin/meson compile
@echo "Compiling Cython code..."
cd python/ && ../venv/bin/python setup.py build_ext --inplace
compile_windows: clean_compile venv
@echo "Cross compiling C++ code for 64 bit Windows target machines..."
cd cpp/ && PATH=$$PATH:../venv/bin/ ../venv/bin/meson setup build/ -Doptimization=3 --cross-file x86_64-windows.txt
cd cpp/build/ && PATH=$$PATH:../../venv/bin/ ../../venv/bin/meson compile
install: compile
@echo "Installing package into virtual environment..."
venv/bin/pip install python/