setup.py will install python packages.

setup.py install to CMAKE_INSTALL_PREFIX.

cmake will create python install dir.
This commit is contained in:
Steinar Foss
2019-08-15 15:10:10 +02:00
parent 36338c8a71
commit 554ceb87dd
2 changed files with 18 additions and 7 deletions

View File

@@ -211,13 +211,13 @@ install(DIRECTORY cmake DESTINATION share/opm)
install(FILES etc/opm_bash_completion.sh.in DESTINATION share/opm/etc)
if (OPM_ENABLE_PYTHON)
find_package(PythonInterp REQUIRED)
include(FindPythonInterp)
make_directory(${CMAKE_BINARY_DIR}/python)
if (EXISTS "/etc/debian_version")
set( PYTHON_PACKAGE_PATH "dist-packages")
else()
set( PYTHON_PACKAGE_PATH "site-packages")
endif()
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}/opm" CACHE STRING "Subdirectory to install Python modules in")
set(PYTHON_PACKAGE_PATH "site-packages")
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
get_target_property(_ecl_include_dirs ecl INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(_opmcommon_include_dirs opmcommon INCLUDE_DIRECTORIES)
@@ -259,7 +259,9 @@ if (OPM_ENABLE_PYTHON)
COMMENT "Building python bindings")
add_custom_target(opmcommon_python ALL DEPENDS python/python/opm/libopmcommon_python.so)
add_dependencies(opmcommon_python opmcommon)
INSTALL( DIRECTORY ${CMAKE_BINARY_DIR}/python/python/opm/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX})
install( CODE "execute_process(COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} )" )
install( CODE "execute_process(COMMAND python python/setup.py build_ext --dry-run install --prefix=${CMAKE_INSTALL_PREFIX} )" )
add_test(NAME python_tests
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/python

View File

@@ -8,6 +8,11 @@ import setuptools
import glob
import os
import subprocess
import argparse
setupdir = os.path.dirname(__file__)
if setupdir != '':
os.chdir( setupdir )
try:
subprocess.call(["c++", "--version"])
@@ -56,6 +61,10 @@ setup(
'opm.deck',
],
ext_modules=ext_modules,
package_data={
'': ['*.so']
},
include_package_data=True,
license='Open Source',
zip_safe=False,
tests_suite='tests',