Skip to content

Commit

Permalink
Merge pull request #1117 from acxz/metis-include
Browse files Browse the repository at this point in the history
Allow more functionality through system METIS
  • Loading branch information
varunagrawal authored Mar 26, 2022
2 parents b2ec9b0 + 4efdc69 commit a9a4075
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
11 changes: 9 additions & 2 deletions cmake/HandleMetis.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ if(GTSAM_USE_SYSTEM_METIS)
mark_as_advanced(METIS_LIBRARY)

add_library(metis-gtsam-if INTERFACE)
target_include_directories(metis-gtsam-if BEFORE INTERFACE ${METIS_INCLUDE_DIR})
target_include_directories(metis-gtsam-if BEFORE INTERFACE ${METIS_INCLUDE_DIR}
# gtsam_unstable/partition/FindSeparator-inl.h uses internal metislib.h API
# via extern "C"
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/libmetis>
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/GKlib>
)
target_link_libraries(metis-gtsam-if INTERFACE ${METIS_LIBRARY})
endif()
else()
Expand All @@ -30,10 +35,12 @@ else()
add_subdirectory(${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis)

target_include_directories(metis-gtsam BEFORE PUBLIC
$<INSTALL_INTERFACE:include/gtsam/3rdparty/metis/>
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/include>
# gtsam_unstable/partition/FindSeparator-inl.h uses internal metislib.h API
# via extern "C"
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/libmetis>
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/GKlib>
$<INSTALL_INTERFACE:include/gtsam/3rdparty/metis/>
)

add_library(metis-gtsam-if INTERFACE)
Expand Down
4 changes: 0 additions & 4 deletions gtsam/inference/Ordering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@
#include <gtsam/3rdparty/CCOLAMD/Include/ccolamd.h>

#ifdef GTSAM_SUPPORT_NESTED_DISSECTION
#ifdef GTSAM_USE_SYSTEM_METIS
#include <metis.h>
#else
#include <gtsam/3rdparty/metis/include/metis.h>
#endif
#endif

using namespace std;
Expand Down
7 changes: 2 additions & 5 deletions gtsam_unstable/partition/FindSeparator-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@

#include "FindSeparator.h"

#ifndef GTSAM_USE_SYSTEM_METIS
#include <metis.h>

extern "C" {
#include <metis.h>
#include "metislib.h"
#include <metislib.h>
}


Expand Down Expand Up @@ -566,5 +565,3 @@ namespace gtsam { namespace partition {
}

}} //namespace

#endif
4 changes: 0 additions & 4 deletions gtsam_unstable/partition/tests/testFindSeparator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ using namespace std;
using namespace gtsam;
using namespace gtsam::partition;

#ifndef GTSAM_USE_SYSTEM_METIS

/* ************************************************************************* */
// x0 - x1 - x2
// l3 l4
Expand Down Expand Up @@ -229,8 +227,6 @@ TEST ( Partition, findSeparator3_with_reduced_camera )
LONGS_EQUAL(2, partitionTable[28]);
}

#endif

/* ************************************************************************* */
int main() { TestResult tr; return TestRegistry::runAllTests(tr);}
/* ************************************************************************* */

0 comments on commit a9a4075

Please sign in to comment.