Skip to content

Commit be38842

Browse files
hadesslanewei120
authored andcommitted
ENH: Allow using system GMP and MPFR
To make it easier to test newer versions, or apply system specific patches. In the case of Flatpak builds, GMP and MPFR are already available in the Freedesktop runtime.
1 parent 5af980b commit be38842

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎deps/CGAL/CGAL.cmake‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ bambustudio_add_cmake_project(
77
URL https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip
88
URL_HASH SHA256=d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0
99
PATCH_COMMAND git apply ${CGAL_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-clang19.patch
10-
DEPENDS ${BOOST_PKG} dep_GMP dep_MPFR
10+
DEPENDS ${BOOST_PKG} ${GMP_PKG} ${MPFR_PKG}
1111
CMAKE_ARGS
1212
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
1313
)

‎deps/CMakeLists.txt‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ option(DEP_BUILD_GLFW "Compile GLFW" ON)
4343
option(DEP_BUILD_BLOSC "Compile Blosc" ON)
4444
option(DEP_BUILD_FREETYPE "Compile freetype" ON)
4545
option(DEP_BUILD_WXWIDGETS "Compile wxWidgets" ON)
46+
option(DEP_BUILD_GMP "Compile GMP" ON)
47+
option(DEP_BUILD_MPFR "Compile MPFR" ON)
4648
option(DEP_BUILD_FFMPEG "Compile ffmpeg" ON)
4749
option(DEP_BUILD_LIBHARU "Compile libharu" ON)
4850

@@ -256,8 +258,16 @@ endif ()
256258
include(OpenEXR/OpenEXR.cmake)
257259
include(OpenVDB/OpenVDB.cmake)
258260

259-
include(GMP/GMP.cmake)
260-
include(MPFR/MPFR.cmake)
261+
set(GMP_PKG "")
262+
if (DEP_BUILD_GMP)
263+
include(GMP/GMP.cmake)
264+
set(GMP_PKG dep_GMP)
265+
endif ()
266+
set(MPFR_PKG "")
267+
if (DEP_BUILD_MPFR)
268+
include(MPFR/MPFR.cmake)
269+
set(MPFR_PKG dep_MPFR)
270+
endif ()
261271
include(CGAL/CGAL.cmake)
262272

263273
include(NLopt/NLopt.cmake)

‎deps/MPFR/MPFR.cmake‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ else ()
4646
CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --prefix=${DESTDIR}/usr/local --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR}/usr/local ${_gmp_build_tgt}
4747
BUILD_COMMAND make -j
4848
INSTALL_COMMAND make install
49-
DEPENDS dep_GMP
49+
DEPENDS ${GMP_PKG}
5050
)
5151
endif ()

0 commit comments

Comments
 (0)