Skip to content

Commit

Permalink
Support new Fast-CDR v2.0.0 (#58)
Browse files Browse the repository at this point in the history
* Refs #18687. Regenerate IDL files

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #18687. Regenerated data type source code

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #18687. Update CMakeLists.txt files

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #18687. Set fastcdr to `master`

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #18687. Try to fix windows ci

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #18687. Fixing windows ci

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #18687. Fixing swig error on windows

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #18687. Fixing windows ci

Signed-off-by: Ricardo González <[email protected]>

* Refs #18687. Testing with swig 4.0.2

Signed-off-by: Ricardo González <[email protected]>

---------

Signed-off-by: Ricardo González Moreno <[email protected]>
Signed-off-by: Ricardo González <[email protected]>
  • Loading branch information
richiware authored Sep 28, 2023
1 parent a9a6d90 commit bbb019c
Show file tree
Hide file tree
Showing 24 changed files with 3,262 additions and 2,620 deletions.
46 changes: 37 additions & 9 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
"System32;SysWoW64" -split ";" | Join-Path -Path $env:windir -ChildPath {$_} `
| ls -Include libssl-*.dll | rm
- name: install swig
shell: pwsh
run: choco install swig --allow-downgrade --version=4.0.2.04082020

- name: Install python build dependencies
shell: pwsh
run: >
Expand All @@ -39,8 +43,8 @@ jobs:
'cmake_minimum_required(VERSION 3.5)' + $cr +
'project(dummy VERSION 1.0.0 LANGUAGES CXX)' + $cr +
'find_package (Python3 COMPONENTS Interpreter Development REQUIRED)' + $cr +
'message(STATUS "cmake detected python=>>>>>${Python3_EXECUTABLE}<<<<<<")' |
Out-File CMakeLists.txt
'message(STATUS "cmake detected python=>>>>>${Python3_EXECUTABLE}<<<<<<")' |
Out-File CMakeLists.txt
(cmake .) *>&1 | % {
if($_ -Match "cmake detected python=>>>>>(?<exec>.*)<<<<<<")
{
Expand All @@ -59,22 +63,35 @@ jobs:
run: |
vcs import src --skip-existing --input src/fastdds_python/fastdds_python.repos
- name: Get minimum supported version of CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.22.6
- name: Use cmake
run: cmake --version

- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
windows_compile_environment: msvc

- name: Build workspace
shell: pwsh
run: |
$installpath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
$modulepath = "$installpath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Import-Module $modulepath
Enter-VsDevShell -SetDefaultWindowTitle -InstallPath $installpath `
-DevCmdArguments '/arch=x64 /host_arch=x64';
$cargs = @("--event-handlers=console_direct+", `
"--metas", "./src/fastdds_python/.github/workflows/test.meta")
colcon build --executor parallel $cargs
-StartInPath (pwd) -DevCmdArguments '/arch=x64 /host_arch=x64';
colcon build --executor parallel --event-handlers console_direct+ desktop_notification- `
--metas ./src/fastdds_python/.github/workflows/test.meta `
--cmake-args -DCMAKE_C_COMPILER_LAUNCHER="${{ env.ccache_symlinks_path }}" `
-DCMAKE_CXX_COMPILER_LAUNCHER="${{ env.ccache_symlinks_path }}"
- name: Run tests
shell: pwsh
run: |
colcon test --packages-select fastdds_python --event-handlers=console_direct+ `
colcon test --packages-select fastdds_python --event-handlers console_direct+ desktop_notification- `
--return-code-on-test-failure --ctest-args --timeout 60
- name: Upload Logs
Expand All @@ -85,7 +102,7 @@ jobs:
if: always()

ubuntu-build-test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
Expand All @@ -111,9 +128,20 @@ jobs:
run: |
vcs import --skip-existing src < src/fastdds_python/fastdds_python.repos
- name: Get minimum supported version of CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.22.6
- name: Use cmake
run: cmake --version

- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1

- name: Build workspace
run: >
colcon build --event-handlers=console_direct+ --metas ./src/fastdds_python/.github/workflows/test.meta
colcon build --event-handlers=console_direct+ --metas ./src/fastdds_python/.github/workflows/test.meta \
--cmake-args -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Run tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion fastdds_python.repos
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repositories:
fastcdr:
type: git
url: https://github.com/eProsima/Fast-CDR.git
version: 1.1.x
version: master
fastdds:
type: git
url: https://github.com/eProsima/Fast-DDS.git
Expand Down
5 changes: 3 additions & 2 deletions fastdds_python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.22)

# SWIG: use standard target name.
if(POLICY CMP0078)
Expand All @@ -36,7 +36,8 @@ set(CMAKE_SWIG_FLAGS "")

find_package (Python3 COMPONENTS Interpreter Development REQUIRED)

find_package(fastrtps REQUIRED)
find_package(fastcdr 2 REQUIRED)
find_package(fastrtps 2.12 REQUIRED)

###############################################################################
# Project subdirectories
Expand Down
9 changes: 7 additions & 2 deletions fastdds_python/src/swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (BUILD_DOCUMENTATION)
set(CMAKE_SWIG_FLAGS "-doxygen")
endif (BUILD_DOCUMENTATION)

SWIG_ADD_LIBRARY(${PROJECT_NAME}
swig_add_library(${PROJECT_NAME}
TYPE SHARED
LANGUAGE python
SOURCES ${${PROJECT_NAME}_FILES}
Expand All @@ -49,8 +49,13 @@ if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set_property(TARGET ${PROJECT_NAME} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64)
endif()

SWIG_LINK_LIBRARIES(${PROJECT_NAME}
if(MSVC OR MSVC_IDE)
target_compile_options(${PROJECT_NAME} PRIVATE /bigobj)
endif()

target_link_libraries(${PROJECT_NAME}
Python3::Module
fastcdr
fastrtps
)

Expand Down
14 changes: 14 additions & 0 deletions fastdds_python/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Compile types
add_subdirectory(types)

Expand Down
34 changes: 27 additions & 7 deletions fastdds_python/test/types/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@

cmake_minimum_required(VERSION 3.16.3)
# Copyright 2022 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.22)

# SWIG: use standard target name.
if(POLICY CMP0078)
Expand All @@ -22,8 +35,8 @@ message(STATUS "Configuring python wrapper for types in test_complete...")

project(test_complete)

find_package(fastcdr REQUIRED)
find_package(fastrtps REQUIRED)
find_package(fastcdr 2 REQUIRED)
find_package(fastrtps 2.12 REQUIRED)


set(${PROJECT_NAME}_FILES
Expand Down Expand Up @@ -74,6 +87,8 @@ include_directories(
${PROJECT_SOURCE_DIR}
)

set_property(SOURCE ${PROJECT_NAME}.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/")

SWIG_ADD_LIBRARY(${${PROJECT_NAME}_MODULE}
TYPE SHARED
LANGUAGE python
Expand All @@ -83,12 +98,17 @@ if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64)
endif()

SWIG_LINK_LIBRARIES(${${PROJECT_NAME}_MODULE}
target_link_libraries(${${PROJECT_NAME}_MODULE}
Python3::Module
fastrtps
${PROJECT_NAME}
)

set_target_properties(${${PROJECT_NAME}_MODULE}
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
)


# Find the installation path
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))"
OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
Expand All @@ -107,7 +127,7 @@ install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib/
ARCHIVE DESTINATION lib/
)
install(TARGETS ${${PROJECT_NAME}_MODULE} DESTINATION ${PYTHON_MODULE_PATH})
install(TARGETS ${${PROJECT_NAME}_MODULE} DESTINATION ${PYTHON_MODULE_PATH}/)
get_property(support_files TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_SUPPORT_FILES)
install(FILES ${support_files} DESTINATION ${PYTHON_MODULE_PATH})
install(FILES ${support_files} DESTINATION ${PYTHON_MODULE_PATH}/)

Loading

0 comments on commit bbb019c

Please sign in to comment.