Category Archives: Windows

Adding doxygen support to CMakeLists.txt

There might be a lot of discussions which build system is the best – I once decided to invest into understanding cmake and never looked back. It’s not perfect, but it’s really easy to set up a build especially a cross-platform one.

There is actually no discussion that one should document his/her source code thoroughly – you should just do it. Over a decade ago I chose to use doxygen and I also didn’t regret it. Also cross-platform and does its job.

It’s actually quite easy to marry both tools since cmake provides doxygen support and here I just present shortly the steps needed to activate doxygen.

First install cmake and doxygen. On Linux this packages will be provided by your distribution, on Mac OS X I would just use homebrew (“brew install cmake doxygen”) and on Windows I actually like chocolatey quite a lot (“choco install doxygen.install” and “choco install cmake”). After installation (and maybe a restart or at least rerunning the CLI) you should make sure that cmake and doxygen are installed (“cmake –version” and “doxygen –version”).

Then add the following lines to you CMakeLists.txt (I added the code after the find_packages() part).

# look for Doxygen package
find_package(Doxygen)

if(DOXYGEN_FOUND)
  # exclude sqlite code
  set(DOXYGEN_EXCLUDE_PATTERNS
        */sqlite3/*
  )

  # doxygen settings can be set here, prefixed with "DOXYGEN_"
  set(DOXYGEN_SOURCE_BROWSER YES)
  set(DOXYGEN_EXTRACT_PRIVATE YES)
  set(DOXYGEN_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/api-docs")

  # this target will only be built if specifically asked to.
  # run "make api-docs" to create the doxygen documentation
  doxygen_add_docs(
    api-docs
    ${PROJECT_SOURCE_DIR}
    COMMENT "Generate API-documents for NoteSearch."
  )
endif(DOXYGEN_FOUND)

This will create a custom target, which is not automatically run with the compilation. Which makes sense for me, since I don’t need the documentation updated all the time. If you want to create the documentation just run “make api-docs” (or similar). If you use Visual C++ there will be a project “api-docs” which you can build on demand.

cmake module to find Gnu Scientific Library, FindGSL.cmake

There is no official FindGSL.cmake module in the cmake distribution to “automagically” find the Gnu Scientific Library on Windows, Linux and Mac OS X. I have written such a module which works for my configurations, but might not cover all GSL installation on all OS. But you can modify it to fit your needs.

Continue reading cmake module to find Gnu Scientific Library, FindGSL.cmake

Adding GDI+ headers to MinGW (to compile wxWidgets with wxGraphicsContext support)

The GDI+ library is mandatory for wxGraphicsContext support on Win32. This is no problem if you’re using Visual C++, since the SDK provides the headers and import libraries, but for MinGW there are no such headers and import libraries provided. But there are some sources on the internet where you can get the necessary files.

Continue reading Adding GDI+ headers to MinGW (to compile wxWidgets with wxGraphicsContext support)

MinGW (3.4.5) binaries of GNU Scientific Library 1.11 for use with MinGW and Visual C

The binaries for GSL 1.12 are provided in this post: MinGW (3.4.5) binaries of GNU Scientific Library 1.12 for use with MinGW and Visual C++

“The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite”.

GSL is quite Unix centric but one might want to use the library at least with MinGW on Windows. I didn’t find any MinGW binaries of GSL apart from the one provided by the Ascend package or the binaries from GNUWin32 (which is only at version 1.8), but I don’t like graphical installers for libraries and I needed the static library. Therefore I compiled my own library with MSYS (I updated MSYS according to this link) and provide here the tarred binary package, which can also be used with the MinGW compiler without MSYS and with Visual C (import libraries for the shared library are provided).

Continue reading MinGW (3.4.5) binaries of GNU Scientific Library 1.11 for use with MinGW and Visual C