diff --git a/simulation/gz_msgs/build.gradle b/simulation/gz_msgs/build.gradle index 44f969220b..c9ebf3599c 100644 --- a/simulation/gz_msgs/build.gradle +++ b/simulation/gz_msgs/build.gradle @@ -1,95 +1,95 @@ -plugins { - id 'cpp' - id 'java' - id 'com.google.protobuf' version '0.8.8' - id 'edu.wpi.first.NativeUtils' -} - -description = "A C++ and Java library to pass FRC Simulation Messages in and out of Gazebo." - -/* The simulation does not run on real hardware; so we always skip Athena */ -ext.skiplinuxathena = true -ext.skiplinuxraspbian = true -apply from: "${rootDir}/shared/config.gradle" - -/* Use a sort of poor man's autoconf to find the protobuf development - files; on Debian, those are supplied by libprotobuf-dev. - - This should get skipped on Windows. - - TODO: Add Windows support for the simulation code */ - -def protobuf_version = "" -try { - protobuf_version = "pkg-config --modversion protobuf".execute().text.trim() - println "Protobuf version is [${protobuf_version}]" -} catch(Exception ex) { -} - -if (!protobuf_version?.trim()) { - println "Protobuf is not available. (pkg-config --modversion protobuf failed)" - protobuf_version = "+" - if (project.hasProperty("makeSim")) { - /* Force the build even though we did not find protobuf. */ - println "makeSim set. Forcing build - failure likely." - } - else { - ext.skip_gz_msgs = true - println "Skipping gz_msgs." - } -} - -tasks.whenTaskAdded { task -> - task.onlyIf { !project.hasProperty('skip_gz_msgs') } -} - -dependencies { - compile "com.google.protobuf:protobuf-java:${protobuf_version}" - compile "com.google.protobuf:protoc:${protobuf_version}" -} - -/* There is a nice gradle plugin for protobuf, and the protoc tool - is included; using it simplifies our build process. - The trick is that we have to use the same version as the system - copy of libprotobuf-dev */ -protobuf { - protoc { - artifact = "com.google.protobuf:protoc:${protobuf_version}" - } - - generatedFilesBaseDir = "$buildDir/generated" - generateProtoTasks { - all().each { task -> - task.builtins { - cpp { - outputSubDir = 'simulation/gz_msgs' - } - } - } - } -} - -model { - components { - gz_msgs(NativeLibrarySpec) { - sources { - cpp { - source { - srcDir "$buildDir/generated/main/simulation/gz_msgs" - builtBy tasks.generateProto - } - exportedHeaders { - srcDir "src/include" - srcDir "$buildDir/generated/main" - } - } - } - /* We must compile with -fPIC to link the static library into an so */ - binaries { - all { - cppCompiler.args "-fPIC" - } - } - } - } -} +plugins { + id 'cpp' + id 'java' + id 'com.google.protobuf' version '0.8.8' + id 'edu.wpi.first.NativeUtils' +} + +description = "A C++ and Java library to pass FRC Simulation Messages in and out of Gazebo." + +/* The simulation does not run on real hardware; so we always skip Athena */ +ext.skiplinuxathena = true +ext.skiplinuxraspbian = true +apply from: "${rootDir}/shared/config.gradle" + +/* Use a sort of poor man's autoconf to find the protobuf development + files; on Debian, those are supplied by libprotobuf-dev. + + This should get skipped on Windows. + + TODO: Add Windows support for the simulation code */ + +def protobuf_version = "" +try { + protobuf_version = "pkg-config --modversion protobuf".execute().text.trim() + println "Protobuf version is [${protobuf_version}]" +} catch(Exception ex) { +} + +if (!protobuf_version?.trim()) { + println "Protobuf is not available. (pkg-config --modversion protobuf failed)" + protobuf_version = "+" + if (project.hasProperty("makeSim")) { + /* Force the build even though we did not find protobuf. */ + println "makeSim set. Forcing build - failure likely." + } + else { + ext.skip_gz_msgs = true + println "Skipping gz_msgs." + } +} + +tasks.whenTaskAdded { task -> + task.onlyIf { !project.hasProperty('skip_gz_msgs') } +} + +dependencies { + compile "com.google.protobuf:protobuf-java:${protobuf_version}" + compile "com.google.protobuf:protoc:${protobuf_version}" +} + +/* There is a nice gradle plugin for protobuf, and the protoc tool + is included; using it simplifies our build process. + The trick is that we have to use the same version as the system + copy of libprotobuf-dev */ +protobuf { + protoc { + artifact = "com.google.protobuf:protoc:${protobuf_version}" + } + + generatedFilesBaseDir = "$buildDir/generated" + generateProtoTasks { + all().each { task -> + task.builtins { + cpp { + outputSubDir = 'simulation/gz_msgs' + } + } + } + } +} + +model { + components { + gz_msgs(NativeLibrarySpec) { + sources { + cpp { + source { + srcDir "$buildDir/generated/main/simulation/gz_msgs" + builtBy tasks.generateProto + } + exportedHeaders { + srcDir "src/include" + srcDir "$buildDir/generated/main" + } + } + } + /* We must compile with -fPIC to link the static library into an so */ + binaries { + all { + cppCompiler.args "-fPIC" + } + } + } + } +} diff --git a/simulation/halsim_gui/build.gradle b/simulation/halsim_gui/build.gradle index 5ac68ea2f5..5df53023dd 100644 --- a/simulation/halsim_gui/build.gradle +++ b/simulation/halsim_gui/build.gradle @@ -1,40 +1,40 @@ -if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { - - description = "A plugin that creates a simulation gui" - - ext { - includeWpiutil = true - pluginName = 'halsim_gui' - } - - apply plugin: 'google-test-test-suite' - - - ext { - staticGtestConfigs = [:] - } - - staticGtestConfigs["${pluginName}Test"] = [] - apply from: "${rootDir}/shared/googletest.gradle" - - apply from: "${rootDir}/shared/plugins/setupBuild.gradle" - - model { - binaries { - all { - nativeUtils.useRequiredLibrary(it, 'imgui_static') - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { - it.buildable = false - return - } - if (it.targetPlatform.operatingSystem.isWindows()) { - it.linker.args << 'Gdi32.lib' << 'Shell32.lib' - } else if (it.targetPlatform.operatingSystem.isMacOsX()) { - it.linker.args << '-framework' << 'Cocoa' << '-framework' << 'IOKit' << '-framework' << 'CoreFoundation' << '-framework' << 'CoreVideo' - } else { - it.linker.args << '-lX11' << '-lvulkan' - } - } - } - } -} +if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { + + description = "A plugin that creates a simulation gui" + + ext { + includeWpiutil = true + pluginName = 'halsim_gui' + } + + apply plugin: 'google-test-test-suite' + + + ext { + staticGtestConfigs = [:] + } + + staticGtestConfigs["${pluginName}Test"] = [] + apply from: "${rootDir}/shared/googletest.gradle" + + apply from: "${rootDir}/shared/plugins/setupBuild.gradle" + + model { + binaries { + all { + nativeUtils.useRequiredLibrary(it, 'imgui_static') + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) { + it.buildable = false + return + } + if (it.targetPlatform.operatingSystem.isWindows()) { + it.linker.args << 'Gdi32.lib' << 'Shell32.lib' + } else if (it.targetPlatform.operatingSystem.isMacOsX()) { + it.linker.args << '-framework' << 'Cocoa' << '-framework' << 'IOKit' << '-framework' << 'CoreFoundation' << '-framework' << 'CoreVideo' + } else { + it.linker.args << '-lX11' << '-lvulkan' + } + } + } + } +} diff --git a/simulation/halsim_gui/src/test/native/cpp/main.cpp b/simulation/halsim_gui/src/test/native/cpp/main.cpp index ba0d9b012c..fd8f022427 100644 --- a/simulation/halsim_gui/src/test/native/cpp/main.cpp +++ b/simulation/halsim_gui/src/test/native/cpp/main.cpp @@ -1,17 +1,17 @@ -/*----------------------------------------------------------------------------*/ -/* Copyright (c) 2015-2019 FIRST. All Rights Reserved. */ -/* Open Source Software - may be modified and shared by FRC teams. The code */ -/* must be accompanied by the FIRST BSD license file in the root directory of */ -/* the project. */ -/*----------------------------------------------------------------------------*/ - -#include - -#include "gtest/gtest.h" - -int main(int argc, char** argv) { - HAL_Initialize(500, 0); - ::testing::InitGoogleTest(&argc, argv); - int ret = RUN_ALL_TESTS(); - return ret; -} +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2015-2019 FIRST. All Rights Reserved. */ +/* Open Source Software - may be modified and shared by FRC teams. The code */ +/* must be accompanied by the FIRST BSD license file in the root directory of */ +/* the project. */ +/*----------------------------------------------------------------------------*/ + +#include + +#include "gtest/gtest.h" + +int main(int argc, char** argv) { + HAL_Initialize(500, 0); + ::testing::InitGoogleTest(&argc, argv); + int ret = RUN_ALL_TESTS(); + return ret; +}