-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD
75 lines (69 loc) · 1.62 KB
/
BUILD
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
package(default_visibility = ["//visibility:public"])
genrule(
name = "version_include",
outs = ["includes/af/version.h"],
cmd = """
touch $(location includes/af/version.h)
""",
)
genrule(
name = "compilers_include",
outs = ["includes/af/compilers.h"],
cmd = """
touch $(location includes/af/compilers.h)
""",
)
genrule(
name = "generate_capi",
srcs = [
"@arrayfire//:include/arrayfire.h",
":version_include",
":compilers_include",
"@arrayfire//:include_files",
"@jextract//:bin/jextract",
"@jextract//:bin/java",
"@jextract//:files",
],
outs = [
"arrayfire-capi.jar",
],
cmd = """
HEADER=$(location @arrayfire//:include/arrayfire.h);
VERSION_HEADER=$(location :version_include);
VERSION_PARENT=$$(dirname $$VERSION_HEADER);
$(location @jextract//:bin/jextract) \
$(location @arrayfire//:include/arrayfire.h) \
-I $$(dirname $$HEADER) \
-I $$(dirname $$VERSION_PARENT) \
--define-macro AF_API_VERSION=39 \
--define-macro __CUDACC_RTC__=1 \
-t arrayfire.capi \
; \
jar cf $(location arrayfire-capi.jar) arrayfire/capi/*;
""",
)
java_import(
name = "capi",
jars = [
":arrayfire-capi.jar",
],
)
java_library(
name = "arrayfire",
srcs = glob(
["**/*.java"],
exclude = ["**/*Test.java"],
),
deps = [
":capi",
],
)
java_test(
name = "ArrayFireTest",
srcs = ["ArrayFireTest.java"],
test_class = "arrayfire.ArrayFireTest",
deps = [
":arrayfire",
":capi",
],
)