forked from unum-cloud/usearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
131 lines (115 loc) · 3.53 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import org.gradle.internal.jvm.Jvm
plugins {
id 'java-library'
id 'cpp'
id 'maven-publish'
}
group "cloud.unum"
version = file("VERSION").text.trim()
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
sourceSets {
main {
java {
srcDir "java/"
exclude "test/"
}
}
test {
java {
srcDir "java/test"
}
}
}
dependencies {
testImplementation('junit:junit:4.13.2')
}
model {
components {
usearch(NativeLibrarySpec) {
sources {
cpp {
source {
srcDirs "java/cloud/unum/usearch"
include "**/*.cpp"
}
exportedHeaders {
srcDirs "include", "fp16/include", "simsimd/include", "${Jvm.current().javaHome}/include"
}
}
}
binaries.withType(StaticLibraryBinarySpec) {
buildable = false
}
binaries.withType(SharedLibraryBinarySpec) {
if (targetPlatform.operatingSystem.linux) {
cppCompiler.args '-I', "${Jvm.current().javaHome}/include/linux"
cppCompiler.args '-D_FILE_OFFSET_BITS=64'
cppCompiler.args '-std=c++11'
} else if (targetPlatform.operatingSystem.macOsX) {
cppCompiler.args '-I', "${Jvm.current().javaHome}/include/darwin"
cppCompiler.args '-D_FILE_OFFSET_BITS=64'
cppCompiler.args '-std=c++11'
} else if (targetPlatform.operatingSystem.windows){
cppCompiler.args "-I${Jvm.current().javaHome}/include/win32"
cppCompiler.args '/std:c++11'
}
}
}
}
}
test {
forkEvery 1
dependsOn jar
// Rearrange test classpath, add compiled JAR instead of main classes
classpath = project.sourceSets.test.output + configurations.testRuntimeClasspath + files(jar.archiveFile)
}
jar {
dependsOn("usearchSharedLibrary")
into("usearch") {
from("$buildDir/libs/usearch/shared/libusearch.dylib")
from("$buildDir/libs/usearch/shared/libusearch.so")
}
}
publishing {
publications {
library(MavenPublication) {
from components.java
pom {
name = "USearch"
description = "Smaller & Faster Single-File Vector Search Engine from Unum"
url = "https://github.com/unum-cloud/usearch"
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
// Publishing to GitHub is much easier ;)
// repositories {
// maven {
// name = "OSSRH"
// url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
// credentials {
// username = System.getenv("MAVEN_USERNAME")
// password = System.getenv("MAVEN_PASSWORD")
// }
// }
// }
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/unum-cloud/usearch"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}