Skip to content

Commit c737430

Browse files
committed
use internal metislib.h; extern C for system&local
1 parent 5d3b0bf commit c737430

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

cmake/HandleMetis.cmake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ if(GTSAM_USE_SYSTEM_METIS)
2121
mark_as_advanced(METIS_LIBRARY)
2222

2323
add_library(metis-gtsam-if INTERFACE)
24-
target_include_directories(metis-gtsam-if BEFORE INTERFACE ${METIS_INCLUDE_DIR})
24+
target_include_directories(metis-gtsam-if BEFORE INTERFACE ${METIS_INCLUDE_DIR}
25+
# gtsam_unstable/partition/FindSeparator-inl.h uses internel metislib.h API
26+
# via extern "C"
27+
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/libmetis>
28+
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/GKlib>
29+
)
2530
target_link_libraries(metis-gtsam-if INTERFACE ${METIS_LIBRARY})
2631
endif()
2732
else()
@@ -30,10 +35,12 @@ else()
3035
add_subdirectory(${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis)
3136

3237
target_include_directories(metis-gtsam BEFORE PUBLIC
38+
$<INSTALL_INTERFACE:include/gtsam/3rdparty/metis/>
3339
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/include>
40+
# gtsam_unstable/partition/FindSeparator-inl.h uses internel metislib.h API
41+
# via extern "C"
3442
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/libmetis>
3543
$<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/GKlib>
36-
$<INSTALL_INTERFACE:include/gtsam/3rdparty/metis/>
3744
)
3845

3946
add_library(metis-gtsam-if INTERFACE)

gtsam_unstable/partition/FindSeparator-inl.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020

2121
#include "FindSeparator.h"
2222

23-
#ifndef GTSAM_USE_SYSTEM_METIS
23+
#include <metis.h>
2424

2525
extern "C" {
26-
#include <metis.h>
2726
#include <metislib.h>
2827
}
2928

@@ -566,5 +565,3 @@ namespace gtsam { namespace partition {
566565
}
567566

568567
}} //namespace
569-
570-
#endif

gtsam_unstable/partition/tests/testFindSeparator.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ using namespace std;
2020
using namespace gtsam;
2121
using namespace gtsam::partition;
2222

23-
#ifndef GTSAM_USE_SYSTEM_METIS
24-
2523
/* ************************************************************************* */
2624
// x0 - x1 - x2
2725
// l3 l4
@@ -229,8 +227,6 @@ TEST ( Partition, findSeparator3_with_reduced_camera )
229227
LONGS_EQUAL(2, partitionTable[28]);
230228
}
231229

232-
#endif
233-
234230
/* ************************************************************************* */
235231
int main() { TestResult tr; return TestRegistry::runAllTests(tr);}
236232
/* ************************************************************************* */

0 commit comments

Comments
 (0)