Skip to content

Commit

Permalink
Merge pull request #319 from bluescarni/pr/new_flint
Browse files Browse the repository at this point in the history
FLINT 3
  • Loading branch information
bluescarni authored Dec 4, 2024
2 parents 805ff40 + c5fc8d3 commit 588b96a
Show file tree
Hide file tree
Showing 44 changed files with 248 additions and 296 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gh_actions_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
- name: Build
shell: pwsh
run: |
conda install -y cmake mpir mpfr 'libflint<3' arb mpc fmt libboost-devel
conda install -y cmake gmp mpfr libflint mpc fmt libboost-devel
mkdir build
cd build
cmake ../ -G "Visual Studio 17 2022" -A x64 -DCMAKE_CXX_STANDARD=20 -DMPPP_BUILD_TESTS=yes -DMPPP_WITH_BOOST_S11N=yes -DMPPP_WITH_FMT=yes -DMPPP_WITH_MPFR=yes -DMPPP_WITH_MPC=yes -DMPPP_WITH_ARB=yes -DMPPP_ENABLE_IPO=yes
cmake ../ -G "Visual Studio 17 2022" -A x64 -DCMAKE_CXX_STANDARD=20 -DMPPP_BUILD_TESTS=yes -DMPPP_WITH_BOOST_S11N=yes -DMPPP_WITH_FMT=yes -DMPPP_WITH_MPFR=yes -DMPPP_WITH_MPC=yes -DMPPP_WITH_FLINT=yes -DMPPP_ENABLE_IPO=yes
cmake --build . --config Release -j2
copy Release\mp++.dll test\Release\
ctest -j4 -V -C Release
Expand Down
36 changes: 11 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
cmake_minimum_required(VERSION 3.8.0)
# NOTE: policy for using the CheckIPOSupported module:
# https://cmake.org/cmake/help/latest/policy/CMP0069.html
cmake_policy(SET CMP0069 NEW)
cmake_minimum_required(VERSION 3.12.0)

# Set default build type to "Release".
# NOTE: this should be done before the project command since the latter can set
Expand All @@ -12,10 +9,10 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

project(mp++ VERSION 1.0.4 LANGUAGES CXX C)
project(mp++ VERSION 2.0.0 LANGUAGES CXX C)

# Setup the mp++ ABI version number.
set(MPPP_ABI_VERSION 15)
set(MPPP_ABI_VERSION 16)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma")

Expand All @@ -31,10 +28,8 @@ option(MPPP_BUILD_TESTS "Build unit tests." OFF)
option(MPPP_BUILD_BENCHMARKS "Build benchmarks." OFF)
option(MPPP_BENCHMARK_BOOST "Build benchmarks against Boost.Multiprecision (effective only if MPPP_BUILD_BENCHMARKS is TRUE, requires Boost)." OFF)
mark_as_advanced(MPPP_BENCHMARK_BOOST)
option(MPPP_BENCHMARK_FLINT "Build benchmarks against Flint (effective only if MPPP_BUILD_BENCHMARKS is TRUE, requires FLINT)." OFF)
mark_as_advanced(MPPP_BENCHMARK_FLINT)
option(MPPP_WITH_MPFR "Enable features relying on MPFR." OFF)
option(MPPP_WITH_ARB "Enable features relying on Arb." OFF)
option(MPPP_WITH_FLINT "Enable features relying on FLINT." OFF)
option(MPPP_WITH_MPC "Enable features relying on MPC." OFF)
option(MPPP_WITH_QUADMATH "Enable features relying on libquadmath (e.g., the real128 type)." OFF)
option(MPPP_WITH_BOOST_S11N "Enable features relying on the Boost.Serialization library." OFF)
Expand All @@ -49,8 +44,8 @@ endif()
option(MPPP_ENABLE_IPO "Enable IPO (requires CMake >= 3.9 and compiler support)." OFF)
mark_as_advanced(MPPP_ENABLE_IPO)

if(MPPP_WITH_ARB AND NOT MPPP_WITH_MPFR)
message(FATAL_ERROR "Arb support requires MPFR, please enable the MPPP_WITH_MPFR build option.")
if(MPPP_WITH_FLINT AND NOT MPPP_WITH_MPFR)
message(FATAL_ERROR "FLINT support requires MPFR, please enable the MPPP_WITH_MPFR build option.")
endif()

if(MPPP_WITH_MPC AND NOT MPPP_WITH_MPFR)
Expand Down Expand Up @@ -229,7 +224,7 @@ if(MPPP_WITH_MPFR)
"${MPPP_SRC_FILES}")
endif()

if(MPPP_WITH_ARB)
if(MPPP_WITH_FLINT)
set(MPPP_SRC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/arb.cpp"
"${MPPP_SRC_FILES}")
Expand Down Expand Up @@ -362,20 +357,11 @@ if(MPPP_WITH_MPFR)
set(MPPP_ENABLE_MPFR "#define MPPP_WITH_MPFR")
endif()

