Skip to content

Commit daaab18

Browse files
committed
Readme (#21): install, deps, tests
1 parent 3e46b2e commit daaab18

1 file changed

Lines changed: 47 additions & 6 deletions

File tree

README.md

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,51 @@ std::cout << "cos: " << xt::cos(x) << std::endl;
4343
std::cout << "sin_derivative: " << sin_derivative << std::endl;
4444
```
4545
46+
## Installation
47+
48+
Using `conda`:
49+
50+
```bash
51+
conda install xtensor-fftw -c conda-forge
52+
```
53+
54+
This automatically installs dependencies as well (see [list of dependencies](#dependencies) below).
55+
56+
Installing from source into `$PREFIX` (for instance `$CONDA_PREFIX` when in a conda environment, or `$HOME/.local`) after manually installing the [dependencies](#dependencies):
57+
58+
```bash
59+
git clone https://github.com/egpbos/xtensor-fftw
60+
cd xtensor-fftw
61+
mkdir build
62+
cd build
63+
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX
64+
make install
65+
```
66+
67+
## Dependencies
68+
69+
* [xtensor](https://github.com/QuantStack/xtensor)
70+
* [xtl](https://github.com/QuantStack/xtl)
71+
* [FFTW](http://www.fftw.org/) version 3
72+
* A compiler supporting C++14
73+
4674
## Usage
4775

4876
_xtensor-fftw_ is a header-only library.
49-
To use, include one of the header files in the `include` directory, e.g. `xtensor-fftw/fft.hpp`, in your c++ code.
77+
To use, include one of the header files in the `include` directory, e.g. `xtensor-fftw/basic.hpp`, in your c++ code.
5078
To compile, one should also include the paths to the FFTW header and libraries and link to the appropriate FFTW library.
5179

5280
Note that _xtensor-fftw_ on Windows does not support `long double` precision.
5381
The `long double` precision version of the FFTW library requires that `sizeof(long double) == 12`.
5482
In recent versions of Visual Studio, `long double` is an alias of `double` and has size 8.
5583

56-
What follows are instructions for compiling the _xtensor-fftw_ tests.
84+
85+
## Building and running tests
86+
87+
What follows are instructions for compiling and running the _xtensor-fftw_ tests.
5788
These also serve as an example of how to do build your own code using _xtensor-fftw_ (excluding the GoogleTest specific parts).
5889

59-
### Dependencies
90+
### Dependencies for building tests
6091
The main dependency is a version of FFTW 3.
6192
For the tests, we need the floating point version which is enabled in the FFTW configuration step using:
6293
```bash
@@ -65,12 +96,13 @@ For the tests, we need the floating point version which is enabled in the FFTW c
6596

6697
CMake and _xtensor_ must also be installed in order to compile the _xtensor-fftw_ tests.
6798
Both can either be installed through Conda or built/installed manually.
68-
When using a non-Conda _xtensor_-install, make sure that the CMake `find_package` command can find _xtensor_, e.g. by passing something like `-DCMAKE_MODULE_PATH="path_to_xtensorConfig.cmake"` to CMake (not tested).
99+
When using a non-Conda _xtensor_-install, make sure that the CMake `find_package` command can find _xtensor_, e.g. by passing something like `-DCMAKE_MODULE_PATH="path_to_xtensorConfig.cmake"` to CMake.
100+
If _xtensor_ was installed in a default location, CMake should be able to find it without any command line options.
69101

70102
Optionally, a GoogleTest installation can be used.
71103
However, it is recommended to use the built-in option to download GoogleTest automatically (see below).
72104

73-
### Configure
105+
### Configure tests
74106

75107
Inside the _xtensor-fftw_ source directory, create a build directory and `cd` into it:
76108
```bash
@@ -93,13 +125,22 @@ or pass the path to CMake directly as such:
93125
cmake .. -DFFTW_ROOT=/home/username/.local -DBUILD_TESTS=ON -DDOWNLOAD_GTEST=ON [other options]
94126
```
95127

96-
### Compile
128+
### Compile tests
97129

98130
After successful CMake configuration, run inside the build directory:
99131
```bash
100132
make
101133
```
102134

135+
### Run tests
136+
137+
From the build directory, change to the test directory and run the tests:
138+
139+
```bash
140+
cd test
141+
./test_xtensor-fftw
142+
```
143+
103144
## License
104145

105146
We use a shared copyright model that enables all contributors to maintain the

0 commit comments

Comments
 (0)