486
494
# WinMain wrapper from QT_QTMAIN_LIBRARY is used and liner must be modified
487
495
LINK_LIBRARIES(${QT_QTMAIN_LIBRARY})
488
496
SET (GUI_TYPE WIN32)
490
SET (CMAKE_EXE_LINKER_FLAGS "/NODEFAULTLIB:msvcrtd.lib ${CMAKE_EXE_LINKER_FLAGS}")
498
SET (CMAKE_EXE_LINKER_FLAGS "/NODEFAULTLIB:msvcrtd.lib ${CMAKE_EXE_LINKER_FLAGS}")
492
500
SET (CMAKE_EXE_LINKER_FLAGS "/NODEFAULTLIB:msvcrt.lib ${CMAKE_EXE_LINKER_FLAGS}")
497
IF (APPLE AND WANT_BUNDLE)
498
SET(GUI_TYPE MACOSX_BUNDLE)
499
SET(MACOSX_BUNDLE_ICON_FILE tora.icns)
500
SET(APPLE_BUNDLE_SOURCES icons/tora.icns)
501
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/src/icons/tora.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
502
ENDIF (APPLE AND WANT_BUNDLE)
505
506
ADD_EXECUTABLE(${EXE_NAME} ${GUI_TYPE}
541
549
IF (NOT WANT_BUNDLE)
542
550
INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
543
551
ELSE (NOT WANT_BUNDLE)
553
SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/osx_tools/Info.plist.in")
554
SET(MACOSX_BUNDLE_ICON_FILE tora.icns)
555
SET(MACOSX_BUNDLE_INFO_STRING "${EXE_NAME} ${VERSION}")
556
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "com.torasql")
557
SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION}")
558
SET(MACOSX_BUNDLE_BUNDLE_NAME "${EXE_NAME}")
559
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION}")
560
SET(MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION}")
561
SET(MACOSX_BUNDLE_COPYRIGHT "(c) TOra developers")
562
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/src/icons/tora.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
564
# Warning: This is dangerous to touch. Except you know what are you doing.
565
# I ususaly don't know anything about it. But it's working ;)
544
567
INSTALL(TARGETS ${EXE_NAME} BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX})
569
IF (WANT_BUNDLE_STANDALONE)
570
# --- If we are on OS X copy all the embedded libraries to the app bundle
571
# -------- Function to build OS X Stand Alone Bundles -----------------
572
function(MakeOSXBundleApp target binary_dir)
573
#-- Set some useful variables
574
SET (OSX_MAKE_STANDALONE_BUNDLE_CMAKE_SCRIPT "${binary_dir}/${target}_OSX_MakeStandAloneBundle.cmake")
575
SET (OSX_MAKE_STANDALONE_BUNDLE_BASH_SCRIPT "${binary_dir}/${target}_OSX_MakeStandAloneBundle.sh")
576
#-- Configure the cmake file and the shell script
577
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/osx_tools/CompleteBundle.cmake.in"
578
"${OSX_MAKE_STANDALONE_BUNDLE_CMAKE_SCRIPT}" @ONLY IMMEDIATE)
579
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/osx_tools/CreateBundle.sh.in"
580
"${OSX_MAKE_STANDALONE_BUNDLE_BASH_SCRIPT}" @ONLY IMMEDIATE)
581
#-- Create the installation code
582
install(SCRIPT "${OSX_MAKE_STANDALONE_BUNDLE_CMAKE_SCRIPT}")
583
endfunction(MakeOSXBundleApp)
586
install(DIRECTORY ${QT_PLUGINS_DIR}/
587
DESTINATION ${PROJECT_BINARY_DIR}/Contents/Plugins/
588
REGEX "(designer|script|phonon_backend|debug|sqlite|ico)" EXCLUDE)
591
# glob for previously installed qt plugins to include in fixup_bundle
592
file(GLOB_RECURSE PluginList
593
${PROJECT_BINARY_DIR}/Contents/Plugins/*.bundle)
596
MakeOSXBundleApp(${EXE_NAME} ${PROJECT_BINARY_DIR})
598
# TODO/FIXME: this is evil! And it should be done automagically...
599
set(hack_bundle_pth "${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/MacOS")
600
INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/sqldrivers)")
601
INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/codecs)")
602
INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/accessible)")
603
INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/imageformats)")
604
INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/graphicssystems)")
605
function(hack_move_plugins filename targetdir)
607
message(STATUS \"file:: ${filename} -> targetdir: ${targetdir} ${hack_bundle_pth}\")
609
install(FILES ${hack_bundle_pth}/${filename} DESTINATION ${hack_bundle_pth}/${targetdir})
610
install(CODE "file(REMOVE ${hack_bundle_pth}/${filename})")
611
endfunction(hack_move_plugins)
612
hack_move_plugins("libqcncodecs.bundle" "codecs")
613
hack_move_plugins("libqjpcodecs.bundle" "codecs")
614
hack_move_plugins("libqtwcodecs.bundle" "codecs")
615
hack_move_plugins("libqkrcodecs.bundle" "codecs")
616
hack_move_plugins("libqsqlmysql.bundle" "sqldrivers")
617
hack_move_plugins("libqsqlodbc.bundle" "sqldrivers")
618
hack_move_plugins("libqsqlpsql.bundle" "sqldrivers")
619
hack_move_plugins("libqgif.bundle" "imageformats")
620
hack_move_plugins("libqjpeg.bundle" "imageformats")
621
hack_move_plugins("libqmng.bundle" "imageformats")
622
hack_move_plugins("libqsvg.bundle" "imageformats")
623
hack_move_plugins("libqtiff.bundle" "imageformats")
624
hack_move_plugins("libqtaccessiblewidgets.bundle" "accessible")
625
hack_move_plugins("libqtaccessiblecompatwidgets.bundle" "accessible")
626
hack_move_plugins("libqglgraphicssystem.bundle" "graphicssystems")
629
#-- Put an empty qt.conf file in the bundle so as to NOT load plugins from the installed Qt.
630
INSTALL(CODE "message(STATUS \"${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/qt.conf\")")
631
INSTALL(FILES "${CMAKE_SOURCE_DIR}/osx_tools/qt.conf.in"
632
DESTINATION "${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/"
635
if ("${QT_MAC_USE_COCOA}" STREQUAL "1")
636
INSTALL(CODE "message(STATUS \"Copying qt_menu.nib into ${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources\")")
637
INSTALL(CODE "file(MAKE_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/qt_menu.nib\")")
638
INSTALL(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
639
\"${QT_LIBRARY_DIR}/QtGui.framework/Resources/qt_menu.nib\"
640
\"${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/qt_menu.nib\")")
642
ENDIF (WANT_BUNDLE_STANDALONE)
545
644
ENDIF (NOT WANT_BUNDLE)