diff --git a/CMakeLists.txt b/CMakeLists.txt index 5475cb0195a4e0b20e7eb92d01e474738c35707e..aa1af2d9b3b2f74b95f5e46f6cc974c23344ef16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,9 @@ IF(POLICY CMP0022) ENDIF(POLICY CMP0022) SET(PROJ_NAME Ring) -SET(RING_VERSION "0.1.x") +SET(RING_VERSION "0.1.0") SET(RING_VERSION_NAME "Samuel de Champlain") -SET(BUNDLE_VERSION "Samuel de Champlain (0.1.x") +SET(BUNDLE_VERSION "Samuel de Champlain (0.1.0") SET(PROJ_COPYRIGHT " © 2015 Savoir-faire Linux \n GPLv3 https://www.gnu.org/copyleft/gpl.html") @@ -174,3 +174,46 @@ FOREACH(xib ${ringclient_XIBS}) COMMENT "Compiling ${CMAKE_CURRENT_SOURCE_DIR}/${xib}.xib") ENDFOREACH() + +set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${CMAKE_INSTALL_PREFIX}) + +SET(APPS "\${CMAKE_INSTALL_PREFIX}/${PROJ_NAME}.app") + +#-------------------------------------------------------------------------------- +# Install the QtTest application, on Apple, the bundle is at the root of the +# install tree +INSTALL(TARGETS ${PROJ_NAME} BUNDLE DESTINATION . COMPONENT Runtime) + +SET(QT_PLUGINS_DESTDIR ${PROJ_NAME}.app/Contents/Plugins/platforms) +#-------------------------------------------------------------------------------- +# Install needed Qt plugins by copying directories from the qt installation +LIST(APPEND QT_PLUGINS Qt5::QTgaPlugin Qt5::QTiffPlugin Qt5::QCocoaIntegrationPlugin) +FOREACH(plugin ${QT_PLUGINS}) + GET_TARGET_PROPERTY(_loc ${plugin} LOCATION) + INSTALL(FILES ${_loc} DESTINATION ${QT_PLUGINS_DESTDIR} COMPONENT Runtime) +ENDFOREACH() + +# directories to look for dependencies +SET(DIRS ${CMAKE_INSTALL_PREFIX}/lib ${QT_LIB_DIR}) + +INSTALL(CODE " + file(GLOB_RECURSE QTPLUGINS + \"\${CMAKE_INSTALL_PREFIX}/${QT_PLUGINS_DESTDIR}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\") + include(BundleUtilities) + SET(BU_CHMOD_BUNDLE_ITEMS TRUE) + fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\") + " COMPONENT Runtime) + +#================================ +# Packaging +#================================ +SET( CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJ_NAME}) +SET( CPACK_PACKAGE_NAME ${PROJ_NAME} ) +SET( CPACK_PACKAGE_CONTACT "Alexandre Lision") +SET( CPACK_PACKAGE_VENDOR "Savoir-faire Linux") +SET( CPACK_PACKAGE_VERSION_MAJOR ${PROG_MAJOR_VERSION}) +SET( CPACK_PACKAGE_VERSION_MINOR ${PROG_MINOR_VERSION}) +SET( CPACK_PACKAGE_VERSION_PATCH ${PROG_PATCH_VERSION}) +SET(CPACK_BINARY_DRAGNDROP ON) +SET( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") +INCLUDE(CPack) diff --git a/main.mm b/main.mm index b97e6126712ce671b683016d23a5a5b7ee5b635b..c1d86761437e639b1af1d57afc352a0f592f307d 100644 --- a/main.mm +++ b/main.mm @@ -29,9 +29,17 @@ */ #import <AppKit/NSApplication.h> // NSApplicationMain #import <qapplication.h> +#import <QDebug> +#import <QDir> int main(int argc, const char *argv[]) { + QDir dir(QString::fromUtf8(argv[0])); + dir.cdUp(); + dir.cdUp(); + dir.cd("Plugins"); + QCoreApplication::addLibraryPath(dir.absolutePath()); + qDebug() << "" << QCoreApplication::libraryPaths(); //Qt event loop will override native event loop QApplication* app = new QApplication(argc, const_cast<char**>(argv)); app->setAttribute(Qt::AA_MacPluginApplication);