Skip to content

Commit

Permalink
update docs for cmake compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveBronder committed Jul 11, 2023
1 parent 8fdf78c commit f9fdb45
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 34 deletions.
48 changes: 14 additions & 34 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,18 @@ C++
:Introduction to oscode: `examples/burst.cpp`
:To plot results from `burst.cpp`: `examples/plot_burst.py`

To compile and run:
To compile and run the burst example you canuse the following:

.. code:: bash
cd examples/
g++ -I../include/ -g -Wall -std=c++11 -c -o burst.o burst.cpp
g++ -I../include/ -g -Wall -std=c++11 -o burst burst.o
./burst
cmake -S . -B "build" -DCMAKE_BUILD_TYPE=Release -DOSCODE_HEADER_ONLY=YES
cd build && make burst_ex && ./burst_ex
The `OSCODE_HEADER_ONLY` flag tells cmake to not create the python package target.
You can use the `CMakeLists.txt` file as a reference point for including `oscode` into your own package.

Documentation
-------------

Expand Down Expand Up @@ -215,30 +217,6 @@ Further help

You can get help by submitting an issue or posting a message on `Gitter <https://gitter.im/oscode-help/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge>`__.

FAQs
----

Installation
~~~~~~~~~~~~

1. Eigen import errors:
.. code:: bash
pyoscode/_pyoscode.hpp:6:10: fatal error: Eigen/Dense: No such file or directory
#include <Eigen/Dense>
^~~~~~~~~~~~~
Try explicitly including the location of your Eigen library via the
``CPLUS_INCLUDE_PATH`` environment variable, for example:

.. code:: bash
CPLUS_INCLUDE_PATH=/usr/include/eigen3 python setup.py install --user
# or
CPLUS_INCLUDE_PATH=/usr/include/eigen3 pip install pyoscode
where ``/usr/include/eigen3`` should be replaced with your system-specific
eigen location.

Development
-------------
Expand All @@ -249,17 +227,19 @@ Run the following to setup an environment for development:
python -m venv env
source ./env/bin/activate
pip install numpy scipy pytest
python setup.py build_ext -i
pip install -e .
# Rerun tests after making changes
# inplace and force comple
python setup.py build_ext -if && pytest ./tests
PYTHON_PATH=$(which python)
cmake -S . -B "build" -DCMAKE_BUILD_TYPE=Debug -DPYTHON_EXECUTABLE=${PYTHON_PATH}
cd build
make oscode
make -j4 test
Tests for the C++ and python can be run via cmake with

.. code:: bash
# This can take a while the first time because of boost
cmake -S . -B "build" -DCMAKE_BUILD_TYPE=Debug
cmake -S . -B "build" -DCMAKE_BUILD_TYPE=Debug -DPYTHON_EXECUTABLE=${PYTHON_PATH}
# If your already inside of the build folder then run
# cmake .. -DCMAKE_BUILD_TYPE=Debug -DPYTHON_EXECUTABLE=${PYTHON_PATH}
cd ./build
make -j4 test
Expand Down
7 changes: 7 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
cmake_minimum_required(VERSION 3.20.2)
project(
oscode_examples
VERSION 1.3.0
LANGUAGES C CXX)


set(CMAKE_VERBOSE_MAKEFILE YES)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
Expand Down

0 comments on commit f9fdb45

Please sign in to comment.