2020-08-25 23:52:09 -07:00
|
|
|
import org.gradle.internal.os.OperatingSystem
|
|
|
|
|
|
2024-11-30 18:04:00 +00:00
|
|
|
if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxsystemcore')) {
|
2023-09-27 21:45:25 -07:00
|
|
|
return;
|
|
|
|
|
}
|
2020-08-25 23:52:09 -07:00
|
|
|
|
2023-09-27 21:45:25 -07:00
|
|
|
apply plugin: 'cpp'
|
|
|
|
|
if (OperatingSystem.current().isMacOsX()) {
|
|
|
|
|
apply plugin: 'objective-cpp'
|
|
|
|
|
}
|
|
|
|
|
apply plugin: 'visual-studio'
|
|
|
|
|
apply plugin: 'edu.wpi.first.NativeUtils'
|
2020-08-25 23:52:09 -07:00
|
|
|
|
2023-09-27 21:45:25 -07:00
|
|
|
ext {
|
|
|
|
|
nativeName = 'wpigui'
|
|
|
|
|
}
|
2020-08-25 23:52:09 -07:00
|
|
|
|
2023-09-27 21:45:25 -07:00
|
|
|
apply from: "${rootDir}/shared/config.gradle"
|
2020-08-25 23:52:09 -07:00
|
|
|
|
2023-09-27 21:45:25 -07:00
|
|
|
nativeUtils.exportsConfigs {
|
|
|
|
|
wpigui {
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
}
|
2020-08-25 23:52:09 -07:00
|
|
|
|
2023-09-27 21:45:25 -07:00
|
|
|
model {
|
|
|
|
|
components {
|
|
|
|
|
"${nativeName}"(NativeLibrarySpec) {
|
|
|
|
|
sources.cpp {
|
|
|
|
|
source {
|
|
|
|
|
srcDirs "src/main/native/cpp"
|
|
|
|
|
include '*.cpp'
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
exportedHeaders {
|
|
|
|
|
srcDirs 'src/main/native/include'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
binaries.all {
|
2024-12-23 22:05:06 -05:00
|
|
|
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
|
2025-01-13 11:23:54 -08:00
|
|
|
if (it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) {
|
2023-09-27 21:45:25 -07:00
|
|
|
it.buildable = false
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (it.targetPlatform.operatingSystem.isWindows()) {
|
|
|
|
|
it.sources {
|
|
|
|
|
wpiguiWindowsCpp(CppSourceSet) {
|
|
|
|
|
source {
|
|
|
|
|
srcDirs 'src/main/native/directx11'
|
|
|
|
|
include '*.cpp'
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
|
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
}
|
|
|
|
|
} else if (it.targetPlatform.operatingSystem.isMacOsX()) {
|
|
|
|
|
it.sources {
|
|
|
|
|
wpiguiMacObjectiveCpp(ObjectiveCppSourceSet) {
|
|
|
|
|
source {
|
|
|
|
|
srcDirs 'src/main/native/metal'
|
|
|
|
|
include '*.mm'
|
2022-10-26 23:16:23 -07:00
|
|
|
}
|
|
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
}
|
|
|
|
|
} else if (it.targetPlatform.name.startsWith('linuxarm')) {
|
|
|
|
|
it.sources {
|
|
|
|
|
wpiguiUnixGl2Cpp(CppSourceSet) {
|
|
|
|
|
source {
|
|
|
|
|
srcDirs 'src/main/native/opengl2'
|
|
|
|
|
include '*.cpp'
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
} else {
|
|
|
|
|
it.sources {
|
|
|
|
|
wpiguiUnixGl3Cpp(CppSourceSet) {
|
|
|
|
|
source {
|
|
|
|
|
srcDirs 'src/main/native/opengl3'
|
|
|
|
|
include '*.cpp'
|
|
|
|
|
}
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
it.sources.each {
|
|
|
|
|
it.exportedHeaders {
|
|
|
|
|
srcDirs 'src/main/native/include'
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
// 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'
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
exportedHeaders {
|
|
|
|
|
srcDirs 'src/dev/native/include'
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
|
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
binaries.all {
|
|
|
|
|
lib library: 'wpigui'
|
2024-12-23 22:05:06 -05:00
|
|
|
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
|
2020-09-13 00:34:28 -07:00
|
|
|
}
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
|
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
binaries {
|
|
|
|
|
all {
|
2025-01-13 11:23:54 -08:00
|
|
|
if (it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) {
|
2023-09-27 21:45:25 -07:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-25 23:52:09 -07:00
|
|
|
}
|
2023-09-27 21:45:25 -07:00
|
|
|
|
|
|
|
|
apply from: 'publish.gradle'
|