Commit 13ac91a2 authored by Joe Snyder's avatar Joe Snyder
Browse files

Update CMake process

Add documentation which describes the two options available
to the user.

Include CTest and add the lint test as the first test.
parent 1d87b51a
project(Wrapper_Example CXX)
cmake_minimum_required(VERSION 3.12)
include(CTest)
add_subdirectory(example)
......@@ -65,6 +65,33 @@ which would output a single C++ files of wrapper code called ``test_py.cpp``
Development Tools
+++++++++++++++++
Building with CMake
-------------------
The repository has a simple CMake system which can be used to compile both the
example code and the wrapped version of the code.
This repository requires a CMake version that is 3.12 or greater.
There are two CMake options which can be altered by the user.
+------------------------+--------------------------+
+ Option Name | Effect +
+------------------------+--------------------------+
+ DEFINE_TEST_PARAM | Adds a "-D" define to +
+ | CXX flags: changes +
+ | a function signature +
+------------------------+--------------------------+
+ GENERATE_WRAPPING | Adds PyBind11 library +
+ | for wrapped code +
+------------------------+--------------------------+
These options can be set either CMake GUIs or on the command line::
$ cmake -DGENERATE_WRAPPING=ON .... <path/to>/wrapper_generator
The ``generator.py`` script will be run as a part of the ``Configure`` step in
of CMake.
Style Checking / Linting
-------------------------
......@@ -75,4 +102,8 @@ repository is available. An example run is as follows::
$ pycodestyle generator.py
or setup a CMake build system and execute the ``WG_Linter`` test::
$ ctest -R WG_Linter -VV
.. _pycodestyle: https://pypi.org/project/pycodestyle/
......@@ -28,4 +28,5 @@ if (GENERATE_WRAPPING)
OUTPUT_VARIABLE generator_return OUTPUT_STRIP_TRAILING_WHITESPACE)
message(${generator_return})
pybind11_add_module(wrapped_example ${generator_return})
add_test(NAME WG_Linter COMMAND pycodestyle ${CMAKE_SOURCE_DIR}/generator.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment