Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add input to use default eProsima flags for CMAKE_CXX_FLAGS #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions multiplatform/colcon_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''

Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}
14 changes: 14 additions & 0 deletions multiplatform/colcon_build_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
30 changes: 23 additions & 7 deletions ubuntu/colcon_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,6 +47,10 @@ inputs:
required: false
default: ''

env:

EPROSIMA_CXX_FLAGS: "-DCMAKE_CXX_FLAGS='-Werror -Wall'"

runs:
using: composite
steps:
Expand All @@ -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
Expand All @@ -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
Expand Down
29 changes: 23 additions & 6 deletions windows/colcon_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''

Expand All @@ -43,6 +47,10 @@ inputs:
required: false
default: ''

env:

EPROSIMA_CXX_FLAGS: "-DCMAKE_CXX_FLAGS='/WX /W4'"

runs:
using: composite
steps:
Expand All @@ -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
}
Expand Down Expand Up @@ -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 -

Expand Down