Skip to content

Commit

Permalink
Refs #19659. Regenerated example idl
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo González Moreno <[email protected]>
  • Loading branch information
richiware committed Oct 24, 2023
1 parent 61d4ad8 commit 1034390
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
38 changes: 14 additions & 24 deletions fastdds_python_examples/HelloWorldExample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -35,25 +22,31 @@ message(STATUS "Configuring python wrapper for types in HelloWorld...")

project(HelloWorld)

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


set(${PROJECT_NAME}_FILES
HelloWorld.cxx
HelloWorldPubSubTypes.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)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
target_include_directories(${PROJECT_NAME} PUBLIC
${PROJECT_SOURCE_DIR}
)
target_link_libraries(${PROJECT_NAME}
PUBLIC
fastcdr
fastrtps
)

###############################################################################
# Python bindings for type
Expand Down Expand Up @@ -83,17 +76,14 @@ SET_SOURCE_FILES_PROPERTIES(
USE_TARGET_INCLUDE_DIRECTORIES TRUE
)

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
SOURCES ${${PROJECT_NAME}_MODULE_FILES})

set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY CXX_STANDARD 11)
if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64)
endif()
Expand Down
14 changes: 14 additions & 0 deletions fastdds_python_examples/HelloWorldExample/HelloWorld.i
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,23 @@
#include <fastdds/dds/core/LoanableSequence.hpp>
%}

%import(module="fastdds") "fastcdr/xcdr/optional.hpp"
%import(module="fastdds") "fastdds/dds/core/LoanableCollection.hpp"
%import(module="fastdds") "fastdds/dds/core/LoanableTypedCollection.hpp"
%import(module="fastdds") "fastdds/dds/core/LoanableSequence.hpp"

%define %traits_penumn(Type...)
%fragment(SWIG_Traits_frag(Type),"header",
fragment="StdTraits") {
namespace swig {
template <> struct traits< Type > {
typedef value_category category;
static const char* type_name() { return #Type; }
};
}
}
%enddef

////////////////////////////////////////////////////////
// Binding for class HelloWorld
////////////////////////////////////////////////////////
Expand All @@ -68,6 +81,7 @@
%rename("%s") HelloWorld::index() const;



%ignore HelloWorld::message(std::string&&);

// Overloaded getter methods shadow each other and are equivalent in python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ eProsima_user_DllExport void serialize_key(
} // namespace fastcdr
} // namespace eprosima

#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_
#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_

Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,5 @@ void serialize_key(
} // namespace fastcdr
} // namespace eprosima

#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_
#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_

0 comments on commit 1034390

Please sign in to comment.