Building gsl 1.8 on Windows

The Visual Studio projects in these subdirectories build static and dynamic versions of the Gnu Scientific Library version 1.8.  In addition, test programs can be built for each of the gsl 1.8 modules providing test code, and for the example programs distributed with gsl.  The projects are collected in 3 Visual Studio 2005 solutions.  Solution libgsl.sln builds the libraries.  Solution test_gsl.sln builds the test programs.  Solution gsl_examples.sln builds the example programs.   The test and example programs are built to test all versions of the gsl libraries (DLL and static library, debug and release).

The VC8 projects included are:

VC8 Project Description
copy_gsl_headers

Utility project to copy the public gsl headers from the individual subdirectories to the ./gsl subdirectory.  This location is where all the library sources look for the headers, and must be performed before any compilation.  To enforce this, all projects performing gsl compilation are dependent on this project.

The copying is performed in a custom build step if the target header is missing or older than the corresponding header in the gsl source tree.

install_libgsl

Utility project providing simple installation using a build event.  The event copies the dll's, libraries, documentation, and headers to a root directory specified in the build event.  Modify the event code to change the target destination.

Note that this project is not dependent on any of the library-building projects.  The installer will simply copy what it finds, so build all desired libraries before building this project.  This project is not run automatically by any of the solution configurations.  The user needs to explicitly build it if desired.

libgsl Builds the gsl libraries. Target depends on the build configuration:

Configuration Build Targets
Release-StaticLib libgsl.lib
Release-DLL libgsl.dll
libgsl_dll.lib (import library)
Debug-StaticLib libgsl_d.lib
Debug-DLL libgsl_d.dll
libgsl_dll_d.lib (import library)
libgslcblas Builds the gsl cblas support libraries. Target depends on the build configuration:

Configuration Build Targets
Release-StaticLib libgslcblas.lib
Release-DLL libgslcblas.dll
libgslcblas_dll.lib (import library)
Debug-StaticLib libgslcblas_d.lib
Debug-DLL libgslcblas_d.dll
libgslcblas_dll_d.lib (import library)
copy_dlls

Utility project used by the test_gsl.sln and gsl_examples.sln solutions to copy the prebuilt gsl dll's from their build directories to the target location for the test/example executables.  Files are only copied for DLL-related build configurations.  The dll's must already exist in the build directories created by the libgsl.sln and libgslcblas.sln solutions.  If the dll's are not properly located when running the test or example programs requiring them, a runtime error will occur.

test_xxx

Builds the test program for gsl module xxx using the appropriate version of the gsl library.  Whether the gsl static library or dll is used is based on the build configuration chosen.

ex_xxx

Builds the example program for xxx.c (in the doc\examples directory) using the appropriate version of the gsl library.  Whether the gsl static library or dll is used is based on the build configuration chosen.

The libraries have been tested using the standard gsl test programs, with all tests passing.  All functional example programs were also executed successfully.

Building & Testing the Libraries

The libraries were built using Visual C++ Express 2005 (Visual C++ 8).  To rebuild from the source, use the following steps:

  1. Load the libgsl.sln solution.
  2. Modify config.h.msvc in the VC8 root directory for your preferences.
  3. If you are using a custom blas implementation, modify the DLL linker configurations in the libgsl project to use your library.
  4. Build the desired library project(s) using the desired build configuration(s).  Copying of the gsl headers to the central ./gsl subdirectory will be performed automatically if necessary.
  5. If collection of the essential library files in a single location is desired, modify the pre-build event in the install_libgsl project to point to the desired location.  Then build the install project to complete the installation.
  6. To test the libraries, load the test_gsl.sln solution and build the tests.
  7. From a command window, run the batchfile VC8\run_gsl_tests. This will run all the tests in the VC8\test_gsl build directories and issue results to the console.
  8. To rbuild the example programs, load the gsl_examples.sln solution and build the examples.
  9. From a command window, run the batchfile VC8\run_gsl_examples. This will run all the example programs in the VC8\gsl_examples build directories and issue results to the console.

Using the Libraries

  1. Include the location of the gsl headers in the compiler search path.
  2. IMPORTANT! If you will be using the gsl dynamic libraries, add GSL_DLL to the list of predefined macros.
  3. Configure your project to use the VC runtime library appropriate to the gsl library version you will be using:
    Configuration gsl Library VC Runtime Library
    Release-StaticLib libgsl.lib Multi-Threaded (/MT)
    Release-DLL libgsl.dll
    libgsl_dll.lib
    Multi-Threaded DLL (/MD)
    Debug-StaticLib libgsl_d.lib Multi-Threaded Debug (/MTd)
    Debug-DLL libgsl_d.dll
    libgsl_dll_d.lib
    Multi-Threaded Debug DLL (/MDd)
  4. Link against the appropriate gsl static or import library.
  5. If you are using a dynamic library, it must be available in the path.

Source Modifications

Only minor tweaks to the original gsl 1.8 release source code were necessary to facilitate building the library using VC8 on Windows.  Changes to the source code were: