Skip to content
Snippets Groups Projects

Adding option to automatically installation

Merged Christoph Alt requested to merge ob28imeq/pystencils-sfg:cmake_setup into master
All threads resolved!
2 files
+ 32
9
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -27,7 +27,7 @@ if(NOT DEFINED CACHE{PystencilsSfg_PYTHON_INTERPRETER})
@@ -27,7 +27,7 @@ if(NOT DEFINED CACHE{PystencilsSfg_PYTHON_INTERPRETER})
set( _sfg_cache_python_init ${PystencilsSfg_PYTHON_PATH} )
set( _sfg_cache_python_init ${PystencilsSfg_PYTHON_PATH} )
elseif (CODEGEN_PRIVATE_VENV)
elseif (CODEGEN_PRIVATE_VENV)
# ... or create own venv ...
# ... or create an own venv ...
set(CODEGEN_VENV_PATH ${CMAKE_CURRENT_BINARY_DIR}/codegen-venv CACHE PATH "Location of the virtual environment used for code generation")
set(CODEGEN_VENV_PATH ${CMAKE_CURRENT_BINARY_DIR}/codegen-venv CACHE PATH "Location of the virtual environment used for code generation")
set(_venv_python_exe ${CODEGEN_VENV_PATH}/bin/python)
set(_venv_python_exe ${CODEGEN_VENV_PATH}/bin/python)
@@ -44,14 +44,26 @@ if(NOT DEFINED CACHE{PystencilsSfg_PYTHON_INTERPRETER})
@@ -44,14 +44,26 @@ if(NOT DEFINED CACHE{PystencilsSfg_PYTHON_INTERPRETER})
)
)
endif()
endif()
message( STATUS "Installing required Python packages..." )
set(CODEGEN_VENV_REQUIREMENTS ${PROJECT_SOURCE_DIR}/requirements.txt CACHE PATH "Location of the requirements installed in the virtual environment used for code generation")
set(CODEGEN_VENV_REQUIREMENTS ${PROJECT_SOURCE_DIR}/requirements.txt CACHE FILEPATH "Location of the requirements installed in the virtual environment used for code generation")
execute_process(
if (EXISTS ${CODEGEN_VENV_REQUIREMENTS})
COMMAND ${_venv_python_exe} -m pip install -r ${CODEGEN_VENV_REQUIREMENTS}
message( STATUS "Installing required Python packages from ${CODEGEN_VENV_REQUIREMENTS}" )
OUTPUT_QUIET
execute_process( COMMAND ${_venv_python_exe} -m pip install -r ${CODEGEN_VENV_REQUIREMENTS} OUTPUT_QUIET)
)
else()
#TODO automatically install pystencilssfg/pystencils
set(Pystencils_URL "git+https://i10git.cs.fau.de/pycodegen/pystencils.git@v2.0-dev" CACHE STRING "Location of pystencils to installed in the virtual environment used for code generation")
 
set(PystencilsSfg_URL "git+https://i10git.cs.fau.de/pycodegen/pystencils-sfg.git" CACHE STRING "Location of pystencils-sfg to installed in the virtual environment used for code generation")
 
 
message( STATUS "Installing required Pystencils from ${Pystencils_URL}" )
 
execute_process(
 
COMMAND ${_venv_python_exe} -m pip install "${Pystencils_URL}"
 
OUTPUT_QUIET
 
)
 
message( STATUS "Installing required Pystencils-sfg from ${PystencilsSfg_URL}" )
 
execute_process(
 
COMMAND ${_venv_python_exe} -m pip install "${PystencilsSfg_URL}"
 
OUTPUT_QUIET
 
)
 
endif()
set( _sfg_private_venv_done TRUE CACHE BOOL "" )
set( _sfg_private_venv_done TRUE CACHE BOOL "" )
mark_as_advanced(_sfg_private_venv_done)
mark_as_advanced(_sfg_private_venv_done)
Loading