diff --git a/patch/ros-noetic-jsk-recognition-utils.patch b/patch/ros-noetic-jsk-recognition-utils.patch index b83e70535..92a55fad1 100644 --- a/patch/ros-noetic-jsk-recognition-utils.patch +++ b/patch/ros-noetic-jsk-recognition-utils.patch @@ -41,6 +41,639 @@ index 83b0d4661..f9d0c6b99 100644 if (CATKIN_ENABLE_TESTING) find_package(rostest REQUIRED) if("$ENV{ROS_DISTRO}" STRGREATER "indigo") # kinetic and later uses qt5 +diff --git a/cmake/FindCython.cmake b/cmake/FindCython.cmake +index f44f1f707..d7fb4205f 100644 +--- a/cmake/FindCython.cmake ++++ b/cmake/FindCython.cmake +@@ -24,9 +24,9 @@ + + # Use the Cython executable that lives next to the Python executable + # if it is a local installation. +-find_package( PythonInterp ) +-if( PYTHONINTERP_FOUND ) +- get_filename_component( _python_path ${PYTHON_EXECUTABLE} PATH ) ++find_package (Python COMPONENTS Interpreter Development NumPy) ++if( Python_Interpreter_FOUND ) ++ get_filename_component( _python_path ${Python_EXECUTABLE} PATH ) + find_program( CYTHON_EXECUTABLE + NAMES cython cython.bat cython3 + HINTS ${_python_path} +diff --git a/cmake/UseCython.cmake b/cmake/UseCython.cmake +index f432c890c..0a11631e5 100644 +--- a/cmake/UseCython.cmake ++++ b/cmake/UseCython.cmake +@@ -1,51 +1,83 @@ +-# Define a function to create Cython modules. ++#.rst: + # +-# For more information on the Cython project, see http://cython.org/. +-# "Cython is a language that makes writing C extensions for the Python language +-# as easy as Python itself." ++# The following functions are defined: + # +-# This file defines a CMake function to build a Cython Python module. +-# To use it, first include this file. ++# .. cmake:command:: add_cython_target + # +-# include( UseCython ) ++# Create a custom rule to generate the source code for a Python extension module ++# using cython. + # +-# Then call cython_add_module to create a module. ++# add_cython_target( [] ++# [EMBED_MAIN] ++# [C | CXX] ++# [PY2 | PY3] ++# [OUTPUT_VAR ]) + # +-# cython_add_module( ... ) ++# ```` is the name of the new target, and ```` ++# is the path to a cython source file. Note that, despite the name, no new ++# targets are created by this function. Instead, see ``OUTPUT_VAR`` for ++# retrieving the path to the generated source for subsequent targets. + # +-# To create a standalone executable, the function ++# If only ```` is provided, and it ends in the ".pyx" extension, then it ++# is assumed to be the ````. The name of the input without the ++# extension is used as the target name. If only ```` is provided, and it ++# does not end in the ".pyx" extension, then the ```` is assumed to ++# be ``.pyx``. + # +-# cython_add_standalone_executable( [MAIN_MODULE src1] ... ) ++# The Cython include search path is amended with any entries found in the ++# ``INCLUDE_DIRECTORIES`` property of the directory containing the ++# ```` file. Use ``include_directories`` to add to the Cython ++# include search path. + # +-# To avoid dependence on Python, set the PYTHON_LIBRARY cache variable to point +-# to a static library. If a MAIN_MODULE source is specified, +-# the "if __name__ == '__main__':" from that module is used as the C main() method +-# for the executable. If MAIN_MODULE, the source with the same basename as +-# is assumed to be the MAIN_MODULE. ++# Options: + # +-# Where is the name of the resulting Python module and +-# ... are source files to be compiled into the module, e.g. *.pyx, +-# *.py, *.c, *.cxx, etc. A CMake target is created with name . This can +-# be used for target_link_libraries(), etc. ++# ``EMBED_MAIN`` ++# Embed a main() function in the generated output (for stand-alone ++# applications that initialize their own Python runtime). + # +-# The sample paths set with the CMake include_directories() command will be used +-# for include directories to search for *.pxd when running the Cython complire. ++# ``C | CXX`` ++# Force the generation of either a C or C++ file. By default, a C file is ++# generated, unless the C language is not enabled for the project; in this ++# case, a C++ file is generated by default. + # +-# Cache variables that effect the behavior include: ++# ``PY2 | PY3`` ++# Force compilation using either Python-2 or Python-3 syntax and code ++# semantics. By default, Python-2 syntax and semantics are used if the major ++# version of Python found is 2. Otherwise, Python-3 syntax and semantics are ++# used. + # +-# CYTHON_ANNOTATE +-# CYTHON_NO_DOCSTRINGS +-# CYTHON_FLAGS ++# ``OUTPUT_VAR `` ++# Set the variable ```` in the parent scope to the path to the ++# generated source file. By default, ```` is used as the output ++# variable name. + # +-# Source file properties that effect the build process are ++# Defined variables: + # +-# CYTHON_IS_CXX ++# ```` ++# The path of the generated source file. + # +-# If this is set of a *.pyx file with CMake set_source_files_properties() +-# command, the file will be compiled as a C++ file. ++# Cache variables that affect the behavior include: ++# ++# ``CYTHON_ANNOTATE`` ++# Whether to create an annotated .html file when compiling. ++# ++# ``CYTHON_FLAGS`` ++# Additional flags to pass to the Cython compiler. ++# ++# Example usage ++# ^^^^^^^^^^^^^ ++# ++# .. code-block:: cmake ++# ++# find_package(Cython) ++# ++# # Note: In this case, either one of these arguments may be omitted; their ++# # value would have been inferred from that of the other. ++# add_cython_target(cy_code cy_code.pyx) ++# ++# add_library(cy_code MODULE ${cy_code}) ++# target_link_libraries(cy_code ...) + # +-# See also FindCython.cmake +- + #============================================================================= + # Copyright 2011 Kitware, Inc. + # +@@ -63,225 +95,290 @@ + #============================================================================= + + # Configuration options. +-set( CYTHON_ANNOTATE OFF +- CACHE BOOL "Create an annotated .html file when compiling *.pyx." ) +-set( CYTHON_NO_DOCSTRINGS OFF +- CACHE BOOL "Strip docstrings from the compiled module." ) +-set( CYTHON_FLAGS "" CACHE STRING +- "Extra flags to the cython compiler." ) +-mark_as_advanced( CYTHON_ANNOTATE CYTHON_NO_DOCSTRINGS CYTHON_FLAGS ) +- +-find_package( Cython REQUIRED ) +-find_package( PythonLibs REQUIRED ) +- +-set( CYTHON_CXX_EXTENSION "cxx" ) +-set( CYTHON_C_EXTENSION "c" ) +- +-# Create a *.c or *.cxx file from a *.pyx file. +-# Input the generated file basename. The generate file will put into the variable +-# placed in the "generated_file" argument. Finally all the *.py and *.pyx files. +-function( compile_pyx _name generated_file ) +- # Default to assuming all files are C. +- set( cxx_arg "" ) +- set( extension ${CYTHON_C_EXTENSION} ) +- set( pyx_lang "C" ) +- set( comment "Compiling Cython C source for ${_name}..." ) +- +- set( cython_include_directories "" ) +- set( pxd_dependencies "" ) +- set( c_header_dependencies "" ) +- set( pyx_locations "" ) +- +- foreach( pyx_file ${ARGN} ) +- get_filename_component( pyx_file_basename "${pyx_file}" NAME_WE ) +- +- # Determine if it is a C or C++ file. +- get_source_file_property( property_is_cxx ${pyx_file} CYTHON_IS_CXX ) +- if( ${property_is_cxx} ) +- set( cxx_arg "--cplus" ) +- set( extension ${CYTHON_CXX_EXTENSION} ) +- set( pyx_lang "CXX" ) +- set( comment "Compiling Cython CXX source for ${_name}..." ) +- endif() ++set(CYTHON_ANNOTATE OFF ++ CACHE BOOL "Create an annotated .html file when compiling *.pyx.") ++ ++set(CYTHON_FLAGS "" CACHE STRING ++ "Extra flags to the cython compiler.") ++mark_as_advanced(CYTHON_ANNOTATE CYTHON_FLAGS) ++ ++set(CYTHON_CXX_EXTENSION "cxx") ++set(CYTHON_C_EXTENSION "c") ++cmake_policy(SET CMP0057 NEW) ++ ++get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES) ++ ++function(add_cython_target _name) ++ set(options EMBED_MAIN C CXX PY2 PY3) ++ set(options1 OUTPUT_VAR) ++ cmake_parse_arguments(_args "${options}" "${options1}" "" ${ARGN}) ++ ++ list(GET _args_UNPARSED_ARGUMENTS 0 _arg0) ++ ++ # if provided, use _arg0 as the input file path ++ if(_arg0) ++ set(_source_file ${_arg0}) ++ ++ # otherwise, must determine source file from name, or vice versa ++ else() ++ get_filename_component(_name_ext "${_name}" EXT) ++ ++ # if extension provided, _name is the source file ++ if(_name_ext) ++ set(_source_file ${_name}) ++ get_filename_component(_name "${_source_file}" NAME_WE) + +- # Get the include directories. +- get_source_file_property( pyx_location ${pyx_file} LOCATION ) +- get_filename_component( pyx_path ${pyx_location} PATH ) +- get_directory_property( cmake_include_directories DIRECTORY ${pyx_path} INCLUDE_DIRECTORIES ) +- list( APPEND cython_include_directories ${cmake_include_directories} ) +- list( APPEND pyx_locations "${pyx_location}" ) +- +- # Determine dependencies. +- # Add the pxd file will the same name as the given pyx file. +- unset( corresponding_pxd_file CACHE ) +- find_file( corresponding_pxd_file ${pyx_file_basename}.pxd +- PATHS "${pyx_path}" ${cmake_include_directories} +- NO_DEFAULT_PATH ) +- if( corresponding_pxd_file ) +- list( APPEND pxd_dependencies "${corresponding_pxd_file}" ) ++ # otherwise, assume the source file is ${_name}.pyx ++ else() ++ set(_source_file ${_name}.pyx) + endif() ++ endif() + +- # pxd files to check for additional dependencies. +- set( pxds_to_check "${pyx_file}" "${pxd_dependencies}" ) +- set( pxds_checked "" ) +- set( number_pxds_to_check 1 ) +- while( ${number_pxds_to_check} GREATER 0 ) +- foreach( pxd ${pxds_to_check} ) +- list( APPEND pxds_checked "${pxd}" ) +- list( REMOVE_ITEM pxds_to_check "${pxd}" ) +- +- # check for C header dependencies +- file( STRINGS "${pxd}" extern_from_statements +- REGEX "cdef[ ]+extern[ ]+from.*$" ) +- foreach( statement ${extern_from_statements} ) +- # Had trouble getting the quote in the regex +- string( REGEX REPLACE "cdef[ ]+extern[ ]+from[ ]+[\"]([^\"]+)[\"].*" "\\1" header "${statement}" ) +- unset( header_location CACHE ) +- find_file( header_location ${header} PATHS ${cmake_include_directories} ) +- if( header_location ) +- list( FIND c_header_dependencies "${header_location}" header_idx ) +- if( ${header_idx} LESS 0 ) +- list( APPEND c_header_dependencies "${header_location}" ) +- endif() +- endif() +- endforeach() +- +- # check for pxd dependencies +- +- # Look for cimport statements. +- set( module_dependencies "" ) +- file( STRINGS "${pxd}" cimport_statements REGEX cimport ) +- foreach( statement ${cimport_statements} ) +- if( ${statement} MATCHES from ) +- string( REGEX REPLACE "from[ ]+([^ ]+).*" "\\1" module "${statement}" ) +- else() +- string( REGEX REPLACE "cimport[ ]+([^ ]+).*" "\\1" module "${statement}" ) +- endif() +- list( APPEND module_dependencies ${module} ) +- endforeach() +- list( REMOVE_DUPLICATES module_dependencies ) +- # Add the module to the files to check, if appropriate. +- foreach( module ${module_dependencies} ) +- unset( pxd_location CACHE ) +- find_file( pxd_location ${module}.pxd +- PATHS "${pyx_path}" ${cmake_include_directories} NO_DEFAULT_PATH ) +- if( pxd_location ) +- list( FIND pxds_checked ${pxd_location} pxd_idx ) +- if( ${pxd_idx} LESS 0 ) +- list( FIND pxds_to_check ${pxd_location} pxd_idx ) +- if( ${pxd_idx} LESS 0 ) +- list( APPEND pxds_to_check ${pxd_location} ) +- list( APPEND pxd_dependencies ${pxd_location} ) +- endif() # if it is not already going to be checked +- endif() # if it has not already been checked +- endif() # if pxd file can be found +- endforeach() # for each module dependency discovered +- endforeach() # for each pxd file to check +- list( LENGTH pxds_to_check number_pxds_to_check ) +- endwhile() +- endforeach() # pyx_file ++ set(_embed_main FALSE) + +- # Set additional flags. +- if( CYTHON_ANNOTATE ) +- set( annotate_arg "--annotate" ) ++ if("C" IN_LIST languages) ++ set(_output_syntax "C") ++ elseif("CXX" IN_LIST languages) ++ set(_output_syntax "CXX") ++ else() ++ message(FATAL_ERROR "Either C or CXX must be enabled to use Cython") + endif() + +- if( CYTHON_NO_DOCSTRINGS ) +- set( no_docstrings_arg "--no-docstrings" ) ++ if(_args_EMBED_MAIN) ++ set(_embed_main TRUE) + endif() + +- if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR +- "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" ) +- set( cython_debug_arg "--gdb" ) ++ if(_args_C) ++ set(_output_syntax "C") + endif() + +- # Include directory arguments. +- list( REMOVE_DUPLICATES cython_include_directories ) +- set( include_directory_arg "" ) +- foreach( _include_dir ${cython_include_directories} ) +- set( include_directory_arg ${include_directory_arg} "-I" "${_include_dir}" ) +- endforeach() ++ if(_args_CXX) ++ set(_output_syntax "CXX") ++ endif() + +- # Determining generated file name. +- set( _generated_file "${CMAKE_CURRENT_BINARY_DIR}/${_name}.${extension}" ) +- set_source_files_properties( ${_generated_file} PROPERTIES GENERATED TRUE ) +- set( ${generated_file} ${_generated_file} PARENT_SCOPE ) ++ # Doesn't select an input syntax - Cython ++ # defaults to 2 for Cython 2 and 3 for Cython 3 ++ set(_input_syntax "default") + +- list( REMOVE_DUPLICATES pxd_dependencies ) +- list( REMOVE_DUPLICATES c_header_dependencies ) ++ if(_args_PY2) ++ set(_input_syntax "PY2") ++ endif() + +- # Add the command to run the compiler. +- add_custom_command( OUTPUT ${_generated_file} +- COMMAND ${CYTHON_EXECUTABLE} +- ARGS ${cxx_arg} ${include_directory_arg} +- ${annotate_arg} ${no_docstrings_arg} ${cython_debug_arg} ${CYTHON_FLAGS} +- --output-file ${_generated_file} ${pyx_locations} +- DEPENDS ${pyx_locations} ${pxd_dependencies} +- IMPLICIT_DEPENDS ${pyx_lang} ${c_header_dependencies} +- COMMENT ${comment} +- ) ++ if(_args_PY3) ++ set(_input_syntax "PY3") ++ endif() + +- # Remove their visibility to the user. +- set( corresponding_pxd_file "" CACHE INTERNAL "" ) +- set( header_location "" CACHE INTERNAL "" ) +- set( pxd_location "" CACHE INTERNAL "" ) +-endfunction() +- +-# cython_add_module( src1 src2 ... srcN ) +-# Build the Cython Python module. +-function( cython_add_module _name ) +- set( pyx_module_sources "" ) +- set( other_module_sources "" ) +- foreach( _file ${ARGN} ) +- if( ${_file} MATCHES ".*\\.py[x]?$" ) +- list( APPEND pyx_module_sources ${_file} ) +- else() +- list( APPEND other_module_sources ${_file} ) +- endif() +- endforeach() +- compile_pyx( ${_name} generated_file ${pyx_module_sources} ) +- include_directories( ${PYTHON_INCLUDE_DIRS} ) +- python_add_module( ${_name} ${generated_file} ${other_module_sources} ) +- if( APPLE ) +- set_target_properties( ${_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" ) +- else() +- target_link_libraries( ${_name} ${PYTHON_LIBRARIES} ) ++ set(embed_arg "") ++ if(_embed_main) ++ set(embed_arg "--embed") + endif() +-endfunction() +- +-include( CMakeParseArguments ) +-# cython_add_standalone_executable( _name [MAIN_MODULE src3.py] src1 src2 ... srcN ) +-# Creates a standalone executable the given sources. +-function( cython_add_standalone_executable _name ) +- set( pyx_module_sources "" ) +- set( other_module_sources "" ) +- set( main_module "" ) +- cmake_parse_arguments( cython_arguments "" "MAIN_MODULE" "" ${ARGN} ) +- include_directories( ${PYTHON_INCLUDE_DIRS} ) +- foreach( _file ${cython_arguments_UNPARSED_ARGUMENTS} ) +- if( ${_file} MATCHES ".*\\.py[x]?$" ) +- get_filename_component( _file_we ${_file} NAME_WE ) +- if( "${_file_we}" STREQUAL "${_name}" ) +- set( main_module "${_file}" ) +- elseif( NOT "${_file}" STREQUAL "${cython_arguments_MAIN_MODULE}" ) +- set( PYTHON_MODULE_${_file_we}_static_BUILD_SHARED OFF ) +- compile_pyx( "${_file_we}_static" generated_file "${_file}" ) +- list( APPEND pyx_module_sources "${generated_file}" ) +- endif() +- else() +- list( APPEND other_module_sources ${_file} ) +- endif() +- endforeach() + +- if( cython_arguments_MAIN_MODULE ) +- set( main_module ${cython_arguments_MAIN_MODULE} ) ++ set(cxx_arg "") ++ set(extension "c") ++ if(_output_syntax STREQUAL "CXX") ++ set(cxx_arg "--cplus") ++ set(extension "cxx") ++ endif() ++ ++ set(py_version_arg "") ++ if(_input_syntax STREQUAL "PY2") ++ set(py_version_arg "-2") ++ elseif(_input_syntax STREQUAL "PY3") ++ set(py_version_arg "-3") ++ endif() ++ ++ set(generated_file "${CMAKE_CURRENT_BINARY_DIR}/${_name}.${extension}") ++ set_source_files_properties(${generated_file} PROPERTIES GENERATED TRUE) ++ ++ set(_output_var ${_name}) ++ if(_args_OUTPUT_VAR) ++ set(_output_var ${_args_OUTPUT_VAR}) ++ endif() ++ set(${_output_var} ${generated_file} PARENT_SCOPE) ++ ++ file(RELATIVE_PATH generated_file_relative ++ ${CMAKE_BINARY_DIR} ${generated_file}) ++ ++ set(comment "Generating ${_output_syntax} source ${generated_file_relative}") ++ set(cython_include_directories "") ++ set(pxd_dependencies "") ++ set(c_header_dependencies "") ++ ++ # Get the include directories. ++ get_directory_property(cmake_include_directories ++ DIRECTORY ${CMAKE_CURRENT_LIST_DIR} ++ INCLUDE_DIRECTORIES) ++ list(APPEND cython_include_directories ${cmake_include_directories}) ++ ++ # Determine dependencies. ++ # Add the pxd file with the same basename as the given pyx file. ++ get_source_file_property(pyx_location ${_source_file} LOCATION) ++ get_filename_component(pyx_path ${pyx_location} PATH) ++ get_filename_component(pyx_file_basename ${_source_file} NAME_WE) ++ unset(corresponding_pxd_file CACHE) ++ find_file(corresponding_pxd_file ${pyx_file_basename}.pxd ++ PATHS "${pyx_path}" ${cmake_include_directories} ++ NO_DEFAULT_PATH) ++ if(corresponding_pxd_file) ++ list(APPEND pxd_dependencies "${corresponding_pxd_file}") ++ endif() ++ ++ # pxd files to check for additional dependencies ++ set(pxds_to_check "${_source_file}" "${pxd_dependencies}") ++ set(pxds_checked "") ++ set(number_pxds_to_check 1) ++ while(number_pxds_to_check GREATER 0) ++ foreach(pxd ${pxds_to_check}) ++ list(APPEND pxds_checked "${pxd}") ++ list(REMOVE_ITEM pxds_to_check "${pxd}") ++ ++ # look for C headers ++ file(STRINGS "${pxd}" extern_from_statements ++ REGEX "cdef[ ]+extern[ ]+from.*$") ++ foreach(statement ${extern_from_statements}) ++ # Had trouble getting the quote in the regex ++ string(REGEX REPLACE ++ "cdef[ ]+extern[ ]+from[ ]+[\"]([^\"]+)[\"].*" "\\1" ++ header "${statement}") ++ unset(header_location CACHE) ++ find_file(header_location ${header} PATHS ${cmake_include_directories}) ++ if(header_location) ++ list(FIND c_header_dependencies "${header_location}" header_idx) ++ if(${header_idx} LESS 0) ++ list(APPEND c_header_dependencies "${header_location}") ++ endif() ++ endif() ++ endforeach() ++ ++ # check for pxd dependencies ++ # Look for cimport statements. ++ set(module_dependencies "") ++ file(STRINGS "${pxd}" cimport_statements REGEX cimport) ++ foreach(statement ${cimport_statements}) ++ if(${statement} MATCHES from) ++ string(REGEX REPLACE ++ "from[ ]+([^ ]+).*" "\\1" ++ module "${statement}") ++ else() ++ string(REGEX REPLACE ++ "cimport[ ]+([^ ]+).*" "\\1" ++ module "${statement}") ++ endif() ++ list(APPEND module_dependencies ${module}) ++ endforeach() ++ ++ # check for pxi dependencies ++ # Look for include statements. ++ set(include_dependencies "") ++ file(STRINGS "${pxd}" include_statements REGEX include) ++ foreach(statement ${include_statements}) ++ string(REGEX REPLACE ++ "include[ ]+[\"]([^\"]+)[\"].*" "\\1" ++ module "${statement}") ++ list(APPEND include_dependencies ${module}) ++ endforeach() ++ ++ list(REMOVE_DUPLICATES module_dependencies) ++ list(REMOVE_DUPLICATES include_dependencies) ++ ++ # Add modules to the files to check, if appropriate. ++ foreach(module ${module_dependencies}) ++ unset(pxd_location CACHE) ++ find_file(pxd_location ${module}.pxd ++ PATHS "${pyx_path}" ${cmake_include_directories} ++ NO_DEFAULT_PATH) ++ if(pxd_location) ++ list(FIND pxds_checked ${pxd_location} pxd_idx) ++ if(${pxd_idx} LESS 0) ++ list(FIND pxds_to_check ${pxd_location} pxd_idx) ++ if(${pxd_idx} LESS 0) ++ list(APPEND pxds_to_check ${pxd_location}) ++ list(APPEND pxd_dependencies ${pxd_location}) ++ endif() # if it is not already going to be checked ++ endif() # if it has not already been checked ++ endif() # if pxd file can be found ++ endforeach() # for each module dependency discovered ++ ++ # Add includes to the files to check, if appropriate. ++ foreach(_include ${include_dependencies}) ++ unset(pxi_location CACHE) ++ find_file(pxi_location ${_include} ++ PATHS "${pyx_path}" ${cmake_include_directories} ++ NO_DEFAULT_PATH) ++ if(pxi_location) ++ list(FIND pxds_checked ${pxi_location} pxd_idx) ++ if(${pxd_idx} LESS 0) ++ list(FIND pxds_to_check ${pxi_location} pxd_idx) ++ if(${pxd_idx} LESS 0) ++ list(APPEND pxds_to_check ${pxi_location}) ++ list(APPEND pxd_dependencies ${pxi_location}) ++ endif() # if it is not already going to be checked ++ endif() # if it has not already been checked ++ endif() # if include file can be found ++ endforeach() # for each include dependency discovered ++ endforeach() # for each include file to check ++ ++ list(LENGTH pxds_to_check number_pxds_to_check) ++ endwhile() ++ ++ # Set additional flags. ++ set(annotate_arg "") ++ if(CYTHON_ANNOTATE) ++ set(annotate_arg "--annotate") + endif() +- if( NOT main_module ) +- message( FATAL_ERROR "main module not found." ) ++ ++ set(cython_debug_arg "") ++ set(line_directives_arg "") ++ if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR ++ CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") ++ set(cython_debug_arg "--gdb") ++ set(line_directives_arg "--line-directives") + endif() +- get_filename_component( main_module_we "${main_module}" NAME_WE ) +- set( CYTHON_FLAGS ${CYTHON_FLAGS} --embed ) +- compile_pyx( "${main_module_we}_static" generated_file ${main_module} ) +- add_executable( ${_name} ${generated_file} ${pyx_module_sources} ${other_module_sources} ) +- target_link_libraries( ${_name} ${PYTHON_LIBRARIES} ${pyx_module_libs} ) +-endfunction() ++ ++ # Include directory arguments. ++ list(REMOVE_DUPLICATES cython_include_directories) ++ set(include_directory_arg "") ++ foreach(_include_dir ${cython_include_directories}) ++ set(include_directory_arg ++ ${include_directory_arg} "--include-dir" "${_include_dir}") ++ endforeach() ++ ++ list(REMOVE_DUPLICATES pxd_dependencies) ++ list(REMOVE_DUPLICATES c_header_dependencies) ++ ++ string(REGEX REPLACE " " ";" CYTHON_FLAGS_LIST "${CYTHON_FLAGS}") ++ ++ # Add the command to run the compiler. ++ add_custom_command(OUTPUT ${generated_file} ++ COMMAND ${CYTHON_EXECUTABLE} ++ ARGS ${cxx_arg} ${include_directory_arg} ${py_version_arg} ++ ${embed_arg} ${annotate_arg} ${cython_debug_arg} ++ ${line_directives_arg} ${CYTHON_FLAGS_LIST} ${pyx_location} ++ --output-file ${generated_file} ++ DEPENDS ${_source_file} ++ ${pxd_dependencies} ++ IMPLICIT_DEPENDS ${_output_syntax} ++ ${c_header_dependencies} ++ COMMENT ${comment}) ++ ++ # NOTE(opadron): I thought about making a proper target, but after trying it ++ # out, I decided that it would be far too convenient to use the same name as ++ # the target for the extension module (e.g.: for single-file modules): ++ # ++ # ... ++ # add_cython_target(_module.pyx) ++ # add_library(_module ${_module}) ++ # ... ++ # ++ # The above example would not be possible since the "_module" target name ++ # would already be taken by the cython target. Since I can't think of a ++ # reason why someone would need the custom target instead of just using the ++ # generated file directly, I decided to leave this commented out. ++ # ++ # add_custom_target(${_name} DEPENDS ${generated_file}) ++ ++ # Remove their visibility to the user. ++ set(corresponding_pxd_file "" CACHE INTERNAL "") ++ set(header_location "" CACHE INTERNAL "") ++ set(pxd_location "" CACHE INTERNAL "") ++endfunction() +\ No newline at end of file diff --git a/include/jsk_recognition_utils/geo_util.h b/include/jsk_recognition_utils/geo_util.h index 6aa73a43d..0c81944d1 100644 --- a/include/jsk_recognition_utils/geo_util.h @@ -83,6 +716,38 @@ index 951102f7b..7f7a4816e 100644 /** \brief Check if p is inside the triangle (u,v,w). * \param[in] u the first triangle vertex +diff --git a/python/jsk_recognition_utils/CMakeLists.txt b/python/jsk_recognition_utils/CMakeLists.txt +index e6bc617b6..8e869ad85 100644 +--- a/python/jsk_recognition_utils/CMakeLists.txt ++++ b/python/jsk_recognition_utils/CMakeLists.txt +@@ -1,18 +1,14 @@ +-if(NOT DEFINED Numpy_INCLUDE_DIRS) +- # Get Numpy include directories +- execute_process( +- COMMAND python$ENV{ROS_PYTHON_VERSION} -c "import sys, numpy; sys.stdout.write(numpy.get_include())" +- OUTPUT_VARIABLE Numpy_INCLUDE_DIRS +- RESULT_VARIABLE retcode) +- if(NOT ${retcode} EQUAL 0) +- message(FATAL_ERROR "Failed to get Numpy include dirs by numpy.get_include(). Exit code: ${retcode}") +- endif() +-endif() ++find_package (Python COMPONENTS Interpreter Development NumPy) ++find_package(Cython) + # Compile nms.pyx +-include_directories(${Numpy_INCLUDE_DIRS}) +-cython_add_module(nms nms.pyx) ++include_directories(${Python_NumPy_INCLUDE_DIRS} ${Python_INCLUDE_DIRS} ${Python_SITELIB}) ++add_cython_target(nms nms.pyx) ++add_library(nms MODULE ${nms}) ++# cython_add_module(nms nms.pyx) + set_target_properties(nms PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}) +-cython_add_module(color color.pyx) ++add_cython_target(color color.pyx) ++add_library(color MODULE ${color}) ++# cython_add_module(color color.pyx) + set_target_properties(color PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}) + install(TARGETS nms color + ARCHIVE DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION} diff --git a/src/pcl/ear_clipping_patched.cpp b/src/pcl/ear_clipping_patched.cpp index 0e26401ba..844abf33f 100644 --- a/src/pcl/ear_clipping_patched.cpp diff --git a/patch/ros-noetic-jsk-rviz-plugins.patch b/patch/ros-noetic-jsk-rviz-plugins.patch index 5126eb512..f9e71dbc3 100644 --- a/patch/ros-noetic-jsk-rviz-plugins.patch +++ b/patch/ros-noetic-jsk-rviz-plugins.patch @@ -1,3 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 310db0bd..a23f2288 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,12 +64,8 @@ include_directories(src ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS}) + ## CATKIN_DEPENDS: catkin_packages dependent projects also need + ## DEPENDS: system dependencies of this project that dependent projects also need + +-if(rviz_QT_VERSION VERSION_LESS "5") +- find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED) +- include(${QT_USE_FILE}) +-else() +- find_package(Qt5Widgets REQUIRED) +-endif() ++find_package(Qt5 COMPONENTS Widgets REQUIRED) ++find_package(OpenCV REQUIRED) + add_definitions(-DQT_NO_KEYWORDS -g) + + include_directories(${CMAKE_CURRENT_BINARY_DIR}) +@@ -194,7 +190,7 @@ add_library(jsk_rviz_plugins ${SOURCE_FILES} ${UIC_FILES}) + if(rviz_QT_VERSION VERSION_LESS "5") + target_link_libraries(jsk_rviz_plugins ${QT_LIBRARIES} ${catkin_LIBRARIES} ${rviz_DEFAULT_PLUGIN_LIBRARIES}) + else() +- target_link_libraries(jsk_rviz_plugins Qt5::Widgets ${catkin_LIBRARIES} ${rviz_DEFAULT_PLUGIN_LIBRARIES}) ++ target_link_libraries(jsk_rviz_plugins Qt5::Widgets ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${rviz_DEFAULT_PLUGIN_LIBRARIES}) + endif() + add_dependencies(jsk_rviz_plugins + jsk_footstep_msgs_generate_messages_cpp diff --git a/src/camera_info_display.cpp b/src/camera_info_display.cpp index eb9de008..09d269aa 100644 --- a/src/camera_info_display.cpp @@ -22,6 +50,18 @@ index 60f21549..9962aa0d 100644 #include "facing_visualizer.h" #include #include +diff --git a/src/overlay_diagnostic_display.h b/src/overlay_diagnostic_display.h +index 01cc7fc0..61fe680d 100644 +--- a/src/overlay_diagnostic_display.h ++++ b/src/overlay_diagnostic_display.h +@@ -42,6 +42,7 @@ + #include + + #include ++#include + + #include + #include diff --git a/src/overlay_utils.cpp b/src/overlay_utils.cpp index 73525c43..494e2bdf 100644 --- a/src/overlay_utils.cpp @@ -47,7 +87,7 @@ index 26ebc921..f5d9ce12 100644 #include #include diff --git a/src/polygon_array_display.cpp b/src/polygon_array_display.cpp -index 118a5405..9d366d6d 100644 +index b1b1ef35..61fc966c 100644 --- a/src/polygon_array_display.cpp +++ b/src/polygon_array_display.cpp @@ -35,6 +35,8 @@