diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ include(KDECompilerSettings NO_POLICY_SCOPE) include(FeatureSummary) -# check for PkgConfig, Qt and GMP +# check for PkgConfig, Qt and MPIR find_package(PkgConfig) if(BUILD_QT4) find_package(Qt4 REQUIRED COMPONENTS QtCore QtDBus QtTest) @@ -31,7 +31,7 @@ set(PC_TARGET_QTPREFIX Qt5) set(PC_TARGET_SUFFIX 5) endif() -find_package(GMP REQUIRED) +find_package(MPIR REQUIRED) # check for Doxygen (for API documentation) find_package(Doxygen) diff --git a/cmake/modules/FindGMP.cmake b/cmake/modules/FindGMP.cmake deleted file mode 100644 --- a/cmake/modules/FindGMP.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# Try to find the GMP librairies -# GMP_FOUND - system has GMP lib -# GMP_INCLUDE_DIR - the GMP include directory -# GMP_LIBRARIES - Libraries needed to use GMP - -# Copyright (c) 2006, Laurent Montel, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -if (GMP_INCLUDE_DIR AND GMP_LIBRARIES) - # Already in cache, be silent - set(GMP_FIND_QUIETLY TRUE) -endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES) - -find_path(GMP_INCLUDE_DIR NAMES gmp.h ) -find_library(GMP_LIBRARIES NAMES gmp libgmp) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) - -mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES) diff --git a/cmake/modules/FindMPIR.cmake b/cmake/modules/FindMPIR.cmake new file mode 100644 --- /dev/null +++ b/cmake/modules/FindMPIR.cmake @@ -0,0 +1,24 @@ +# Try to find the MPIR librairies +# MPIR_FOUND - system has MPIR lib +# MPIR_INCLUDE_DIR - the MPIR include directory +# MPIR_LIBRARIES - Libraries needed to use MPIR + +# Copyright (c) 2006, Laurent Montel, +# Copyright (c) 2018, Thomas Baumgart +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if (MPIR_INCLUDE_DIR AND MPIR_LIBRARIES) + # Already in cache, be silent + set(MPIR_FIND_QUIETLY TRUE) +endif (MPIR_INCLUDE_DIR AND MPIR_LIBRARIES) + +find_path(MPIR_INCLUDE_DIR NAMES mpir.h ) +find_library(MPIR_LIBRARIES NAMES mpir libmpir) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPIR DEFAULT_MSG MPIR_INCLUDE_DIR MPIR_LIBRARIES) + +mark_as_advanced(MPIR_INCLUDE_DIR MPIR_LIBRARIES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,7 +2,7 @@ # The current version of libalkimia (used for packages and config.h) set(VERSION_MAJOR "7") set(VERSION_MINOR "0") -set(VERSION_PATCH "0") +set(VERSION_PATCH "1") include(GenerateExportHeader) include(ECMGenerateHeaders) @@ -30,8 +30,8 @@ kde_target_enable_exceptions(alkimia PUBLIC) -target_include_directories(alkimia PUBLIC ${GMP_INCLUDE_DIR}) -target_link_libraries(alkimia PUBLIC ${QT_USE_LIBSPREFIX}Core ${QT_USE_LIBSPREFIX}DBus ${GMP_LIBRARIES}) +target_include_directories(alkimia PUBLIC ${MPIR_INCLUDE_DIR}) +target_link_libraries(alkimia PUBLIC ${QT_USE_LIBSPREFIX}Core ${QT_USE_LIBSPREFIX}DBus ${MPIR_LIBRARIES}) generate_export_header(alkimia BASE_NAME alk) if(WIN32) @@ -88,7 +88,7 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/LibAlkimia${ALKIMIA_PATH_SUFFIX}Config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/LibAlkimia${ALKIMIA_PATH_SUFFIX}ConfigVersion.cmake" - "../cmake/modules/FindGMP.cmake" + "../cmake/modules/FindMPIR.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel) diff --git a/src/alkvalue.h b/src/alkvalue.h --- a/src/alkvalue.h +++ b/src/alkvalue.h @@ -1,5 +1,6 @@ /*************************************************************************** - * Copyright 2010 Thomas Baumgart ipwizard@users.sourceforge.net * + * Copyright 2010 Thomas Baumgart tbaumgart@kde.org * + * Copyright 2018 Thomas Baumgart tbaumgart@kde.org * * * * This file is part of libalkimia. * * * @@ -23,7 +24,7 @@ // Workaround: include before gmpxx.h to fix build with gcc-4.9 /** @todo When gmp version is higer than 5.1.3, remove cstddef include */ #include -#include // krazy:exclude=camelcase +#include // krazy:exclude=camelcase #include #include diff --git a/src/alkvalue.cpp b/src/alkvalue.cpp --- a/src/alkvalue.cpp +++ b/src/alkvalue.cpp @@ -1,5 +1,6 @@ /*************************************************************************** - * Copyright 2010 Thomas Baumgart ipwizard@users.sourceforge.net * + * Copyright 2010 Thomas Baumgart tbaumgart@kde.org * + * Copyright 2018 Thomas Baumgart tbaumgart@kde.org * * * * This file is part of libalkimia. * * * @@ -46,7 +47,7 @@ QString result = QString::fromLatin1(p); // and free up the resources allocated by gmp_asprintf - __gmp_freefunc_t freefunc; + void (*freefunc) (void *, size_t); mp_get_memory_functions(NULL, NULL, &freefunc); (*freefunc)(p, std::strlen(p) + 1); diff --git a/src/libalkimia.pc.in b/src/libalkimia.pc.in --- a/src/libalkimia.pc.in +++ b/src/libalkimia.pc.in @@ -14,6 +14,6 @@ Version: @ALKIMIA_LIB_VERSION@ Libs: -lalkimia@PC_TARGET_SUFFIX@ -Libs.private: -lgmp -l@PC_TARGET_QTPREFIX@Core -l@PC_TARGET_QTPREFIX@DBus -lstdc++ +Libs.private: -lmpir -l@PC_TARGET_QTPREFIX@Core -l@PC_TARGET_QTPREFIX@DBus -lstdc++ Cflags: -I${includedir}