Skip to content

Commit

Permalink
More fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
  • Loading branch information
clalancette committed Jan 26, 2024
1 parent 62714a1 commit 4b6622e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
11 changes: 3 additions & 8 deletions rosidl_generator_py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ if(BUILD_TESTING)
find_package(python_cmake_module REQUIRED)
find_package(PythonExtra MODULE REQUIRED)

set(BUILDTYPE_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
if(WIN32 AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(BUILDTYPE_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
endif()

include(cmake/register_py.cmake)
include(cmake/rosidl_generator_py_get_typesupports.cmake)

Expand Down Expand Up @@ -72,18 +67,18 @@ if(BUILD_TESTING)
string(REPLACE ";" ":" pythonpath "${pythonpath}")
endif()
ament_add_pytest_test(test_interfaces_py "test/test_interfaces.py"
PYTHON_EXECUTABLE "${BUILDTYPE_PYTHON_EXECUTABLE}"
PYTHON_EXECUTABLE PythonExtra::Interpreter
APPEND_ENV "PYTHONPATH=${pythonpath}"
APPEND_LIBRARY_DIRS "${_append_library_dirs}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_py"
)

ament_add_pytest_test(test_cli_extension test/test_cli_extension.py
PYTHON_EXECUTABLE "${BUILDTYPE_PYTHON_EXECUTABLE}"
PYTHON_EXECUTABLE PythonExtra::Interpreter
)

ament_add_pytest_test(test_property_py test/test_property.py
PYTHON_EXECUTABLE "${BUILDTYPE_PYTHON_EXECUTABLE}"
PYTHON_EXECUTABLE PythonExtra::Interpreter
APPEND_ENV "PYTHONPATH=${pythonpath}"
APPEND_LIBRARY_DIRS "${_append_library_dirs}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_py"
Expand Down
4 changes: 3 additions & 1 deletion rosidl_generator_py/cmake/custom_command.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
# add_subdirectory() call.
add_custom_command(
OUTPUT ${_generated_extension_files} ${_generated_py_files} ${_generated_c_files}
COMMAND Python3::Interpreter ${rosidl_generator_py_BIN}
# This assumes that python_cmake_module was found, which is always the case since this is only
# called from rosidl_generator_py_generate_interfaces.cmake
COMMAND PythonExtra::Interpreter ${rosidl_generator_py_BIN}
--generator-arguments-file "${generator_arguments_file}"
--typesupport-impls "${_typesupport_impls}"
DEPENDS ${target_dependencies} ${rosidl_generate_interfaces_TARGET}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ foreach(_generated_py_file ${_generated_py_files})
endforeach()

if(NOT _generated_c_files STREQUAL "")
foreach(_typesupport_impl ${_typesupport_impls})
list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/_${PROJECT_NAME}_s.ep.${_typesupport_impl}.c")
list(APPEND _generated_extension_files "${_generated_extension_${_typesupport_impl}_files}")
endforeach()
foreach(_typesupport_impl ${_typesupport_impls})
list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/_${PROJECT_NAME}_s.ep.${_typesupport_impl}.c")
list(APPEND _generated_extension_files "${_generated_extension_${_typesupport_impl}_files}")
endforeach()
endif()
set(_dependency_files "")
set(_dependencies "")
Expand Down Expand Up @@ -185,9 +185,10 @@ foreach(_typesupport_impl ${_typesupport_impls})
${rosidl_generate_interfaces_TARGET}__rosidl_typesupport_c
)

set_target_properties(${_target_name} PROPERTIES DEBUG_POSTFIX "${PythonExtra_POSTFIX}")
# target_compile_options(${_target_name} PRIVATE ${_extension_compile_flags})
# TODO(sloretz) use target_compile_options when python extension passes -Wpedantic
set_target_properties(${_target_name} PROPERTIES COMPILE_OPTIONS "${_extension_compile_flags}") # XXX
set_target_properties(${_target_name} PROPERTIES COMPILE_OPTIONS "${_extension_compile_flags}")

set_target_properties(${_target_name} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${_output_path}
Expand Down

0 comments on commit 4b6622e

Please sign in to comment.