forked from wpilibsuite/allwpilib
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
129 lines (122 loc) · 4.4 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
import org.gradle.internal.os.OperatingSystem
if (project.hasProperty('onlylinuxathena')) {
return;
}
apply plugin: 'cpp'
if (OperatingSystem.current().isMacOsX()) {
apply plugin: 'objective-cpp'
}
apply plugin: 'visual-studio'
apply plugin: 'edu.wpi.first.NativeUtils'
ext {
nativeName = 'wpigui'
}
apply from: "${rootDir}/shared/config.gradle"
nativeUtils.exportsConfigs {
wpigui {
}
}
model {
components {
"${nativeName}"(NativeLibrarySpec) {
sources.cpp {
source {
srcDirs "src/main/native/cpp"
include '*.cpp'
}
exportedHeaders {
srcDirs 'src/main/native/include'
}
}
binaries.all {
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
it.buildable = false
return
}
if (it.targetPlatform.operatingSystem.isWindows()) {
it.sources {
wpiguiWindowsCpp(CppSourceSet) {
source {
srcDirs 'src/main/native/directx11'
include '*.cpp'
}
}
}
} else if (it.targetPlatform.operatingSystem.isMacOsX()) {
it.sources {
wpiguiMacObjectiveCpp(ObjectiveCppSourceSet) {
source {
srcDirs 'src/main/native/metal'
include '*.mm'
}
}
}
} else if (it.targetPlatform.name.startsWith('linuxarm')) {
it.sources {
wpiguiUnixGl2Cpp(CppSourceSet) {
source {
srcDirs 'src/main/native/opengl2'
include '*.cpp'
}
}
}
} else {
it.sources {
wpiguiUnixGl3Cpp(CppSourceSet) {
source {
srcDirs 'src/main/native/opengl3'
include '*.cpp'
}
}
}
}
it.sources.each {
it.exportedHeaders {
srcDirs 'src/main/native/include'
}
}
}
}
// By default, a development executable will be generated. This is to help the case of
// testing specific functionality of the library.
"${nativeName}Dev"(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources.cpp {
source {
srcDirs 'src/dev/native/cpp'
include '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/dev/native/include'
}
}
binaries.all {
lib library: 'wpigui'
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
}
}
}
binaries {
all {
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
it.buildable = false
return
}
if (it.targetPlatform.operatingSystem.isWindows()) {
it.linker.args << 'Gdi32.lib' << 'Shell32.lib' << 'd3d11.lib' << 'd3dcompiler.lib'
} else if (it.targetPlatform.operatingSystem.isMacOsX()) {
it.linker.args << '-framework' << 'Metal' << '-framework' << 'MetalKit' << '-framework' << 'Cocoa' << '-framework' << 'IOKit' << '-framework' << 'CoreFoundation' << '-framework' << 'CoreVideo' << '-framework' << 'QuartzCore'
} else {
it.linker.args << '-lX11'
if (it.targetPlatform.name.startsWith('linuxarm')) {
it.linker.args << '-lGL'
}
}
}
withType(SharedLibraryBinarySpec) {
buildable = false
}
}
}
apply from: 'publish.gradle'