Thursday, September 08, 2005
Adding external libraries to KDevelop
My current version of KDevelop is a nice one, but still lacks interface-based configuration of external libraries. As the whole majority of free IDE's, KDevelop is based on GNU automake/configure to manage the libraries and sources, and finally create a Makefile that the 'make' command reads to make the proper compiler/linker calls.
Ok, so, this trick is valid for all systems of this kind. I'll configure for this example the Gnu Scientific Library (GSL):
Locate a file named configure.in inside your project directory. Open it and put the following lines anywhere:
Ok, so, this trick is valid for all systems of this kind. I'll configure for this example the Gnu Scientific Library (GSL):
Locate a file named configure.in inside your project directory. Open it and put the following lines anywhere:
AC_CHECK_LIB(m,main)
AC_CHECK_LIB(gslcblas,main)
AC_CHECK_LIB(gsl,main)
What are we doing with this? Easy one: We're checking the existence of an entry called 'main' inside the libraries m, gslcblas and gsl, which must be located in the library path (/usr/lib, /usr/local/lib...).
Now, the next step is to execute automake and folks and then execute the generated 'configure' script, which happens to create a set of Makefile's that tell the compiler/linker to work with '-lm -lgslcblas -lgsl'.
So, now, if you run 'make', you must see those libraries are being linked. You can repeat this operation with, for example, SDL_Image lib, just writing AC_CHECK_LIB(SDL_Image,main) to your configure.in file.
Hope that this helps somebody! Thanks for the KDE, KDevelop and GSL teams for their nice work.
AC_CHECK_LIB(gslcblas,main)
AC_CHECK_LIB(gsl,main)
What are we doing with this? Easy one: We're checking the existence of an entry called 'main' inside the libraries m, gslcblas and gsl, which must be located in the library path (/usr/lib, /usr/local/lib...).
Now, the next step is to execute automake and folks and then execute the generated 'configure' script, which happens to create a set of Makefile's that tell the compiler/linker to work with '-lm -lgslcblas -lgsl'.
So, now, if you run 'make', you must see those libraries are being linked. You can repeat this operation with, for example, SDL_Image lib, just writing AC_CHECK_LIB(SDL_Image,main) to your configure.in file.
Hope that this helps somebody! Thanks for the KDE, KDevelop and GSL teams for their nice work.