Skip to content

Commit

Permalink
CMAKE use CONDA_PREFIX as installation path when defined
Browse files Browse the repository at this point in the history
  • Loading branch information
v1kko committed Apr 6, 2022
1 parent 853c5a9 commit 9851a2c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ set(CMAKE_Fortran_COMPILER ${Fortran_COMPILER})

project(QUICKLB LANGUAGES Fortran)

if (DEFINED ENV{CONDA_PREFIX})
set(CMAKE_INSTALL_PREFIX $ENV{CONDA_PREFIX} CACHE PATH "..." FORCE)
endif()
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}" )


set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -Wall -Wextra \
-Wno-compare-reals -ffixed-form -fimplicit-none \
-ffixed-line-length-none") # Shared Flags
-ffixed-line-length-none -march=native -mtune=native") # Shared Flags
if (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp") #Preprocessor
else()
Expand Down
5 changes: 4 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@ For python functionality:
- matplotlib **>= 3.5.1**
- scipy **>= 1.8**

The library can be created through cmake directly:
The library can be created through cmake directly, the CMakeFile honors the CONDA_PREFIX if present, and tries to install there instead of the default install location:

.. code:: bash
$ mkdir build
$ cd build
$ cmake ../ -DFortran_COMPILER=mpif90 -DCMAKE_BUILD_TYPE={RELEASE,DEBUG} -DPYTHON_INTERFACE={off,on}
$ make
$ make install
Or it can be created throught the python setuptools:

.. code:: bash
$ python setup.py install

0 comments on commit 9851a2c

Please sign in to comment.