diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Python/CMakeLists.txt | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/src/Python/CMakeLists.txt b/src/Python/CMakeLists.txt index b84f5a3..707f006 100644 --- a/src/Python/CMakeLists.txt +++ b/src/Python/CMakeLists.txt @@ -23,7 +23,59 @@ set (NUMPY_VERSION 1.12) #set (PYTHON_VERSION 3.5) #https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/R9gWjl09UFs -set (CONDA_ENVIRONMENT "cil") +#set (CONDA_ENVIRONMENT "cil") + +execute_process(COMMAND "conda" "env" "list" + OUTPUT_VARIABLE _CONDA_ENVS + RESULT_VARIABLE _CONDA_RESULT + ERROR_VARIABLE _CONDA_ERR) + if(NOT _CONDA_RESULT) + #message("conda envs list " ${_CONDA_ENVS}) + string(REPLACE "\n" ";" ENV_LIST ${_CONDA_ENVS}) + #string(REGEX MATCHALL "^.*[\t\n]" matches ${_CONDA_ENVS}) + foreach(line ${ENV_LIST}) + message("line='${line}'") + string(REGEX MATCHALL "(.+)[*](.+)" match ${line}) + #list(LENGTH ${match} N) + #string(LENGTH ${match} Ns) + #string(REPLACE "*" ";" env_dir ) + #message("list length " ${N} " string length " ${Ns}) + #list(GET ${env_dir} 0 CONDA_ENVIRONMENT) + #list(GET ${env_dir} 1 CONDA_PATH) + if (NOT ${match} EQUAL "") + message("match='${match}'") + string(REPLACE "*" ";" ENV_DIR ${match}) + #string(MATCHALL "(.*)[*](.*)" ENV_DIR ${match}) + list (APPEND cc "") + foreach(conda ${ENV_DIR}) + message("THERE YOU ARE " ${conda}) + list(APPEND cc ${conda}) + endforeach() + list(LENGTH cc Ns) + message("cc " ${cc} " " ${Ns}) + if (${Ns} EQUAL 2) + list(GET cc 0 CONDA_ENVIRONMENT) + list(GET cc 1 CONDA_ENVIRONMENT_PATH) + message("Current conda environmnet " ${CONDA_ENVIRONMENT}) + message("Current conda environmnet path" ${CONDA_ENVIRONMENT_PATH}) + + endif() + + #list(GET ${env_dir} 0 CONDA_ENVIRONMENT) + #list(GET ${env_dir} 1 CONDA_PATH) + #message("******" ${env_dir}) + #message("******" ${CONDA_ENVIRONMENT} " " ${CONDA_PATH} ) + endif() + endforeach() + #string(REGEX REPLACE "^.*[*].*" "" CONDA_ENVIRONMENT ${_CONDA_ENVS}) + else() + message("conda result false" ${_CONDA_ERR}) + endif() + +message("**********************************************************") +message("Current conda environmnet " ${CONDA_ENVIRONMENT}) +message("Current conda environmnet path" ${CONDA_ENVIRONMENT_PATH}) + if (WIN32) set (CONDA_ENVIRONMENT_PATH "C:\\Apps\\Miniconda2\\envs\\${CONDA_ENVIRONMENT}" CACHE PATH "Main environment directory") set (CONDA_ENVIRONMENT_PREFIX "${CONDA_ENVIRONMENT_PATH}\\Library" CACHE PATH "env dir") @@ -70,8 +122,8 @@ endif() find_package(tiff) if (TIFF_FOUND) message("LibTIFF Found") - message("TIFF_INCLUDE_DIR "${TIFF_INCLUDE_DIR}) - message("TIFF_LIBRARIES"${TIFF_LIBRARIES}) + message("TIFF_INCLUDE_DIR " ${TIFF_INCLUDE_DIR}) + message("TIFF_LIBRARIES" ${TIFF_LIBRARIES}) else() message("LibTIFF not found") -endif()
\ No newline at end of file +endif() |