Skip to content

Commit 3408a65

Browse files
author
opennao
committed
Merge commit 'refs/integration/team/platform/merge-naoqi-libqi-302'
2 parents 59e69ef + 59316e1 commit 3408a65

7 files changed

Lines changed: 101 additions & 97 deletions

File tree

README.rst

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,30 @@
22
LibQiPython - LibQi Python bindings
33
===================================
44

5-
This repository contains the official Python bindings of the `LibQi`_, the `qi`
5+
This repository contains the official Python bindings of the `LibQi`__, the ``qi``
66
Python module.
77

8+
__ LibQi_repo_
9+
810
Building
911
========
1012

11-
This project supports the building of a "standalone" package (for instance as a
13+
This project supports the building of a *standalone* package (for instance as a
1214
wheel that can be uploaded on PyPi_) or of a "system" archive.
1315

1416
.. _standalone:
17+
1518
Standalone (wheel)
1619
------------------
1720

18-
This build mode is also referred to as the "standalone" mode. It is enabled by
19-
passing `-DQIPYTHON_STANDALONE=ON` to the CMake call. The Python setup script
21+
This build mode is also referred to as the *standalone* mode. It is enabled by
22+
passing ``-DQIPYTHON_STANDALONE=ON`` to the CMake call. The Python setup script
2023
also sets this mode automatically when used.
2124

2225
In this mode, the project will build libqi and install all its dependencies as
2326
part of the project.
2427

25-
The package can be built from the `setup.py` script:
28+
The package can be built from the ``setup.py`` script:
2629

2730
.. code:: bash
2831
@@ -42,7 +45,7 @@ handles any option the latter can handle. Additionally, it can take CMake
4245
arguments, which means that you can almost entirely customize how the native
4346
part is built.
4447

45-
In particular, you can use the `CMAKE_TOOLCHAIN_FILE` variable to specify a
48+
In particular, you can use the ``CMAKE_TOOLCHAIN_FILE`` variable to specify a
4649
toolchain to build the native part of the wheel (e.g. if you are using qi
4750
toolchains):
4851

@@ -65,13 +68,13 @@ first build libqi then libqi-python.
6568
qibuild configure
6669
qibuild make
6770
68-
You can also set the `QI_DIR` variable at the CMake call to let it know it of
71+
You can also set the ``QI_DIR`` variable at the CMake call to let it know it of
6972
the location of the libqi package.
7073

7174
.. code:: bash
7275
7376
mkdir build && cd build
74-
cmake .. -DQI_DIR=<path to the libqi installation>
77+
cmake .. -DQI_DIR=/path/to/libqi/install/dir
7578
cmake --build .
7679
7780
@@ -84,76 +87,78 @@ least CMake v3.17.
8487

8588
Our CMake scripts may take a few parameters:
8689

87-
- `QIPYTHON_STANDALONE`, when set, builds the library in "standalone" mode.
90+
- ``QIPYTHON_STANDALONE``, when set, builds the library in *standalone* mode.
8891
Refer to the standalone_ section for details.
89-
- `QIPYTHON_FORCE_STRIP`, when set, forces the build system to strip the
92+
- ``QIPYTHON_FORCE_STRIP``, when set, forces the build system to strip the
9093
libqi-python native module library at install, resulting in a smaller binary.
91-
- `QI_WITH_TESTS`, when set, enables building of tests. This option is ignored
94+
- ``QI_WITH_TESTS``, when set, enables building of tests. This option is ignored
9295
when cross-compiling.
9396

9497
Dependencies
9598
~~~~~~~~~~~~
9699

97100
The project has a few dependencies and the build system might report errors if
98-
it fails to find them. It uses either `FindXXX` CMake modules through the
99-
`find_package` command or the `FetchContent` module for subprojects. Either way,
100-
any parameter that these modules and the `find_package` command accept can be
101+
it fails to find them. It uses either ``FindXXX`` CMake modules through the
102+
``find_package`` command or the ``FetchContent`` module for subprojects. Either way,
103+
any parameter that these modules and the ``find_package`` command accept can be
101104
used to customize how the build system finds the libraries or fetches the
102105
subprojects.
103106

104107
Most of the variables described here are defined in the
105-
`cmake/set_dependencies.cmake` file. You may refer to this file for more details
108+
``cmake/set_dependencies.cmake`` file. You may refer to this file for more details
106109
on these variables and their values.
107110

108111
LibQi
109112
>>>>>
110113

111114
The project's dependencies on LibQi depends on the building mode:
112115

113-
- In system mode, it will expect to find it as a binary package. The location
114-
of the binary package installation can be specified through the `QI_DIR`
116+
- In **system mode**, it will expect to find it as a binary package. The location
117+
of the binary package installation can be specified through the ``QI_DIR``
115118
variable.
116-
- In standalone mode, it will download and compile it as a subproject through
117-
the `FetchContent` CMake module. How it is downloaded can be customized
119+
- In **standalone mode**, it will download and compile it as a subproject through
120+
the ``FetchContent`` CMake module. How it is downloaded can be customized
118121
through the following variables:
119122

120-
- `LIBQI_VERSION`
121-
- `LIBQI_GIT_REPOSITORY`
122-
- `LIBQI_GIT_TAG`
123+
- ``LIBQI_VERSION``
124+
- ``LIBQI_GIT_REPOSITORY``
125+
- ``LIBQI_GIT_TAG``
123126

124127
It is possible to skip the download step and use an existing source directory by
125-
setting its path as the `FETCH_CONTENT_SOURCE_DIR_LIBQI` CMake variable. The
128+
setting its path as the ``FETCHCONTENT_SOURCE_DIR_LIBQI`` CMake variable. The
126129
build system will still check that the version of the sources matches the
127-
`LIBQI_VERSION` value if it is set.
130+
``LIBQI_VERSION`` value if it is set.
128131

129132
Python
130133
>>>>>>
131134

132135
The build system uses the FindPython_ CMake module. It will try to honor the
133136
following variables if they are set:
134137

135-
- `PYTHON_VERSION_STRING`
136-
- `PYTHON_LIBRARY`
137-
- `PYTHON_INCLUDE_DIR`
138+
- ``PYTHON_VERSION_STRING``
139+
- ``PYTHON_LIBRARY``
140+
- ``PYTHON_INCLUDE_DIR``
138141

139142
pybind11
140143
>>>>>>>>
141144

142-
The build system will by default download and compile pybind11_ as a
143-
subproject through the `FetchContent` CMake module. How it is downloaded can be
145+
The build system will by default download and compile pybind11__ as a
146+
subproject through the ``FetchContent`` CMake module. How it is downloaded can be
144147
customized through the following variables:
145148

146-
- `PYBIND11_VERSION`
147-
- `PYBIND11_GIT_REPOSITORY`
148-
- `PYBIND11_GIT_TAG`
149+
__ pybind11_repo_
150+
151+
- ``PYBIND11_VERSION``
152+
- ``PYBIND11_GIT_REPOSITORY``
153+
- ``PYBIND11_GIT_TAG``
149154

150155

151156
Boost
152157
>>>>>
153158

154159
The build system will look for the Boost libraries on the system or in the
155160
toolchain if one is set. The expected version of the libraries is specified as
156-
the `BOOST_VERSION` variable.
161+
the ``BOOST_VERSION`` variable.
157162

158163
The build system uses the FindBoost_ CMake module.
159164

@@ -170,13 +175,15 @@ The build system uses the FindICU_ CMake module.
170175
GoogleTest
171176
>>>>>>>>>>
172177

173-
The build system will by default download and compile GoogleTest_ as a
174-
subproject through the `FetchContent` CMake module. How it is downloaded can be
178+
The build system will by default download and compile GoogleTest__ as a
179+
subproject through the ``FetchContent`` CMake module. How it is downloaded can be
175180
customized through the following variables:
176181

177-
- `GOOGLETEST_VERSION`
178-
- `GOOGLETEST_GIT_REPOSITORY`
179-
- `GOOGLETEST_GIT_TAG`
182+
__ GoogleTest_repo_
183+
184+
- ``GOOGLETEST_VERSION``
185+
- ``GOOGLETEST_GIT_REPOSITORY``
186+
- ``GOOGLETEST_GIT_TAG``
180187

181188
Install
182189
~~~~~~~
@@ -195,7 +202,7 @@ Crosscompiling
195202
--------------
196203

197204
The project supports cross-compiling as explained in the `CMake manual about
198-
toolchains`__. You may simply set the `CMAKE_TOOLCHAIN_FILE` variable to the
205+
toolchains`__. You may simply set the ``CMAKE_TOOLCHAIN_FILE`` variable to the
199206
path of the CMake file in your toolchain.
200207

201208
__ CMake_toolchains_
@@ -210,16 +217,16 @@ When enabled, tests can be executed with `CTest`_.
210217
cd build
211218
ctest . --output-on-failure
212219
213-
.. _LibQi: https://github.com/aldebaran/libqi
220+
.. _LibQi_repo: https://github.com/aldebaran/libqi
214221
.. _PyPi: https://pypi.org/
215222
.. _scikit-build: https://scikit-build.readthedocs.io/en/latest/
216223
.. _setuptools: https://setuptools.readthedocs.io/en/latest/setuptools.html
217224
.. _qibuild: https://github.com/aldebaran/qibuild
218-
.. _pybind11: https://pybind11.readthedocs.io/en/latest/
225+
.. _pybind11_repo: https://pybind11.readthedocs.io/en/latest/
219226
.. _FindPython: https://cmake.org/cmake/help/latest/module/FindPython.html
220227
.. _FindBoost: https://cmake.org/cmake/help/latest/module/FindBoost.html
221228
.. _FindOpenSSL: https://cmake.org/cmake/help/latest/module/FindOpenSSL.html
222229
.. _FindICU: https://cmake.org/cmake/help/latest/module/FindICU.html
223-
.. _GoogleTest: https://github.com/google/googletest
230+
.. _GoogleTest_repo: https://github.com/google/googletest
224231
.. _CMake_toolchains: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html
225-
.. _CTest: https://cmake.org/cmake/help/latest/manual/ctest.1.html
232+
.. _CTest: https://cmake.org/cmake/help/latest/manual/ctest.1.html

cmake/set_dependencies.cmake

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,42 +44,30 @@
4444

4545
include_guard(GLOBAL)
4646

47-
set(BOOST_VERSION 1.64
48-
CACHE STRING
49-
"Version of Boost to use. It will be used as the argument to the
50-
`find_package(Boost)` call.")
51-
52-
set(PYBIND11_VERSION 2.5.0
53-
CACHE STRING
54-
"Version of pybind11 to use.")
55-
56-
set(PYBIND11_GIT_REPOSITORY https://github.com/pybind/pybind11
57-
CACHE STRING
58-
"URL of the git repository from which to download pybind11. For more \
59-
details, see CMake `ExternalProject` module documentation of the \
60-
`GIT_REPOSITORY` argument.")
61-
62-
set(PYBIND11_GIT_TAG v${PYBIND11_VERSION}
63-
CACHE STRING
64-
"Git branch name, tag or commit hash to checkout for pybind11. \
65-
For more details, see CMake `ExternalProject` module documentation of the \
66-
`GIT_TAG` argument.")
67-
68-
set(GOOGLETEST_VERSION 1.10.0
69-
CACHE STRING
70-
"Version of googletest to use.")
71-
72-
set(GOOGLETEST_GIT_REPOSITORY https://github.com/google/googletest.git
73-
CACHE STRING
74-
"URL of the git repository from which to download googletest. For more \
75-
details, see CMake `ExternalProject` module documentation of the \
76-
`GIT_REPOSITORY` argument.")
77-
78-
set(GOOGLETEST_GIT_TAG release-${GOOGLETEST_VERSION}
79-
CACHE STRING
80-
"Git branch name, tag or commit hash to checkout for googletest. \
81-
For more details, see CMake `ExternalProject` module documentation of the \
82-
`GIT_TAG` argument.")
47+
# Version of Boost to use. It will be used as the argument to the `find_package(Boost)` call.
48+
overridable_variable(BOOST_VERSION 1.64)
49+
50+
# Version of pybind11 to use.
51+
overridable_variable(PYBIND11_VERSION 2.5.0)
52+
53+
# URL of the git repository from which to download pybind11. For more details, see CMake
54+
# `ExternalProject` module documentation of the `GIT_REPOSITORY` argument.
55+
overridable_variable(PYBIND11_GIT_REPOSITORY https://github.com/pybind/pybind11)
56+
57+
# Git branch name, tag or commit hash to checkout for pybind11. For more details, see CMake
58+
# `ExternalProject` module documentation of the `GIT_TAG` argument.
59+
overridable_variable(PYBIND11_GIT_TAG v${PYBIND11_VERSION})
60+
61+
# Version of googletest to use.
62+
overridable_variable(GOOGLETEST_VERSION 1.10.0)
63+
64+
# URL of the git repository from which to download googletest. For more details, see CMake
65+
# `ExternalProject` module documentation of the `GIT_REPOSITORY` argument.
66+
overridable_variable(GOOGLETEST_GIT_REPOSITORY https://github.com/google/googletest.git)
67+
68+
# Git branch name, tag or commit hash to checkout for googletest. For more details, see CMake
69+
# `ExternalProject` module documentation of the `GIT_TAG` argument.
70+
overridable_variable(GOOGLETEST_GIT_TAG release-${GOOGLETEST_VERSION})
8371

8472
set(PYTHON_VERSION_STRING "" CACHE STRING "Version of Python to look for. This \
8573
variable can be specified by tools run directly from Python to enforce the \

cmake/set_libqi_dependency.cmake

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
1-
set(LIBQI_VERSION 1.8.6
2-
CACHE STRING
3-
"Version of LibQi to use. If not empty, it will be checked against the \
4-
version in the `package.xml` file in the libqi sources.")
1+
overridable_variable(LIBQI_VERSION 1.8.7)
52

63
# Our github clone is sometimes late or is missing tags, so we enable
74
# customisation of the URL at configuration time, so users can use another clone.
8-
set(LIBQI_GIT_REPOSITORY https://github.com/aldebaran/libqi.git
9-
CACHE STRING
10-
"URL of the git repository from which to download LibQi. For more details, \
11-
see CMake `ExternalProject` module documentation of the `GIT_REPOSITORY` \
12-
argument.")
13-
14-
set(LIBQI_GIT_TAG qi-framework-v${LIBQI_VERSION}
15-
CACHE STRING
16-
"Git branch name, tag or commit hash to checkout for LibQi. \
17-
For more details, see CMake `ExternalProject` module documentation of the \
18-
`GIT_TAG` argument.")
5+
overridable_variable(LIBQI_GIT_REPOSITORY https://github.com/aldebaran/libqi.git)
196

7+
overridable_variable(LIBQI_GIT_TAG qi-framework-v${LIBQI_VERSION})
208

219
if(LIBQI_VERSION)
2210
message(STATUS "LibQi: expected version is \"${LIBQI_VERSION}\"")

cmake/utils.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,24 @@ function(set_install_rpath)
8383
endif()
8484
endforeach()
8585
endfunction()
86+
87+
# Creates a variable that can be overridden by the user from either the
88+
# command-line, the cache or the environment.
89+
# The order of preference is:
90+
# - the value from the variable in cache (or the command-line, since setting
91+
# a variable from the command-line automatically adds it to the cache).
92+
# - the value from the variable in the environment.
93+
# - the default value for the variable.
94+
function(overridable_variable name default_value)
95+
# The variable already exists in the cache. It's the preferred value, so we
96+
# don't change it.
97+
if(DEFINED CACHE{${name}})
98+
return()
99+
endif()
100+
101+
set(value ${default_value})
102+
if(DEFINED ENV{${name}})
103+
set(value $ENV{${name}})
104+
endif()
105+
set(${name} ${value} PARENT_SCOPE)
106+
endfunction()

qi/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.1'
1+
__version__ = '2.0.2'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
version=version['__version__'],
2626
description='LibQi Python bindings',
2727
long_description=long_description,
28-
long_description_content_type='text/markdown',
28+
long_description_content_type='text/x-rst',
2929
keywords=['libqi', 'qi', 'naoqi',
3030
'softbank', 'robotics', 'aldebaran',
3131
'robot', 'nao', 'pepper', 'romeo'],

tests/moduletest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ std::string Cat::meow(int volume)
6464
return "meow";
6565
}
6666

67-
bool Cat::eat(const Mouse& m)
67+
bool Cat::eat(const Mouse&)
6868
{
6969
qiLogInfo() << "eating mouse";
7070
return true;

0 commit comments

Comments
 (0)