diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a8b6ce01..9dce69903 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -428,14 +428,6 @@ add_subdirectory(CppUnitLite) if(GTSAM_BUILD_PYTHON) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/wrap/cmake") add_subdirectory(python) - if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") - # Common directory which always has write access - # This is because the exact location of the Python installation may vary - # depending on various factors such as python version and use of virtual envs. - set(GTSAM_PYTHON_DATASET_DIR "/tmp/gtsam_example_data") - elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") - set(GTSAM_PYTHON_DATASET_DIR "$ENV{LOCALAPPDATA}/gtsam_example_data") - endif() endif() # Build GTSAM library diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 23898f61d..6fad7ba45 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -4,6 +4,17 @@ if (NOT GTSAM_BUILD_PYTHON) return() endif() +# Common directory for storing data stored with the package. +# This is because the exact location of the Python installation may vary +# depending on various factors such as python version and use of virtual envs. +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") + # Easy directory with write access. + set(GTSAM_PYTHON_DATASET_DIR "/tmp/gtsam_example_data") +elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + # %LocalAppData% directory in Windows. + set(GTSAM_PYTHON_DATASET_DIR "$ENV{LOCALAPPDATA}/gtsam_example_data") +endif() + # Generate setup.py. file(READ "${PROJECT_SOURCE_DIR}/README.md" README_CONTENTS) configure_file(${PROJECT_SOURCE_DIR}/python/setup.py.in