-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.toml
60 lines (48 loc) · 1.47 KB
/
Makefile.toml
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
[config]
skip_core_tasks = true
on_error_task = "catch"
[env]
RUST_LIB_PATH = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = "", mapping = { "linux" = "./target/release/librust_ext.so", "macos" = "./target/release/librust_ext.dylib", "windows" = ".\\target\\release\\rust_ext.dll" } }
RUST_LIB_EXT = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = "so", mapping = { "windows" = "pyd" } }
PYQT_INSTALL = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = "pip3 install --user pyqt5", mapping = {"linux" = "sudo apt-get install python3-pyqt5" } }
[tasks.default]
clear = true
dependencies = ["all"]
[tasks.all]
dependencies = ["build", "move", "python_dep"]
[tasks.re]
dependencies = ["clean", "all"]
[tasks.catch]
script_runner = "@shell"
script = '''
echo "Could not build. If you are using linux you may want to install pyqt5 or run cargo make with sudo"
'''
[tasks.move]
script_runner = "@shell"
script = '''
echo Detected platform : $CARGO_MAKE_RUST_TARGET_OS.
echo Moving file to correct folder.
mv $RUST_LIB_PATH ./target/release/rust_ext.$RUST_LIB_EXT
'''
[tasks.python_dep]
dependencies = ["numpy", "pyqt"]
[tasks.pyqt]
script_runner = "@shell"
script = '''
$PYQT_INSTALL
'''
[tasks.numpy]
script_runner = "@shell"
script = '''
echo Checking/installing pip requirements.
pip3 install numpy
'''
[tasks.build]
command = "cargo"
args = ["build", "--release"]
[tasks.test]
command = "cargo"
args = ["test"]
[tasks.clean]
command = "cargo"
args = ["clean"]