This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
69 lines (58 loc) · 1.24 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
import static org.apache.tools.ant.taskdefs.condition.Os.*
plugins {
id "cpp"
id "google-test-test-suite"
id "groovy"
}
model {
components {
udp_transferNT(NativeExecutableSpec) {
sources.cpp {
source {
srcDirs = ['UDP_TransferNT/test']
include '**/*.cpp', '**/*.cc', '**/*.c'
}
exportedHeaders {
srcDirs = ['UDP_TransferNT/include']
}
}
binaries.all {
linker.args '-pthread'
cppCompiler.args '-pthread'
}
}
}
}
[FAMILY_WINDOWS, FAMILY_UNIX, FAMILY_MAC].each { osName ->
// Create Task
if (!project.tasks.findByName("$osName")) {
tasks.create(osName) {
description "OS is ${osName}"
// Add condition to check operating system.
onlyIf { isFamily(osName) }
doLast {
println "Execution Family: '${it.name}'"
}
}
// Add task as dependency for the os task
build.dependsOn(osName)
}
}
task run {
doLast {
exec {
workingDir "build/exe/udp_transferNT"
if (isFamily(FAMILY_WINDOWS)) {
commandLine "cmd", "/c", "start", "udp_transferNT.exe"
} else if (isFamily(FAMILY_UNIX)) {
commandLine "./udp_transferNT"
} else {
ant.fail("Unknown platform. Cannot run. Please run manually")
}
}
}
}
run.dependsOn(build)
wrapper {
gradleVersion = "6.0"
}