From 577f1ee5fd9caf3c893ea3e8d06e1660cf283a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez?= Date: Thu, 4 Jul 2024 11:27:39 +0200 Subject: [PATCH] Support compilation againt Ubuntu 24.04 swig4.1 (#153) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Refs #21268. Compilation againt swig4.1 Signed-off-by: Ricardo González Moreno * Refs #21268. Regenerate code Signed-off-by: Ricardo González Moreno --------- Signed-off-by: Ricardo González Moreno --- fastdds_python/CMakeLists.txt | 8 ++++++- fastdds_python/test/types/CMakeLists.txt | 21 ++++++++++++++++--- .../HelloWorldExample/CMakeLists.txt | 7 ++++++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/fastdds_python/CMakeLists.txt b/fastdds_python/CMakeLists.txt index e070670a..6daa9b3f 100644 --- a/fastdds_python/CMakeLists.txt +++ b/fastdds_python/CMakeLists.txt @@ -36,7 +36,13 @@ endif() # Dependencies ############################################################################### -find_package(SWIG REQUIRED) +find_package(SWIG) +if (NOT SWIG_FOUND) + # Trick to find swig4.1 in Ubuntu noble. + find_program(SWIG_EXECUTABLE NAMES swig4.1 swig) + find_package(SWIG REQUIRED) +endif() + include(${SWIG_USE_FILE}) set(CMAKE_SWIG_FLAGS "") diff --git a/fastdds_python/test/types/CMakeLists.txt b/fastdds_python/test/types/CMakeLists.txt index 876c696a..c1815bc9 100644 --- a/fastdds_python/test/types/CMakeLists.txt +++ b/fastdds_python/test/types/CMakeLists.txt @@ -48,7 +48,12 @@ target_link_libraries(${PROJECT_NAME} ############################################################################### # Python bindings for type -find_package(SWIG REQUIRED) +find_package(SWIG) +if (NOT SWIG_FOUND) + # Trick to find swig4.1 in Ubuntu noble. + find_program(SWIG_EXECUTABLE NAMES swig4.1 swig) + find_package(SWIG REQUIRED) +endif() include(${SWIG_USE_FILE}) set(CMAKE_SWIG_FLAGS "") @@ -148,7 +153,12 @@ target_link_libraries(${PROJECT_NAME} ############################################################################### # Python bindings for type -find_package(SWIG REQUIRED) +find_package(SWIG) +if (NOT SWIG_FOUND) + # Trick to find swig4.1 in Ubuntu noble. + find_program(SWIG_EXECUTABLE NAMES swig4.1 swig) + find_package(SWIG REQUIRED) +endif() include(${SWIG_USE_FILE}) set(CMAKE_SWIG_FLAGS "") @@ -249,7 +259,12 @@ target_link_libraries(${PROJECT_NAME} ############################################################################### # Python bindings for type -find_package(SWIG REQUIRED) +find_package(SWIG) +if (NOT SWIG_FOUND) + # Trick to find swig4.1 in Ubuntu noble. + find_program(SWIG_EXECUTABLE NAMES swig4.1 swig) + find_package(SWIG REQUIRED) +endif() include(${SWIG_USE_FILE}) set(CMAKE_SWIG_FLAGS "") diff --git a/fastdds_python_examples/HelloWorldExample/CMakeLists.txt b/fastdds_python_examples/HelloWorldExample/CMakeLists.txt index 84a53ee6..89735e43 100644 --- a/fastdds_python_examples/HelloWorldExample/CMakeLists.txt +++ b/fastdds_python_examples/HelloWorldExample/CMakeLists.txt @@ -48,7 +48,12 @@ target_link_libraries(${PROJECT_NAME} ############################################################################### # Python bindings for type -find_package(SWIG REQUIRED) +find_package(SWIG) +if (NOT SWIG_FOUND) + # Trick to find swig4.1 in Ubuntu noble. + find_program(SWIG_EXECUTABLE NAMES swig4.1 swig) + find_package(SWIG REQUIRED) +endif() include(${SWIG_USE_FILE}) set(CMAKE_SWIG_FLAGS "")