Merge pull request #3037 from hakonhagland/inst_pyt

WIP: Install the `install.py` script such that it can be reused by opm-simulators
This commit is contained in:
Markus Blatt 2022-06-07 13:02:09 +02:00 committed by GitHub
commit 5a61625768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -214,6 +214,9 @@ if (OPM_ENABLE_PYTHON)
# Compatibility settings for PythonInterp and PythonLibs # Compatibility settings for PythonInterp and PythonLibs
# used e.g. in FindCwrap, pybind11 # used e.g. in FindCwrap, pybind11
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
# Directory to install common (for opm modules) python scripts
include (GNUInstallDirs)
set(OPM_PYTHON_COMMON_DIR "${CMAKE_INSTALL_DATAROOTDIR}/opm/python")
endif() endif()
# We always need the PYTHON_INCLUDE_DIR. Unfortunately # We always need the PYTHON_INCLUDE_DIR. Unfortunately
# When we build pypi packages CMake will fail to determine # When we build pypi packages CMake will fail to determine
@ -441,6 +444,9 @@ if (OPM_ENABLE_PYTHON)
# setup-install.sh - and completely bypass cmake in the installation phase. # setup-install.sh - and completely bypass cmake in the installation phase.
if (OPM_INSTALL_PYTHON) if (OPM_INSTALL_PYTHON)
install( CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/install.py ${PROJECT_BINARY_DIR}/python/opm ${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)") install( CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/install.py ${PROJECT_BINARY_DIR}/python/opm ${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")
## Need to install this Python script such that it can be used by opm-simulators when building against an installed
## opm-common
install( PROGRAMS "python/install.py" DESTINATION "${OPM_PYTHON_COMMON_DIR}" )
endif() endif()
# Observe that if the opmcommon library has been built as a shared library the # Observe that if the opmcommon library has been built as a shared library the

View File

@ -35,6 +35,9 @@ if(NOT @opm-project_NAME@_FOUND)
# actual code is self contained - and can be used downstream without awareness of this. # actual code is self contained - and can be used downstream without awareness of this.
set (@opm-project_NAME@_EMBEDDED_PYTHON @OPM_ENABLE_EMBEDDED_PYTHON@) set (@opm-project_NAME@_EMBEDDED_PYTHON @OPM_ENABLE_EMBEDDED_PYTHON@)
# Directory for common (across opm modules) Python scripts
set(@opm-project_NAME@_PYTHON_COMMON_DIR "${@opm-project_NAME@_PREFIX}/@OPM_PYTHON_COMMON_DIR@")
# libraries come from the build tree where this file was generated # libraries come from the build tree where this file was generated
set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@") set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@")
set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@") set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@")
@ -58,6 +61,7 @@ if(NOT @opm-project_NAME@_FOUND)
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_INCLUDE_DIRS "${@opm-project_NAME@_INCLUDE_DIRS}") string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_INCLUDE_DIRS "${@opm-project_NAME@_INCLUDE_DIRS}")
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_LIBRARY_DIRS "${@opm-project_NAME@_LIBRARY_DIRS}") string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_LIBRARY_DIRS "${@opm-project_NAME@_LIBRARY_DIRS}")
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_LIBRARY "${@opm-project_NAME@_LIBRARY}") string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_LIBRARY "${@opm-project_NAME@_LIBRARY}")
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_PYTHON_COMMON_DIR "${@opm-project_NAME@_PYTHON_COMMON_DIR}")
endif() endif()