Skip to content

Commit

Permalink
Regenerate test data types after rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sanchez-Mateos <[email protected]>
  • Loading branch information
rsanchez15 committed Sep 28, 2023
1 parent e04f4be commit 0c20499
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 25 deletions.
145 changes: 120 additions & 25 deletions fastdds_python/test/types/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 @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}/"
)


Expand All @@ -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}/)

1 change: 1 addition & 0 deletions fastdds_python/test/types/test_complete.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ eprosima::test2::StructType2& StructType::included_module_struct()




CompleteTestType::CompleteTestType()
{

Expand Down
7 changes: 7 additions & 0 deletions fastdds_python/test/types/test_included_modulesPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>(data_representation);
return false;
}

#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN

#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
Expand Down
21 changes: 21 additions & 0 deletions fastdds_python/test/types/test_modulesPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>(data_representation);
return false;
}

#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN

#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
Expand Down Expand Up @@ -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<void>(data_representation);
return false;
}

#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN

#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
Expand Down Expand Up @@ -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<void>(data_representation);
return false;
}

#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN

#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
Expand Down

0 comments on commit 0c20499

Please sign in to comment.