Difference between revisions of "CMake"

From Navit's Wiki
Jump to: navigation, search
(Building with MinGW)
(detailled Windows build instructions)
Line 41: Line 41:
 
  mingw32-make
 
  mingw32-make
 
</pre>
 
</pre>
 +
 +
===arpy's detailled instructions proved to be working with r4672===
 +
 +
Since all attempts suggested on the [[Navit_on_Windows|Navit on Windows page]] failed for weeks, we were given the hint to use CMake, and a link to this page, which I try now to enhance with my detailled instructions which worked for me finally. I hope you can find them useful too.
 +
 +
Unfortunately, since I am no Navit developer, this is a one-shot explanation (because the ones provided did not work for us!). I will not keep it up to date, please feel free to further enhance this HOWTO by yourself!
 +
 +
====Setup the build Environment====
 +
 +
* Setup MinGW
 +
** Download MinGW from http://www.mingw.org/
 +
** Install to C:\MinGW (default) and use prepacked libs (default)
 +
* Setup GTK+
 +
** Download the GTK+ dev installer.
 +
** Install to C:\GTK (default) and select all components
 +
** Add an environment variable to have CMake find glib-2.0 later <br /><code>PKG_CONFIG_PATH=C:\GTK\lib\pkgconfig</code>
 +
* Setup CMake
 +
** Download CMake 2.8.5 from http://www.cmake.org
 +
** Install to C:\CMake (not default!) and add configure adding it to the Path (not default!)
 +
* Install an image converter tool <br />This is needed to convert the SVG vector graphics from the sources to actual pixel images for the runtime.
 +
** To use ImageMagick, download it from http://www.imagemagick.org, we took the 16 bit dll package.
 +
** Install to C:\ImageMagic (not default!) and have it added to your Path variable (not default!)
 +
** Make sure ImageMagic is in your Path variable before system32, it contains a convert.exe as well, and ImageMagic won't work.
 +
 +
====Run a build====
 +
 +
* Open a MinGW shell
 +
* Go to the navit sources
 +
* Create a build directory next to the navit source directory and cd into it
 +
* Configure the build (assuming that ../navit is the navit source directory) <br /><code>cmake ../navit -G "MinGW Makefiles"</code>
 +
* Hint: If CMake gives an error like ''sh.exe was found in your PATH'', just ignore it and run the command again. CMake always seems to do this in an empty build directory.
 +
* Run the build <br /><code>mingw32-make</code>
 +
* Hint: If it complanins during image conversions, and multiple runs won't overcome the problem, simply take a pre-converted set of images and copy them to the navit/xpm folder. You may take the ones provided with a pre-installed Navit release. You may have to touch them (<code>touch navit/xpm/*.png</code>) in order for make to find them new enough.
 +
* Go into the navit folder and run navit.exe
 +
 +
====Configuration of Navi====
 +
 +
* To make life easier, begin with a copy of navit.xml from an installed release of Navit
 +
* Copy the map file from the installed navit to the built one

Revision as of 12:23, 8 August 2011

Building navit with CMake on different platforms:

Known limitations

* Samplemap building is not implemented yet
* Not everything is copied to the build directory, so navit may fail to start after build

Building on *nix systems

Dependencies

* CMake 2.6 or newer 
* modern gcc (and g++ for Qt)
* FreeType 2.3.10 or newer 
* Glib (optional, but highly recommended)
* zlib (optional, but highly recommended)
* libpng (optional, but highly recommended)
* gtk2 for gtk graphics and gtk gui
* Qt for qt graphics. With qt 4.7 or newer qml gui is available
* SDL for sdl graphics
* OpenGL for opengl graphics
* libgpsd

Building

Get navit source code, create somewhere a directory for the build and then type

   cd /path/to/build/directory
   cmake /path/to/navit/source
   make

with cmake -i youll be able to configure various build aspects

Building on windows

Building with MinGW

You'll need MinGW with development headers and libs and CMake 2.6 or newer. FreeType is a used library (but not really required, Stand 4. August 2011), so get it from the http://www.gtk.org/download/win32.php (32 bit) or http://www.gtk.org/download/win64.php (64 bit). It is recommended to download a pkc-config and gettext from the site, mentioned above. You may get full GTK2 download too, as you will be able to use a gtk graphics and gui. Qt graphics modules works fine too, but Qml gui have issues.

When build environment is ready, get the navit source code, create directory for build and issue following commands:

 cd drive:/path/to/build/directory
 cmake drive:/path/to/navit/source -G "MinGW Makefiles"
 mingw32-make

arpy's detailled instructions proved to be working with r4672

Since all attempts suggested on the Navit on Windows page failed for weeks, we were given the hint to use CMake, and a link to this page, which I try now to enhance with my detailled instructions which worked for me finally. I hope you can find them useful too.

Unfortunately, since I am no Navit developer, this is a one-shot explanation (because the ones provided did not work for us!). I will not keep it up to date, please feel free to further enhance this HOWTO by yourself!

Setup the build Environment

  • Setup MinGW
    • Download MinGW from http://www.mingw.org/
    • Install to C:\MinGW (default) and use prepacked libs (default)
  • Setup GTK+
    • Download the GTK+ dev installer.
    • Install to C:\GTK (default) and select all components
    • Add an environment variable to have CMake find glib-2.0 later
      PKG_CONFIG_PATH=C:\GTK\lib\pkgconfig
  • Setup CMake
    • Download CMake 2.8.5 from http://www.cmake.org
    • Install to C:\CMake (not default!) and add configure adding it to the Path (not default!)
  • Install an image converter tool
    This is needed to convert the SVG vector graphics from the sources to actual pixel images for the runtime.
    • To use ImageMagick, download it from http://www.imagemagick.org, we took the 16 bit dll package.
    • Install to C:\ImageMagic (not default!) and have it added to your Path variable (not default!)
    • Make sure ImageMagic is in your Path variable before system32, it contains a convert.exe as well, and ImageMagic won't work.

Run a build

  • Open a MinGW shell
  • Go to the navit sources
  • Create a build directory next to the navit source directory and cd into it
  • Configure the build (assuming that ../navit is the navit source directory)
    cmake ../navit -G "MinGW Makefiles"
  • Hint: If CMake gives an error like sh.exe was found in your PATH, just ignore it and run the command again. CMake always seems to do this in an empty build directory.
  • Run the build
    mingw32-make
  • Hint: If it complanins during image conversions, and multiple runs won't overcome the problem, simply take a pre-converted set of images and copy them to the navit/xpm folder. You may take the ones provided with a pre-installed Navit release. You may have to touch them (touch navit/xpm/*.png) in order for make to find them new enough.
  • Go into the navit folder and run navit.exe

Configuration of Navi

  • To make life easier, begin with a copy of navit.xml from an installed release of Navit
  • Copy the map file from the installed navit to the built one