Skip to content

Add install from source instructions #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions quaddtype/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,39 @@ np.array([1,2,3], dtype=QuadPrecDType("sleef"))
# using longdouble backend
np.array([1,2,3], dtype=QuadPrecDType("longdouble"))
```

## Install from source

The code needs the quad precision pieces of the sleef library, which
is not available on most systems by default, so we have to generate
that first. The below assumes one has the required pieces to build
sleef (cmake and libmpfr-dev), and that one is in the package
directory locally.

```
git clone https://github.com/shibatch/sleef.git
cd sleef
cmake -S . -B build -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build build/ --clean-first -j
cd ..
```

In principle, one can now install this system-wide, but easier would
seem to use the version that was just created, as follows:
```
export SLEEF_DIR=$PWD/sleef/build
export LIBRARY_PATH=$SLEEF_DIR/lib
export C_INCLUDE_PATH=$SLEEF_DIR/include
export CPLUS_INCLUDE_PATH=$SLEEF_DIR/include
python3 -m venv temp
source temp/bin/activate
pip install meson-python numpy pytest
pip install -e . -v --no-build-isolation
export LD_LIBRARY_PATH=$SLEEF_DIR/lib
```

Here, we created an editable install on purpose, so one can just work
from the package directory if needed, e.g., to run the tests with,
```
python -m pytest
```
Loading