Merge pull request #207 from ProfFan/feature/python_packaging

Patches for allowing static build for PyPI distribution (pip install)
release/4.3a0
Fan Jiang 2020-01-08 19:50:13 -05:00 committed by GitHub
commit 7ebfdadb28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 15 deletions

View File

@ -5,13 +5,17 @@ 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)
if(GTSAM_PYTHON_VERSION STREQUAL "Default") # Allow override from command line
find_package(PythonInterp REQUIRED) if(NOT DEFINED GTSAM_USE_CUSTOM_PYTHON_LIBRARY)
find_package(PythonLibs REQUIRED) if(GTSAM_PYTHON_VERSION STREQUAL "Default")
else() find_package(PythonInterp REQUIRED)
find_package(PythonInterp ${GTSAM_PYTHON_VERSION} EXACT REQUIRED) find_package(PythonLibs REQUIRED)
find_package(PythonLibs ${GTSAM_PYTHON_VERSION} EXACT REQUIRED) else()
find_package(PythonInterp ${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)

View File

@ -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(

View File

@ -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})