From 3b28d157644bd3f48ebd2f651c9af0bb1aafd575 Mon Sep 17 00:00:00 2001 From: 4c3y <69460051+4c3y@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:36:42 +0100 Subject: [PATCH 1/4] Added CI jobs for C++11 and C++14 --- .github/workflows/cpp_ubuntu20_04.yml | 3 ++- CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cpp_ubuntu20_04.yml b/.github/workflows/cpp_ubuntu20_04.yml index 8b9f0ba..8ae7933 100644 --- a/.github/workflows/cpp_ubuntu20_04.yml +++ b/.github/workflows/cpp_ubuntu20_04.yml @@ -12,6 +12,7 @@ jobs: matrix: rosdistro: ['noetic'] gcc: ['8', '9', '10'] + cxx: ['11', '14', '17'] container: ros:${{ matrix.rosdistro }}-ros-base-focal name: ROS ${{ matrix.rosdistro }} - GCC ${{ matrix.gcc }} steps: @@ -35,7 +36,7 @@ jobs: run: sudo apt install -y libgoogle-glog-dev - name: Build lpp - run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && catkin build lpp && source ${GITHUB_WORKSPACE}/catkin_ws/devel/setup.bash + run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && catkin build -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} lpp && source ${GITHUB_WORKSPACE}/catkin_ws/devel/setup.bash working-directory: catkin_ws shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index b09bffa..262d95a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) endif () # Set standard of top level project or C++17 -if (NOT DEFINED ${CMAKE_CXX_STANDARD}) +if (NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 17) else () set(CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD}) From 5e03ee47d35b499435e97d688c0d5bc1b054ac4a Mon Sep 17 00:00:00 2001 From: 4c3y <69460051+4c3y@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:41:18 +0100 Subject: [PATCH 2/4] Add C++ standard to job name --- .github/workflows/cpp_ubuntu20_04.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp_ubuntu20_04.yml b/.github/workflows/cpp_ubuntu20_04.yml index 8ae7933..a899ad2 100644 --- a/.github/workflows/cpp_ubuntu20_04.yml +++ b/.github/workflows/cpp_ubuntu20_04.yml @@ -14,7 +14,7 @@ jobs: gcc: ['8', '9', '10'] cxx: ['11', '14', '17'] container: ros:${{ matrix.rosdistro }}-ros-base-focal - name: ROS ${{ matrix.rosdistro }} - GCC ${{ matrix.gcc }} + name: ROS ${{ matrix.rosdistro }} - GCC ${{ matrix.gcc }} - C++${{ matrix.cxx }} steps: - uses: actions/checkout@v3 name: Checkout lpp From b877594602d87525a5da831e1249c39397b99f4e Mon Sep 17 00:00:00 2001 From: 4c3y <69460051+4c3y@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:43:37 +0100 Subject: [PATCH 3/4] Added CI trigger on push to master --- .github/workflows/cpp_ubuntu20_04.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cpp_ubuntu20_04.yml b/.github/workflows/cpp_ubuntu20_04.yml index a899ad2..d588868 100644 --- a/.github/workflows/cpp_ubuntu20_04.yml +++ b/.github/workflows/cpp_ubuntu20_04.yml @@ -3,6 +3,9 @@ on: pull_request: branches: - "master" + push: + branches: + - "master" jobs: build: From 48ea7a4ea51e15cf3afb1602bfa9aaf72e2d0e41 Mon Sep 17 00:00:00 2001 From: 4c3y <69460051+4c3y@users.noreply.github.com> Date: Thu, 21 Dec 2023 12:02:48 +0100 Subject: [PATCH 4/4] Added [[maybe_unused]] compiler attribute to argc --- src/demo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/demo.cpp b/src/demo.cpp index 46a0944..24d4306 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -4,7 +4,7 @@ #include -int main(int argc, char **argv) { +int main([[maybe_unused]] int argc, char **argv) { LOG_INIT(argv[0]); int foo = 5;