[build] Build examples in CMake CI (#5667)

This commit is contained in:
Tyler Veness
2023-09-20 21:03:55 -07:00
committed by GitHub
parent 97021f074a
commit 07a0d22fe6
7 changed files with 43 additions and 11 deletions

View File

@@ -15,11 +15,11 @@ jobs:
- os: ubuntu-22.04
name: Linux
container: wpilib/roborio-cross-ubuntu:2023-22.04
flags: ""
flags: "-DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON"
- os: macOS-12
name: macOS
container: ""
flags: "-DWITH_JAVA=OFF"
flags: "-DCMAKE_BUILD_TYPE=Release -DWITH_JAVA=OFF -DWITH_EXAMPLES=ON"
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
@@ -75,8 +75,8 @@ jobs:
run: python -m pip install jinja2
- name: configure
run: cmake -S . -B build -G "Ninja Multi-Config" -DWITH_JAVA=OFF -DWITH_TESTS=OFF -DUSE_SYSTEM_FMTLIB=ON -DUSE_SYSTEM_LIBUV=ON -DUSE_SYSTEM_EIGEN=ON -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_INSTALL_OPTIONS=--clean-after-build -DVCPKG_TARGET_TRIPLET=x64-windows-release -DVCPKG_HOST_TRIPLET=x64-windows-release
run: cmake -S . -B build -G "Ninja Multi-Config" -DCMAKE_BUILD_TYPE=Release -DWITH_JAVA=OFF -DWITH_EXAMPLES=ON -DWITH_TESTS=OFF -DUSE_SYSTEM_FMTLIB=ON -DUSE_SYSTEM_LIBUV=ON -DUSE_SYSTEM_EIGEN=ON -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_INSTALL_OPTIONS=--clean-after-build -DVCPKG_TARGET_TRIPLET=x64-windows-release -DVCPKG_HOST_TRIPLET=x64-windows-release
- name: build
working-directory: build
run: cmake --build . --parallel $(nproc) --config Release
run: cmake --build . --parallel 1 --config Release

View File

@@ -317,6 +317,8 @@ if (WITH_WPILIB)
add_subdirectory(wpilibj)
add_subdirectory(wpilibc)
add_subdirectory(wpilibNewCommands)
add_subdirectory(romiVendordep)
add_subdirectory(xrpVendordep)
if (WITH_EXAMPLES)
add_subdirectory(wpilibcExamples)
endif()

View File

@@ -13,6 +13,12 @@ macro(wpilib_target_warnings target)
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-anon-enum-enum-conversion>)
endif()
# Suppress warning "enumeration types with a fixed underlying type are a
# Clang extension"
if(APPLE)
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-fixed-enum-extension>)
endif()
# Compress debug info with GCC
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR
${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo") AND

View File

@@ -20,6 +20,11 @@
namespace nt {
#if __GNUC__ >= 13
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
/**
* A network table entry value.
* @ingroup ntcore_cpp_api
@@ -641,9 +646,13 @@ class Value final {
private:
NT_Value m_val = {};
std::shared_ptr<void> m_storage;
size_t m_size;
size_t m_size = 0;
};
#if __GNUC__ >= 13
#pragma GCC diagnostic pop
#endif
bool operator==(const Value& lhs, const Value& rhs);
/**

View File

@@ -18,21 +18,25 @@ SwerveModule::SwerveModule(int driveMotorChannel, int turningMotorChannel,
: m_driveMotor(driveMotorChannel),
m_turningMotor(turningMotorChannel),
m_driveEncoder(driveEncoderPorts[0], driveEncoderPorts[1]),
m_turningEncoder(turningEncoderPorts[0], turningEncoderPorts[1]),
m_reverseDriveEncoder(driveEncoderReversed),
m_reverseTurningEncoder(turningEncoderReversed) {
m_turningEncoder(turningEncoderPorts[0], turningEncoderPorts[1]) {
// Set the distance per pulse for the drive encoder. We can simply use the
// distance traveled for one rotation of the wheel divided by the encoder
// resolution.
m_driveEncoder.SetDistancePerPulse(
ModuleConstants::kDriveEncoderDistancePerPulse);
// Set whether drive encoder should be reversed or not
m_driveEncoder.SetReverseDirection(driveEncoderReversed);
// Set the distance (in this case, angle) per pulse for the turning encoder.
// This is the the angle through an entire rotation (2 * std::numbers::pi)
// divided by the encoder resolution.
m_turningEncoder.SetDistancePerPulse(
ModuleConstants::kTurningEncoderDistancePerPulse);
// Set whether turning encoder should be reversed or not
m_turningEncoder.SetReverseDirection(turningEncoderReversed);
// Limit the PID Controller's input range between -pi and pi and set the input
// to be continuous.
m_turningPIDController.EnableContinuousInput(

View File

@@ -47,9 +47,6 @@ class SwerveModule {
frc::Encoder m_driveEncoder;
frc::Encoder m_turningEncoder;
bool m_reverseDriveEncoder;
bool m_reverseTurningEncoder;
frc::PIDController m_drivePIDController{
ModuleConstants::kPModuleDriveController, 0, 0};
frc::ProfiledPIDController<units::radians> m_turningPIDController{

View File

@@ -396,7 +396,14 @@ TEST_F(WebSocketServerTest, ReceiveFragment) {
std::vector<uint8_t> data2(4, 0x04);
std::vector<uint8_t> data3(4, 0x05);
std::vector<uint8_t> combData{data};
#if __GNUC__ == 11
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif // __GNUC__ == 11
combData.insert(combData.end(), data2.begin(), data2.end());
#if __GNUC__ == 11
#pragma GCC diagnostic pop
#endif // __GNUC__ == 11
combData.insert(combData.end(), data3.begin(), data3.end());
setupWebSocket = [&] {
@@ -481,7 +488,14 @@ TEST_F(WebSocketServerTest, ReceiveFragmentWithControl) {
std::vector<uint8_t> data3(4, 0x05);
std::vector<uint8_t> data4(4, 0x06);
std::vector<uint8_t> combData{data};
#if __GNUC__ == 11
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif // __GNUC__ == 11
combData.insert(combData.end(), data2.begin(), data2.end());
#if __GNUC__ == 11
#pragma GCC diagnostic pop
#endif // __GNUC__ == 11
combData.insert(combData.end(), data4.begin(), data4.end());
setupWebSocket = [&] {