diff --git a/CMakeLists.txt b/CMakeLists.txt index ef31dae07..fb58b0124 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -384,9 +384,6 @@ endif() if (APPLE) set(INSTALL_SUBDIR OpenMW) - #install(FILES ${MISC_FILES} DESTINATION ../MacOS) - #install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Plugins" DESTINATION ..) - #install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Resources/resources" DESTINATION ../Resources) install(DIRECTORY "${APP_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) install(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) install(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" RENAME "openmw.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) @@ -394,9 +391,6 @@ if (APPLE) install(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) install(FILES "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) set(CPACK_GENERATOR "DragNDrop") - # set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/files/mac/Info.plist") - # set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw.icns") - # set(CPACK_BUNDLE_NAME "OpenMW") set(CPACK_PACKAGE_VERSION ${OPENMW_VERSION}) set(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO}) @@ -406,11 +400,13 @@ if (APPLE) set(PLUGINS "") # Scan Plugins dir for *.dylibs - file(GLOB ALL_PLUGINS "${APP_BUNDLE_DIR}/Contents/Plugins/*.dylib") + set(PLUGIN_SEARCH_ROOT "${APP_BUNDLE_DIR}/Contents/Plugins") + file(GLOB_RECURSE ALL_PLUGINS "${PLUGIN_SEARCH_ROOT}/*.dylib") + set(PLUGIN_INSTALL_BASE "\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}/${APP_BUNDLE_NAME}/Contents/Plugins") foreach(PLUGIN ${ALL_PLUGINS}) - get_filename_component(PLUGIN_FILENAME ${PLUGIN} NAME) - set(PLUGINS ${PLUGINS} "\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}/${APP_BUNDLE_NAME}/Contents/Plugins/${PLUGIN_FILENAME}") + string(REPLACE "${PLUGIN_SEARCH_ROOT}/" "" PLUGIN_RELATIVE "${PLUGIN}") + set(PLUGINS ${PLUGINS} "${PLUGIN_INSTALL_BASE}/${PLUGIN_RELATIVE}") endforeach() #For now, search unresolved dependencies only in default system paths, so if you put unresolveable (i.e. with @executable_path in id name) lib or framework somewhere else, it would fail diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index e46a06205..2879539a7 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -41,8 +41,10 @@ source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER} ${LAUNCHER_HEADER_MOC find_package(Qt4 REQUIRED) set(QT_USE_QTGUI 1) -#find_package(PNG REQUIRED) -#include_directories(${PNG_INCLUDE_DIR}) +if (NOT APPLE) # this dependency can be completely removed, but now it only tested on OS X + find_package(PNG REQUIRED) + include_directories(${PNG_INCLUDE_DIR}) +endif() QT4_ADD_RESOURCES(RCC_SRCS resources.qrc) QT4_WRAP_CPP(MOC_SRCS ${LAUNCHER_HEADER_MOC}) @@ -51,14 +53,14 @@ include(${QT_USE_FILE}) # list here plugins that can't be detected statically, but loaded in runtime # it needed for packaging automatisation -#set(USED_QT_PLUGINS imageformats/libqgif -# imageformats/libqico -# imageformats/libqjpeg -# imageformats/libqmng -# imageformats/libqsvg -# imageformats/libqtga -# imageformats/libqtiff) -# It seems that launcher works without this plugins, but it loads them into memory if they exists +set(USED_QT_PLUGINS imageformats/libqgif + imageformats/libqico + imageformats/libqjpeg + imageformats/libqmng + imageformats/libqsvg + imageformats/libqtga + imageformats/libqtiff) +# It seems that launcher works without this plugins, but it loads them if they exists # Main executable add_executable(omwlauncher @@ -71,7 +73,7 @@ target_link_libraries(omwlauncher ${Boost_LIBRARIES} ${OGRE_LIBRARIES} ${QT_LIBRARIES} -# ${PNG_LIBRARY} + ${PNG_LIBRARY} components ) @@ -86,10 +88,10 @@ if (APPLE) "${APP_BUNDLE_DIR}/../launcher.cfg") # copy used QT plugins into ${APP_BUNDLE_DIR}/Contents/Plugins - #foreach(PLUGIN ${USED_QT_PLUGINS}) - # get_filename_component(PLUGIN_FILENAME ${PLUGIN} NAME) - # configure_file("${QT_PLUGINS_DIR}/${PLUGIN}.dylib" "${APP_BUNDLE_DIR}/Contents/Plugins/${PLUGIN_FILENAME}.dylib" COPYONLY) - #endforeach() + foreach(PLUGIN ${USED_QT_PLUGINS}) + get_filename_component(PLUGIN_FILENAME ${PLUGIN} NAME) + configure_file("${QT_PLUGINS_DIR}/${PLUGIN}.dylib" "${APP_BUNDLE_DIR}/Contents/Plugins/${PLUGIN}.dylib" COPYONLY) + endforeach() else() configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss diff --git a/apps/launcher/main.cpp b/apps/launcher/main.cpp index 4e438a4db..93d23371e 100644 --- a/apps/launcher/main.cpp +++ b/apps/launcher/main.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "maindialog.hpp" @@ -17,6 +18,14 @@ int main(int argc, char *argv[]) dir.cdUp(); dir.cdUp(); } + + QDir pluginsPath(QCoreApplication::applicationDirPath()); + pluginsPath.cdUp(); + pluginsPath.cd("Plugins"); + + QStringList libraryPaths; + libraryPaths << pluginsPath.path() << QCoreApplication::applicationDirPath(); + app.setLibraryPaths(libraryPaths); #endif QDir::setCurrent(dir.absolutePath());