-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.toml
54 lines (47 loc) · 1.65 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
[env]
RUSTFLAGS = "-C linker=${GRAAL_HOME}/languages/llvm/native/bin/clang -C ar=${GRAAL_HOME}/languages/llvm/native/bin/ar -C link-args=-lgraalvm-llvm -Og --emit=llvm-bc"
[tasks.ensure_graal]
condition = { env_not_set = ["GRAAL_HOME"], fail_message = "Found GraalVM in ${GRAAL_HOME}." }
script = '''
echo Environment variable GRAAL_HOME is not set. Set it to GraalVM\'s root directory.
exit 1
'''
[tasks.ensure_llvm]
condition = { files_not_exist = ["${GRAAL_HOME}/languages/llvm/native"], fail_message = "Found LLVM toolchain in ${GRAAL_HOME}/languages/llvm/native." }
script = '''
echo LLVM toolchain was not found in ${GRAAL_HOME}/languages/llvm/native. Try running "gu install llvm-toolchain".
exit 1
'''
[tasks.clean]
command = "cargo"
args = ["clean", "-p", "graal-bindgen", "-p", "graal-bindgen-macros"]
[tasks.bindings]
install_crate = { crate_name = "bindgen", binary = "bindgen", test_arg = "--help" }
command = "bindgen"
args = [
"${CARGO_MAKE_WORKING_DIRECTORY}/src/header.h",
"--rust-target",
"1.40",
"--no-derive-default",
"--ctypes-prefix",
"crate::types::ctypes",
"--generate",
"functions,types,vars,methods,constructors,destructors",
"-o",
"${CARGO_MAKE_WORKING_DIRECTORY}/src/bindings.rs",
"--",
"-I${GRAAL_HOME}/languages/llvm/include",
]
[tasks.build]
command = "cargo"
dependencies = ["ensure_graal", "ensure_llvm", "clean", "bindings"]
args = ["build"]
[tasks.run]
dependencies = ["build"]
script = '''
${GRAAL_HOME}/languages/llvm/bin/lli --polyglot --lib $(rustc --print sysroot)/lib/libstd-* target/debug/deps/graal_bindgen-*.bc
'''
[tasks.test]
command = "cargo"
args = ["test"]
dependencies = ["clean"]