Fix:Build:Better bundle building
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 5 Sep 2011 15:57:52 +0000 (15:57 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 5 Sep 2011 15:57:52 +0000 (15:57 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4761 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/CMakeLists.txt
navit/navit/CMakeLists.txt
navit/navit/xpm/CMakeLists.txt

index 2e497cf..18cbf80 100644 (file)
@@ -453,6 +453,7 @@ endif()
 if (APPLE OR USE_UIKIT)
    set_with_reason(vehicle/iphone "apple detected" TRUE)
    set_with_reason(graphics/cocoa "apple detected" TRUE)
+   set(BUILD_BUNDLE TRUE)
 endif()
 
 set(LOCALEDIR "${LOCALE_DIR}/locale")
index 3c84970..d44fac2 100644 (file)
@@ -66,18 +66,27 @@ endforeach()
 add_subdirectory (fib-1.1)
 
 if(NOT ANDROID)
+   set(NAVIT_START_SRC start.c)
    if(WIN32 OR WINCE AND NOT WIN_OMIT_RESOURCES)
-      add_executable (navit start.c ${CMAKE_CURRENT_SOURCE_DIR}/gui/win32/resources/resource.rc)
+      list(APPEND NAVIT_START_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui/win32/resources/resource.rc)
    else()
       if (APPLE)
-          add_executable (navit MACOSX_BUNDLE start.c)
-      else()
-          add_executable (navit start.c)
+          set(NAVIT_START_SRC start_apple.m)
       endif()
    endif()
-   
+   if (BUILD_BUNDLE)
+      list(APPEND NAVIT_START_SRC resources/share)
+   endif()
+   add_executable(navit ${NAVIT_START_SRC})
    target_link_libraries (navit ${NAVIT_LIBNAME})
    set_target_properties(navit PROPERTIES COMPILE_DEFINITIONS "MODULE=${MODULE_NAME}")
+   if (BUILD_BUNDLE)
+      add_custom_command(OUTPUT resources/share COMMAND mkdir -p resources/share)
+      set_source_files_properties(resources/share PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+      set_target_properties(navit PROPERTIES MACOSX_BUNDLE TRUE)
+      add_dependencies(navit navit_config_xml_resource)
+      add_dependencies(navit images_resource)
+   endif()
 endif()
 
 if (SHARED_LIBNAVIT)
@@ -134,6 +143,7 @@ if(ANDROID)
    add_custom_target( navit_config_xml ALL DEPENDS navithdpi.xml navitmdpi.xml navitldpi.xml)
 else()
    process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml ${CMAKE_CURRENT_BINARY_DIR}/navit.xml "")
+   add_custom_target( navit_config_xml_resource DEPENDS navit.xml COMMAND mkdir -p resources/share/navit COMMAND cp navit.xml resources/share/navit)
    add_custom_target( navit_config_xml ALL DEPENDS navit.xml)
 endif()
 
index a614b83..c61e016 100644 (file)
@@ -100,6 +100,7 @@ foreach (IMAGE_SRC ${FILES_TO_PNG})
 endforeach()
 
 add_custom_target(images ALL DEPENDS ${IMAGE_TARGETS})
+add_custom_target(images_resource DEPENDS images COMMAND mkdir -p ../resources/share/navit/xpm COMMAND cp ${IMAGE_TARGETS} ../resources/share/navit/xpm)
 
 install(
    FILES ${IMAGE_TARGETS}