From 4e9dd1292d90eecfed84036e7c838c8bee5d478f Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sun, 5 Jan 2020 13:15:07 -0500 Subject: [PATCH 1/7] Fix library find --- cmake/GtsamCythonWrap.cmake | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cmake/GtsamCythonWrap.cmake b/cmake/GtsamCythonWrap.cmake index c3cad9d83..d6190447f 100644 --- a/cmake/GtsamCythonWrap.cmake +++ b/cmake/GtsamCythonWrap.cmake @@ -6,12 +6,16 @@ unset(CYTHON_EXECUTABLE CACHE) unset(PYTHON_INCLUDE_DIR CACHE) unset(PYTHON_MAJOR_VERSION CACHE) -if(GTSAM_PYTHON_VERSION STREQUAL "Default") - find_package(PythonInterp REQUIRED) - find_package(PythonLibs REQUIRED) +if(PYTHON_LIBRARY) + else() - find_package(PythonInterp ${GTSAM_PYTHON_VERSION} EXACT REQUIRED) - find_package(PythonLibs ${GTSAM_PYTHON_VERSION} EXACT REQUIRED) + if(GTSAM_PYTHON_VERSION STREQUAL "Default") + find_package(PythonInterp REQUIRED) + find_package(PythonLibs REQUIRED) + else() + find_package(PythonInterp ${GTSAM_PYTHON_VERSION} EXACT REQUIRED) + find_package(PythonLibs ${GTSAM_PYTHON_VERSION} EXACT REQUIRED) + endif() endif() find_package(Cython 0.25.2 REQUIRED) From 1319f400ccd5d1817ddbbadfdf523bb857871927 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sun, 5 Jan 2020 22:58:25 -0500 Subject: [PATCH 2/7] Fix error when packaging --- cython/setup.py.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cython/setup.py.in b/cython/setup.py.in index c35e54079..91bfaeb2b 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -5,13 +5,13 @@ try: except ImportError: 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) +# 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() From 4f214b5e6bec8b041c3218279e21c4ace20f090c Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Mon, 6 Jan 2020 16:25:33 -0500 Subject: [PATCH 3/7] Allow static metis in shared lib --- gtsam/3rdparty/metis/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gtsam/3rdparty/metis/CMakeLists.txt b/gtsam/3rdparty/metis/CMakeLists.txt index 8ff69dde3..c3b25ef73 100644 --- a/gtsam/3rdparty/metis/CMakeLists.txt +++ b/gtsam/3rdparty/metis/CMakeLists.txt @@ -34,6 +34,11 @@ else() set(METIS_LIBRARY_TYPE STATIC) endif() +# Configure libmetis library. +if(BUILD_STATIC_METIS) + set(METIS_LIBRARY_TYPE STATIC) +endif() + include(${GKLIB_PATH}/GKlibSystem.cmake) # Add include directories. include_directories(${GKLIB_PATH}) From 982c904c1cbb83f36a6728434d36952d18d63c34 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Mon, 6 Jan 2020 18:52:09 -0500 Subject: [PATCH 4/7] Cleanup the cmake files --- cmake/GtsamCythonWrap.cmake | 6 +++--- gtsam/3rdparty/metis/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/GtsamCythonWrap.cmake b/cmake/GtsamCythonWrap.cmake index d6190447f..51ef4ab92 100644 --- a/cmake/GtsamCythonWrap.cmake +++ b/cmake/GtsamCythonWrap.cmake @@ -5,10 +5,10 @@ unset(PYTHON_EXECUTABLE CACHE) unset(CYTHON_EXECUTABLE CACHE) unset(PYTHON_INCLUDE_DIR CACHE) unset(PYTHON_MAJOR_VERSION CACHE) +unset(PYTHON_LIBRARY CACHE) -if(PYTHON_LIBRARY) - -else() +# Allow override from command line +if(NOT PYTHON_LIBRARY) if(GTSAM_PYTHON_VERSION STREQUAL "Default") find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) diff --git a/gtsam/3rdparty/metis/CMakeLists.txt b/gtsam/3rdparty/metis/CMakeLists.txt index c3b25ef73..de46165ff 100644 --- a/gtsam/3rdparty/metis/CMakeLists.txt +++ b/gtsam/3rdparty/metis/CMakeLists.txt @@ -34,7 +34,7 @@ else() set(METIS_LIBRARY_TYPE STATIC) endif() -# Configure libmetis library. +# Allow a static METIS while building GTSAM as dynamic if(BUILD_STATIC_METIS) set(METIS_LIBRARY_TYPE STATIC) endif() From ef8026bc239b39c1d50e20e18d57dd2f77637f5e Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Mon, 6 Jan 2020 22:35:11 -0500 Subject: [PATCH 5/7] Regression --- cmake/GtsamCythonWrap.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/GtsamCythonWrap.cmake b/cmake/GtsamCythonWrap.cmake index 51ef4ab92..93dd2e32d 100644 --- a/cmake/GtsamCythonWrap.cmake +++ b/cmake/GtsamCythonWrap.cmake @@ -8,7 +8,7 @@ unset(PYTHON_MAJOR_VERSION CACHE) unset(PYTHON_LIBRARY CACHE) # Allow override from command line -if(NOT PYTHON_LIBRARY) +if(NOT DEFINED PYTHON_LIBRARY) if(GTSAM_PYTHON_VERSION STREQUAL "Default") find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) From cbea85dafdc40be3337550d372150e952ac6c561 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Mon, 6 Jan 2020 22:42:52 -0500 Subject: [PATCH 6/7] Regression --- cmake/GtsamCythonWrap.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/GtsamCythonWrap.cmake b/cmake/GtsamCythonWrap.cmake index 93dd2e32d..e963a0d9c 100644 --- a/cmake/GtsamCythonWrap.cmake +++ b/cmake/GtsamCythonWrap.cmake @@ -8,7 +8,7 @@ unset(PYTHON_MAJOR_VERSION CACHE) unset(PYTHON_LIBRARY CACHE) # Allow override from command line -if(NOT DEFINED PYTHON_LIBRARY) +if(NOT DEFINED GTSAM_USE_CUSTOM_PYTHON_LIBRARY) if(GTSAM_PYTHON_VERSION STREQUAL "Default") find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) From 6a4453a16a232d1b5e5563bcc0ef88b285dea727 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Wed, 8 Jan 2020 15:13:40 -0500 Subject: [PATCH 7/7] Nuke the commented out check --- cython/setup.py.in | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cython/setup.py.in b/cython/setup.py.in index 91bfaeb2b..127eb9c3f 100644 --- a/cython/setup.py.in +++ b/cython/setup.py.in @@ -5,15 +5,6 @@ try: except ImportError: 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() setup(