forked from apaniukov/openvino_contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
94 lines (85 loc) · 2.59 KB
/
build.gradle
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
plugins {
id 'java-library'
}
import org.gradle.internal.os.OperatingSystem
println 'Operating system: ' + OperatingSystem.current()
def arch = System.getProperty("os.arch")
def ov_arch = arch;
println 'CPU architecture: ' + arch
def nativesCPP;
def openvinoVersion = "2023.0"
def native_resources = []
def tbb_dir = System.getenv('TBB_DIR')
if (tbb_dir) {
if (new File(tbb_dir + "/../lib/").exists()) {
native_resources.add(tbb_dir + "/../lib/");
} else {
native_resources.add(tbb_dir + "/../../");
}
}
if (arch == "x86_64" || arch == "amd64" || arch == "x64" || arch == "x86-64") {
arch = "x86_64";
ov_arch = "intel64";
} else if (arch == "aarch64" || arch == "arm64" || arch == "arm-v8") {
arch = "arm64";
ov_arch = "aarch64";
} else if (arch == "arm" || arch == "arm-v7" || arch == "armv7" || arch == "arm32") {
arch = "arm32";
ov_arch = "armhf";
}
if (OperatingSystem.current().isMacOsX()) {
nativesCPP = 'macosx-'
native_resources.add(System.getenv('INTEL_OPENVINO_DIR') + "/runtime/lib/" + ov_arch + "/Release");
} else if (OperatingSystem.current().isLinux()) {
nativesCPP = 'linux-'
native_resources.add(System.getenv('INTEL_OPENVINO_DIR') + "/runtime/lib/" + ov_arch);
} else if (OperatingSystem.current().isWindows()) {
nativesCPP = 'windows-'
native_resources.add(System.getenv('INTEL_OPENVINO_DIR') + "/runtime/bin/" + ov_arch + "/Release");
} else {
logger.warn('Unknown operating system!')
}
nativesCPP += arch;
project.version = "${openvinoVersion}-${nativesCPP}"
def resources_list = ""
native_resources.each {
def tree = fileTree(it) {
include '*'
}
tree.visit { FileVisitDetails details ->
if (!details.file.isDirectory()) {
resources_list += details.file.name + "\n"
}
}
}
file('src/main/native').mkdirs()
file('src/main/native/resources_list.txt').text = "${resources_list}"
sourceSets {
main {
java {
srcDirs = ["src/main/java"]
}
resources {
srcDirs = native_resources
srcDir 'src/main/native'
}
}
test {
java {
srcDirs = ["src/test/java"]
include "org/intel/openvino/compatibility/*.java", "org/intel/openvino/*.java"
}
}
}
repositories {
mavenCentral()
}
dependencies {
testImplementation "junit:junit:4.13.1"
testImplementation "org.hamcrest:hamcrest-core:1.3"
}
test {
systemProperty 'MODELS_PATH', System.getProperty('MODELS_PATH')
systemProperty 'device', System.getProperty('device')
}
test.onlyIf { project.hasProperty('run_tests') }