Skip to content

Commit e098ac0

Browse files
committed
Modifid cmake
1 parent df14b87 commit e098ac0

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ if(USE_MULTIPRECISION)
3636
# Turning this on activates mpfr in the conformal code
3737
option(LIBIGL_COPYLEFT_CGAL "Use CGAL" ON)
3838
add_compile_definitions(WITH_MPFR)
39+
find_package(MPFR REQUIRED QUIET)
3940
include_directories(${MPFR_INCLUDE_DIR})
4041
include_directories(${GMP_INCLUDE_DIR})
4142
link_directories(${MPFR_LIBRARIES_DIR})

cmake/FindMPFR.cmake

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Try to find the MPFR libraries
2+
# MPFR_FOUND - system has MPFR lib
3+
# MPFR_INCLUDE_DIR - the MPFR include directory
4+
# MPFR_LIBRARIES_DIR - Directory where the MPFR libraries are located
5+
# MPFR_LIBRARIES - the MPFR libraries
6+
7+
INCLUDE(FindPackageHandleStandardArgs)
8+
9+
# GMP is also needed, prerequisite
10+
find_path(GMP_INCLUDE_DIR
11+
NAMES gmp.h
12+
HINTS ENV GMP_INC_DIR
13+
ENV GMP_DIR
14+
ENV GMP_INC
15+
PATH_SUFFIXES include
16+
DOC "The directory containing the GMP header files"
17+
)
18+
19+
find_library(GMP_LIBRARIES NAMES gmp libgmp
20+
HINTS ENV GMP_LIB_DIR
21+
ENV GMP_DIR
22+
ENV GMP_LIB
23+
PATH_SUFFIXES lib
24+
DOC "Path to the GMP library"
25+
)
26+
27+
28+
# find MPFR
29+
find_path(MPFR_INCLUDE_DIR
30+
NAMES mpfr.h
31+
HINTS ENV MPFR_INC_DIR
32+
ENV MPFR_DIR
33+
ENV MPFR_INC
34+
PATH_SUFFIXES include
35+
DOC "The directory containing the MPFR header files"
36+
)
37+
38+
find_library(MPFR_LIBRARIES NAMES mpfr libmpfr-4 libmpfr-1
39+
HINTS ENV MPFR_LIB_DIR
40+
ENV MPFR_DIR
41+
ENV MPFR_LIB
42+
PATH_SUFFIXES lib
43+
DOC "Path to the MPFR library"
44+
)
45+
46+
if ( MPFR_LIBRARIES AND GMP_LIBRARIES )
47+
get_filename_component(MPFR_LIBRARIES_DIR ${MPFR_LIBRARIES} PATH CACHE )
48+
get_filename_component(GMP_LIBRARIES_DIR ${GMP_LIBRARIES} PATH CACHE )
49+
endif()
50+
51+
find_package_handle_standard_args(MPFR "DEFAULT_MSG" MPFR_LIBRARIES MPFR_INCLUDE_DIR)
52+
find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_LIBRARIES GMP_INCLUDE_DIR)

cmake/eigen.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ else()
2424
include(FetchContent)
2525
FetchContent_Declare(
2626
eigen
27+
SYSTEM
2728
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
2829
GIT_TAG 3.4.0
2930
GIT_SHALLOW TRUE

src/optimization/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ target_link_libraries(MetricOptimizationLib PUBLIC
3333
pybind11::module
3434
${MPFR_LIBRARIES}
3535
)
36+
message(MPRF libraries are ${MPFR_LIBRARIES})
3637
target_compile_definitions(MetricOptimizationLib PUBLIC
3738
SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG
3839
)

0 commit comments

Comments
 (0)