set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.navitproject.navit")
set(MACOSX_BUNDLE_BUNDLE_NAME "Navit")
project(navit C)
if(DEFINED CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER MATCHES "^$")
set(CMAKE_CXX_COMPILER CMAKE_CXX_COMPILER-NOTFOUND)
endif(DEFINED CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER MATCHES "^$")
if (NOT DISABLE_CXX)
enable_language(CXX OPTIONAL)
endif(NOT DISABLE_CXX)
cmake_minimum_required(VERSION 2.6)
cmake_policy(VERSION 2.6)
set(PACKAGE_VERSION "0.5.0")
set(PACKAGE_NAME "navit-svn")
set(PACKAGE "navit")
set(PACKAGE_STRING "${PACKAGE} ${PACKAGE_VERSION}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
include("${PROJECT_SOURCE_DIR}/cmake/navit_macros.cmake")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# install path
set(BIN_DIR bin)
set(SHARE_DIR share/navit)
set(LOCALE_DIR share/locale)
set(IMAGE_DIR share/navit/xpm)
set(LIB_DIR lib)
foreach(EXTRA_MODULE ${EXTRA_MODULES})
add_module(${EXTRA_MODULE} "extra module specified" TRUE)
endforeach()
if (EXTRA_LIBS)
list(APPEND NAVIT_LIBS ${EXTRA_LIBS})
endif(EXTRA_LIBS)
if (EXTRA_INCLUDES)
include_directories(${EXTRA_INCLUDES})
endif(EXTRA_INCLUDES)
### Detect environment
add_plugin(support/ezxml "native Glib found" FALSE)
add_plugin(support/glib "native Glib found" FALSE)
add_plugin(support/zlib "native zlib found" FALSE)
add_plugin(support/libpng "native libpng found" FALSE)
add_plugin(support/wordexp "native wordexp found" FALSE)
add_module(font/freetype "freetype not found" FALSE)
add_module(graphics/android "FreeType library not found" FALSE)
add_module(graphics/gd "FreeType library not found" FALSE)
add_module(graphics/gtk_drawing_area "FreeType library not found" FALSE)
add_module(graphics/opengl "FreeType library not found" FALSE)
add_module(graphics/sdl "FreeType library not found" FALSE)
add_module(graphics/qt_qpainter "Qt libraries not found" FALSE)
add_module(gui/qml "Qt Declarative not found" FALSE)
add_module(gui/gtk "GTK libs not found" FALSE)
add_module(vehicle/gpsd "gpsd lib not found" FALSE)
add_module(vehicle/gypsy "gypsy lib not found" FALSE)
add_module(vehicle/maemo "Default" FALSE)
add_module(binding/win32 "Default" FALSE)
add_module(binding/dbus "dbus-glib-1 not found" FALSE)
add_module(speech/dbus "dbus-glib-1 not found" FALSE)
add_module(speech/cmdline "neither system() nor CreateProcess() found" FALSE)
add_module(vehicle/gpsd_dbus "dbus-glib-1 not found" FALSE)
add_module(speech/speech_dispatcher "speech_dispatcher lib not found" FALSE)
add_module(autoload/osso "Default" FALSE)
add_module(map/garmin "Garmin library not found" FALSE)
add_feature(ENABLE_NLS "default" TRUE)
INCLUDE (CPack)
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckLibraryExists)
INCLUDE (CheckFunctionExists)
INCLUDE (CheckSymbolExists)
find_package(Glib)
find_package(Gmodule)
find_package(ZLIB)
find_package(Freetype)
find_package(SDL)
find_package(SDL_ttf)
find_package(SDL_image)
find_package(OpenGL)
find_package(GLUT)
find_package(GTK2 2.6 COMPONENTS gtk)
find_package(Gettext)
find_package(PNG)
find_package(DBusGLib)
find_package(OpenSSL)
find_package(Threads)
libfind_pkg_check_modules(FONTCONFIG fontconfig)
#Qt detection
if (NOT DISABLE_QT)
SET(QT_USE_QTSVG TRUE)
SET(QT_USE_QTXML TRUE)
SET(QT_USE_QTDECLARATIVE TRUE)
find_package(Qt4 COMPONENTS QtCore QtGui QtXml QtDeclarative QtSvg OPTIONAL)
endif (NOT DISABLE_QT)
#pkg-config based detection
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(QUESOGLC quesoglc)
pkg_check_modules(LIBGPS libgps)
pkg_check_modules(LIBLOCATION liblocation)
pkg_check_modules(LIBOSSO libosso)
pkg_check_modules(LIBGPS19 libgps>=2.90)
pkg_check_modules(LIBGARMIN libgarmin)
endif(PKG_CONFIG_FOUND)
#Simple checks
CHECK_INCLUDE_FILES(wordexp.h HAVE_WORDEXP)
CHECK_INCLUDE_FILES(endian.h HAVE_ENDIAN_H)
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILES(byteswap.h HAVE_BYTESWAP_H)
CHECK_LIBRARY_EXISTS(gypsy gypsy_control_get_default "" GYPSY_FOUND)
CHECK_INCLUDE_FILES(libspeechd.h HAVE_LIBSPEECHD)
CHECK_INCLUDE_FILES(sys/socket.h HAVE_SOCKET)
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
CHECK_INCLUDE_FILES(locale.h HAVE_LC_MESSAGES)
CHECK_INCLUDE_FILES(libintl.h HAVE_LIBINTL)
CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES(getopt.h HAVE_GETOPT_H)
CHECK_INCLUDE_FILES(string.h HAVE_STRING_H)
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
CHECK_SYMBOL_EXISTS(system stdlib.h HAVE_SYSTEM)
CHECK_SYMBOL_EXISTS(CreateProcess windows.h HAVE_CREATEPROCESS)
CHECK_SYMBOL_EXISTS(stpcpy string.h HAVE_STPCPY)
CHECK_FUNCTION_EXISTS(sbrk HAVE_SBRK)
CHECK_FUNCTION_EXISTS(getdelim HAVE_GETDELIM)
CHECK_FUNCTION_EXISTS(getline HAVE_GETLINE)
### Configure build
#Required libraries, supplied with navit
if (NOT HAVE_LIBINTL)
add_plugin(intl_cmake "native libintl missing" TRUE)
set(USE_LIBGNUINTL TRUE)
else()
CHECK_LIBRARY_EXISTS(intl libintl_fprintf "" NEEDS_LIBINTL)
if (NEEDS_LIBINTL)
list(APPEND NAVIT_LIBS intl)
set(INTL_LIBS intl)
endif(NEEDS_LIBINTL)
endif(NOT HAVE_LIBINTL)
if (CMAKE_USE_PTHREADS_INIT)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
endif(CMAKE_USE_PTHREADS_INIT)
if (Glib_FOUND)
set(HAVE_GLIB 1)
include_directories(${Glib_INCLUDE_DIRS})
list(APPEND NAVIT_LIBS ${Glib_LIBRARIES})
else(Glib_FOUND)
set_with_reason(support/glib "Glib not found" TRUE ${INTL_LIBS})
endif(Glib_FOUND)
if (Gmodule_FOUND)
set(HAVE_GMODULE 1)
include_directories(${Gmodule_INCLUDE_DIRS})
list(APPEND NAVIT_LIBS ${Gmodule_LIBRARIES})
endif(Gmodule_FOUND)
if(ZLIB_FOUND)
set(HAVE_ZLIB 1)
include_directories(${ZLIB_INCLUDE_DIRS})
list(APPEND NAVIT_LIBS ${ZLIB_LIBRARIES})
else(ZLIB_FOUND)
message(STATUS "using internal zlib")
set_with_reason(support/zlib "native zlib missing" TRUE)
endif(ZLIB_FOUND)
if(OPENSSL_CRYPTO_LIBRARIES)
set(HAVE_LIBCRYPTO 1)
include_directories(${OPENSSL_INCLUDE_DIR})
list(APPEND NAVIT_LIBS ${OPENSSL_CRYPTO_LIBRARIES})
endif()
if(PNG_FOUND)
set(HAVE_PNG 1)
include_directories(${PNG_INCLUDE_DIR})
list(APPEND NAVIT_LIBS ${PNG_LIBRARIES})
else(PNG_FOUND)
message(STATUS "using internal libpng")
set_with_reason(support/libpng "native libpng missing" TRUE)
endif(PNG_FOUND)
if (NOT HAVE_WORDEXP)
message(STATUS "wordexp.h not found. use internal wordexp")
set_with_reason(support/wordexp "native wordexp missing" TRUE)
endif()
if (NOT Glib_FOUND)
set_with_reason(support/ezxml "Glib not found" TRUE)
endif()
if(FREETYPE_FOUND)
pkg_check_modules(FRIBIDI fribidi)
pkg_check_modules(FRIBIDI2 fribidi>=0.19.0)
include_directories(${FREETYPE_INCLUDE_DIRS})
set_with_reason(font/freetype "freetype found" TRUE "${FREETYPE_LIBRARY};${FONTCONFIG_LDFLAGS};${FRIBIDI_LIBRARIES}")
else(FREETYPE_FOUND)
MESSAGE("No freetype library found, graphics modules may not be available")
set_with_reason(graphics/android "FreeType library not found" FALSE)
set_with_reason(graphics/gd "FreeType library not found" FALSE)
set_with_reason(graphics/gtk_drawing_area "FreeType library not found" FALSE)
set_with_reason(graphics/opengl "FreeType library not found" FALSE)
set_with_reason(graphics/sdl "FreeType library not found" FALSE)
endif(FREETYPE_FOUND)
if(FONTCONFIG_FOUND)
set(HAVE_FONTCONFIG 1)
endif(FONTCONFIG_FOUND)
if (QT_FOUND)
if (QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND FREETYPE_FOUND)
include(${QT_USE_FILE})
set_with_reason(graphics/qt_qpainter "Qt libraries found" TRUE ${QT_LIBRARIES})
if (QT_QTDECLARATIVE_FOUND AND QT_QTXML_FOUND)
set_with_reason(gui/qml "Qt Declarative found" TRUE ${QT_LIBRARIES})
endif()
if (QT_QTSVG_FOUND)
set(HAVE_QT_SVG 1)
elseif( USE_SVG AND graphics/qt_qpainter)
message( WARNING "QT compiled without SVG support")
endif()
endif()
endif(QT_FOUND)
if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})
set(HAVE_GTK2 1)
set_with_reason(gui/gtk "GTK libs found" TRUE ${GTK2_LIBRARIES})
if(FREETYPE_FOUND)
set_with_reason(graphics/gtk_drawing_area "GTK libs found" TRUE ${GTK2_LIBRARIES})
endif(FREETYPE_FOUND)
endif(GTK2_FOUND)
CHECK_LIBRARY_EXISTS(freeimage FreeImage_Load "" HAVE_FREEIMAGE)
if (USE_OPENGLES OR USE_OPENGLES2)
CHECK_LIBRARY_EXISTS(EGL eglInitialize "" HAVE_EGL)
endif(USE_OPENGLES OR USE_OPENGLES2)
if (FREETYPE_FOUND)
if (OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND AND OPENGL_INCLUDE_DIR)
message (STATUS "opengl found: ${OPENGL_gl_LIBRARY}")
include_directories(${OPENGL_INCLUDE_DIR})
if (USE_OPENGLES2)
set(USE_OPENGLES TRUE)
set(GRAPHICS_OPENGL_LIBRARY GLESv2 EGL)
elseif (USE_OPENGLES)
set(GRAPHICS_OPENGL_LIBRARY GLESv1_CM EGL)
else()
set(GRAPHICS_OPENGL_LIBRARY ${OPENGL_gl_LIBRARY};${OPENGL_glu_LIBRARY};${GLUT_glut_LIBRARY})
endif(USE_OPENGLES2)
if (HAVE_FREEIMAGE)
list(APPEND GRAPHICS_OPENGL_LIBRARY freeimage)
endif(HAVE_FREEIMAGE)
set_with_reason(graphics/opengl "Found OpenGL" TRUE ${GRAPHICS_OPENGL_LIBRARY})
else()
message (STATUS "opengl not found")
endif()
else()
message (STATUS "no Freetype found")
endif(FREETYPE_FOUND)
if(SDL_FOUND AND SDLIMAGE_FOUND AND FREETYPE_FOUND)
set(SDL_IMAGE 1)
if(SDLTTF_FOUND)
set(SDL_TTF 1)
list(APPEND SDL_LIBRARY ${SDLTTF_LIBRARY})
endif(SDLTTF_FOUND)
set_with_reason(graphics/sdl "SDL/SDL_image libs found" TRUE ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY})
endif(SDL_FOUND AND SDLIMAGE_FOUND AND FREETYPE_FOUND)
if (LIBGPS_FOUND)
set_with_reason(vehicle/gpsd "gpsd lib found" TRUE ${LIBGPS_LDFLAGS})
endif(LIBGPS_FOUND)
if (GYPSY_FOUND)
set_with_reason(vehicle/gypsy "gypsy lib found" TRUE)
endif(GYPSY_FOUND)
if (LIBGARMIN_FOUND)
include_directories(${LIBGARMIN_INCLUDE_DIRS})
set_with_reason(map/garmin "Garmin library found" TRUE ${LIBGARMIN_LDFLAGS})
endif(LIBGARMIN_FOUND)
if(DBusGLib_FOUND)
include_directories(${DBusGLib_INCLUDE_DIRS})
set_with_reason(binding/dbus "dbus-glib-1 found" TRUE ${DBusGLib_LIBRARIES})
set_with_reason(speech/dbus "dbus-glib-1 found" TRUE ${DBusGLib_LIBRARIES})
set_with_reason(vehicle/gpsd_dbus "dbus-glib-1 found" TRUE ${DBusGLib_LIBRARIES})
endif()
if (HAVE_LIBSPEECHD)
set_with_reason(speech/speech_dispatcher "speech_dispatcher lib found" TRUE speechd)
endif(HAVE_LIBSPEECHD)
if (HAVE_SYSTEM)
set_with_reason(speech/cmdline "system() call is available" TRUE)
endif(HAVE_SYSTEM)
if (HAVE_CREATEPROCESS)
set_with_reason(speech/cmdline "CreateProcess() call is available" TRUE)
endif(HAVE_CREATEPROCESS)
if (GETTEXT_FOUND)
execute_process(COMMAND echo "" COMMAND xgettext -L glade - RESULT_VARIABLE GETTEXT_RET)
if ("${GETTEXT_RET}" STREQUAL "0")
set(XGETTEXT_GLADE TRUE)
else()
set(XGETTEXT_GLADE FALSE)
endif()
endif(GETTEXT_FOUND)
if (LIBLOCATION_FOUND)
set_with_reason(vehicle/maemo "Maemo location library found" TRUE ${LIBLOCATION_LIBRARIES})
endif(LIBLOCATION_FOUND)
if (LIBOSSO_FOUND)
set_with_reason(autoload/osso "Maemo osso library found" TRUE ${LIBOSSO_LIBRARIES})
endif(LIBOSSO_FOUND)
#Independent modules
add_module(graphics/null "Default" TRUE)
add_module(osd/core "Default" TRUE)
add_module(vehicle/demo "Default" TRUE)
add_module(vehicle/file "Default" TRUE)
add_module(vehicle/null "Default" FALSE)
add_module(gui/internal "Default" TRUE)
add_module(map/binfile "Default" TRUE)
add_module(map/filter "Default" TRUE)
if(NOT MSVC)
add_module(map/mg "Default" TRUE)
endif(NOT MSVC)
add_module_plugin(support/shapefile "Default" TRUE)
set(map_shapefile_INCLUDES "${CMAKE_SOURCE_DIR}/navit/support/shapefile")
#set(map_shapefile_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/navit/support/shapefile")
set(map_shapefile_LIBS "support_shapefile")
add_module(map/shapefile "Default" TRUE)
add_module(map/textfile "Default" TRUE)
add_module(map/csv "Default" TRUE)
#Modules without test yet
add_module(plugin/pedestrian "Default" FALSE)
add_module(speech/android "Default" FALSE)
add_module(speech/espeak "Default" FALSE)
add_plugin(support/espeak "Default" FALSE)
add_module(vehicle/android "Default" FALSE)
add_module(vehicle/iphone "Default" FALSE)
add_module(vehicle/wince "Default" FALSE)
add_module(graphics/cocoa "Default" FALSE)
# other features
add_feature(USE_PLUGINS "default" TRUE)
add_feature(SHARED_LIBNAVIT "default" FALSE)
add_feature(USE_ROUTING "default" TRUE)
add_feature(USE_SVG "default" TRUE)
add_feature(SVG2PNG "default" TRUE)
add_feature(SAMPLE_MAP "default" TRUE)
IF(NOT svg2png_scaling)
set(svg2png_scaling 0 32 48 64)
ENDIF()
IF(NOT svg2png_scaling_flag)
set(svg2png_scaling_flag 32)
ENDIF()
IF(NOT svg2png_scaling_nav)
set(svg2png_scaling_nav 64)
ENDIF()
add_feature(DBUS_USE_SYSTEM_BUS "default" FALSE)
add_feature(BUILD_MAPTOOL "default" TRUE)
add_feature(XSL_PROCESSING "default" TRUE)
find_program(XSLT_PROCESSOR NAMES saxon saxon8 saxon-xslt saxonb-xslt xsltproc transform.exe)
if(XSLT_PROCESSOR)
execute_process(COMMAND ${XSLT_PROCESSOR} -snone ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test.xml ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test.xslt
RESULT_VARIABLE SAXON_ERROR ERROR_QUIET)
if (NOT SAXON_ERROR)
set (XSLT_PROCESSOR_OPTIONS -snone)
endif()
else()
cfg_feature(XSL_PROCESSING "Saxon missing" FALSE)
endif(XSLT_PROCESSOR)
if (NOT XSL_PROCESSING)
message(WARNING "XSLT processing disabled. You have to configure navit.xml yourself, or enable XSLT processing.")
endif()
### Platform specific settings
if(NOT CACHE_SIZE)
SET(CACHE_SIZE 1048576)
endif(NOT CACHE_SIZE)
if(WIN32 OR WINCE)
SET(CMAKE_EXECUTABLE_SUFFIX ".exe")
add_module(graphics/win32 "Windows detected" TRUE)
add_plugin(support/win32 "Windows detected" TRUE)
SET(CMAKE_RC_COMPILE_OBJECT " -O coff -I ${CMAKE_CURRENT_SOURCE_DIR}/navit/gui/win32/resources -i