Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

$PATH - Magics++ provides not only libraries, but also some executables. To use these, the $PATH needs to include the location of these programs. Usually this will be $MAGPLUS_HOME/bin.

Warning
titlemagics-config

...

In the past we offered a tool called magics-config

...

To compile a C program and link it to Magics++ you only need to type

     gcc  shade.c  -o  shade  `magics-config  --clibs  --cxxflags`

To compile simple Magics Fortran programs you can use magics-config by typing :

     magics-config --compile=test.f
      

In case a different suffix is used for Fortran code the call can be extended to:

     magics-config --compile=test.F90 --suffix=F90
      

There is a similar shortcut for C code called --compileC=test.c.

To do so $MAGPLUS_HOME/bin needs to be added to the $PATH first or magics-config called with its full path. Please be aware that the option '--print-setup' will tell you which environment variables you need to set before you can compile and run Magics++ programs. You might want to add this setup in your shell or start-up scripts. Below you find the usage help for magics-config.

 

Code Block
languagebash
titlemagics-config help text
Usage:  magics-config  [OPTION]  ...

Uses  by  default  version  2.12.5  of  Magics++.

Generic  options

    --version          output  Magics++  version  information.

    --help                display  this  help  and  exit.

    --print-setup  print  how  the  environment  can  be  set  up

Compilation  support  options

    --cxxflags        print  pre-processor  and  compiler  flags  for  C/C++

    --libs                print  linking  flags  for  C++

    --clibs              print  linking  flags  for  C

    --f90static      print  library  linking  information  (static)

    --f90shared      print  library  linking  information  (shared)

 

    --compile          compile  simple  Magics++  Fortran  programs  (default  single  precision!)   

                                    Example:  magics-config  --compile=wind.f

    --compileC        compile  simple  Magics++  C  programs   

                                    Example:  magics-config  --compileC=wind.c

    --suffix            set  suffix  of  Fortran  or  C  code  files

 

    --double            include  compiler  option  for  fortran  double  precision 

                                    (default  single  -  only  for  interface  -  internally  only  double  is  used)

    --64bit              include  fortran  option  for  64  bit

 

C/C++  flags  use  shared  libraries  if  possible,  otherwise  static  libraries  are  used.  '--double'  has  

NO  effect  on  C/C++  programs.

 

Install  directories  Magics++  was  configured  to

    --prefix[=DIR]

...

to ease the compilation of Fortran programs using Magics. Unfortunately this tool caused many problems for users and we replaced it with the more generic pkg-config setup described below.

Compiling with pkg-config

pkg-config is a script that provides a unified interface for querying installed libraries for the purpose of compiling software from its source code. pkg-config was originally designed for Linux but is now also available for the various BSDs, Microsoft Windows, Mac OS X, and Solaris. It outputs various information about installed libraries. This information may include parameters for C or C++ compiler and parameters for linker.

This script is very similar to what magics-config offersoffered previously, but pkg-config is more general while magics-config has was very Magics specific options.

...

To find the information about Magics compilation the environment variable PKG_CONFIG_PATH needs to contain the directory $MAGPLUS_HOME/lib/pkgconfig. For more information visit pkg-config on Wikipedia.

Using Magics++ in your own configure scripts [advanced]

To simplify the use of the Magics library in software also using the autotools package, a script called magics.m4 is provided. The file can be found in the Magics++ install directory under share/aclocal/. It is recommended to copy the file into the own project and include it in the configure.ac file by typing

m4_include(m4/magics.m4)

...

.