mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
244 lines
9.2 KiB
Groovy
244 lines
9.2 KiB
Groovy
import edu.wpi.first.nativeutils.*
|
|
import org.gradle.internal.os.OperatingSystem
|
|
|
|
def windowsCompilerArgs = ['/EHsc', '/DNOMINMAX', '/D_SCL_SECURE_NO_WARNINGS', '/D_WINSOCK_DEPRECATED_NO_WARNINGS',
|
|
'/Zi', '/FS', '/Zc:inline', '/MT']
|
|
def windowsReleaseCompilerArgs = ['/O2']
|
|
def windowsLinkerArgs = [ '/DEBUG:FULL' ]
|
|
def windowsReleaseLinkerArgs = [ '/OPT:REF', '/OPT:ICF' ]
|
|
|
|
def linuxCompilerArgs = ['-std=c++1y', '-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
|
|
'-Wno-unused-parameter', '-Wno-error=deprecated-declarations', '-fPIC', '-rdynamic', '-pthread']
|
|
def linuxLinkerArgs = ['-rdynamic', '-pthread']
|
|
def linuxReleaseCompilerArgs = ['-O2']
|
|
def linuxDebugCompilerArgs = ['-O0']
|
|
def linux32BitArg = '-m32'
|
|
|
|
def macCompilerArgs = ['-std=c++11', '-Wall', '-Wextra', '-Werror', '-pedantic-errors', '-fPIC', '-g',
|
|
'-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wno-unused-private-field', '-Wno-unused-const-variable', '-pthread']
|
|
def macReleaseCompilerArgs = ['-O2']
|
|
def macDebugCompilerArgs = ['-O0']
|
|
def mac32BitArg = '-m32'
|
|
|
|
def buildAll = project.hasProperty('buildAll')
|
|
|
|
def windows64PlatformDetect = {
|
|
def arch = System.getProperty("os.arch")
|
|
def isWin = OperatingSystem.current().isWindows()
|
|
if (buildAll) {
|
|
return isWin
|
|
} else {
|
|
return isWin && arch == 'amd64'
|
|
}
|
|
}
|
|
|
|
def windows32PlatformDetect = {
|
|
def arch = System.getProperty("os.arch")
|
|
def isWin = OperatingSystem.current().isWindows()
|
|
if (buildAll) {
|
|
return isWin
|
|
} else {
|
|
return isWin && arch == 'x86'
|
|
}
|
|
}
|
|
|
|
def linux32IntelPlatformDetect = {
|
|
def arch = System.getProperty("os.arch")
|
|
def isLinux = OperatingSystem.current().isLinux()
|
|
def isIntel = (arch == 'amd64' || arch == 'i386')
|
|
if (buildAll) {
|
|
return isLinux && isIntel
|
|
} else {
|
|
return isLinux && arch == 'i386'
|
|
}
|
|
}
|
|
|
|
def linux64IntelPlatformDetect = {
|
|
def arch = System.getProperty("os.arch")
|
|
def isLinux = OperatingSystem.current().isLinux()
|
|
def isIntel = (arch == 'amd64' || arch == 'i386')
|
|
if (buildAll) {
|
|
return isLinux && isIntel
|
|
} else {
|
|
return isLinux && arch == 'amd64'
|
|
}
|
|
}
|
|
|
|
def linuxArmPlatformDetect = {
|
|
def arch = System.getProperty("os.arch")
|
|
def isIntel = (arch == 'amd64' || arch == 'i386')
|
|
return OperatingSystem.current().isLinux() && !isIntel
|
|
}
|
|
|
|
def mac64PlatformDetect = {
|
|
def arch = System.getProperty("os.arch")
|
|
def isMac = OperatingSystem.current().isMacOsX()
|
|
if (buildAll) {
|
|
return isMac
|
|
} else {
|
|
return isMac && arch == 'x86_64'
|
|
}
|
|
}
|
|
|
|
def mac32PlatformDetect = {
|
|
def arch = System.getProperty("os.arch")
|
|
def isMac = OperatingSystem.current().isMacOsX()
|
|
if (buildAll) {
|
|
return isMac
|
|
} else {
|
|
return isMac && arch == 'x86'
|
|
}
|
|
}
|
|
|
|
if (!project.hasProperty('skipAthena')) {
|
|
model {
|
|
buildConfigs {
|
|
roboRio(CrossBuildConfig) {
|
|
architecture = 'athena'
|
|
operatingSystem = 'linux'
|
|
toolChainPrefix = 'arm-frc-linux-gnueabi-'
|
|
compilerArgs = linuxCompilerArgs
|
|
linkerArgs = linuxLinkerArgs
|
|
debugCompilerArgs = linuxDebugCompilerArgs
|
|
releaseCompilerArgs = linuxReleaseCompilerArgs
|
|
releaseStripBinaries = true
|
|
compilerFamily = 'Gcc'
|
|
exclude << 'halSim'
|
|
exclude << 'halSimStaticDeps'
|
|
exclude << 'halSimTestingBase'
|
|
exclude << 'wpilibcTestingBase'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!project.hasProperty('onlyAthena')) {
|
|
model {
|
|
buildConfigs {
|
|
winX86(BuildConfig) {
|
|
architecture = 'x86'
|
|
operatingSystem = 'windows'
|
|
compilerArgs = windowsCompilerArgs
|
|
linkerArgs = windowsLinkerArgs
|
|
releaseCompilerArgs = windowsReleaseCompilerArgs
|
|
releaseLinkerArgs = windowsReleaseLinkerArgs
|
|
compilerFamily = 'VisualCpp'
|
|
detectPlatform = windows32PlatformDetect
|
|
exclude << 'halAthena'
|
|
}
|
|
winX64(BuildConfig) {
|
|
architecture = 'x86-64'
|
|
operatingSystem = 'windows'
|
|
compilerArgs = windowsCompilerArgs
|
|
linkerArgs = windowsLinkerArgs
|
|
releaseCompilerArgs = windowsReleaseCompilerArgs
|
|
releaseLinkerArgs = windowsReleaseLinkerArgs
|
|
compilerFamily = 'VisualCpp'
|
|
detectPlatform = windows64PlatformDetect
|
|
exclude << 'halAthena'
|
|
}
|
|
/* Disable 32 bit linux until we can figure out jenkins
|
|
linuxX86(BuildConfig) {
|
|
architecture = 'x86'
|
|
operatingSystem = 'linux'
|
|
compilerArgs = linuxCompilerArgs
|
|
compilerArgs << linux32BitArg
|
|
linkerArgs = linuxLinkerArgs
|
|
linkerArgs << linux32BitArg
|
|
debugCompilerArgs = linuxDebugCompilerArgs
|
|
releaseCompilerArgs = linuxReleaseCompilerArgs
|
|
compilerFamily = 'Gcc'
|
|
detectPlatform = linux32IntelPlatformDetect
|
|
exclude << 'halAthena'
|
|
}
|
|
*/
|
|
linuxX64(BuildConfig) {
|
|
architecture = 'x86-64'
|
|
operatingSystem = 'linux'
|
|
compilerArgs = linuxCompilerArgs
|
|
linkerArgs = linuxLinkerArgs
|
|
debugCompilerArgs = linuxDebugCompilerArgs
|
|
releaseCompilerArgs = linuxReleaseCompilerArgs
|
|
compilerFamily = 'Gcc'
|
|
detectPlatform = linux64IntelPlatformDetect
|
|
exclude << 'halAthena'
|
|
}
|
|
/* 32 bit Mac OS X not supported by OpenCV.
|
|
* If support is ever added, will add this back in
|
|
macX86(BuildConfig) {
|
|
architecture = 'x86'
|
|
operatingSystem = 'osx'
|
|
compilerArgs = macCompilerArgs
|
|
compilerArgs << mac32BitArg
|
|
linkerArgs << mac32BitArg
|
|
debugCompilerArgs = macDebugCompilerArgs
|
|
releaseCompilerArgs = macReleaseCompilerArgs
|
|
compilerFamily = 'Clang'
|
|
detectPlatform = mac32PlatformDetect
|
|
exclude << 'halAthena'
|
|
}
|
|
*/
|
|
macX64(BuildConfig) {
|
|
architecture = 'x86-64'
|
|
operatingSystem = 'osx'
|
|
compilerArgs = macCompilerArgs
|
|
debugCompilerArgs = macDebugCompilerArgs
|
|
releaseCompilerArgs = macReleaseCompilerArgs
|
|
compilerFamily = 'Clang'
|
|
detectPlatform = mac64PlatformDetect
|
|
exclude << 'halAthena'
|
|
}
|
|
raspbian(CrossBuildConfig) {
|
|
architecture = 'raspbian'
|
|
operatingSystem = 'linux'
|
|
toolChainPrefix = 'arm-linux-gnueabihf-'
|
|
compilerArgs = linuxCompilerArgs
|
|
linkerArgs = linuxLinkerArgs
|
|
debugCompilerArgs = linuxDebugCompilerArgs
|
|
releaseCompilerArgs = linuxReleaseCompilerArgs
|
|
skipByDefault = true
|
|
compilerFamily = 'Gcc'
|
|
exclude << 'gmock'
|
|
exclude << 'halAthena'
|
|
}
|
|
armhf(CrossBuildConfig) {
|
|
architecture = 'armhf'
|
|
operatingSystem = 'linux'
|
|
toolChainPrefix = 'arm-linux-gnueabihf-'
|
|
compilerArgs = linuxCompilerArgs
|
|
linkerArgs = linuxLinkerArgs
|
|
debugCompilerArgs = linuxDebugCompilerArgs
|
|
releaseCompilerArgs = linuxReleaseCompilerArgs
|
|
skipByDefault = true
|
|
compilerFamily = 'Gcc'
|
|
exclude << 'gmock'
|
|
exclude << 'halAthena'
|
|
}
|
|
aarch(CrossBuildConfig) {
|
|
architecture = 'aarch'
|
|
operatingSystem = 'linux'
|
|
toolChainPrefix = 'aarch-linux-gnu-'
|
|
compilerArgs = linuxCompilerArgs
|
|
linkerArgs = linuxLinkerArgs
|
|
debugCompilerArgs = linuxDebugCompilerArgs
|
|
releaseCompilerArgs = linuxReleaseCompilerArgs
|
|
skipByDefault = true
|
|
compilerFamily = 'Gcc'
|
|
exclude << 'gmock'
|
|
exclude << 'halAthena'
|
|
}
|
|
linuxArm(BuildConfig) {
|
|
architecture = 'arm'
|
|
operatingSystem = 'linux'
|
|
compilerArgs = linuxCompilerArgs
|
|
linkerArgs = linuxLinkerArgs
|
|
debugCompilerArgs = linuxDebugCompilerArgs
|
|
releaseCompilerArgs = linuxReleaseCompilerArgs
|
|
compilerFamily = 'Gcc'
|
|
detectPlatform = linuxArmPlatformDetect
|
|
exclude << 'halAthena'
|
|
}
|
|
}
|
|
}
|
|
}
|