diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dce69903..8a8b6ce01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -428,6 +428,14 @@ 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/gtsam/config.h.in b/gtsam/config.h.in index 9d1bd4ebd..7f5be65b0 100644 --- a/gtsam/config.h.in +++ b/gtsam/config.h.in @@ -27,6 +27,7 @@ // Paths to example datasets distributed with GTSAM #define GTSAM_SOURCE_TREE_DATASET_DIR "@GTSAM_SOURCE_DIR@/examples/Data" #define GTSAM_INSTALLED_DATASET_DIR "@GTSAM_TOOLBOX_INSTALL_PATH@/gtsam_examples/Data" +#define GTSAM_PYTHON_DATASET_DIR "@GTSAM_PYTHON_DATASET_DIR" // Whether GTSAM is compiled to use quaternions for Rot3 (otherwise uses rotation matrices) #cmakedefine GTSAM_USE_QUATERNIONS