diff --git a/multiplatform/colcon_build/action.yml b/multiplatform/colcon_build/action.yml index 21e06023..cfdbc92c 100644 --- a/multiplatform/colcon_build/action.yml +++ b/multiplatform/colcon_build/action.yml @@ -18,13 +18,21 @@ inputs: required: false default: '--event-handlers=console_direct+' - cmake_args: - description: CMake arguments + set_eprosima_flags: + description: | + This flag sets the compilation flags (CMAKE_CXX_FLAGS) for eProsima product testing. + These are: + - Warnigs as errors + - Linux: -Werror -Wall + - Windows: /WX /W4 + - Multithreaded compilation + - Windows: /MP + type: boolean required: false - default: '' + default: true - cmake_args_default: - description: Default CMake arguments + cmake_args: + description: CMake arguments required: false default: '' @@ -55,7 +63,7 @@ runs: colcon_build_args: ${{ inputs.colcon_build_args }} colcon_build_args_default: ${{ inputs.colcon_build_args_default }} cmake_args: ${{ inputs.cmake_args }} - cmake_args_default: ${{ inputs.cmake_args_default }} + set_eprosima_flags: ${{ inputs.set_eprosima_flags }} workspace: ${{ inputs.workspace }} workspace_dependencies: ${{ inputs.workspace_dependencies }} cmake_build_type: ${{ inputs.cmake_build_type }} @@ -69,7 +77,7 @@ runs: colcon_build_args_default: ${{ inputs.colcon_build_args_default }} cmake_args: ${{ inputs.cmake_args }} # TODO (jparisu) find a way to use it for windows, as there is not a common Werror flag for both - cmake_args_default: ${{ inputs.cmake_args_default }} + set_eprosima_flags: ${{ inputs.set_eprosima_flags }} workspace: ${{ inputs.workspace }} workspace_dependencies: ${{ inputs.workspace_dependencies }} cmake_build_type: ${{ inputs.cmake_build_type }} diff --git a/multiplatform/colcon_build_test/action.yml b/multiplatform/colcon_build_test/action.yml index 76cc5db3..6e227ecd 100644 --- a/multiplatform/colcon_build_test/action.yml +++ b/multiplatform/colcon_build_test/action.yml @@ -12,6 +12,19 @@ inputs: required: false default: '' + set_eprosima_flags: + description: | + This flag sets the compilation flags (CMAKE_CXX_FLAGS) for eProsima product testing. + These are: + - Warnigs as errors + - Linux: -Werror -Wall + - Windows: /WX /W4 + - Multithreaded compilation + - Windows: /MP + type: boolean + required: false + default: true + cmake_args: description: 'Cmake arguments' required: false @@ -52,6 +65,7 @@ runs: colcon_meta_file: ${{ inputs.colcon_meta_file }} colcon_build_args: '--packages-up-to ${{ inputs.packages_names }}' cmake_args: ' ${{ inputs.cmake_args }}' + set_eprosima_flags: ' ${{ inputs.set_eprosima_flags }}' workspace: ${{ inputs.workspace }} workspace_dependencies: ${{ inputs.workspace_dependencies }} cmake_build_type: ${{ inputs.cmake_build_type }} diff --git a/ubuntu/colcon_build/action.yml b/ubuntu/colcon_build/action.yml index 2a0fc967..90be563d 100644 --- a/ubuntu/colcon_build/action.yml +++ b/ubuntu/colcon_build/action.yml @@ -18,16 +18,20 @@ inputs: required: false default: '--event-handlers=console_direct+' + set_eprosima_flags: + description: | + This flag sets the compilation flags (CMAKE_CXX_FLAGS) for eProsima product testing. + These are: + - Warnigs as errors (-Werror -Wall) + type: boolean + required: false + default: true + cmake_args: description: 'CMake arguments' required: false default: '' - cmake_args_default: - description: Default CMake arguments - required: false - default: '-DCMAKE_CXX_FLAGS="-Werror -Wall"' - cmake_build_type: description: Set the cmake build type required: false @@ -43,6 +47,10 @@ inputs: required: false default: '' +env: + + EPROSIMA_CXX_FLAGS: "-DCMAKE_CXX_FLAGS='-Werror -Wall'" + runs: using: composite steps: @@ -58,6 +66,15 @@ runs: echo "::group::Compile using colcon ${{ inputs.workspace }}" + if [ "${{ inputs.set_eprosima_flags }}" = "true" ]; then + # EPROSIMA_CXX_FLAGS is set first so that it can be overridden by cmake_args + # in case the user wants to set its own flags. If that's the case and the user want's to use both flags, + # it should set EPROSIMA_CXX_FLAGS in cmake_args. + export CMAKE_ARGS="${EPROSIMA_CXX_FLAGS} ${{ inputs.cmake_args }}" + else + export CMAKE_ARGS="${{ inputs.cmake_args }}" + fi + if [[ ! -z "${{ inputs.workspace_dependencies }}" ]]; then source ${{ inputs.workspace_dependencies }}/setup.bash fi @@ -77,8 +94,7 @@ runs: ${{ inputs.colcon_build_args }} \ --cmake-args \ -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} \ - ${{ inputs.cmake_args_default }} \ - ${{ inputs.cmake_args }} + ${CMAKE_ARGS} if [[ -z "${{ inputs.colcon_meta_file }}" ]]; then rm colcon.meta diff --git a/windows/colcon_build/action.yml b/windows/colcon_build/action.yml index 32bc9a44..9ba7c7e4 100644 --- a/windows/colcon_build/action.yml +++ b/windows/colcon_build/action.yml @@ -18,13 +18,17 @@ inputs: required: false default: '--event-handlers=console_direct+' - cmake_args: - description: CMake arguments + set_eprosima_flags: + description: | + This flag sets the compilation flags (CMAKE_CXX_FLAGS) for eProsima product testing. + These are: + - Warnigs as errors (/WX /W4) + type: boolean required: false - default: '' + default: true - cmake_args_default: - description: Default CMake arguments + cmake_args: + description: CMake arguments required: false default: '' @@ -43,6 +47,10 @@ inputs: required: false default: '' +env: + + EPROSIMA_CXX_FLAGS: "-DCMAKE_CXX_FLAGS='/WX /W4'" + runs: using: composite steps: @@ -53,6 +61,15 @@ runs: "::group::Build using colcon" + if (${{ inputs.set_eprosima_flags }}) { + # EPROSIMA_CXX_FLAGS is set first so that it can be overridden by cmake_args + # in case the user wants to set its own flags. If that's the case and the user want's to use both flags, + # it should set EPROSIMA_CXX_FLAGS in cmake_args. + $env:CMAKE_ARGS = $env:EPROSIMA_CXX_FLAGS + " " + ${{ inputs.cmake_args }} + } else { + $env:CMAKE_ARGS = ${{ inputs.cmake_args }} + } + if (! [string]::IsNullOrEmpty("${{ inputs.workspace_dependencies }}")) { ${{ inputs.workspace_dependencies }}/setup.ps1 } @@ -82,7 +99,7 @@ runs: ${{ inputs.colcon_build_args_default }} ` ${{ inputs.colcon_build_args }} ` --cmake-args ` - -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} ${{ inputs.cmake_args_default }} ${{ inputs.cmake_args }} + -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} $env:CMAKE_ARGS cd -