tools/CMakeLists.txt
author Wuzzy <Wuzzy2@mail.ru>
Fri, 11 Oct 2019 18:41:56 +0200
changeset 15465 a18f7e4681b8
parent 15334 8951eaad20e5
child 15555 107170c05bac
permissions -rw-r--r--
Add flame-less dynamite sprite for drowning dynamite
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9963
9e75dbffec81 drop extra spaces from a few CMakeLists.txt files
koda
parents: 9961
diff changeset
     1
if(NOT APPLE)
7817
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
     2
    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
     3
                   "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
     4
                    IMMEDIATE @ONLY)
2593
dd995a9c8871 add an uninstall target (to be tested)
koda
parents: 2550
diff changeset
     5
7817
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
     6
    add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
2593
dd995a9c8871 add an uninstall target (to be tested)
koda
parents: 2550
diff changeset
     7
endif()
dd995a9c8871 add an uninstall target (to be tested)
koda
parents: 2550
diff changeset
     8
10976
56f07b52213a Allow skipping the bundle step after install on OSX
koda
parents: 10975
diff changeset
     9
if(APPLE AND NOT SKIPBUNDLE)
13338
0b12b0d0d12c Fix outdated Qt CMake dependency for OS X
Wuzzy <Wuzzy2@mail.ru>
parents: 12386
diff changeset
    10
    find_package(Qt5 REQUIRED QUIET COMPONENTS Core Widgets Gui Network)
11362
ed5a6478e710 merge default
sheepluva
parents: 9703 11271
diff changeset
    11
    find_package(SDL2 REQUIRED)
12386
e4f8bf43224d fix build. sorry 'bout that.
sheepluva
parents: 11610
diff changeset
    12
    find_package(SDL2_image 2 REQUIRED)
e4f8bf43224d fix build. sorry 'bout that.
sheepluva
parents: 11610
diff changeset
    13
    find_package(SDL2_net 2 REQUIRED)
e4f8bf43224d fix build. sorry 'bout that.
sheepluva
parents: 11610
diff changeset
    14
    find_package(SDL2_ttf 2 REQUIRED)
e4f8bf43224d fix build. sorry 'bout that.
sheepluva
parents: 11610
diff changeset
    15
    find_package(SDL2_mixer 2 REQUIRED)
11610
523b153f7f22 Add FindOggVorbis to make sure all paths are set
koda
parents: 11609
diff changeset
    16
    find_package(OggVorbis REQUIRED)
10975
47c3a00f8037 Make sure that the png library name is always defined
koda
parents: 10974
diff changeset
    17
    find_package(PNG REQUIRED)
9679
dfaa39674e1e some improvements for sdl2 building (not complete nor clean)
koda
parents: 9347
diff changeset
    18
7817
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
    19
    if(NOT NOAUTOUPDATE)
8659
e49056d3aba1 fail if sparkle not found consciously
koda
parents: 8322
diff changeset
    20
        find_package(Sparkle) #needed for SPARKLE_FOUND variable
7817
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
    21
        #needed because the 'if' clause in the script prints silly policy warnings
9961
c18c66d621e5 consistent cmake checks
koda
parents: 9347
diff changeset
    22
        if(SPARKLE_FOUND)
7817
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
    23
            set(SPARKLE_FOUND 1)
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
    24
        else()
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
    25
            set(SPARKLE_FOUND 0)
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
    26
        endif()
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
    27
    endif()
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7112
diff changeset
    28
11609
b77870abb3c4 Update osx bundle creation with SDL2 library names
koda
parents: 11362
diff changeset
    29
    #remove the ";-framework Cocoa" from the SDL2_LIBRARY variable
b77870abb3c4 Update osx bundle creation with SDL2 library names
koda
parents: 11362
diff changeset
    30
    string(REGEX REPLACE "(.*);-.*" "\\1" sdl_library_only "${SDL2_LIBRARY}")
b77870abb3c4 Update osx bundle creation with SDL2 library names
koda
parents: 11362
diff changeset
    31
    #remove the "libSDLmain.a" from the SDL2_LIBRARY variable
10974
0f9fc5923be4 Fix libsdl bundling on OSX when library rather than framework is used
koda
parents: 10382
diff changeset
    32
    string(REGEX REPLACE ".*;(.*)" "\\1" sdl_library_only "${sdl_library_only}")
5169
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
    33
10975
47c3a00f8037 Make sure that the png library name is always defined
koda
parents: 10974
diff changeset
    34
    #get the neme of the library (harmelss if it is static)
47c3a00f8037 Make sure that the png library name is always defined
koda
parents: 10974
diff changeset
    35
    string(REGEX REPLACE ".*/(.*)$" "\\1" PNG_LIBNAME "${PNG_LIBRARY}")
47c3a00f8037 Make sure that the png library name is always defined
koda
parents: 10974
diff changeset
    36
    string(REGEX REPLACE ".*/(.*)$" "\\1" ZLIB_LIBNAME "${ZLIB_LIBRARY}")
2219
07f5345ecae7 additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
diff changeset
    37
8317
ec9f94ab2737 remove the CROSSAPPLE option until a better solution is found
koda
parents: 8316
diff changeset
    38
    set(frameworks_dir ${CMAKE_INSTALL_PREFIX}/${target_library_install_dir})
15313
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    39
    
8322
50369fa5053b adjust rpath on osx too for libengine
koda
parents: 8317
diff changeset
    40
    if(${BUILD_ENGINE_LIBRARY})
