Commits

Vincent Rabeux committed 0390a92

Fixed packaging on Mac OS X. closes #3.

  • Participants
  • Parent commits 1ef58a9

Comments (0)

Files changed (9)

documentImageCreator/src/framework/DocumentCreator/context/backgroundcontext.cpp

 #include "backgroundcontext.h"
 
+#include <QApplication>
+
 namespace Context {
 	BackgroundContext* BackgroundContext::_instance;
 
 	}
 
 	void BackgroundContext::initialize(QString path){
+//		#ifdef Q_OS_MAC
+//						path = qApp->applicationDirPath()+"/"+path;
+//		#endif
+		
 		QStringList fileExtensions;
 		fileExtensions << QString(".jpg");
 		fileExtensions << QString(".png");

documentImageCreator/src/framework/DocumentCreator/context/fontcontext.cpp

 #include "fontcontext.h"
+#include <QApplication>
 
 namespace Context {
 	FontContext* FontContext::_instance;
 	}
 
 	void FontContext::initialize(QString path, QString fileExtension){
-        qDebug() << "FontContext::initialize  : path =" << path << "fileextention : " << fileExtension;
+//#ifdef Q_OS_MAC
+//				path = qApp->applicationDirPath()+"/"+path;
+//#endif
 		FontContext* inst = instance();
 		inst->setVars(path, fileExtension);
 		QDir directory(path);

documentImageCreator/src/framework/DocumentCreator/core/configurationmanager.cpp

 #include "configurationmanager.h"
 #include <QApplication>
+#include <QDebug>
 
 namespace Core {
 	QSettings* ConfigurationManager::_settings;
 
 	void ConfigurationManager::initialize(QString file, QObject* parent)
 	{
+#ifdef Q_OS_MAC
+		qDebug() << " INI path =" << qApp->applicationDirPath()+"/"+file;
+		_settings = new QSettings(qApp->applicationDirPath()+"/"+file, QSettings::IniFormat, parent);
+#endif
+#ifndef Q_OS_MAC
 		_settings = new QSettings(file, QSettings::IniFormat, parent);
+#endif
 	}
 
 	QVariant ConfigurationManager::get(QString group, QString key)

documentImageCreator/src/gui/AncientDocumentEditor/CMakeLists.txt

+### Cmake requirements
 cmake_minimum_required(VERSION 2.8)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
 
+####################################
+############ The Project ###########
+####################################
 PROJECT(AncientDocumentEditor)
-SET( CMAKE_COLOR_MAKEFILE ON )
-#SET( CMAKE_VERBOSE_MAKEFILE ON )
+SET( PROGNAME AncientDocumentEditor )
 
-
-project(AncientDocumentEditor)
-
+#---
+#### Options for conf
+#---
 option(NO_DOQUBOOK "deactivate doqubook even if installed on system" OFF)
 
-
+#---
+### Packaging infos.
+#---
 set(AncientDocumentEditor_DESCRIPTION "GUI to create synthetics documents. Developped for the ANR-Digidoc project")
-
 set(AncientDocumentEditor_AUTHOR "Vincent Rabeux <rabeux@labri.fr>")
 set(AncientDocumentEditor_VENDOR "labri")
-
 set(AncientDocumentEditor_MAJOR_VERSION 0)
 set(AncientDocumentEditor_MINOR_VERSION 1)
 set(AncientDocumentEditor_PATCH_VERSION 2)
 set(AncientDocumentEditor_VERSION ${AncientDocumentEditor_MAJOR_VERSION}.${AncientDocumentEditor_MINOR_VERSION}.${AncientDocumentEditor_PATCH_VERSION})
 
 
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
 
+
+#---
+### Libs
+#---
 find_package(Qt4 4.4.3  REQUIRED )
 
-
 SET( QT_USE_QTXML TRUE )
 SET( QT_USE_QTXMLPATTERNS TRUE )
 SET( QT_USE_QTNETWORK TRUE )
+INCLUDE( ${QT_USE_FILE} )
   
-
 FIND_PACKAGE(Lipsum4Qt REQUIRED)
 include_directories(${Lipsum4Qt_INCLUDE_DIRS})
 
 FIND_PACKAGE(DocumentCreator REQUIRED)
 include_directories(${DocumentCreator_INCLUDE_DIRS})
 
-
+#- DoQuBook is not required
 if(NOT NO_DOQUBOOK)
-FIND_PACKAGE(DoQuBook QUIET)
-
-if(DoQuBook_FOUND)
-    message("==> Activating DoQuBook features")
-    add_definitions("-DDOQUBOOK_FOUND")
-    include_directories(${DoQuBook_INCLUDE_DIRS})
-    set(EXTRA_LIBS ${EXTRA_LIBS} ${DoQuBook_LIBRARIES})
-endif(DoQuBook_FOUND)
-
+	FIND_PACKAGE(DoQuBook QUIET)
+	if(DoQuBook_FOUND)
+    	message("==> Activating DoQuBook features")
+    	add_definitions("-DDOQUBOOK_FOUND")
+    	include_directories(${DoQuBook_INCLUDE_DIRS})
+    	set(EXTRA_LIBS ${EXTRA_LIBS} ${DoQuBook_LIBRARIES})
+		endif(DoQuBook_FOUND)
 endif(NOT NO_DOQUBOOK)
 
 
-
-INCLUDE( ${QT_USE_FILE} )
-
-
+#---
+### Sources files
+#---
 file(
 GLOB_RECURSE
 AncientDocumentCreator_moc
 	src/*.ui
 )
 
+#---
+#### Resources files and conf variables 
+#---
+
+#- The icon :
+set( APP_ICON ${CMAKE_CURRENT_SOURCE_DIR}/adoc.icns )
+
+#- Qt Resources
+file(
+        GLOB_RECURSE
+        AncientDocumentCreator_rcs
+        src/*.qrc
+)
+
+#- File resources
 set(install true)
-
+# if in debug :
 if(NOT install)
 set(fontfolder ../../../../font/)
 set(backgroundfolder ../../../../background/)
 set(formatsfolder ../../../../keyboard/)
 endif()
 
-
+# if in release / packaging mode 
 if(install)
 set(fontfolder ../../../font/)
 set(backgroundfolder ../../../background/)
 set(installxmlcheckerfolder ${CMAKE_INSTALL_PREFIX}/share/AncientDocumentEditor/xmlchecker/)
 set(installformatsfolder ${CMAKE_INSTALL_PREFIX}/share/AncientDocumentEditor/keyboard/)
 
-install (DIRECTORY ${fontfolder} DESTINATION  share/AncientDocumentEditor/font)
-install (DIRECTORY ${backgroundfolder} DESTINATION share/AncientDocumentEditor/background)
-install (DIRECTORY ${xmlcheckerfolder} DESTINATION share/AncientDocumentEditor/xmlchecker)
-install (DIRECTORY ${formatsfolder} DESTINATION share/AncientDocumentEditor/keyboard)
-
+if(APPLE)
+	set(installfontfolder ../Resources/font/)
+	set(installbackgroundfolder ../Resources/background/)
+	set(installxmlcheckerfolder ../Resources/xmlchecker/)
+	set(installformatsfolder ../Resources/keyboard/)
+endif(APPLE)
 endif()
 
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/application.ini.in
                ${CMAKE_CURRENT_SOURCE_DIR}/src/application.ini
                @ONLY)
 
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/application.ini DESTINATION share/AncientDocumentEditor/)
 set(APPLICATION_INI_PATH ${CMAKE_INSTALL_PREFIX}/share/AncientDocumentEditor/application.ini)
+if(APPLE)
+	set(APPLICATION_INI_PATH ../Resources/application.ini)
+endif()
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/appconstants.h.in
-               ${CMAKE_CURRENT_SOURCE_DIR}/src/appconstants.h
-               @ONLY)
+CONFIGURE_FILE(
+	${CMAKE_CURRENT_SOURCE_DIR}/AncientDocumentEditor.desktop.in
+	${CMAKE_CURRENT_BINARY_DIR}/AncientDocumentEditor.desktop
+	@ONLY)
 
-file(
-        GLOB_RECURSE
-        AncientDocumentCreator_rcs
-        src/*.qrc
+#---
+### Building Rules
+#---
+
+CONFIGURE_FILE(
+	${CMAKE_CURRENT_SOURCE_DIR}/src/appconstants.h.in
+	${CMAKE_CURRENT_SOURCE_DIR}/src/appconstants.h
+	@ONLY
 )
 
-
-
-
-set( APP_ICON ${CMAKE_CURRENT_SOURCE_DIR}/adoc.icns )
-message("ICON")
-message(${APP_ICON})
-IF( APPLE )
-    SET( PROGNAME AncientDocumentEditor )
-    SET( MACOSX_BUNDLE_ICON_FILE adoc.icns )
-    SET_SOURCE_FILES_PROPERTIES(${APP_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
-    SET( MACOSX_BUNDLE_SHORT_VERSION_STRING 0.1 )
-    SET( MACOSX_BUNDLE_VERSION 0.7-beta2 )
-    SET( MACOSX_BUNDLE_LONG_VERSION_STRING Version 0.1 )
-    #SET( CMAKE_OSX_ARCHITECTURES i686 ) #Comment out if not universal binary
-ELSE( APPLE )
-    SET( PROGNAME AncientDocumentEditor )
-ENDIF( APPLE )
-
-if( UNIX AND NOT APPLE )
-
-    SET(PACKAGE_INSTALL_PREFIX /usr/local)
-    set(CMAKE_INSTALL_PREFIX ${PACKAGE_INSTALL_PREFIX})
-
-    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/images/appicon.png DESTINATION share/AncientDocumentEditor/)
-    set(APPLICATION_ICON_PATH ${CMAKE_INSTALL_PREFIX}/share/AncientDocumentEditor/appicon.png)
-
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/AncientDocumentEditor.desktop DESTINATION  /usr/share/applications)
-
-    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/AncientDocumentEditor.desktop.in
-               ${CMAKE_CURRENT_BINARY_DIR}/AncientDocumentEditor.desktop
-               @ONLY)
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/AncientDocumentEditor.desktop DESTINATION  /usr/share/applications/)
-
-endif( UNIX AND NOT APPLE )
-
-
 QT4_ADD_RESOURCES(RCS ${AncientDocumentCreator_rcs} )
 QT4_WRAP_UI(UI ${AncientDocumentCreator_ui})
 QT4_WRAP_CPP(MOC ${AncientDocumentCreator_moc})
 INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} )
 INCLUDE_DIRECTORIES( ./src )
 
-SET(EXTRA_LIBS  ${EXTRA_LIBS} ${QT_LIBRARIES} ${Lipsum4Qt_LIBRARIES} ${DocumentCreator_LIBRARIES})
+SET(ALL_SOURCES ${AncientDocumentCreator_sources}  ${MOC} ${RCS} ${UI} ${APP_ICON})
 
-
- #IF( APPLE )
- #   ADD_EXECUTABLE(${PROGNAME} MACOSX_BUNDLE ${AncientDocumentCreator_sources}  ${MOC} ${RCS} ${UI})
- #   ADD_CUSTOM_COMMAND( TARGET ${PROGNAME} POST_BUILD
- #     #COMMAND mkdir ARGS ${CMAKE_CURRENT_BINARY_DIR}/${PROGNAME}.app/Contents/Resources
- #     COMMAND cp ARGS ${CMAKE_SOURCE_DIR}/${MACOSX_BUNDLE_ICON_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${PROGNAME}.app/Contents/Resources
-#      #COMMAND cp -r src/images ${CMAKE_CURRENT_BINARY_DIR}/${PROGNAME}.app/Contents/Resources
-#      #COMMAND cp  application.ini ${CMAKE_CURRENT_BINARY_DIR}/${PROGNAME}.app/Contents/Resources
-#    )
-#  ELSE( APPLE )
-    #ADD_EXECUTABLE(${PROGNAME} ${AncientDocumentCreator_sources}  ${MOC} ${RCS} ${UI})
-SET(ALL_SOURCES ${AncientDocumentCreator_sources}  ${MOC} ${RCS} ${UI} ${APP_ICON})
 ADD_EXECUTABLE(${PROGNAME} MACOSX_BUNDLE WIN32
         ${ALL_SOURCES}
 )
-
-#    if(UNIX AND NOT APPLE)
-#       INSTALL( TARGETS ${PROGNAME} DESTINATION bin )
-#       install( FILES ${APP_ICON} DESTINATION share/icons )
-#	INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_ENTRY} DESTINATION share/applications)
- #   endif(UNIX AND NOT APPLE)
- # ENDIF( APPLE )
-
-
+SET(EXTRA_LIBS  ${EXTRA_LIBS} ${QT_LIBRARIES} ${Lipsum4Qt_LIBRARIES} ${DocumentCreator_LIBRARIES})
 TARGET_LINK_LIBRARIES(${PROGNAME} ${EXTRA_LIBS})
 
-##########################################################################################
-##########################################################################################
-##########################################################################################
-## PACKAGING
-
+#---
+### Install Rules
+#---
+#- Resources 
 SET(NAME ${PROGNAME})
 
-#--------------------------------------------------------------------------------
-# def des variable necesaires :
-# APPS : est utilisé pour CPack
+if(install)
+	if(UNIX AND NOT APPLE)
+		install (DIRECTORY ${fontfolder} DESTINATION  share/AncientDocumentEditor/font)
+		install (DIRECTORY ${backgroundfolder} DESTINATION share/AncientDocumentEditor/background)
+		install (DIRECTORY ${xmlcheckerfolder} DESTINATION share/AncientDocumentEditor/xmlchecker)
+		install (DIRECTORY ${formatsfolder} DESTINATION share/AncientDocumentEditor/keyboard)
+		install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/application.ini DESTINATION share/AncientDocumentEditor/)
+	endif(UNIX AND NOT APPLE)
+
+	if(APPLE)
+		install (DIRECTORY ${fontfolder} DESTINATION  ${NAME}.app/Contents/Resources/font)
+		install (DIRECTORY ${backgroundfolder} DESTINATION ${NAME}.app/Contents/Resources/background)
+		install (DIRECTORY ${xmlcheckerfolder} DESTINATION ${NAME}.app/Contents/Resources/xmlchecker)
+		install (DIRECTORY ${formatsfolder} DESTINATION ${NAME}.app/Contents/Resources/keyboard)
+		install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/application.ini DESTINATION ${NAME}.app/Contents/Resources/ COMPONENT Runtime)
+
+	endif(APPLE)
+endif()
+
+
+if( UNIX AND NOT APPLE )
+    SET(PACKAGE_INSTALL_PREFIX /usr/local)
+    set(CMAKE_INSTALL_PREFIX ${PACKAGE_INSTALL_PREFIX})
+    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/images/appicon.png DESTINATION share/AncientDocumentEditor/)
+    set(APPLICATION_ICON_PATH ${CMAKE_INSTALL_PREFIX}/share/AncientDocumentEditor/appicon.png)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/AncientDocumentEditor.desktop DESTINATION  /usr/share/applications)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/AncientDocumentEditor.desktop DESTINATION  /usr/share/applications/)
+endif( UNIX AND NOT APPLE )
+
+INSTALL(TARGETS ${PROGNAME}
+	BUNDLE DESTINATION . COMPONENT Runtime
+	RUNTIME DESTINATION bin COMPONENT Runtime
+)
+
+#---
+### Packaging Rules
+#---
+SET(NAME ${PROGNAME})
+
+IF( APPLE )
+    SET( MACOSX_BUNDLE_ICON_FILE adoc.icns )
+    SET_SOURCE_FILES_PROPERTIES(${APP_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+    SET( MACOSX_BUNDLE_SHORT_VERSION_STRING 0.1 )
+    SET( MACOSX_BUNDLE_VERSION 0.7-beta2 )
+    SET( MACOSX_BUNDLE_LONG_VERSION_STRING Version 0.1 )
+    #SET( CMAKE_OSX_ARCHITECTURES i686 ) #Comment out if not universal binary
+		
+		#ADD_CUSTOM_COMMAND( TARGET ${PROGNAME} POST_BUILD
+		#     #COMMAND mkdir ARGS ${CMAKE_CURRENT_BINARY_DIR}/${PROGNAME}.app/Contents/Resources
+		#     COMMAND cp ARGS ${CMAKE_SOURCE_DIR}/${MACOSX_BUNDLE_ICON_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${PROGNAME}.app/Contents/Resources
+		#      #COMMAND cp -r src/images ${CMAKE_CURRENT_BINARY_DIR}/${PROGNAME}.app/Contents/Resources
+		#      #COMMAND cp  application.ini ${CMAKE_CURRENT_BINARY_DIR}/${PROGNAME}.app/Contents/Resources
+		#    )
+ENDIF( APPLE )
+
+
+#- Using bundle utilisties on Mac os x and Win32
+if(APPLE OR WIN32)
+	
 SET(plugin_dest_dir bin)
 SET(qtconf_dest_dir bin)
 SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${NAME}")
-IF(APPLE)
-SET(plugin_dest_dir ${NAME}.app/Contents)
-SET(qtconf_dest_dir ${NAME}.app/Contents/Resources)
-SET(APPS "\${CMAKE_INSTALL_PREFIX}/${NAME}.app")
-ENDIF(APPLE)
-IF(WIN32)
-SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${NAME}.exe")
-ENDIF(WIN32)
 
+	IF(APPLE)
+		SET(plugin_dest_dir ${NAME}.app/Contents)
+		SET(qtconf_dest_dir ${NAME}.app/Contents/Resources)
+		SET(APPS "\${CMAKE_INSTALL_PREFIX}/${NAME}.app")
+	ENDIF(APPLE)
+	IF(WIN32)
+		SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${NAME}.exe")
+	ENDIF(WIN32)
 
-#--------------------------------------------------------------------------------
-# Installation de QtTest, sure apple, le bundle se trouve à la racine,
-# sur les autres plate-forme dans bin
-INSTALL(TARGETS ${PROGNAME}
-BUNDLE DESTINATION . COMPONENT Runtime
-RUNTIME DESTINATION bin COMPONENT Runtime
+#- Qt plugins
+INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION ${plugin_dest_dir}/plugins COMPONENT Runtime)
+
+#- DoQuBookPlugins :
+if(APPLE)
+	set(DoQuBook_plugins /Library/Frameworks/DoQuBook.framework/PlugIns/)
+endif(APPLE)
+if(WIN32)
+	set(DoQuBook_plugins "C:/DoQuBook_plugins/")
+endif(WIN32)
+INSTALL(DIRECTORY ${DoQuBook_plugins} 
+		DESTINATION ${plugin_dest_dir}/DoQuBook_plugins 
+		COMPONENT Runtime
+		PATTERN "*.lib" EXCLUDE)
+
+if(APPLE)
+    SET(MY_OWN_INSTALL_PREFIX "/Applications" CACHE PATH "Prefix prepended to install directories")
+    SET(CMAKE_INSTALL_PREFIX "${MY_OWN_INSTALL_PREFIX}" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
+endif()
+
+#- Extralibs
+# Sort libs between .framework and .dylibs (.so or .dll), other file types are left behind
+set(LIBS ${EXTRA_LIBS})
+message(LIBS : ${LIBS})
+SET(BUNDLE_LIBS )
+SET(BUNDLE_FRAMEWORKS )
+FOREACH(item ${LIBS})
+  if(WIN32)
+	STRING(REPLACE "/lib/" "/bin/" item ${item})
+	STRING(REPLACE ".lib" ".dll" item ${item})
+  endif()
+  message("Testing item ext : "${CMAKE_SHARED_LIBRARY_SUFFIX}"   item "${item})
+  STRING(REGEX MATCH ".*${CMAKE_SHARED_LIBRARY_SUFFIX}" lib ${item})
+  IF(lib)
+	if(EXISTS ${lib})
+		LIST(APPEND BUNDLE_LIBS ${lib})
+	endif()
+  ENDIF(lib)
+  if(APPLE)
+	  STRING(REGEX MATCH ".*so" lib ${item})
+	  IF(lib)
+		if(EXISTS ${lib})
+			LIST(APPEND BUNDLE_LIBS ${lib})
+		endif()
+	  ENDIF(lib)
+  endif()
+  STRING(REGEX MATCH ".*framework" framework ${item})
+  if(framework AND APPLE)
+	LIST(APPEND BUNDLE_FRAMEWORKS ${framework})
+  endif(framework AND APPLE)
+ENDFOREACH(item ${LIBS})
+
+INSTALL(FILES ${BUNDLE_LIBS}
+			  DESTINATION ${plugin_dest_dir}/MacOS COMPONENT Runtime
 )
 
-IF(APPLE OR WIN32)
-#--------------------------------------------------------------------------------
-# On copie le dossier de plugins QT dans le bundle courant
-INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION ${plugin_dest_dir}/plugins COMPONENT Runtime)
+#INSTALL(DIRECTORY ${BUNDLE_FRAMEWORKS}
+#			  DESTINATION ${plugin_dest_dir}/Frameworks COMPONENT Runtime
+#)
 
+if(APPLE)
+	INSTALL(DIRECTORY /Library/Frameworks/Lipsum4Qt.framework
+				  DESTINATION ${plugin_dest_dir}/Frameworks COMPONENT Runtime
+	)
+endif()
 
-#if(APPLE)
-#set(DoQuBook_plugins /Library/Frameworks/DoQuBook.framework/PlugIns/)
-#INSTALL(DIRECTORY ${DoQuBook_plugins} DESTINATION ${plugin_dest_dir}/DoQuBook_plugins COMPONENT Runtime)
-#endif(APPLE)
-#message(DoQuBookPlugins_DIR = ${DoQuBook_plugins})
-
-#--------------------------------------------------------------------------------
-# installation du qt.conf
-# on insert du code cmake pour écrire le fichier dans le script d'installation
-
+#- qt.conf
 INSTALL(CODE "
-file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"\")
+	file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"\")
 " COMPONENT Runtime)
 
-## On install les fichiers de conf dans le bundle :
-MESSAGE(${Lipsum4Qt_LIBRARIES})
-MESSAGE(${NAME}.app/Contents/Frameworks)
+
+#- qt_menu.nib
+if(APPLE)
+	install (DIRECTORY ${QT_LIBRARY_DIR}/QtGui.framework/Resources/qt_menu.nib DESTINATION ${NAME}.app/Contents/Resources)
+endif(APPLE)
+
+
+#- Répèrtoire à regarder pour les dépendance
+SET(DIRS ${QT_LIBRARY_DIRS} ${DoQuBook_plugins}/lib /usr/local/lib/ /usr/local /Library/Frameworks /usr/lib)
+
+#- on insert du code cmake pour utiliser BundleUtilities dans le script d'installation
+INSTALL(CODE "
+file(GLOB_RECURSE QTPLUGINS
+\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
+file(GLOB_RECURSE DOQUBOOKPLUGINS
+\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/DoQuBook_plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
+include(BundleUtilities)
+SET(PLUGINS \${QTPLUGINS})
+SET(PLUGINS \${QTPLUGINS} \${DOQUBOOKPLUGINS})
+fixup_bundle(\"${APPS}\" \"\${PLUGINS}\" \"${DIRS}\")
+" COMPONENT Runtime)
 
 endif(APPLE OR WIN32)
 
-IF(APPLE)
-install (DIRECTORY ${Lipsum4Qt_LIBRARIES} DESTINATION ${NAME}.app/Contents/Frameworks)
-
-#--------------------------------------------------------------------------------
-# On copie le qt_menu.nib de QT dans le bundle courant
-install (DIRECTORY ${QT_LIBRARY_DIR}/QtGui.framework/Resources/qt_menu.nib DESTINATION ${NAME}.app/Contents/Resources)
-#--------------------------------------------------------------------------------
-# Grace a BundleUtilities on peux copier les libs nécessaire dans la partie
-# Frameworks du bundle
-
-
-
-#install (FILES ${CMAKE_CURRENT_BINARY_DIR}/application.ini DESTINATION ${NAME}.app/Contents/MacOS/)
-install (DIRECTORY ${fontfolder} DESTINATION ${NAME}.app/Contents/Resources)
-install (DIRECTORY ${backgroundfolder} DESTINATION ${NAME}.app/Contents/Resources)
-install (DIRECTORY ${xmlcheckerfolder} DESTINATION ${NAME}.app/Contents/Resources)
-install (DIRECTORY ${formatsfolder} DESTINATION ${NAME}.app/Contents/Resources)
-
-endif(APPLE)
-
-# Répèrtoire à regarder pour les dépendance
-message("QT LIB DIRS : " ${QT_LIBRARY_DIRS})
-SET(DIRS ${QT_LIBRARY_DIRS} ${EXTRA_LIBS})
-
-# on insert du code cmake pour utiliser BundleUtilities dans le script d'installation
-INSTALL(CODE "
-file(GLOB_RECURSE QTPLUGINS
-\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
-include(BundleUtilities)
-SET(PLUGINS \${QTPLUGINS})
-fixup_bundle(\"${APPS}\" \"\${PLUGINS}\" \"${DIRS}\")
-" COMPONENT Runtime)
-
-# on utilise cpack : "cpack -G DragNDrop CPackConfig.cmake" sur mac os x
-# le CPackConfig.cmake est créer par un premier cmake
-# Command osx /Applications/CMake\ 2.8-1.app/Contents/bin/cpack -G DragNDrop CPackConfig.cmake
-
-IF(APPLE)
-
-SET(CPACK_GENERATOR "DragNDrop")
-#set(CPACK_BINARY_DRAGNDROP ON)
-
-endif(APPLE)
-
-
+#- CPack Settings
 
 set(CPACK_PACKAGE_NAME AncientDocumentEditor)
-
 set(CPACK_PACKAGE_VENDOR ${AncientDocumentEditor_VENDOR})
 SET(CPACK_PACKAGE_VERSION "${AncientDocumentEditor_VERSION}")
 SET(CPACK_PACKAGE_VERSION_MAJOR "${AncientDocumentEditor_MAJOR_VERSION}")
 	SET(CPACK_NSIS_MODIFY_PATH ON)
 endif()
 
+IF(APPLE)
+SET(CPACK_GENERATOR "DragNDrop")
+endif(APPLE)
+
+
 IF(UNIX AND NOT APPLE)
         SET(CPACK_GENERATOR "DEB")
         SET(CPACK_DEBIAN_PACKAGE_NAME "AncientDocumentEditor")

documentImageCreator/src/gui/AncientDocumentEditor/cmake/Modules/LibFindMacros.cmake

-# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments
-# used for the current package. For this to work, the first parameter must be the
-# prefix of the current package, then the prefix of the new package etc, which are
-# passed to find_package.
-macro (libfind_package PREFIX)
-  set (LIBFIND_PACKAGE_ARGS ${ARGN})
-  if (${PREFIX}_FIND_QUIETLY)
-    set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET)
-  endif (${PREFIX}_FIND_QUIETLY)
-  if (${PREFIX}_FIND_REQUIRED)
-    set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED)
-  endif (${PREFIX}_FIND_REQUIRED)
-  find_package(${LIBFIND_PACKAGE_ARGS})
-endmacro (libfind_package)
-
-# CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
-# where they added pkg_check_modules. Consequently I need to support both in my scripts
-# to avoid those deprecated warnings. Here's a helper that does just that.
-# Works identically to pkg_check_modules, except that no checks are needed prior to use.
-macro (libfind_pkg_check_modules PREFIX PKGNAME)
-  if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
-    include(UsePkgConfig)
-    pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
-  else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
-    find_package(PkgConfig)
-    if (PKG_CONFIG_FOUND)
-      pkg_check_modules(${PREFIX} ${PKGNAME})
-    endif (PKG_CONFIG_FOUND)
-  endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
-endmacro (libfind_pkg_check_modules)
-
-# Do the final processing once the paths have been detected.
-# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
-# all the variables, each of which contain one include directory.
-# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
-# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
-# Also handles errors in case library detection was required, etc.
-macro (libfind_process PREFIX)
-  # Skip processing if already processed during this run
-  if (NOT ${PREFIX}_FOUND)
-    # Start with the assumption that the library was found
-    set (${PREFIX}_FOUND TRUE)
-
-    # Process all includes and set _FOUND to false if any are missing
-    foreach (i ${${PREFIX}_PROCESS_INCLUDES})
-      if (${i})
-        set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
-        mark_as_advanced(${i})
-      else (${i})
-        set (${PREFIX}_FOUND FALSE)
-      endif (${i})
-    endforeach (i)
-
-    # Process all libraries and set _FOUND to false if any are missing
-    foreach (i ${${PREFIX}_PROCESS_LIBS})
-      if (${i})
-        set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
-        mark_as_advanced(${i})
-      else (${i})
-        set (${PREFIX}_FOUND FALSE)
-      endif (${i})
-    endforeach (i)
-
-    # Print message and/or exit on fatal error
-    if (${PREFIX}_FOUND)
-      if (NOT ${PREFIX}_FIND_QUIETLY)
-        message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
-      endif (NOT ${PREFIX}_FIND_QUIETLY)
-    else (${PREFIX}_FOUND)
-      if (${PREFIX}_FIND_REQUIRED)
-        foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
-          message("${i}=${${i}}")
-        endforeach (i)
-        message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
-      endif (${PREFIX}_FIND_REQUIRED)
-    endif (${PREFIX}_FOUND)
-  endif (NOT ${PREFIX}_FOUND)
-endmacro (libfind_process)
-
-macro(libfind_library PREFIX basename)
-  set(TMP "")
-  if(MSVC80)
-    set(TMP -vc80)
-  endif(MSVC80)
-  if(MSVC90)
-    set(TMP -vc90)
-  endif(MSVC90)
-  set(${PREFIX}_LIBNAMES ${basename}${TMP})
-  if(${ARGC} GREATER 2)
-    set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
-    string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
-    set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
-  endif(${ARGC} GREATER 2)
-  find_library(${PREFIX}_LIBRARY
-    NAMES ${${PREFIX}_LIBNAMES}
-    PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}
-  )
-endmacro(libfind_library)
-

documentImageCreator/src/gui/AncientDocumentEditor/cmake/Modules/LibFindMacros.cmake.backup

+# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments
+# used for the current package. For this to work, the first parameter must be the
+# prefix of the current package, then the prefix of the new package etc, which are
+# passed to find_package.
+macro (libfind_package PREFIX)
+  set (LIBFIND_PACKAGE_ARGS ${ARGN})
+  if (${PREFIX}_FIND_QUIETLY)
+    set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET)
+  endif (${PREFIX}_FIND_QUIETLY)
+  if (${PREFIX}_FIND_REQUIRED)
+    set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED)
+  endif (${PREFIX}_FIND_REQUIRED)
+  find_package(${LIBFIND_PACKAGE_ARGS})
+endmacro (libfind_package)
+
+# CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
+# where they added pkg_check_modules. Consequently I need to support both in my scripts
+# to avoid those deprecated warnings. Here's a helper that does just that.
+# Works identically to pkg_check_modules, except that no checks are needed prior to use.
+macro (libfind_pkg_check_modules PREFIX PKGNAME)
+  if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+    include(UsePkgConfig)
+    pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
+  else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+    find_package(PkgConfig)
+    if (PKG_CONFIG_FOUND)
+      pkg_check_modules(${PREFIX} ${PKGNAME})
+    endif (PKG_CONFIG_FOUND)
+  endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+endmacro (libfind_pkg_check_modules)
+
+# Do the final processing once the paths have been detected.
+# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
+# all the variables, each of which contain one include directory.
+# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
+# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
+# Also handles errors in case library detection was required, etc.
+macro (libfind_process PREFIX)
+  # Skip processing if already processed during this run
+  if (NOT ${PREFIX}_FOUND)
+    # Start with the assumption that the library was found
+    set (${PREFIX}_FOUND TRUE)
+
+    # Process all includes and set _FOUND to false if any are missing
+    foreach (i ${${PREFIX}_PROCESS_INCLUDES})
+      if (${i})
+        set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
+        mark_as_advanced(${i})
+      else (${i})
+        set (${PREFIX}_FOUND FALSE)
+      endif (${i})
+    endforeach (i)
+
+    # Process all libraries and set _FOUND to false if any are missing
+    foreach (i ${${PREFIX}_PROCESS_LIBS})
+      if (${i})
+        set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
+        mark_as_advanced(${i})
+      else (${i})
+        set (${PREFIX}_FOUND FALSE)
+      endif (${i})
+    endforeach (i)
+
+    # Print message and/or exit on fatal error
+    if (${PREFIX}_FOUND)
+      if (NOT ${PREFIX}_FIND_QUIETLY)
+        message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
+      endif (NOT ${PREFIX}_FIND_QUIETLY)
+    else (${PREFIX}_FOUND)
+      if (${PREFIX}_FIND_REQUIRED)
+        foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
+          message("${i}=${${i}}")
+        endforeach (i)
+        message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
+      endif (${PREFIX}_FIND_REQUIRED)
+    endif (${PREFIX}_FOUND)
+  endif (NOT ${PREFIX}_FOUND)
+endmacro (libfind_process)
+
+macro(libfind_library PREFIX basename)
+  set(TMP "")
+  if(MSVC80)
+    set(TMP -vc80)
+  endif(MSVC80)
+  if(MSVC90)
+    set(TMP -vc90)
+  endif(MSVC90)
+  set(${PREFIX}_LIBNAMES ${basename}${TMP})
+  if(${ARGC} GREATER 2)
+    set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
+    string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
+    set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
+  endif(${ARGC} GREATER 2)
+  find_library(${PREFIX}_LIBRARY
+    NAMES ${${PREFIX}_LIBNAMES}
+    PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}
+  )
+endmacro(libfind_library)
+

documentImageCreator/src/gui/AncientDocumentEditor/src/ancientdocumenteditor.cpp

     // Initialize font context
     QString fontpath = ConfigurationManager::get(AppConfigMainGroup,AppConfigFontFolderKey).toString()  ;
     QString fontext = ConfigurationManager::get(AppConfigMainGroup,AppConfigFontExtKey).toString();
-
+#ifdef Q_OS_MAC
+    fontpath = qApp->applicationDirPath()+"/"+fontpath;
+#endif
     qDebug() << "FontContext::initialize  : path =" << fontpath << "fileextention : " << fontext;
 
     FontContext::initialize(fontpath, fontext);
     FontContext::instance()->setCurrentFont(ConfigurationManager::get(AppConfigMainGroup, AppConfigDefaultFontKey).toString());
 
     QString backgroundpath = ConfigurationManager::get(AppConfigMainGroup,AppConfigBackgdFolderKey).toString();
+#ifdef Q_OS_MAC
+    backgroundpath = qApp->applicationDirPath()+"/"+backgroundpath;
+#endif
+    qDebug() << "BackGround Path " << backgroundpath;
+
     BackgroundContext::initialize(backgroundpath);
     BackgroundContext::instance()->setCurrentBackground(ConfigurationManager::get(AppConfigMainGroup, AppConfigDefaultBackbg).toString());
 
     _keyboard = ConfigurationManager::get(AppConfigKeyBoardGroup, AppConfigKbFolderKey).toString()
 		+ ConfigurationManager::get(AppConfigKeyBoardGroup, AppConfigKbDefautlFormatKey).toString();
-    qDebug() << _keyboard;
+//#ifdef Q_OS_MAC
+//    _keyboard  = qApp->applicationDirPath()+"/"+_keyboard ;
+//#endif
+
+    qDebug() << "Keyboard : " << _keyboard;
 
     createControllers();
     createActions();
     {
         QString XsdPath = ConfigurationManager::get(AppConfigMainGroup,AppConfigXmlCheckerFolderKey).toString()
                           + ConfigurationManager::get(AppConfigMainGroup,AppConfigDocumentXSDCheckerKey).toString();
+#ifdef Q_OS_MAC
+    XsdPath = qApp->applicationDirPath()+"/"+XsdPath;
+#endif
+
+
         QUrl schemaUrl(XsdPath);
         MessageHandler messageHandler;
         QXmlSchema schema;
     _docPropertiesView = new DocumentPropertiesView(_docController);
 
     QString keyboardPath = ConfigurationManager::get(AppConfigKeyBoardGroup, AppConfigKbFolderKey).toString() + ConfigurationManager::get(AppConfigKeyBoardGroup, AppConfigKbDefautlFormatKey).toString() ;
+#ifdef Q_OS_MAC
+    keyboardPath = qApp->applicationDirPath()+"/"+keyboardPath;
+#endif
+
+
     KeyboardViewDirector kbvDirector( new KeyboardViewXmlBuilder( keyboardPath ) );
     kbvDirector.constructKeyboardView();
     _keyboardView = kbvDirector.getKeyboardView();

documentImageCreator/src/gui/AncientDocumentEditor/src/appconstants.h

 #ifndef APPCONSTANTS_H
 #define APPCONSTANTS_H
 
-const QString AppConfigFile = "/usr/local/share/AncientDocumentEditor/application.ini";
+const QString AppConfigFile = "../Resources/application.ini";
 
 
 /* Groups config */

documentImageCreator/src/gui/AncientDocumentEditor/src/application.ini

 [mainapp]
 
-fontfolder=/usr/local/share/AncientDocumentEditor/font/
-backgroundfolder=/usr/local/share/AncientDocumentEditor/background/
-xmlcheckerfolder=/usr/local/share/AncientDocumentEditor/xmlchecker/
+fontfolder=../Resources/font/
+backgroundfolder=../Resources/background/
+xmlcheckerfolder=../Resources/xmlchecker/
 documentxsdchecker=document.xsd
 defaultfont=vesale 
 defaultfontextension=.of
 pagesizey=1782
 
 [keyboard]
-formatsfolder=/usr/local/share/AncientDocumentEditor/keyboard/
+formatsfolder=../Resources/keyboard/
 defaultformat=fr_alternative.kb