Debian Codegraph @

cmake/wxLauncherInstaller.cmake

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 # Note: assuming that this file is included in CMakeLists.txt, so
2 # using IS_WIN32, IS_APPLE, IS_LINUX
3 # Setup the packer
4
5 if(IS_WIN32) # and WIN64
6 # find the runtime files
7 if(CMAKE_BUILD_TYPE MATCHES Debug)
8 # Determine the name of the pdb on the first run of CMake.
9 # From Cmake mailing list:
10 # http://www.cmake.org/pipermail/cmake/2007-October/016924.html
11 # First, build the full name of the EXE.
12 install(CODE "set(wxLauncher_pdb ${CMAKE_CURRENT_BINARY_DIR}/\${${project}_BUILD_NAME_\${CMAKE_INSTALL_CONFIG_NAME}})")
13 # Then, replace .exe with .pdb.
14 install(CODE "string(REPLACE .exe .pdb wxLauncher_pdb \${wxLauncher_pdb})")
15 # Finally, get it installed.
16 install(CODE "install(FILES ${wxLauncher_pdb} DESTINATION bin)")
17 set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
18 endif()
19 include(InstallRequiredSystemLibraries)
20 endif() # IS_WIN32
21
22 set(CPACK_PACKAGE_VERSION_MAJOR ${wxlauncher_VERSION_MAJOR})
23 set(CPACK_PACKAGE_VERSION_MINOR ${wxlauncher_VERSION_MINOR})
24 set(CPACK_PACKAGE_VERSION_PATCH ${wxlauncher_VERSION_PATCH})
25 set(CPACK_PACKAGE_NAME "wxLauncher")
26 set(CPACK_PACKAGE_VENDOR "wxLauncher Team")
27 set(CPACK_PACKAGE_INSTALL_DIRECTORY "wxLauncher")
28 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Launcher and installer for the FreeSpace SCP")
29 set(CPACK_PACKAGE_DESCRIPTION "Launcher and installer for the FreeSpace 2 Open Source Code Project")
30
31 # TODO we need separate welcome and readme files,
32 # and a readme better geared towards end users
33
34 if(NOT IS_APPLE) # a license agreement popping up whenever people open the DMG will drive them crazy
35 set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/License.txt)
36 endif()
37
38 set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/ReadMe.md)
39 set(CPACK_RESOURCE_FILE_WELCOME ${PROJECT_SOURCE_DIR}/ReadMe.md)
40
41 if(IS_WIN32)
42 set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY wxLauncher)
43 # the \\\\ is because NSIS does not handle unix paths correctly - http://www.batchmake.org/Wiki/CMake:Packaging_With_CPack
44 set(CPACK_NSIS_MUI_ICON ${PROJECT_SOURCE_DIR}/platform/win32\\\\wxlauncher.ico)
45 set(CPACK_NSIS_MUI_UNIICON ${PROJECT_SOURCE_DIR}/platform/win32\\\\wxlauncher.ico)
46 # the header image *must* be a bitmap
47 set(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/platform/win32\\\\installer_header.bmp)
48 set(CPACK_NSIS_HELP_LINK http::\\\\\\\\wxlauncher.googlecode.com)
49 set(CPACK_NSIS_URL_INFO_ABOUT http::\\\\\\\\www.hard-light.net)
50 endif()
51
52 if(DEVELOPMENT_MODE)
53 set(CPACK_PACKAGE_FILE_NAME wxlaucher-development-mode-do-not-distribute)
54 else()
55 if(CMAKE_BUILD_TYPE MATCHES Debug)
56 set(CPACK_PACKAGE_FILE_NAME wxlauncher-${wxlauncher_VERSION_STRING}-debug-withpdbs)
57 elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
58 set(CPACK_PACKAGE_FILE_NAME wxlauncher-${wxlauncher_VERSION_STRING})
59 else()
60 set(CPACK_PACKAGE_FILE_NAME wxlauncher-${wxlauncher_VERSION_STRING})
61 endif()
62 endif()
63
64 if( IS_WIN32 AND NOT UNIX )
65 set(CPACK_PACKAGE_EXECUTABLES "wxLauncher" "wxLauncher for the SCP")
66 endif()
67
68 if(IS_APPLE)
69 # currently can't get bundle name and long version string to display, grr
70 # set(MACOSX_BUNDLE_BUNDLE_NAME "wxLauncher")
71 # set(MACOSX_BUNDLE_LONG_VERSION_STRING "wxLauncher for the SCP, version ${MACOSX_BUNDLE_SHORT_VERSION_STRING}")
72 set(MACOSX_BUNDLE_ICON_FILE wxlauncher.icns)
73 set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${wxlauncher_VERSION})
74 set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2009-2016 ${CPACK_PACKAGE_VENDOR}")
75 endif(IS_APPLE)
76
77 if(IS_LINUX)
78 set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Iss Mneur <[email protected]>")
79 set(CPACK_PACKAGE_DEPENDS "libwxgtk2.8 libopenal1")
80 set(CPACK_DEBIAN_PACKAGE_SECTION "Games")
81 endif()
82
83 if(IS_WIN32)
84 set(CPACK_BINARY_NSIS "ON")
85 option(BUILD_BINARY_ZIP "Generate a binary zip" "OFF")
86 if(BUILD_BINARY_ZIP)
87 set(CPACK_BINARY_ZIP "ON")
88 else()
89 set(CPACK_BINARY_ZIP "OFF")
90 endif()
91 elseif(IS_APPLE)
92 set(CPACK_BINARY_DRAGNDROP "ON")
93 set(CPACK_BINARY_PACKAGEMAKER "OFF")
94 set(CPACK_BINARY_STGZ "OFF")
95 set(CPACK_BINARY_TZ "OFF")
96 set(CPACK_BINARY_TGZ "OFF")
97 else()
98 set(CPACK_BINARY_DEB "ON")
99 find_program(rpmbuild_exists rpmbuild)
100 if(rpmbuild_exists)
101 set(CPACK_BINARY_RPM "ON")
102 else()
103 set(CPACK_BINARY_RPM "OFF")
104 message(STATUS "rpmbuild does not exist, will not build RPM")
105 endif()
106 set(CPACK_BINARY_STGZ "OFF")
107 set(CPACK_BINARY_TZ "OFF")
108 set(CPACK_BINARY_TGZ "OFF")
109 endif()
110
111 include(CPack)
112
113 if(IS_WIN32)
114 install(TARGETS wxlauncher RUNTIME DESTINATION bin)
115 install(FILES "${SDL2_DLL}" DESTINATION bin)
116 elseif(IS_APPLE)
117 install(TARGETS wxlauncher
118 RUNTIME DESTINATION .
119 BUNDLE DESTINATION .)
120 else()
121 install(TARGETS wxlauncher
122 RUNTIME DESTINATION bin)
123 endif()
124
125 # prototype for post-processing code that will be needed later
126 # to automatically generate .dmg that doesn't have /Applications symlink
127 #if(IS_APPLE)
128 # set(DRAGNDROP_PATH ${CMAKE_CURRENT_BINARY_DIR}/_CPack_Packages/Darwin/DragNDrop)
129 # set(DMG_FOLDER_PATH ${DRAGNDROP_PATH}/${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
130 # message(${DRAGNDROP_PATH})
131 # message(${DMG_FOLDER_PATH})
132 # TODO the current major problem is getting the command to run at the right time
133 # add_custom_command(TARGET package POST_BUILD
134 # COMMAND echo post-build test
135 # # TODO delete auto-generated .dmg, delete /Applications symlink, re-generate .dmg
136 # )
137 #endif(IS_APPLE)
138
139 if(IS_WIN32)
140 install(DIRECTORY resources/ DESTINATION resources)
141 install(FILES ${helphtblocation} DESTINATION resources)
142 elseif(IS_APPLE)
143 install(FILES ${PROJECT_SOURCE_DIR}/License.txt DESTINATION .)
144 install(FILES ${PROJECT_SOURCE_DIR}/GPLv2.txt DESTINATION .)
145 # add_custom_target(RemoveAppsLink ALL ${PROJECT_SOURCE_DIR}/platform/macosx/removeAppsLink.sh "${CMAKE_CURRENT_BINARY_DIR}/_CPack_Packages/Darwin/DragNDrop/wxlauncher-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" VERBATIM) # attempt to remove link to Applications folder, will keep this as placeholder until I come up with a better idea -- maybe a postinstall script to delete the generated DMG, remove the Applications link, then create a new DMG with hdiutil?
146 else()
147 install(DIRECTORY resources/ DESTINATION ${RESOURCES_PATH})
148 install(FILES ${helphtblocation} DESTINATION ${RESOURCES_PATH})
149 if (${CMAKE_VERSION} VERSION_EQUAL 3.0 OR ${CMAKE_VERSION} VERSION_GREATER 3.0)
150 # Assume a freedesktop environment
151 set(WXLAUNCHER_FILE ${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:wxlauncher>)
152 configure_file("${PROJECT_SOURCE_DIR}/platform/freedesktop/wxLauncher.desktop.in" "${CMAKE_BINARY_DIR}/platform/freedesktop/wxlauncher.desktop")
153
154 file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/platform/freedesktop/wxlauncher.desktop-$<CONFIG>"
155 INPUT "${CMAKE_BINARY_DIR}/platform/freedesktop/wxlauncher.desktop")
156
157 install(FILES "${CMAKE_BINARY_DIR}/platform/freedesktop/wxlauncher.desktop-$<CONFIG>"
158 DESTINATION share/applications
159 RENAME wxlauncher.desktop)
160 else()
161 message(STATUS "The CMake version is too old to support desktop file generation. CMake 3.0 or newer required")
162 endif()
163 endif()