diff --git a/config.gradle b/config.gradle index 94a3e10f07..f3f9ee2994 100644 --- a/config.gradle +++ b/config.gradle @@ -15,7 +15,7 @@ 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-parameter', '-Wno-missing-field-initializers', '-Wno-unused-private-field', '-pthread'] def macReleaseCompilerArgs = ['-O2'] def macDebugCompilerArgs = ['-O0'] def mac32BitArg = '-m32' @@ -137,6 +137,7 @@ if (!project.hasProperty('onlyAthena')) { detectPlatform = windows64PlatformDetect exclude << 'halAthena' } + /* Disable 32 bit linux until we can figure out jenkins linuxX86(BuildConfig) { architecture = 'x86' operatingSystem = 'linux' @@ -150,6 +151,7 @@ if (!project.hasProperty('onlyAthena')) { detectPlatform = linux32IntelPlatformDetect exclude << 'halAthena' } + */ linuxX64(BuildConfig) { architecture = 'x86-64' operatingSystem = 'linux' @@ -161,6 +163,8 @@ if (!project.hasProperty('onlyAthena')) { 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' @@ -173,6 +177,7 @@ if (!project.hasProperty('onlyAthena')) { detectPlatform = mac32PlatformDetect exclude << 'halAthena' } + */ macX64(BuildConfig) { architecture = 'x86-64' operatingSystem = 'osx' diff --git a/gmock/build.gradle b/gmock/build.gradle index d396ceb6c5..d7f0d8aaa3 100644 --- a/gmock/build.gradle +++ b/gmock/build.gradle @@ -1,42 +1,43 @@ import org.gradle.internal.os.OperatingSystem -apply plugin: 'cpp' -apply plugin: 'visual-studio' -apply plugin: 'edu.wpi.first.NativeUtils' +if (!project.hasProperty('onlyAthena')) { + apply plugin: 'cpp' + apply plugin: 'visual-studio' + apply plugin: 'edu.wpi.first.NativeUtils' -ext.gmockProject = true + ext.gmockProject = true -apply from: '../config.gradle' + apply from: '../config.gradle' -ext.addGmockToLinker = { binary-> - binary.lib project: ':gmock', library: 'gmock', linkage: 'static' -} + ext.addGmockToLinker = { binary-> + binary.lib project: ':gmock', library: 'gmock', linkage: 'static' + } - -model { - components { - gmock(NativeLibrarySpec) { - sources { - cpp { - source { - srcDirs = ['src', 'gtest/src'] - includes = ['*-all.cc'] - } - exportedHeaders { - srcDirs = ['include', 'gtest/include', '.', 'gtest'] - includes = ['**/*.h', '**/*.cc'] + model { + components { + gmock(NativeLibrarySpec) { + 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' + 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' + } + } + binaries.withType(SharedLibraryBinarySpec) { + buildable = false } - } - binaries.withType(SharedLibraryBinarySpec) { - buildable = false } } } diff --git a/hal/build.gradle b/hal/build.gradle index a2b7e6be5e..b27f622b8b 100644 --- a/hal/build.gradle +++ b/hal/build.gradle @@ -167,11 +167,11 @@ model { project(':ni-libraries').addNiLibrariesToLinker(it) } withType(GoogleTestTestSuiteBinarySpec) { - if (!it.component.testedComponent.name.contains('TestingBase')) { - it.buildable = false - } else { + if (it.component.testedComponent.name.contains('TestingBase') && !project.hasProperty('onlyAthena')) { project(':gmock').addGmockToLinker(it) project.addHalToLinker(it) + } else { + it.buildable = false } } } diff --git a/hal/src/main/native/include/HAL/cpp/priority_mutex.h b/hal/src/main/native/include/HAL/cpp/priority_mutex.h index 17a4767040..8e1b437d1e 100644 --- a/hal/src/main/native/include/HAL/cpp/priority_mutex.h +++ b/hal/src/main/native/include/HAL/cpp/priority_mutex.h @@ -10,7 +10,7 @@ // Allows usage with std::lock_guard without including separately #include -#if defined(_WIN32) +#if !defined(__linux__) namespace hal { // We do not want to use pthreads if in the simulator; however, in the // simulator, we do not care about priority inversion. diff --git a/hal/src/main/native/shared/cpp/priority_mutex.cpp b/hal/src/main/native/shared/cpp/priority_mutex.cpp index 648d431832..9b5a941661 100644 --- a/hal/src/main/native/shared/cpp/priority_mutex.cpp +++ b/hal/src/main/native/shared/cpp/priority_mutex.cpp @@ -7,7 +7,7 @@ #include "HAL/cpp/priority_mutex.h" -#if !defined(_WIN32) +#if defined(__linux__) using namespace hal; diff --git a/wpilibc-examples/build.gradle b/wpilibc-examples/build.gradle index 06639f0156..c74715118e 100644 --- a/wpilibc-examples/build.gradle +++ b/wpilibc-examples/build.gradle @@ -1,64 +1,66 @@ import org.gradle.language.base.internal.ProjectLayout -apply plugin: 'cpp' -apply plugin: 'visual-studio' -apply plugin: 'edu.wpi.first.NativeUtils' +if (!project.hasProperty('skipAthena')) { + apply plugin: 'cpp' + apply plugin: 'visual-studio' + apply plugin: 'edu.wpi.first.NativeUtils' -apply from: '../config.gradle' + apply from: '../config.gradle' -ext.examplesMap = [:] + ext.examplesMap = [:] -def tree = file("$projectDir/src") -tree.list().each { - examplesMap.put(it, []) -} - -model { - dependencyConfigs { - wpiutil(DependencyConfig) { - groupId = 'edu.wpi.first.wpiutil' - artifactId = 'wpiutil-cpp' - headerClassifier = 'headers' - ext = 'zip' - version = '+' - sharedConfigs = examplesMap - } - ntcore(DependencyConfig) { - groupId = 'edu.wpi.first.ntcore' - artifactId = 'ntcore-cpp' - headerClassifier = 'headers' - ext = 'zip' - version = '+' - sharedConfigs = examplesMap - } - opencv(DependencyConfig) { - groupId = 'org.opencv' - artifactId = 'opencv-cpp' - headerClassifier = 'headers' - ext = 'zip' - version = '3.2.0' - sharedConfigs = examplesMap - } - cscore(DependencyConfig) { - groupId = 'edu.wpi.first.cscore' - artifactId = 'cscore-cpp' - headerClassifier = 'headers' - ext = 'zip' - version = '+' - sharedConfigs = examplesMap - } + def tree = file("$projectDir/src") + tree.list().each { + examplesMap.put(it, []) } - components { - examplesMap.each { - "${it.key}"(NativeLibrarySpec) { - binaries.all { binary-> - if (binary.targetPlatform.architecture.name == 'athena') { - project(':ni-libraries').addNiLibrariesToLinker(binary) - binary.lib project: ':hal', library: 'halAthena', linkage: 'shared' - binary.lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' - } else { - binary.buildable = false + model { + dependencyConfigs { + wpiutil(DependencyConfig) { + groupId = 'edu.wpi.first.wpiutil' + artifactId = 'wpiutil-cpp' + headerClassifier = 'headers' + ext = 'zip' + version = '+' + sharedConfigs = examplesMap + } + ntcore(DependencyConfig) { + groupId = 'edu.wpi.first.ntcore' + artifactId = 'ntcore-cpp' + headerClassifier = 'headers' + ext = 'zip' + version = '+' + sharedConfigs = examplesMap + } + opencv(DependencyConfig) { + groupId = 'org.opencv' + artifactId = 'opencv-cpp' + headerClassifier = 'headers' + ext = 'zip' + version = '3.2.0' + sharedConfigs = examplesMap + } + cscore(DependencyConfig) { + groupId = 'edu.wpi.first.cscore' + artifactId = 'cscore-cpp' + headerClassifier = 'headers' + ext = 'zip' + version = '+' + sharedConfigs = examplesMap + } + } + + components { + examplesMap.each { + "${it.key}"(NativeLibrarySpec) { + binaries.all { binary-> + if (binary.targetPlatform.architecture.name == 'athena') { + project(':ni-libraries').addNiLibrariesToLinker(binary) + binary.lib project: ':hal', library: 'halAthena', linkage: 'shared' + binary.lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' + } else { + binary.buildable = false + } } } } diff --git a/wpilibc/build.gradle b/wpilibc/build.gradle index ff17f1c89a..2351716e3e 100644 --- a/wpilibc/build.gradle +++ b/wpilibc/build.gradle @@ -172,7 +172,7 @@ model { project.addWpilibCCompilerArguments(it) } withType(GoogleTestTestSuiteBinarySpec) { - if (it.component.testedComponent.name.contains('TestingBase')) { + if (it.component.testedComponent.name.contains('TestingBase') && !project.hasProperty('onlyAthena')) { project(':gmock').addGmockToLinker(it) project.addWpilibCToLinker(it) } else { diff --git a/wpilibcIntegrationTests/build.gradle b/wpilibcIntegrationTests/build.gradle index 210376402b..b36540c415 100644 --- a/wpilibcIntegrationTests/build.gradle +++ b/wpilibcIntegrationTests/build.gradle @@ -1,77 +1,79 @@ import org.gradle.language.base.internal.ProjectLayout -apply plugin: 'cpp' -apply plugin: 'visual-studio' -apply plugin: 'edu.wpi.first.NativeUtils' +if (!project.hasProperty('skipAthena')) { + apply plugin: 'cpp' + apply plugin: 'visual-studio' + apply plugin: 'edu.wpi.first.NativeUtils' -apply from: '../config.gradle' + apply from: '../config.gradle' -model { - dependencyConfigs { - wpiutil(DependencyConfig) { - groupId = 'edu.wpi.first.wpiutil' - artifactId = 'wpiutil-cpp' - headerClassifier = 'headers' - ext = 'zip' - version = '+' - sharedConfigs = [ wpilibcIntegrationTests: [] ] - } - ntcore(DependencyConfig) { - groupId = 'edu.wpi.first.ntcore' - artifactId = 'ntcore-cpp' - headerClassifier = 'headers' - ext = 'zip' - version = '+' - sharedConfigs = [ wpilibcIntegrationTests: [] ] - } - opencv(DependencyConfig) { - groupId = 'org.opencv' - artifactId = 'opencv-cpp' - headerClassifier = 'headers' - ext = 'zip' - version = '3.2.0' - sharedConfigs = [ wpilibcIntegrationTests: [] ] - } - cscore(DependencyConfig) { - groupId = 'edu.wpi.first.cscore' - artifactId = 'cscore-cpp' - headerClassifier = 'headers' - ext = 'zip' - version = '+' - sharedConfigs = [ wpilibcIntegrationTests: [] ] + model { + dependencyConfigs { + wpiutil(DependencyConfig) { + groupId = 'edu.wpi.first.wpiutil' + artifactId = 'wpiutil-cpp' + headerClassifier = 'headers' + ext = 'zip' + version = '+' + sharedConfigs = [ wpilibcIntegrationTests: [] ] + } + ntcore(DependencyConfig) { + groupId = 'edu.wpi.first.ntcore' + artifactId = 'ntcore-cpp' + headerClassifier = 'headers' + ext = 'zip' + version = '+' + sharedConfigs = [ wpilibcIntegrationTests: [] ] + } + opencv(DependencyConfig) { + groupId = 'org.opencv' + artifactId = 'opencv-cpp' + headerClassifier = 'headers' + ext = 'zip' + version = '3.2.0' + sharedConfigs = [ wpilibcIntegrationTests: [] ] + } + cscore(DependencyConfig) { + groupId = 'edu.wpi.first.cscore' + artifactId = 'cscore-cpp' + headerClassifier = 'headers' + ext = 'zip' + version = '+' + sharedConfigs = [ wpilibcIntegrationTests: [] ] + } } } -} -model { - components { - wpilibcIntegrationTests(NativeExecutableSpec) { - baseName = 'FRCUserProgram' - sources { - cpp { - source { - srcDirs = ["${rootDir}/gmock/gtest/src", 'src/FRCUserProgram/cpp'] - includes = ['*-all.cc', '*_main.cc', '*.cpp'] - } - exportedHeaders { - srcDirs = ["${rootDir}/gmock/gtest/include", "${rootDir}/gmock/gtest", 'src/FRCUserProgram/headers'] - includes = ['**/*.h', '**/*.cc'] + model { + components { + wpilibcIntegrationTests(NativeExecutableSpec) { + baseName = 'FRCUserProgram' + sources { + cpp { + source { + srcDirs = ["${rootDir}/gmock/gtest/src", 'src/FRCUserProgram/cpp'] + includes = ['*-all.cc', '*_main.cc', '*.cpp'] + } + exportedHeaders { + srcDirs = ["${rootDir}/gmock/gtest/include", "${rootDir}/gmock/gtest", 'src/FRCUserProgram/headers'] + includes = ['**/*.h', '**/*.cc'] + } } } - } - binaries.all { binary-> - if (binary.targetPlatform.architecture.name == 'athena') { - binary.tasks.withType(CppCompile) { - cppCompiler.args "-Wno-missing-field-initializers" - cppCompiler.args "-Wno-unused-variable" + binaries.all { binary-> + if (binary.targetPlatform.architecture.name == 'athena') { + binary.tasks.withType(CppCompile) { + cppCompiler.args "-Wno-missing-field-initializers" + cppCompiler.args "-Wno-unused-variable" + } + project(':ni-libraries').addNiLibrariesToLinker(binary) + project(':hal').addHalCompilerArguments(binary) + project(':hal').addHalToLinker(binary) + project(':wpilibc').addWpilibCCompilerArguments(binary) + project(':wpilibc').addWpilibCToLinker(binary) + } else { + binary.buildable = false } - project(':ni-libraries').addNiLibrariesToLinker(binary) - project(':hal').addHalCompilerArguments(binary) - project(':hal').addHalToLinker(binary) - project(':wpilibc').addWpilibCCompilerArguments(binary) - project(':wpilibc').addWpilibCToLinker(binary) - } else { - binary.buildable = false } } } @@ -80,6 +82,7 @@ model { def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles") + model { tasks { copyWpilibCTestLibrariesToOutput(Task) { @@ -113,6 +116,10 @@ model { } } } - build.dependsOn copyWpilibCTestLibrariesToOutput + // This is in a separate if statement because of what I would assume is a bug in grade. + // Will file an issue on their side. + if (!project.hasProperty('skipAthena')) { + build.dependsOn copyWpilibCTestLibrariesToOutput + } } }