blob: 5b8c4b2abcebdbc97eee103126fefc0d9ac76b41 [file] [log] [blame]
Austin Schuh1e69f942020-11-14 15:06:14 -08001import org.gradle.internal.os.OperatingSystem
2
3if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) {
4
5 apply plugin: 'cpp'
6 if (OperatingSystem.current().isMacOsX()) {
7 apply plugin: 'objective-cpp'
8 }
9 apply plugin: 'visual-studio'
10 apply plugin: 'edu.wpi.first.NativeUtils'
11
12 ext {
13 nativeName = 'wpigui'
14 }
15
16 apply from: "${rootDir}/shared/config.gradle"
17
18 nativeUtils.exportsConfigs {
19 wpigui {
Austin Schuh812d0d12021-11-04 20:16:48 -070020 x86ExcludeSymbols = [
21 '_CT??_R0?AV_System_error',
22 '_CT??_R0?AVexception',
23 '_CT??_R0?AVfailure',
24 '_CT??_R0?AVruntime_error',
25 '_CT??_R0?AVsystem_error',
26 '_CTA5?AVfailure',
27 '_TI5?AVfailure',
28 '_CT??_R0?AVout_of_range',
29 '_CTA3?AVout_of_range',
30 '_TI3?AVout_of_range',
31 '_CT??_R0?AVbad_cast'
32 ]
33 x64ExcludeSymbols = [
34 '_CT??_R0?AV_System_error',
35 '_CT??_R0?AVexception',
36 '_CT??_R0?AVfailure',
37 '_CT??_R0?AVruntime_error',
38 '_CT??_R0?AVsystem_error',
39 '_CTA5?AVfailure',
40 '_TI5?AVfailure',
41 '_CT??_R0?AVout_of_range',
42 '_CTA3?AVout_of_range',
43 '_TI3?AVout_of_range',
44 '_CT??_R0?AVbad_cast'
45 ]
Austin Schuh1e69f942020-11-14 15:06:14 -080046 }
47 }
48
49 model {
50 components {
51 "${nativeName}"(NativeLibrarySpec) {
52 sources {
53 cpp {
54 source {
55 srcDirs "src/main/native/cpp"
56 include '*.cpp'
57 }
58 exportedHeaders {
59 srcDirs 'src/main/native/include'
60 }
61 }
62 }
63 binaries.all {
64 nativeUtils.useRequiredLibrary(it, 'imgui_static')
Austin Schuh812d0d12021-11-04 20:16:48 -070065 lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
Austin Schuh1e69f942020-11-14 15:06:14 -080066 if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) {
67 it.buildable = false
68 return
69 }
70 if (it.targetPlatform.operatingSystem.isWindows()) {
71 it.sources {
72 wpiguiWindowsCpp(CppSourceSet) {
73 source {
74 srcDirs 'src/main/native/directx11'
75 include '*.cpp'
76 }
77 }
78 }
79 } else if (it.targetPlatform.operatingSystem.isMacOsX()) {
80 it.sources {
81 wpiguiMacObjectiveCpp(ObjectiveCppSourceSet) {
82 source {
83 srcDirs 'src/main/native/metal'
84 include '*.mm'
85 }
86 }
87 }
88 } else {
89 it.sources {
90 wpiguiUnixCpp(CppSourceSet) {
91 source {
92 srcDirs 'src/main/native/opengl3'
93 include '*.cpp'
94 }
95 }
96 }
97 }
98 it.sources.each {
99 it.exportedHeaders {
100 srcDirs 'src/main/native/include'
101 }
102 }
103 }
104 }
105 // By default, a development executable will be generated. This is to help the case of
106 // testing specific functionality of the library.
107 "${nativeName}Dev"(NativeExecutableSpec) {
108 targetBuildTypes 'debug'
109 sources {
110 cpp {
111 source {
112 srcDirs 'src/dev/native/cpp'
113 include '**/*.cpp'
114 }
115 exportedHeaders {
116 srcDirs 'src/dev/native/include'
117 }
118 }
119 }
120 binaries.all {
121 lib library: 'wpigui'
122 nativeUtils.useRequiredLibrary(it, 'imgui_static')
Austin Schuh812d0d12021-11-04 20:16:48 -0700123 lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
Austin Schuh1e69f942020-11-14 15:06:14 -0800124 }
125 }
126 }
127 binaries {
128 all {
129 if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) {
130 it.buildable = false
131 return
132 }
133 if (it.targetPlatform.operatingSystem.isWindows()) {
134 it.linker.args << 'Gdi32.lib' << 'Shell32.lib' << 'd3d11.lib' << 'd3dcompiler.lib'
135 } else if (it.targetPlatform.operatingSystem.isMacOsX()) {
136 it.linker.args << '-framework' << 'Metal' << '-framework' << 'MetalKit' << '-framework' << 'Cocoa' << '-framework' << 'IOKit' << '-framework' << 'CoreFoundation' << '-framework' << 'CoreVideo' << '-framework' << 'QuartzCore'
137 } else {
138 it.linker.args << '-lX11'
139 }
140 }
141 withType(SharedLibraryBinarySpec) {
142 buildable = false
143 }
144 }
145 }
146
147 apply from: 'publish.gradle'
148}