author | koda |
Mon, 22 Feb 2016 15:56:32 -0500 | |
branch | 0.9.22 |
changeset 11571 | d80378a6ab31 |
parent 11276 | a292efd31bde |
child 11342 | ed5a6478e710 |
permissions | -rw-r--r-- |
9963 | 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 | 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 | 7 |
endif() |
8 |
||
10976 | 9 |
if(APPLE AND NOT SKIPBUNDLE) |
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
|
10 |
find_package(Qt4 REQUIRED QUIET) |
10975
47c3a00f8037
Make sure that the png library name is always defined
koda
parents:
10974
diff
changeset
|
11 |
find_package(PNG REQUIRED) |
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
|
12 |
find_package(SDL REQUIRED) |
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
|
13 |
find_package(SDL_image REQUIRED) |
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
|
14 |
find_package(SDL_net REQUIRED) |
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
|
15 |
find_package(SDL_ttf REQUIRED) |
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
|
16 |
find_package(SDL_mixer REQUIRED) |
8660 | 17 |
find_package(OggVorbis REQUIRED) |
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
|
18 |
if(NOT NOAUTOUPDATE) |
8659 | 19 |
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
|
20 |
#needed because the 'if' clause in the script prints silly policy warnings |
9961 | 21 |
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
|
22 |
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
|
23 |
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
|
24 |
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
|
25 |
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
|
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 |
|
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 |
#use the associated tool from the libraries we've selected |
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
|
29 |
string(REGEX REPLACE "(.*)/include.*" "\\1" qt_base_dir "${QT_INCLUDE_DIR}") |
4335 | 30 |
|
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
|
31 |
#remove the ";-framework Cocoa" from the SDL_LIBRARY variable |
8316
89232b2fa1d6
cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents:
7817
diff
changeset
|
32 |
string(REGEX REPLACE "(.*);-.*" "\\1" sdl_library_only "${SDL_LIBRARY}") |
10974
0f9fc5923be4
Fix libsdl bundling on OSX when library rather than framework is used
koda
parents:
10382
diff
changeset
|
33 |
#remove the "libSDLmain.a" from the SDL_LIBRARY variable |
0f9fc5923be4
Fix libsdl bundling on OSX when library rather than framework is used
koda
parents:
10382
diff
changeset
|
34 |
string(REGEX REPLACE ".*;(.*)" "\\1" sdl_library_only "${sdl_library_only}") |
5169 | 35 |
|
10975
47c3a00f8037
Make sure that the png library name is always defined
koda
parents:
10974
diff
changeset
|
36 |
#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
|
37 |
string(REGEX REPLACE ".*/(.*)$" "\\1" PNG_LIBNAME "${PNG_LIBRARY}") |
47c3a00f8037
Make sure that the png library name is always defined
koda
parents:
10974
diff
changeset
|
38 |
string(REGEX REPLACE ".*/(.*)$" "\\1" ZLIB_LIBNAME "${ZLIB_LIBRARY}") |
2219
07f5345ecae7
additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
diff
changeset
|
39 |
|
8317
ec9f94ab2737
remove the CROSSAPPLE option until a better solution is found
koda
parents:
8316
diff
changeset
|
40 |
set(frameworks_dir ${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}) |
8322 | 41 |
if(${BUILD_ENGINE_LIBRARY}) |
42 |
set(engine_full_path "${frameworks_dir}/${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}") |
|
43 |
else() |
|
44 |
set(engine_full_path "${CMAKE_INSTALL_PREFIX}/hwengine${CMAKE_EXECUTABLE_SUFFIX}") |
|
45 |
endif() |
|
8317
ec9f94ab2737
remove the CROSSAPPLE option until a better solution is found
koda
parents:
8316
diff
changeset
|
46 |
|
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
|
47 |
#this tool is present in qt 4.5 but only if you compile from sources |
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
|
48 |
#from qt 4.6 is present also in the binary version |
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
|
49 |
find_program(macdeployqt_executable NAMES macdeployqt macdeployqt-mac PATHS ${qt_base_dir}/bin) |
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
|
50 |
if(NOT macdeployqt_executable) |
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
|
51 |
message(FATAL_ERROR "The utility macdeployqt is required to create the bundle (seached: ${qt_base_dir})") |
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
|
52 |
endif() |
2219
07f5345ecae7
additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
diff
changeset
|
53 |
|
9345
bb9bf1efd0d2
use the modern install(SCRIPT ...) command instead of legacy POST_BUILD_SCRIPT
koda
parents:
9229
diff
changeset
|
54 |
#create the .app bundle |
bb9bf1efd0d2
use the modern install(SCRIPT ...) command instead of legacy POST_BUILD_SCRIPT
koda
parents:
9229
diff
changeset
|
55 |
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CreateMacBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CreateMacBundle.cmake) |
bb9bf1efd0d2
use the modern install(SCRIPT ...) command instead of legacy POST_BUILD_SCRIPT
koda
parents:
9229
diff
changeset
|
56 |
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/CreateMacBundle.cmake |
bb9bf1efd0d2
use the modern install(SCRIPT ...) command instead of legacy POST_BUILD_SCRIPT
koda
parents:
9229
diff
changeset
|
57 |
CODE "message(STATUS \"Your app bundle is ready\")") |
2219
07f5345ecae7
additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
diff
changeset
|
58 |
|
9347 | 59 |
#create the .dmg for deployment |
60 |
#first make sure .app exists, then remove any old .dmg with same name, finally run the script |
|
11276 | 61 |
add_custom_target(dmg COMMAND make install |
9347 | 62 |
COMMAND rm -f ${CMAKE_BINARY_DIR}/Hedgewars-${HEDGEWARS_VERSION}.dmg |
63 |
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/create-dmg.sh |
|
64 |
--volname "Hedgewars ${HEDGEWARS_VERSION}" |
|
65 |
# --volicon icon.icns |
|
66 |
--window-size 600 470 |
|
67 |
--icon-size 96 |
|
68 |
--icon "Hedgewars" 190 190 |
|
69 |
--app-drop-link 410 190 |
|
70 |
--background "${CMAKE_CURRENT_SOURCE_DIR}/../misc/dmgBackground.png" |
|
71 |
${CMAKE_BINARY_DIR}/Hedgewars-${HEDGEWARS_VERSION}.dmg |
|
72 |
${CMAKE_BINARY_DIR}/Hedgewars.app |
|
73 |
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) |
|
5169 | 74 |
endif() |
2547 | 75 |