Skip to main content

################################################# ``tox-cmake``: Build CMake projects using Tox ################################################# :author: Andre Caron (andre.l.caron@gmail.com) Introduction ============ I guess this projects needs a bit of explaning :-) I work on a product that uses Python on the back-end and C++ for the client-side SDK. Testing that the C++ client SDK and the Python back-end quickly becomes painful. Since Python has IMHO much, much better testing tools, it's only natural to want to use them all the time. Calling ``cmake`` directly from Tox's ``commands`` setting works, but it has a few quirks: * ``cmake`` has to be in ``PATH`` for thos to work, which makes requiring a specific CMake version kind of hard; * there can be only one ``cmake`` in ``PATH``, which makes it impossible to test against multiple CMake versions with the same ``tox.ini`` configuration; and * Tox warns when it invokes a command-line tool that isn't installed in the virtual environment (e.g. when it resorts to searching ``PATH`` to invoke a command). This Python package is simply a stub for CMake that will accept a CMake version requirement and find a compatible ``cmake`` program installed on your machine (or fail with a clear error). Since it uses a ``setuptools`` console entry-point, it also conveniently silences Tox's warning about relying on ``PATH``. Usage ===== The process is quite simple: #. Add ``tox-cmake`` to Tox's ``deps`` setting. #. Use Tox's ``changedir`` setting (for out-of-source CMake builds). #. Invoke ``tox-cmake`` in Tox's ``commands`` setting. Here's a full example:: [testenv] deps = tox-cmake changedir = {toxinidir}/build/{envname} commands = tox-cmake ">=2.8" ../.. -G "..." CMake version requirements -------------------------- The CMake version requirement string should feel familiar: * similar to ``requirements.txt`` files, it accepts ``>=``, ``<`` and ``==`` constraints; * for ``>=`` and ``<`` constraints, you can specify partial version numbers (e.g. only major and minor); * for ``==`` constraints, you need to have an exact match; * a small extension allows picking a taggerd build (e.g. ``"-foo"`` will pick a version like ``2.8.12.2-foo``) * commas allow to specify multiple constraints (e.g. ">=2.8,<3" will search for the latest CMake 2.8 on your system). Licensing and redistribution ============================ The project is released under the MIT license. See the ``LICENSE.txt`` file for legal text. Contributing ============ Pull requests are welcome!

Project description

#################################################
``tox-cmake``: Build CMake projects using Tox
#################################################


:author: Andre Caron (andre.l.caron@gmail.com)


Introduction
============

I guess this projects needs a bit of explaning :-)

I work on a product that uses Python on the back-end and C++ for the
client-side SDK. Testing that the C++ client SDK and the Python back-end
quickly becomes painful. Since Python has IMHO much, much better testing
tools, it's only natural to want to use them all the time.

Calling ``cmake`` directly from Tox's ``commands`` setting works, but it has a
few quirks:
* ``cmake`` has to be in ``PATH`` for thos to work, which makes requiring a
specific CMake version kind of hard;
* there can be only one ``cmake`` in ``PATH``, which makes it impossible to
test against multiple CMake versions with the same ``tox.ini`` configuration;
and
* Tox warns when it invokes a command-line tool that isn't installed in the
virtual environment (e.g. when it resorts to searching ``PATH`` to invoke a
command).

This Python package is simply a stub for CMake that will accept a CMake version
requirement and find a compatible ``cmake`` program installed on your machine
(or fail with a clear error).

Since it uses a ``setuptools`` console entry-point, it also conveniently
silences Tox's warning about relying on ``PATH``.


Usage
=====

The process is quite simple:

#. Add ``tox-cmake`` to Tox's ``deps`` setting.
#. Use Tox's ``changedir`` setting (for out-of-source CMake builds).
#. Invoke ``tox-cmake`` in Tox's ``commands`` setting.

Here's a full example::

[testenv]
deps =
tox-cmake
changedir = {toxinidir}/build/{envname}
commands =
tox-cmake ">=2.8" ../.. -G "..."

CMake version requirements
--------------------------

The CMake version requirement string should feel familiar:

* similar to ``requirements.txt`` files, it accepts ``>=``, ``<`` and ``==``
constraints;
* for ``>=`` and ``<`` constraints, you can specify partial version numbers
(e.g. only major and minor);
* for ``==`` constraints, you need to have an exact match;
* a small extension allows picking a taggerd build (e.g. ``"-foo"`` will pick a
version like ``2.8.12.2-foo``)
* commas allow to specify multiple constraints (e.g. ">=2.8,<3" will search for
the latest CMake 2.8 on your system).


Licensing and redistribution
============================

The project is released under the MIT license. See the ``LICENSE.txt`` file
for legal text.


Contributing
============

Pull requests are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tox-cmake-0.1.zip (7.8 kB view details)

Uploaded Source

File details

Details for the file tox-cmake-0.1.zip.

File metadata

  • Download URL: tox-cmake-0.1.zip
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tox-cmake-0.1.zip
Algorithm Hash digest
SHA256 1cddef17183fee7261bba37790ace33cca93a9277d64702e4ddf05381f8bda62
MD5 48f11fd2f84935a1e03185c1a4d3819f
BLAKE2b-256 9a896b8b8c19d9419beaa553446d84016b2ca96da46bba7d8e365512c453d371

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page