Browse Source

Merge pull request #76 from youliangtan/dev/noetic

Compile cython code during catkin build stretch_funmap
pull/85/head
Binit Shah 2 years ago
committed by GitHub
parent
commit
0ccea05c67
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions
  1. +8
    -0
      stretch_funmap/CMakeLists.txt
  2. +1
    -0
      stretch_funmap/package.xml
  3. +5
    -2
      stretch_funmap/src/stretch_funmap/compile_cython_code.sh

+ 8
- 0
stretch_funmap/CMakeLists.txt View File

@ -11,6 +11,14 @@ find_package(catkin REQUIRED COMPONENTS
rospy
)
set(cython_code_dir ${CMAKE_CURRENT_SOURCE_DIR}/src/stretch_funmap)
message("Compile cython code within cmake build")
execute_process(
WORKING_DIRECTORY ${cython_code_dir}
COMMAND bash ${cython_code_dir}/compile_cython_code.sh
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)

+ 1
- 0
stretch_funmap/package.xml View File

@ -49,6 +49,7 @@
<buildtool_depend>catkin</buildtool_depend>
<build_depend>rospy</build_depend>
<build_export_depend>rospy</build_export_depend>
<build_depend>cython3</build_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>ros_numpy</exec_depend>

+ 5
- 2
stretch_funmap/src/stretch_funmap/compile_cython_code.sh View File

@ -1,8 +1,11 @@
#!/bin/bash
echo "Building cython_min_cost_path.pyx..."
cython3 ./cython_min_cost_path.pyx
gcc -shared -pthread -fPIC -fwrapv -ffast-math -O3 -Wall -fno-strict-aliasing -I/usr/include/python3.8 -o cython_min_cost_path.so cython_min_cost_path.c
cython3 ./cython_min_cost_path.pyx
PY_INCLUDE_PATH=$(python3 -c 'from sysconfig import get_paths as gp; print(gp()["include"])')
echo "Using python lib: $PY_INCLUDE_PATH"
gcc -shared -pthread -fPIC -fwrapv -ffast-math -O3 -Wall -fno-strict-aliasing -I$PY_INCLUDE_PATH -o cython_min_cost_path.so cython_min_cost_path.c
echo "Done."
echo ""

Loading…
Cancel
Save