# Optional dependency on Arb.
if(MPPP_WITH_ARB)
# Optional dependency on FLINT.
if(MPPP_WITH_FLINT)
find_package(mp++_FLINT REQUIRED)
find_package(mp++_Arb REQUIRED)

# Check support for certain Arb functions.
set(CMAKE_REQUIRED_INCLUDES "${MPPP_ARB_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${MPPP_ARB_LIBRARY}")
check_symbol_exists(acb_agm "acb.h" MPPP_ARB_HAVE_ACB_AGM)
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)

target_link_libraries(mp++ PRIVATE mp++::Arb mp++::FLINT)
set(MPPP_ENABLE_ARB "#define MPPP_WITH_ARB")
target_link_libraries(mp++ PRIVATE mp++::FLINT)
set(MPPP_ENABLE_FLINT "#define MPPP_WITH_FLINT")
endif()

# Optional dependency on quadmath.
Expand Down
6 changes: 1 addition & 5 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ endif()
# fmt is always required.
find_package(fmt ${_MPPP_MIN_FMT_VERSION} REQUIRED CONFIG)

if(MPPP_BENCHMARK_FLINT)
find_package(mp++_FLINT REQUIRED)
endif()

# The benchmarking helper library.
add_library(mp++_benchmark STATIC utils.cpp)
target_compile_options(mp++_benchmark PRIVATE
Expand All @@ -45,7 +41,7 @@ function(ADD_MPPP_BENCHMARK arg1)
target_link_libraries(${arg1} PRIVATE Boost::boost mp++::GMP)
target_compile_options(${arg1} PRIVATE "-DMPPP_BENCHMARK_BOOST")
endif()
if(MPPP_BENCHMARK_FLINT)
if(MPPP_WITH_FLINT)
target_link_libraries(${arg1} PRIVATE mp++::FLINT)
target_compile_options(${arg1} PRIVATE "-DMPPP_BENCHMARK_FLINT")
endif()
Expand Down
50 changes: 0 additions & 50 deletions cmake/Findmp++_Arb.cmake

This file was deleted.

30 changes: 0 additions & 30 deletions cmake/Findmp++_FLINT.cmake
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
# Originally copied from the KDE project repository:
# http://websvn.kde.org/trunk/KDE/kdeutils/cmake/modules/FindGMP.cmake?view=markup&pathrev=675218

# Copyright (c) 2006, Laurent Montel, <[email protected]>
# Copyright (c) 2008-2023 Francesco Biscani, <[email protected]>

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------------------

if(MPPP_FLINT_INCLUDE_DIR AND MPPP_FLINT_LIBRARY)
# Already in cache, be silent
set(mp++_FLINT_FIND_QUIETLY TRUE)
Expand Down
2 changes: 1 addition & 1 deletion cmake/Findmp++_GMP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if(MPPP_GMP_INCLUDE_DIR AND MPPP_GMP_LIBRARY)
endif()

find_path(MPPP_GMP_INCLUDE_DIR NAMES gmp.h)
find_library(MPPP_GMP_LIBRARY NAMES gmp mpir)
find_library(MPPP_GMP_LIBRARY NAMES gmp)

include(FindPackageHandleStandardArgs)

Expand Down
3 changes: 1 addition & 2 deletions config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
#cmakedefine MPPP_MPFR_HAVE_MPFR_ROUNDEVEN
#cmakedefine MPPP_MPFR_HAVE_MPFR_FMODQUO
#cmakedefine MPPP_MPFR_HAVE_MPFR_GET_STR_NDIGITS
@MPPP_ENABLE_ARB@
#cmakedefine MPPP_ARB_HAVE_ACB_AGM
@MPPP_ENABLE_FLINT@
@MPPP_ENABLE_MPC@
@MPPP_ENABLE_QUADMATH@
#cmakedefine MPPP_QUADMATH_HAVE_EXP2Q
Expand Down
18 changes: 18 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Changelog
=========

2.0.0 (unreleased)
------------------

Changes
~~~~~~~

- **BREAKING**: when FLINT support is enabled, mp++ now requires FLINT>=3
(`#319 <https://github.com/bluescarni/mppp/pull/319>`__).
- **BREAKING**: mp++ now requires CMake>=3.12
(`#319 <https://github.com/bluescarni/mppp/pull/319>`__).

Fix
~~~

- Implement workaround to avoid segfaults when compiling with
MSVC against a MinGW build of MPFR and MPC
(`#319 <https://github.com/bluescarni/mppp/pull/319>`__).

1.0.4 (2024-10-10)
------------------

Expand Down
Loading

0 comments on commit 588b96a

Please sign in to comment.