Merge pull request #207 from ProfFan/feature/python_packaging
Patches for allowing static build for PyPI distribution (pip install)release/4.3a0
commit
7ebfdadb28
|
|
@ -5,7 +5,10 @@ unset(PYTHON_EXECUTABLE CACHE)
|
||||||
unset(CYTHON_EXECUTABLE CACHE)
|
unset(CYTHON_EXECUTABLE CACHE)
|
||||||
unset(PYTHON_INCLUDE_DIR CACHE)
|
unset(PYTHON_INCLUDE_DIR CACHE)
|
||||||
unset(PYTHON_MAJOR_VERSION CACHE)
|
unset(PYTHON_MAJOR_VERSION CACHE)
|
||||||
|
unset(PYTHON_LIBRARY CACHE)
|
||||||
|
|
||||||
|
# Allow override from command line
|
||||||
|
if(NOT DEFINED GTSAM_USE_CUSTOM_PYTHON_LIBRARY)
|
||||||
if(GTSAM_PYTHON_VERSION STREQUAL "Default")
|
if(GTSAM_PYTHON_VERSION STREQUAL "Default")
|
||||||
find_package(PythonInterp REQUIRED)
|
find_package(PythonInterp REQUIRED)
|
||||||
find_package(PythonLibs REQUIRED)
|
find_package(PythonLibs REQUIRED)
|
||||||
|
|
@ -13,6 +16,7 @@ else()
|
||||||
find_package(PythonInterp ${GTSAM_PYTHON_VERSION} EXACT REQUIRED)
|
find_package(PythonInterp ${GTSAM_PYTHON_VERSION} EXACT REQUIRED)
|
||||||
find_package(PythonLibs ${GTSAM_PYTHON_VERSION} EXACT REQUIRED)
|
find_package(PythonLibs ${GTSAM_PYTHON_VERSION} EXACT REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
find_package(Cython 0.25.2 REQUIRED)
|
find_package(Cython 0.25.2 REQUIRED)
|
||||||
|
|
||||||
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
|
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from distutils.core import setup, find_packages
|
from distutils.core import setup, find_packages
|
||||||
|
|
||||||
if 'SETUP_PY_NO_CHECK' not in os.environ:
|
|
||||||
script_path = os.path.abspath(os.path.realpath(__file__))
|
|
||||||
install_path = os.path.abspath(os.path.realpath(os.path.join('${GTSAM_CYTHON_INSTALL_PATH}${GTSAM_BUILD_TAG}', 'setup.py')))
|
|
||||||
if script_path != install_path:
|
|
||||||
print('setup.py is being run from an unexpected location: "{}"'.format(script_path))
|
|
||||||
print('please run `make install` and run the script from there')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
packages = find_packages()
|
packages = find_packages()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,11 @@ else()
|
||||||
set(METIS_LIBRARY_TYPE STATIC)
|
set(METIS_LIBRARY_TYPE STATIC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Allow a static METIS while building GTSAM as dynamic
|
||||||
|
if(BUILD_STATIC_METIS)
|
||||||
|
set(METIS_LIBRARY_TYPE STATIC)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(${GKLIB_PATH}/GKlibSystem.cmake)
|
include(${GKLIB_PATH}/GKlibSystem.cmake)
|
||||||
# Add include directories.
|
# Add include directories.
|
||||||
include_directories(${GKLIB_PATH})
|
include_directories(${GKLIB_PATH})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue