4.5.1 : Check the environnement

First, we have to set properly the installation prefix of modules by respect to the working environnement (if there is Anaconda or not) :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
if(DEFINED ENV{CONDA_DEFAULT_ENV})
	message(STATUS "ENV{CONDA_DEFAULT_ENV} exist $ENV{CONDA_DEFAULT_ENV}")
	message(STATUS "ENV{CONDA_PREFIX} exist $ENV{CONDA_PREFIX}")
	message(STATUS "ENV{CONDA_ENV_PATH} = $ENV{CONDA_ENV_PATH}")
	
	if(DEFINED ENV{CONDA_ENV_PATH})
		set(PYTHON_LIBRARY_DIR $ENV{CONDA_ENV_PATH}/lib CACHE STRING "link directory of python")
	endif()
	if(DEFINED ENV{CONDA_PREFIX})
		set(PYTHON_LIBRARY_DIR $ENV{CONDA_PREFIX}/lib CACHE STRING "link directory of python")
	endif()
	set(PYTHON_INSTALL_PREFIX "" CACHE STRING "Install prefix of the python plib functions")
else()
	message(STATUS "ENV{CONDA_DEFAULT_ENV} does not exist")
	set(PYTHON_INSTALL_PREFIX $ENV{HOME}/.local CACHE STRING "Install prefix of the python plib functions")
endif()

if(PYTHON_INSTALL_PREFIX)
	set (PYTHON_INSTALL_PREFIX "--prefix=${PYTHON_INSTALL_PREFIX}")
endif()
Then, we have to defined some useful cmake variables for the python part :
1
2
3
4
5
set(ASTERICS_HPC_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/AstericsHPC)
set(ASTERICS_HPC_PYINCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/AstericsHPC/astericshpc)
set(ASTERICS_CPP_LIBRARY_BUILD ${CMAKE_CURRENT_BINARY_DIR}/AstericsHPC)
set(ASTERICS_CPP_LIBRARY_DIR ${CMAKE_INSTALL_PREFIX}/lib)
set(SCRIPT_CALL_PYTHON_SETUP ${CMAKE_CURRENT_SOURCE_DIR}/AstericsHPC/astericshpc/scriptCallPythonSetup.sh.cmake)