mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
52 lines
1.7 KiB
Groovy
52 lines
1.7 KiB
Groovy
import org.gradle.internal.os.OperatingSystem
|
|
|
|
apply plugin: 'cpp'
|
|
apply plugin: 'visual-studio'
|
|
|
|
// Apply the correct toolchain settings for the target platform
|
|
if (OperatingSystem.current().isLinux()) {
|
|
apply from: '../toolchains/linux.gradle'
|
|
} else if (OperatingSystem.current().isMacOsX()) {
|
|
apply from: '../toolchains/mac.gradle'
|
|
} else if (OperatingSystem.current().isWindows()) {
|
|
apply from: '../toolchains/windows.gradle'
|
|
} else {
|
|
throw new GradleException("ntcore does not support building on ${OperatingSystem.current().getFamilyName()}.")
|
|
}
|
|
|
|
model {
|
|
platforms {
|
|
x86 {
|
|
architecture 'x86'
|
|
}
|
|
x64 {
|
|
architecture 'x86_64'
|
|
}
|
|
}
|
|
components {
|
|
gmock(NativeLibrarySpec) {
|
|
targetPlatform 'x86'
|
|
targetPlatform 'x64'
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs = ['src', 'gtest/src']
|
|
includes = ['*-all.cc']
|
|
}
|
|
exportedHeaders {
|
|
srcDirs = ['include', 'gtest/include', '.', 'gtest']
|
|
includes = ['**/*.h', '**/*.cc']
|
|
}
|
|
}
|
|
}
|
|
binaries.all {
|
|
if (toolChain in VisualCpp) {
|
|
cppCompiler.args '-D_UNICODE', '-DUNICODE', '-DWIN32', '-D_WIN32', '-DSTRICT', '-DWIN32_LEAN_AND_MEAN', '-D_HAS_EXCEPTIONS=1'
|
|
} else {
|
|
cppCompiler.args '-Wall', '-Wshadow', '-fexceptions', '-Wextra', '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-pthread', '-fPIC'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|