diff --git a/fastdds_python/CMakeLists.txt b/fastdds_python/CMakeLists.txt index db9a21ac..275e6e79 100644 --- a/fastdds_python/CMakeLists.txt +++ b/fastdds_python/CMakeLists.txt @@ -24,7 +24,7 @@ if(POLICY CMP0086) cmake_policy(SET CMP0086 NEW) endif() -project(FastDdsPythonWrapper) +project(fastdds_python VERSION 0.2.0) ############################################################################### # Dependencies diff --git a/fastdds_python/cmake/packaging/Config.cmake.in b/fastdds_python/cmake/packaging/Config.cmake.in new file mode 100644 index 00000000..b54cd53a --- /dev/null +++ b/fastdds_python/cmake/packaging/Config.cmake.in @@ -0,0 +1,21 @@ +# 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. + +set(@PROJECT_NAME@_VERSION @PROJECT_VERSION@) + +@PACKAGE_INIT@ + +set_and_check(@PROJECT_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") + +include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) diff --git a/fastdds_python/src/swig/CMakeLists.txt b/fastdds_python/src/swig/CMakeLists.txt index e3433e68..cc2b5c1e 100644 --- a/fastdds_python/src/swig/CMakeLists.txt +++ b/fastdds_python/src/swig/CMakeLists.txt @@ -20,6 +20,8 @@ message(STATUS "Configuring FastDDS wrapper for Python...") find_package (PythonInterp REQUIRED) +set(LIB_INSTALL_DIR lib/ CACHE PATH "Installation directory for libraries") + set(${PROJECT_NAME}_MODULE fastdds ) @@ -36,7 +38,12 @@ SET_SOURCE_FILES_PROPERTIES( INCLUDE_DIRECTORIES() -SWIG_ADD_LIBRARY(${PROJECT_NAME} +option(BUILD_DOCUMENTATION "Use doxygen to create product documentation" OFF) +if (BUILD_DOCUMENTATION) + set(CMAKE_SWIG_FLAGS "-doxygen") +endif (BUILD_DOCUMENTATION) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} TYPE SHARED LANGUAGE python SOURCES ${${PROJECT_NAME}_FILES} @@ -59,6 +66,32 @@ SET (PYTHON_MODULE_PATH ) # Install -install(TARGETS ${PROJECT_NAME} DESTINATION ${PYTHON_MODULE_PATH}) +install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + DESTINATION ${PYTHON_MODULE_PATH} + ) get_property(support_files TARGET ${PROJECT_NAME} PROPERTY SWIG_SUPPORT_FILES) install(FILES ${support_files} DESTINATION ${PYTHON_MODULE_PATH}) + +export(TARGETS ${PROJECT_NAME} FILE ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-targets.cmake) + +install(EXPORT ${PROJECT_NAME}-targets + DESTINATION ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}/ + ) + +# Create CMake config file. +include(CMakePackageConfigHelpers) + +configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/packaging/Config.cmake.in + ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config.cmake + INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME} + PATH_VARS LIB_INSTALL_DIR + ) +write_basic_package_version_file(${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config-version.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion + ) +install(FILES ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config.cmake + ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config-version.cmake + DESTINATION ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME} + ) diff --git a/fastdds_python/src/swig/fastdds.i b/fastdds_python/src/swig/fastdds.i index 28c62536..12bc0729 100644 --- a/fastdds_python/src/swig/fastdds.i +++ b/fastdds_python/src/swig/fastdds.i @@ -15,6 +15,7 @@ %module(directors="1", threads="1") fastdds // SWIG helper modules +%include "stdint.i" %include "std_string.i" %include "typemaps.i" %include "std_shared_ptr.i" @@ -30,11 +31,6 @@ // and make not difference in python anyways #define final -// Definition of internal types -typedef int int32_t; -typedef unsigned int uint32_t; -typedef unsigned int size_t; - // Macro delcarations // Any macro used on the Fast DDS header files will give an error if it is not redefined here #define RTPS_DllAPI @@ -72,7 +68,6 @@ namespace builtin { %include "fastrtps/utils/collections/ResourceLimitedVector.i" /* -%include "fastdds/rtps/common/Property.i" %include "fastdds/rtps/common/FragmentNumber.i" %include "fastdds/rtps/common/LocatorSelector.i" %include "fastdds/rtps/common/LocatorSelectorEntry.i" @@ -89,7 +84,6 @@ namespace builtin { %include "fastdds/rtps/common/SequenceNumber.i" %include "fastdds/rtps/common/RemoteLocators.i" %include "fastdds/rtps/common/WriteParams.i" -%include "fastdds/rtps/common/BinaryProperty.i" %include "fastrtps/rtps/common/SerializedPayload.i" %include "fastrtps/rtps/common/Time_t.i" @@ -139,7 +133,6 @@ namespace builtin { %include "fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.i" %include "fastdds/rtps/attributes/WriterAttributes.i" %include "fastdds/rtps/attributes/ServerAttributes.i" -%include "fastdds/rtps/attributes/PropertyPolicy.i" %include "fastdds/rtps/reader/ReaderDiscoveryInfo.i" %include "fastdds/rtps/reader/StatelessReader.i" %include "fastdds/rtps/reader/StatefulReader.i" @@ -365,10 +358,17 @@ namespace builtin { %include "fastrtps/Domain.i" */ -%include "fastdds/dds/core/status/StatusMask.i" %include "fastdds/rtps/common/EntityId_t.i" %include "fastdds/rtps/common/GuidPrefix_t.i" %include "fastdds/rtps/common/Guid.i" + +/* +%include "fastdds/rtps/common/BinaryProperty.i" +%include "fastdds/rtps/common/Property.i" +%include "fastdds/rtps/attributes/PropertyPolicy.i" +*/ + +%include "fastdds/dds/core/status/StatusMask.i" %include "fastdds/dds/common/InstanceHandle.i" %include "fastdds/dds/core/policy/ParameterTypes.i" %include "fastdds/dds/core/policy/QosPolicies.i" @@ -426,7 +426,7 @@ namespace builtin { %include "fastdds/dds/domain/DomainParticipant.i" %include "fastdds/dds/domain/DomainParticipantFactory.i" -// Log functionality not available in the bind +// Log functionality not available in the bind // Logs in the library is still available, only 'Log' class will not be available on Python /* %include "fastdds/dds/log/Log.i" diff --git a/fastdds_python/src/swig/fastdds/rtps/attributes/PropertyPolicy.i b/fastdds_python/src/swig/fastdds/rtps/attributes/PropertyPolicy.i index fef44e3c..622600bd 100644 --- a/fastdds_python/src/swig/fastdds/rtps/attributes/PropertyPolicy.i +++ b/fastdds_python/src/swig/fastdds/rtps/attributes/PropertyPolicy.i @@ -16,4 +16,8 @@ #include "fastdds/rtps/attributes/PropertyPolicy.h" %} +// Ignore overloaded constructor that have no effect on target language +%ignore eprosima::fastrtps::rtps::PropertyPolicy::PropertyPolicy(PropertyPolicy &&); +%ignore eprosima::fastrtps::rtps::PropertyPolicyHelper; + %include "fastdds/rtps/attributes/PropertyPolicy.h" diff --git a/fastdds_python/src/swig/fastdds/rtps/common/BinaryProperty.i b/fastdds_python/src/swig/fastdds/rtps/common/BinaryProperty.i index 1988c203..165168d1 100644 --- a/fastdds_python/src/swig/fastdds/rtps/common/BinaryProperty.i +++ b/fastdds_python/src/swig/fastdds/rtps/common/BinaryProperty.i @@ -16,4 +16,9 @@ #include "fastdds/rtps/common/BinaryProperty.h" %} +// Ignore overloaded constructor that have no effect on target language +%ignore eprosima::fastrtps::rtps::BinaryProperty::BinaryProperty(BinaryProperty &&); +%ignore eprosima::fastrtps::rtps::BinaryProperty::value(std::vector &&); +%ignore eprosima::fastrtps::rtps::BinaryProperty::propagate(); + %include "fastdds/rtps/common/BinaryProperty.h" diff --git a/fastdds_python/src/swig/fastdds/rtps/common/Property.i b/fastdds_python/src/swig/fastdds/rtps/common/Property.i index 7f4c6865..8b728b56 100644 --- a/fastdds_python/src/swig/fastdds/rtps/common/Property.i +++ b/fastdds_python/src/swig/fastdds/rtps/common/Property.i @@ -16,4 +16,8 @@ #include "fastdds/rtps/common/Property.h" %} +// Ignore overloaded constructor that have no effect on target language +%ignore eprosima::fastrtps::rtps::Property::Property(Property &&); +%ignore eprosima::fastrtps::rtps::Property::propagate(); + %include "fastdds/rtps/common/Property.h"