50369fa5053b adjust rpath on osx too for libengine
koda
parents: 8317
diff changeset
    41
        set(engine_full_path "${frameworks_dir}/${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}")
50369fa5053b adjust rpath on osx too for libengine
koda
parents: 8317
diff changeset
    42
    else()
50369fa5053b adjust rpath on osx too for libengine
koda
parents: 8317
diff changeset
    43
        set(engine_full_path "${CMAKE_INSTALL_PREFIX}/hwengine${CMAKE_EXECUTABLE_SUFFIX}")
50369fa5053b adjust rpath on osx too for libengine
koda
parents: 8317
diff changeset
    44
    endif()
8317
ec9f94ab2737 remove the CROSSAPPLE option until a better solution is found
koda
parents: 8316
diff changeset
    45
15313
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    46
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    47
    #create the .app bundle using BundleUtilities instead of old macdeployqt
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    48
    set(APP_DIR "Hedgewars.app")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    49
    set(APP_BASE_DIR "${CMAKE_INSTALL_PREFIX}/../")  # should be, Hedgewars.app/Contents/MacOS/../
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    50
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    51
    # macro to install qt5 plugins 
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    52
    # modified from https://github.com/Kitware/CMake/blob/master/Source/QtDialog/CMakeLists.txt
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    53
    macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var)
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    54
      get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION)
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    55
      if(EXISTS "${_qt_plugin_path}")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    56
        get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME)
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    57
        get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH)
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    58
        get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME)
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    59
        set(_qt_plugin_dir "PlugIns")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    60
        set(_qt_plugin_dest "${_qt_plugin_dir}/${_qt_plugin_type}")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    61
        install(FILES "${_qt_plugin_path}"
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    62
          DESTINATION "../${_qt_plugin_dest}" # relative to install dir
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    63
          ${COMPONENT})
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    64
        list(APPEND ${_qt_plugins_var}
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    65
          "\${CMAKE_BINARY_DIR}/${APP_BASE_DIR}/${_qt_plugin_dest}/${_qt_plugin_file}")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    66
      else()
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    67
        message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    68
      endif()
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    69
    endmacro()
2219
07f5345ecae7 additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
diff changeset
    70
15313
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    71
    # install cocoa plugin and build list to send to fixup_bundle
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    72
    install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS)
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    73
    file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    74
        "[Paths]\nPlugins = ${_qt_plugin_dir}\n")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    75
    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    76
        DESTINATION "../Resources"  # relative to install dir
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    77
        ${COMPONENT})
2219
07f5345ecae7 additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
diff changeset
    78
15313
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    79
    # Build up search directories for fixup_bundle
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    80
    set(DIRS "")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    81
    # Add QT bin and lib paths
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    82
    if(CMAKE_PREFIX_PATH)
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    83
        foreach(dir ${CMAKE_PREFIX_PATH})
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    84
            list(APPEND DIRS "${dir}/bin" "${dir}/lib")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    85
        endforeach()
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    86
    endif()
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    87
    # Add other lib folder from around the system
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    88
    list(APPEND DIRS 
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    89
        ~/Library/Frameworks
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    90
        /Library/Frameworks
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    91
        /usr/local/lib
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    92
        /opt/local/lib
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    93
    )
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    94
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    95
    # operate on the Hedgewars.app
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    96
    set(APPS ${CMAKE_BINARY_DIR}/${APP_DIR})
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    97
    
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    98
    # debugging
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
    99
    message(STATUS "APPS: ${APPS}")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
   100
    message(STATUS "QT_PLUGINS: ${QT_PLUGINS}")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
   101
    message(STATUS "DIRS: ${DIRS}")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
   102
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
   103
    # properly fixup the .app to include all dependencies    
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
   104
    install(CODE "include(BundleUtilities)
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
   105
        fixup_bundle(\"${APPS}\" \"${QT_PLUGINS}\" \"${DIRS}\")")
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
   106
    
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
   107
    
9347
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   108
    #create the .dmg for deployment
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   109
    #first make sure .app exists, then remove any old .dmg with same name, finally run the script
11271
a292efd31bde Always install before making dmg
koda
parents: 10976
diff changeset
   110
    add_custom_target(dmg COMMAND make install
9347
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   111
                          COMMAND rm -f ${CMAKE_BINARY_DIR}/Hedgewars-${HEDGEWARS_VERSION}.dmg
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   112
                          COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/create-dmg.sh
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   113
                                  --volname "Hedgewars ${HEDGEWARS_VERSION}"
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   114
                                # --volicon icon.icns
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   115
                                  --window-size 600 470
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   116
                                  --icon-size 96
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   117
                                  --icon "Hedgewars" 190 190
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   118
                                  --app-drop-link 410 190
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   119
                                  --background "${CMAKE_CURRENT_SOURCE_DIR}/../misc/dmgBackground.png"
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   120
                                  ${CMAKE_BINARY_DIR}/Hedgewars-${HEDGEWARS_VERSION}.dmg
15313
7e3bd4030aa5 Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents: 14923
diff changeset
   121
                                  ${CMAKE_BINARY_DIR}/${APP_DIR}
9347
5b582d49358c automate dmg creation (woo)
koda
parents: 9345
diff changeset
   122
                          WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
5169
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
   123
endif()
2547
koda
parents: 2546
diff changeset
   124