← Back to team overview

dolfin team mailing list archive

Re: Scons test for GMP

 

> On Tue, October 7, 2008 17:40, Benjamin Kehlet wrote:
>>> On Tue, October 7, 2008 14:45, Johannes Ring wrote:
>>>> On Tue, October 7, 2008 14:38, Anders Logg wrote:
>>>>> I would like to add a test for GMP (gmplib.org). Can someone who
>>>>> knows
>> the build system add this?
>>>> I can do that.
>>>>> We need to check for the header file gmpxx.h and we want to use the
>> latest GMP (4.2.4). If found and enabled, a variable HAS_GMP should be
>> defined. The default value of enableGmp should be false.
>>>> Ok.
>>>> Do you have a small example program for GMP? It will be useful to add
>> as
>>>> a
>>>> test-program for the pkg-config generator to verify that the selected
>> compiler will work.
>>>
>>> I just used the example found here:
>>>
>>> http://www.gnu.org/software/gmp/manual/html_node/Parameter-Conventions.html#Parameter
>> Conventions
>>>
>> This program is in C and doesn't use the C++ wrapper. Here is a small
>> program that uses both the C types and the C++ classes from GMP.
>
> Thanks. Will it be enough to use the first case as the test? That is:
>
> #include <iostream>
> #include <gmpxx.h>
>
> int main (void)
> {
>   mpz_class integer1("1000000023457323");
>   mpz_class integer2("54367543212");
>   mpz_class int_result = integer1*integer2;
>
>   std::cout << integer1 << " * " << integer2 << " = "
>             << int_result << std::endl;
>
>   return EXIT_SUCCESS;
> }
>

I guess that should do, yes.


>> Also, the linker needs the flags -lgmp and -lgmpxx
>
> Yes, these are already used.
>
> Johannes
>




Follow ups

References