From 0c204990b1a291b930d4c1d08f96334c58047d03 Mon Sep 17 00:00:00 2001 From: Raul Sanchez-Mateos Date: Thu, 28 Sep 2023 09:35:20 +0200 Subject: [PATCH] Regenerate test data types after rebase Signed-off-by: Raul Sanchez-Mateos --- fastdds_python/test/types/CMakeLists.txt | 145 +++++++++++++++--- fastdds_python/test/types/test_complete.cxx | 1 + .../types/test_included_modulesPubSubTypes.h | 7 + .../test/types/test_modulesPubSubTypes.h | 21 +++ 4 files changed, 149 insertions(+), 25 deletions(-) diff --git a/fastdds_python/test/types/CMakeLists.txt b/fastdds_python/test/types/CMakeLists.txt index bd46515c..725e1237 100644 --- a/fastdds_python/test/types/CMakeLists.txt +++ b/fastdds_python/test/types/CMakeLists.txt @@ -1,18 +1,5 @@ -# 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) + +cmake_minimum_required(VERSION 3.16.3) # SWIG: use standard target name. if(POLICY CMP0078) @@ -25,23 +12,130 @@ if(POLICY CMP0086) endif() ############################################################################### -# Library for types defined in test_modules IDL +# Library for types defined in test_included_modules IDL +############################################################################### + +message(STATUS "Configuring python wrapper for types in test_included_modules...") + +############################################################################### +# Type library on C++ + +project(test_included_modules) + +find_package(fastcdr REQUIRED) +find_package(fastrtps REQUIRED) + + +set(${PROJECT_NAME}_FILES + test_included_modules.cxx + test_included_modulesPubSubTypes.cxx + ) + +include_directories() + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +#Create library for C++ types +add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_FILES}) +if(WIN32) + target_compile_definitions(${PROJECT_NAME} PRIVATE EPROSIMA_USER_DLL_EXPORT) +endif(WIN32) +target_link_libraries(${PROJECT_NAME} PUBLIC fastcdr fastrtps) + +############################################################################### +# Python bindings for type + +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) +set(CMAKE_SWIG_FLAGS "") + +find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +set(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS}) +set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) +set(PYTHON_LIBRARIES ${Python3_LIBRARIES}) + +include_directories(${PYTHON_INCLUDE_PATH}) + +set(${PROJECT_NAME}_MODULE + test_included_modulesWrapper + ) + +set(${PROJECT_NAME}_MODULE_FILES + ${PROJECT_NAME}.i + ) + +SET_SOURCE_FILES_PROPERTIES( + ${${PROJECT_NAME}_MODULE_FILES} + PROPERTIES CPLUSPLUS ON + USE_TARGET_INCLUDE_DIRECTORIES TRUE + ) + +include_directories( + ${PROJECT_SOURCE_DIR} + ) + +set_property(SOURCE ${PROJECT_NAME}.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/eprosima/test2") + +SWIG_ADD_LIBRARY(${${PROJECT_NAME}_MODULE} + TYPE SHARED + LANGUAGE python + SOURCES ${${PROJECT_NAME}_MODULE_FILES}) + +if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8) + set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64) +endif() + +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}/eprosima/test2" + ) + + +# 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 + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +get_filename_component (_ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE) +file (RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH}) +SET (PYTHON_MODULE_PATH + ${_REL_PYTHON_MODULE_PATH} + ) + +# Install +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin/ + LIBRARY DESTINATION lib/ + ARCHIVE DESTINATION lib/ + ) +install(TARGETS ${${PROJECT_NAME}_MODULE} DESTINATION ${PYTHON_MODULE_PATH}/eprosima/test2) +get_property(support_files TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_SUPPORT_FILES) +install(FILES ${support_files} DESTINATION ${PYTHON_MODULE_PATH}/eprosima/test2) + +############################################################################### +# Library for types defined in test_complete IDL ############################################################################### -message(STATUS "Configuring python wrapper for types in test_modules...") +message(STATUS "Configuring python wrapper for types in test_complete...") ############################################################################### # Type library on C++ -project(test_modules) +project(test_complete) find_package(fastcdr REQUIRED) find_package(fastrtps REQUIRED) set(${PROJECT_NAME}_FILES - test_modules.cxx - test_modulesPubSubTypes.cxx + test_complete.cxx + test_completePubSubTypes.cxx ) include_directories() @@ -70,7 +164,7 @@ set(PYTHON_LIBRARIES ${Python3_LIBRARIES}) include_directories(${PYTHON_INCLUDE_PATH}) set(${PROJECT_NAME}_MODULE - test_modulesWrapper + test_completeWrapper ) set(${PROJECT_NAME}_MODULE_FILES @@ -87,7 +181,7 @@ include_directories( ${PROJECT_SOURCE_DIR} ) -set_property(SOURCE ${PROJECT_NAME}.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/eprosima/test") +set_property(SOURCE ${PROJECT_NAME}.i PROPERTY OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/") SWIG_ADD_LIBRARY(${${PROJECT_NAME}_MODULE} TYPE SHARED @@ -102,10 +196,11 @@ target_link_libraries(${${PROJECT_NAME}_MODULE} Python3::Module fastrtps ${PROJECT_NAME} + test_included_modules ) set_target_properties(${${PROJECT_NAME}_MODULE} - PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/eprosima/test" + PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" ) @@ -127,7 +222,7 @@ install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/ ARCHIVE DESTINATION lib/ ) -install(TARGETS ${${PROJECT_NAME}_MODULE} DESTINATION ${PYTHON_MODULE_PATH}/eprosima/test) +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}/eprosima/test) +install(FILES ${support_files} DESTINATION ${PYTHON_MODULE_PATH}/) diff --git a/fastdds_python/test/types/test_complete.cxx b/fastdds_python/test/types/test_complete.cxx index 9e37c2f2..6b0c374e 100644 --- a/fastdds_python/test/types/test_complete.cxx +++ b/fastdds_python/test/types/test_complete.cxx @@ -613,6 +613,7 @@ eprosima::test2::StructType2& StructType::included_module_struct() + CompleteTestType::CompleteTestType() { diff --git a/fastdds_python/test/types/test_included_modulesPubSubTypes.h b/fastdds_python/test/types/test_included_modulesPubSubTypes.h index 6cc52860..f235b871 100644 --- a/fastdds_python/test/types/test_included_modulesPubSubTypes.h +++ b/fastdds_python/test/types/test_included_modulesPubSubTypes.h @@ -106,6 +106,13 @@ namespace eprosima return false; } + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE diff --git a/fastdds_python/test/types/test_modulesPubSubTypes.h b/fastdds_python/test/types/test_modulesPubSubTypes.h index c36efa15..22e91227 100644 --- a/fastdds_python/test/types/test_modulesPubSubTypes.h +++ b/fastdds_python/test/types/test_modulesPubSubTypes.h @@ -106,6 +106,13 @@ namespace eprosima return false; } + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE @@ -189,6 +196,13 @@ namespace eprosima return false; } + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE @@ -270,6 +284,13 @@ namespace eprosima return false; } + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE