Commit be8b8790 authored by Felipe Bordeu's avatar Felipe Bordeu Committed by Felipe Bordeu
Browse files

Add support for pip compilation

parent 1b5f8273
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -45,16 +45,28 @@ PIP
The pip installation requires a local compilation, so you need to have a C++ (C++17 compatible) compiler installed locally on your system.
To compile and install BasicTools (version 1.9.4 in this case) with pip:

    set BASICTOOLS_USE_EIGENCYEIGEN=1                                   # or "export" depending on your shell
    wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip
    unzip boost_1_82_0.zip
    set BASICTOOLS_USE_EIGENCYEIGEN=1
    set BASICTOOLS_EXTERNAL_BOOST_DIR=%cd%\boost_1_82_0
    pip install eigency mkl numpy sympy mkl-include cython wheel
    pip install BasicTools@https://gitlab.com/drti/basic-tools/-/archive/1.9.4/basic-tools-1.9.4.tar.bz2



or for the latest master version:

    set BASICTOOLS_USE_EIGENCYEIGEN=1                                   # or "export" depending on your shell
    wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip
    unzip boost_1_82_0.zip
    set BASICTOOLS_USE_EIGENCYEIGEN=1
    set BASICTOOLS_EXTERNAL_BOOST_DIR=%cd%\boost_1_82_0
    pip install eigency mkl numpy sympy mkl-include cython wheel
    pip install BasicTools@git+https://gitlab.com/drti/basic-tools.git

>Note
On linux/OsX you must:
>- Change the `set` to `export` or `setenv` depending on your os/shell
>- Change the `%cd%` to `$PWD`  depending on your os/shell

The user can set the environment variable `PREFIX` to point to external libraries (like mkl and eigen header). For advance configuration please read the setup.py file on the git repository.

@@ -63,7 +75,7 @@ It is also good practice to use a virtual environment when using pip.

>Note
We can not guarantee that all combinations of OS, Python Versions, packaging systems works.
>The current know issues are :


For more complex installation (from sources) for developers please read the documentation.

@@ -85,7 +97,6 @@ Dependencies
    * scipy
    * sympy
    * cython
    * vtk
    * eigency >=2
    * mkl
    * mkl-include
@@ -94,6 +105,7 @@ Dependencies
    Optionals Python packages (some functionalities may not be available without this packages):

    * scikit-sparse
    * vtk
    * matplotlib
    * pyamg
    * h5py
+25 −5
Original line number Diff line number Diff line
@@ -34,16 +34,30 @@ The actual install command is:

    conda install -c conda-forge basictools

the Conda-Forge packages of BasicTools  are split in 4 packages :

*  BasicTools-core: BasicTools package with the mandatory dependencies.
*  BasicTools-extensions: a meta package with the extra dependencies to enable all functionalities of BasicTools
*  BasicTools: this meta package install BasicTools-core and BasicTools-extensions to have a full installation in one shot
*  BasicTools-envdev: is a meta package with the dependencies necessarily for the development, debugging, compilation and documentation generation.


PIP
---

The pip installation requires a local compilation, so you need to have a C++ (C++17 compatible) compiler installed locally on your system.
Two C++ libraries, Eigen and boost, are needed during compilation (we onnly use the header only libraries part of this libraries).
Eigen can be found inside the pip package eignecy. To use this embedded version the BASICTOOLS_USE_EIGENCYEIGEN must be set to 1.
The C++ boost library is not present in PyPI so a manual installation is required.

To compile and install BasicTools (version 1.9.4 in this case) with pip:

.. code-block::


    set BASICTOOLS_USE_EIGENCYEIGEN=1                                   # or "export" depending on your shell
    wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip
    unzip boost_1_82_0.zip
    set BASICTOOLS_USE_EIGENCYEIGEN=1
    set BASICTOOLS_EXTERNAL_BOOST_DIR=%cd%\boost_1_82_0
    pip install eigency mkl numpy sympy mkl-include cython wheel
    pip install BasicTools@https://gitlab.com/drti/basic-tools/-/archive/1.9.4/basic-tools-1.9.4.tar.bz2

@@ -51,12 +65,18 @@ or for the latest master version:

.. code-block::

    set BASICTOOLS_USE_EIGENCYEIGEN=1                                   # or "export" depending on your shell
    wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip
    unzip boost_1_82_0.zip
    set BASICTOOLS_USE_EIGENCYEIGEN=1
    set BASICTOOLS_EXTERNAL_BOOST_DIR=%cd%\boost_1_82_0
    pip install eigency mkl numpy sympy mkl-include cython wheel
    set BASICTOOLS_USE_EIGENCYEIGEN=1                                   # or "export" depending on your shell

    pip install BasicTools@git+https://gitlab.com/drti/basic-tools.git

.. note::
    On linux/OsX you must:
     - Change the `set` to `export` or `setenv` depending on your os/shell
     - Change the `%cd%` to `$PWD`  depending on your os/shell

The user can set the environment variable `PREFIX` to point to external libraries (like mkl and eigen header). For advanced configuration please refer to the setup.py file on the git repository.

It is also a good practice to use a virtual environment when using pip.
+6 −1
Original line number Diff line number Diff line
@@ -25,8 +25,9 @@ to activate debug compilation set the variable debug in the file setup.cfg to Tr

enable_MKL =  int(os.environ.get("BASICTOOLS_DISABLE_MKL",0)) ==  0
annotate = False # to generate annotation (HTML files)
useEigencyEigen = "BASICTOOLS_USE_EIGENCYEIGEN" in os.environ
useEigencyEigen = int(os.environ.get("BASICTOOLS_USE_EIGENCYEIGEN",0)) == 1
externalBOOST = os.environ.get("BASICTOOLS_EXTERNAL_BOOST_DIR","")

__config = configparser.ConfigParser()
__config.read('setup.cfg')
debug = True if __config["build_ext"]["debug"].lower()  in ["1","true"] else False
@@ -89,6 +90,10 @@ def GetBasicToolsIncludeDirs():
    if not useEigencyEigen:
        if "EIGEN_INC" in os.environ:
            include_dirs.append(os.environ.get('EIGEN_INC'))

    if len(externalBOOST) > 0:
        include_dirs.append(externalBOOST)

    return list(set(include_dirs))

class add_path():