diff --git a/cmake/GtsamTesting.cmake b/cmake/GtsamTesting.cmake index 24a340b79..9fff4f351 100644 --- a/cmake/GtsamTesting.cmake +++ b/cmake/GtsamTesting.cmake @@ -195,13 +195,10 @@ macro(gtsamAddTestsGlob_impl groupName globPatterns excludedFiles linkLibraries) # Add TOPSRCDIR set_property(SOURCE ${script_src} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${GTSAM_SOURCE_DIR}\"") - - if(QNX) - # Do not exclude from 'make all' and 'make install' - set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL OFF) - else() + # Exclude from 'make all' and 'make install' - set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL ON) + if(NOT QNX OR NOT DEFINED ENV{QNX_BUILD_TESTS}) + set_target_properties(${script_name} PROPERTIES EXCLUDE_FROM_ALL ON) endif() # Configure target folder (for MSVC and Xcode) @@ -242,14 +239,11 @@ macro(gtsamAddTestsGlob_impl groupName globPatterns excludedFiles linkLibraries) # Add TOPSRCDIR set_property(SOURCE ${script_srcs} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${GTSAM_SOURCE_DIR}\"") - if(QNX) - # Do not exclude from 'make all' and 'make install' - set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL OFF) - else() # Exclude from 'make all' and 'make install' - set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL ON) + if(NOT QNX OR NOT DEFINED ENV{QNX_BUILD_TESTS}) + set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL ON) endif() - + # Configure target folder (for MSVC and Xcode) set_property(TARGET ${script_name} PROPERTY FOLDER "Unit tests") endif() diff --git a/gtsam/3rdparty/ceres/CMakeLists.txt b/gtsam/3rdparty/ceres/CMakeLists.txt index 3a6031f17..e8d39da67 100644 --- a/gtsam/3rdparty/ceres/CMakeLists.txt +++ b/gtsam/3rdparty/ceres/CMakeLists.txt @@ -1,6 +1,7 @@ file(GLOB ceres_headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -if(QNX) - install(FILES ${ceres_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/3rdparty/ceres) -else() +if(NOT QNX) install(FILES ${ceres_headers} DESTINATION include/gtsam/3rdparty/ceres) +else() + #Install in the install include directory rather than at the install prefix. + install(FILES ${ceres_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/3rdparty/ceres) endif() \ No newline at end of file diff --git a/gtsam/3rdparty/metis/include/CMakeLists.txt b/gtsam/3rdparty/metis/include/CMakeLists.txt index b87596f97..0d5af2e83 100644 --- a/gtsam/3rdparty/metis/include/CMakeLists.txt +++ b/gtsam/3rdparty/metis/include/CMakeLists.txt @@ -1,5 +1,6 @@ -if(QNX) - install(FILES metis.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/3rdparty/metis) +if(NOT QNX) + install(FILES metis.h DESTINATION include/gtsam/3rdparty/metis) else() + #Install in the install include directory rather than at the install prefix. install(FILES metis.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/3rdparty/metis) endif() \ No newline at end of file diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index bf3d8556f..fb4a3c6e4 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -83,7 +83,7 @@ ENDIF(MSVC) # Generate and install config and dllexport files #For config.in searches -if(DEFINED ENV{QNX}) +if(QNX) set(QNX_TARGET_DATASET_DIR "$ENV{QNX_TARGET_DATASET_DIR}") endif() configure_file(config.h.in config.h) diff --git a/gtsam/base/CMakeLists.txt b/gtsam/base/CMakeLists.txt index b876c7293..7e9927d6d 100644 --- a/gtsam/base/CMakeLists.txt +++ b/gtsam/base/CMakeLists.txt @@ -1,23 +1,19 @@ # Install headers +# Header groups file(GLOB base_headers "*.h") -if(QNX) - install(FILES ${base_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/base) -else() - install(FILES ${base_headers} DESTINATION include/gtsam/base) -endif() - file(GLOB base_headers_tree "treeTraversal/*.h") -if(QNX) - install(FILES ${base_headers_tree} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/base/treeTraversal) -else() - install(FILES ${base_headers_tree} DESTINATION include/gtsam/base/treeTraversal) -endif() - file(GLOB deprecated_headers "deprecated/*.h") -if(QNX) - install(FILES ${deprecated_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/base/deprecated) -else() + +# Installation +if(NOT QNX) + install(FILES ${base_headers} DESTINATION include/gtsam/base) + install(FILES ${base_headers_tree} DESTINATION include/gtsam/base/treeTraversal) install(FILES ${deprecated_headers} DESTINATION include/gtsam/base/deprecated) +else() + # For QNX, Install in the Installation's Include Directory + install(FILES ${base_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/base) + install(FILES ${base_headers_tree} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/base/treeTraversal) + install(FILES ${deprecated_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/base/deprecated) endif() # Build tests diff --git a/gtsam/basis/CMakeLists.txt b/gtsam/basis/CMakeLists.txt index e429adce4..98e6076e9 100644 --- a/gtsam/basis/CMakeLists.txt +++ b/gtsam/basis/CMakeLists.txt @@ -1,9 +1,9 @@ # Install headers file(GLOB basis_headers "*.h") -if(QNX) - install(FILES ${basis_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/basis) +if(NOT QNX) + install(FILES ${basis_headers} DESTINATION include/gtsam/basis) else() - install(FILES ${basis_headers} DESTINATION include/gtsam/basis) + install(FILES ${basis_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gtsam/basis) endif() # Build tests diff --git a/gtsam/config.h.in b/gtsam/config.h.in index 5691b8f7f..6e237a8d5 100644 --- a/gtsam/config.h.in +++ b/gtsam/config.h.in @@ -26,9 +26,11 @@ // Paths to example datasets distributed with GTSAM #define GTSAM_SOURCE_TREE_DATASET_DIR "@GTSAM_SOURCE_DIR@/examples/Data" +#ifndef __QNX__ #define GTSAM_INSTALLED_DATASET_DIR "@GTSAM_TOOLBOX_INSTALL_PATH@/gtsam_examples/Data" -#ifdef __QNX__ -#define QNX_INSTALLED_DATASET_DIR "@QNX_TARGET_DATASET_DIR@/gtsam_examples/Data" +#else +//Set toolbox path to the path on the target. +#define GTSAM_INSTALLED_DATASET_DIR "@QNX_TARGET_DATASET_DIR@/gtsam_examples/Data" #endif // Whether GTSAM is compiled to use quaternions for Rot3 (otherwise uses rotation matrices) diff --git a/gtsam/inference/tests/testOrdering.cpp b/gtsam/inference/tests/testOrdering.cpp index 0305218af..e33015cca 100644 --- a/gtsam/inference/tests/testOrdering.cpp +++ b/gtsam/inference/tests/testOrdering.cpp @@ -270,7 +270,7 @@ TEST(Ordering, MetisLoop) { symbolicGraph.push_factor(0, 5); // METIS -#if !defined(__APPLE__) +#if !defined(__APPLE__) && !defined(__QNX__) { Ordering actual = Ordering::Create(Ordering::METIS, symbolicGraph); // - P( 0 4 1) diff --git a/gtsam/slam/dataset.cpp b/gtsam/slam/dataset.cpp index 0baaccf1b..d7e925bd9 100644 --- a/gtsam/slam/dataset.cpp +++ b/gtsam/slam/dataset.cpp @@ -69,9 +69,6 @@ string findExampleDataFile(const string &name) { // Constants below are defined by CMake, see gtsam/gtsam/CMakeLists.txt rootsToSearch.push_back(GTSAM_SOURCE_TREE_DATASET_DIR); rootsToSearch.push_back(GTSAM_INSTALLED_DATASET_DIR); - #ifdef __QNX__ - rootsToSearch.push_back(QNX_INSTALLED_DATASET_DIR); - #endif // Search for filename as given, and with .graph and .txt extensions vector namesToSearch; diff --git a/gtsam/symbolic/tests/testSymbolicBayesTree.cpp b/gtsam/symbolic/tests/testSymbolicBayesTree.cpp index 33fc3243b..a5e0a8c6c 100644 --- a/gtsam/symbolic/tests/testSymbolicBayesTree.cpp +++ b/gtsam/symbolic/tests/testSymbolicBayesTree.cpp @@ -731,7 +731,7 @@ TEST(SymbolicBayesTree, COLAMDvsMETIS) { { Ordering ordering = Ordering::Create(Ordering::METIS, sfg); // Linux and Mac split differently when using mettis -#if !defined(__APPLE__) +#if !defined(__APPLE__) && !defined(__QNX__) EXPECT(assert_equal(Ordering(list_of(3)(2)(5)(0)(4)(1)), ordering)); #else EXPECT(assert_equal(Ordering(list_of(5)(4)(2)(1)(0)(3)), ordering)); @@ -742,7 +742,7 @@ TEST(SymbolicBayesTree, COLAMDvsMETIS) { // | | - P( 5 | 0 4) // | - P( 2 | 1 3) SymbolicBayesTree expected; -#if !defined(__APPLE__) +#if !defined(__APPLE__) && !defined(__QNX__) expected.insertRoot( MakeClique(list_of(2)(4)(1), 3, list_of( diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 78cf1614a..068b39eca 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,8 +14,3 @@ if(MSVC) set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/testSerializationSLAM.cpp" APPEND PROPERTY COMPILE_FLAGS "/bigobj") endif() - -if(QNX) -file(GLOB built_tests "${PROJECT_BINARY_DIR}/tests/test*") -install(FILES ${built_tests} DESTINATION ${CMAKE_INSTALL_BINDIR}/gtsam_tests/) -endif() \ No newline at end of file