Category Archives: MacOSX

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.

Remove duplicate entries in “Open With…” Popup in Mac OS X (Mountain Lion)

After running Mac OS X for some years I encountered that the “Open With…” popup menu had multiple entries of one program listed, which was kind of annoying. I tried to find solutions for this, but couldn’t find one, until I eventually ask Dr. Google the right question and found a blog post about it. Anyway, all you have to do is to start the Terminal.app and run

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/\
LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local\
-domain system -domain user

Then restart the Finder.app or restart the computer. Worked well with Mountain Lion!

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

Solution for “My Mac OS X GUI program doesn’t get focus if it’s outside an application bundle”

This problem regularly comes up at the wxWidgets mailing list: You write an application for Mac OS X which utilizes a GUI and when you start the program, you can see the user interface, but the window doesn’t have the focus and also you can’t click it. So the window is not reactive in any way. Usually the answer is, that you should put your program in an application bundle, which is basically a folder which is called “something.app” (the executable needs to be copied to “Contents/MacOS” and you also might need to add an Info.plist file) and run the application bundle with “open something.app”. But there are situations where this is not really possible, e.g. you have some command line tool (PLplot program) and then you run some code which opens a GUI (wxWidgets driver for PLplot). If you write some easy program to calculate something and show a plot with the help of PLplot you don’t want to create an application bundle for that. Continue reading Solution for “My Mac OS X GUI program doesn’t get focus if it’s outside an application bundle”

Install Gnuplot 4.4.0 on Mac OS X

In a former post I showed how Gnuplot 4.2.6 could be easily installed on Mac OS X. In the meantime Gnuplot 4.4.0 was released and although the wxWidgets terminal still doesn’t work on Mac OS X, there are the new cairo based terminals which provide png and pdf output. These terminals replace the gd terminals (libgd is not easily installed due it’s dependencies) and the old pdf terminal (which depends on the not-very-free pdflib). Since gif and jpeg (libgd terminal) shouldn’t be used for plots anyways, this is no loss. Since these formats are the ones which I need mainly, I show in this post how we could compile and install Gnuplot with little effort, providing X11, png and pdf terminal (and others which are compiled in anyway). Continue reading Install Gnuplot 4.4.0 on Mac OS X

GTK-Framework for Mac OS X (as well as cairo, pango, ….)

There is no official GTK framework for Mac OS X available. They are working hard on it, but in the moment you are forced to compile the framework on your own, though the instructions don’t look that complicated. You could also use macports or fink, but when I use them I always encounter some problems, if a package doesn’t compile. I found an easy and fast solution to install the GTK framework for Mac OS X (using X11) and you also get cairo, pango and other libraries of the GTK project. Continue reading GTK-Framework for Mac OS X (as well as cairo, pango, ….)

Install Gnuplot on Mac OS X

I provide another instructions to install Gnuplot 4.4.0 compiling it yourself on Mac OS X.

There are some possibilities to install Gnuplot on Mac OS X, none of them is “official”, since the Gnuplot project doesn’t provide binaries for Mac OS X. It’s actually quite easy to configure and compile Gnuplot (i.e. ./configure; make; make install), but some terminals are not built due to missing dependencies and this makes Gnuplot less powerful.

Continue reading Install Gnuplot on Mac OS X

Apple keyboard keymap (German) for Windows running as guest on Mac OS X host in Virtualbox

Puh, that’s a long title. I’m working on Mac OS X and use Virtualbox to run Windows XP as a guest operating system. Virtualbox runs exceptionally well and it’s even free. But the keyboard mapping is problematic since Windows XP assumes a standard PC keyboard. The layout of the Apple keyboards is different, so if you are not a Windows guy, you’ll have troubles to find the backslash ‘\’ or ‘@’. I was looking for a solution for a long time now, but didn’t find anything until now. Stefan Bohm actually published a solution for the same problem if you run parallels. He provided a new keyboard layout for installation (the layout is called ‘Parallels Keyboard Map’) as well a registry hack so that the ‘alt’ keys work as expected.

Continue reading Apple keyboard keymap (German) for Windows running as guest on Mac OS X host in Virtualbox