Skip to content

Commit 25766e7

Browse files
author
Felix Widmaier
committed
Rename package and simplify package.xml & CMakeLists.txt
Rename the package to the more descriptive 'boost_python_catkin_example'. Add some information in package.xml and remove unnecessary dependencies and autogenerated stuff. Set Python version to 2.7 (otherwise it may find Python 3 which does not work).
1 parent 132b35b commit 25766e7

File tree

4 files changed

+16
-60
lines changed

4 files changed

+16
-60
lines changed

CMakeLists.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
cmake_minimum_required(VERSION 2.8.3)
2-
project(boostpy_test)
2+
project(boost_python_catkin_example)
33

44
## Find catkin macros and libraries
55
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
66
## is used, also find other catkin packages
7-
find_package(catkin REQUIRED COMPONENTS
8-
roscpp
9-
rospy
10-
)
7+
find_package(catkin REQUIRED)
118

129
## System dependencies are found with CMake's conventions
1310
find_package(Boost REQUIRED COMPONENTS python)
14-
15-
find_package(PythonLibs REQUIRED) # sets ${PYTHON_INCLUDE_DIRS}
11+
find_package(PythonLibs 2.7 REQUIRED) # sets ${PYTHON_INCLUDE_DIRS}
1612

1713

1814
## Uncomment this if the package has a setup.py. This macro ensures
@@ -21,7 +17,6 @@ find_package(PythonLibs REQUIRED) # sets ${PYTHON_INCLUDE_DIRS}
2117
catkin_python_setup() # this sets up the path /devel/lib/python2.7/dist-packages/boostpy_test
2218

2319

24-
2520
###################################
2621
## catkin specific configuration ##
2722
###################################
@@ -54,7 +49,8 @@ include_directories(
5449
add_library(mycpplib SHARED
5550
src/mycpplib.cpp
5651
)
57-
# change output directory, so python can find the module
52+
# change output directory, so python can find the module, and set prefix to ""
53+
# to omit the default "lib".
5854
set_target_properties(mycpplib PROPERTIES
5955
PREFIX ""
6056
LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}

package.xml

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,17 @@
11
<?xml version="1.0"?>
22
<package>
3-
<name>boostpy_test</name>
4-
<version>0.0.0</version>
5-
<description>The boostpy_test package</description>
6-
7-
<!-- One maintainer tag required, multiple allowed, one person per tag -->
8-
<!-- Example: -->
9-
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
10-
<maintainer email="felix@todo.todo">felix</maintainer>
11-
12-
13-
<!-- One license tag required, multiple allowed, one license per tag -->
14-
<!-- Commonly used license strings: -->
15-
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
16-
<license>TODO</license>
3+
<name>boost_python_catkin_example</name>
4+
<version>1.0.0</version>
5+
<description>
6+
A minimal example package on how to use Boost::Python with catkin.
7+
</description>
178

9+
<maintainer email="felix@todo.todo">Felix Widmaier</maintainer>
10+
<license>GPLv2</license>
1811

1912
<!-- Url tags are optional, but mutiple are allowed, one per tag -->
2013
<!-- Optional attribute type can be: website, bugtracker, or repository -->
21-
<!-- Example: -->
22-
<!-- <url type="website">http://wiki.ros.org/boostpy_test</url> -->
23-
24-
25-
<!-- Author tags are optional, mutiple are allowed, one per tag -->
26-
<!-- Authors do not have to be maintianers, but could be -->
27-
<!-- Example: -->
28-
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
14+
<url type="website">https://github.com/luator/ros-boost-python</url>
2915

30-
31-
<!-- The *_depend tags are used to specify dependencies -->
32-
<!-- Dependencies can be catkin packages or system dependencies -->
33-
<!-- Examples: -->
34-
<!-- Use build_depend for packages you need at compile time: -->
35-
<!-- <build_depend>message_generation</build_depend> -->
36-
<!-- Use buildtool_depend for build tool packages: -->
37-
<!-- <buildtool_depend>catkin</buildtool_depend> -->
38-
<!-- Use run_depend for packages you need at runtime: -->
39-
<!-- <run_depend>message_runtime</run_depend> -->
40-
<!-- Use test_depend for packages you need only for testing: -->
41-
<!-- <test_depend>gtest</test_depend> -->
4216
<buildtool_depend>catkin</buildtool_depend>
43-
<build_depend>roscpp</build_depend>
44-
<build_depend>rospy</build_depend>
45-
<run_depend>roscpp</run_depend>
46-
<run_depend>rospy</run_depend>
47-
48-
49-
<!-- The export tag contains other, unspecified, tags -->
50-
<export>
51-
<!-- You can specify that this package is a metapackage here: -->
52-
<!-- <metapackage/> -->
53-
54-
<!-- Other tools can request additional information be placed here -->
55-
56-
</export>
57-
</package>
17+
</package>

scripts/use_cpplib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
import boostpy_test.mycpplib as cpp
3+
import boost_python_catkin_example.mycpplib as cpp
44

55
# this is the equivalent to `main()` in c++
66
if __name__ == '__main__':

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# fetch values from package.xml
77
setup_args = generate_distutils_setup(
8-
packages=['boostpy_test'],
8+
packages=['boost_python_catkin_example'],
99
package_dir={'': 'src'},
1010
)
1111

0 commit comments

Comments
 (0)