Merge pull request #71 from birarda/console-hf-folder

use a folder icon for dmg on OS X
This commit is contained in:
Ryan Huffman 2016-01-20 10:58:50 -08:00
commit 17d6cb6a96
6 changed files with 1692 additions and 34 deletions

1
.gitattributes vendored
View file

@ -25,3 +25,4 @@
*.svg binary
*.ttf binary
*.wav binary
*.rsrc binary

File diff suppressed because it is too large Load diff

View file

@ -24,6 +24,11 @@ macro(GENERATE_INSTALLERS)
set(CPACK_NSIS_PACKAGE_NAME ${_DISPLAY_NAME})
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${_DISPLAY_NAME})
# configure a cpack properties file for custom variables in template
set(CPACK_CONFIGURED_PROP_FILE "${CMAKE_CURRENT_BINARY_DIR}/CPackCustomProperties.cmake")
configure_file("${HF_CMAKE_DIR}/templates/CPackProperties.cmake.in" ${CPACK_CONFIGURED_PROP_FILE})
set(CPACK_PROPERTIES_FILE ${CPACK_CONFIGURED_PROP_FILE})
if (WIN32)
set(CPACK_NSIS_MUI_ICON "${HF_CMAKE_DIR}/installer/installer.ico")
@ -41,28 +46,33 @@ macro(GENERATE_INSTALLERS)
set(_UNINSTALLER_HEADER_BAD_PATH "${HF_CMAKE_DIR}/installer/uninstaller-header.bmp")
set(UNINSTALLER_HEADER_IMAGE "")
fix_path_for_nsis(${_UNINSTALLER_HEADER_BAD_PATH} UNINSTALLER_HEADER_IMAGE)
endif()
elseif (APPLE)
# produce a drag and drop DMG on OS X
set(CPACK_GENERATOR "DragNDrop")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
# configure a cpack properties file for custom variables in NSIS template
set(CPACK_CONFIGURED_PROP_FILE "${CMAKE_CURRENT_BINARY_DIR}/CPackCustomProperties.cmake")
configure_file("${HF_CMAKE_DIR}/templates/CPackProperties.cmake.in" ${CPACK_CONFIGURED_PROP_FILE})
set(CPACK_PROPERTIES_FILE ${CPACK_CONFIGURED_PROP_FILE})
if (APPLE)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "/")
set(CPACK_PACKAGING_INSTALL_PREFIX /)
set(CPACK_OSX_PACKAGE_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})
# make sure a High Fidelity directory exists, in case this hits prior to other installs
install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${DMG_SUBFOLDER_NAME}\")")
# add the resource file to the Icon file inside the folder
install(CODE
"execute_process(COMMAND Rez -append ${DMG_SUBFOLDER_ICON} -o \${CMAKE_INSTALL_PREFIX}/${ESCAPED_DMG_SUBFOLDER_NAME}/Icon\\r)"
)
# modify the folder to use that custom icon
install(CODE "execute_process(COMMAND SetFile -a C \${CMAKE_INSTALL_PREFIX}/${ESCAPED_DMG_SUBFOLDER_NAME})")
# hide the special Icon? file
install(CODE "execute_process(COMMAND SetFile -a V \${CMAKE_INSTALL_PREFIX}/${ESCAPED_DMG_SUBFOLDER_NAME}/Icon\\r)")
endif ()
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
cpack_add_component(${CLIENT_COMPONENT} DISPLAY_NAME "High Fidelity Client")
cpack_add_component(${SERVER_COMPONENT} DISPLAY_NAME "High Fidelity Server")
if (APPLE)
# we don't want the OS X package to install anywhere but the main volume, so disable relocation
set(CPACK_PACKAGE_RELOCATABLE FALSE)
endif ()
include(CPack)
endmacro()

View file

@ -30,9 +30,9 @@ macro(SET_PACKAGING_PARAMETERS)
elseif (RELEASE_TYPE STREQUAL "PR")
set(DEPLOY_PACKAGE TRUE)
set(PR_BUILD 1)
set(BUILD_VERSION "PR#${RELEASE_NUMBER}")
set(BUILD_VERSION "PR${RELEASE_NUMBER}")
set(BUILD_ORGANIZATION "High Fidelity - ${BUILD_VERSION}")
set(INTERFACE_BUNDLE_NAME "High Fidelity ${BUILD_VERSION}")
set(INTERFACE_BUNDLE_NAME "High Fidelity")
set(INTERFACE_ICON_PREFIX "interface-beta")
else ()
set(DEV_BUILD 1)
@ -42,8 +42,20 @@ macro(SET_PACKAGING_PARAMETERS)
set(INTERFACE_ICON_PREFIX "interface-beta")
endif ()
set(CONSOLE_INSTALL_DIR ".")
set(INTERFACE_INSTALL_DIR ".")
if (APPLE)
set(DMG_SUBFOLDER_NAME "${BUILD_ORGANIZATION}")
set(ESCAPED_DMG_SUBFOLDER_NAME "")
string(REPLACE " " "\\ " ESCAPED_DMG_SUBFOLDER_NAME ${DMG_SUBFOLDER_NAME})
set(DMG_SUBFOLDER_ICON "${HF_CMAKE_DIR}/installer/install-folder.rsrc")
set(CONSOLE_INSTALL_DIR ${DMG_SUBFOLDER_NAME})
set(INTERFACE_INSTALL_DIR ${DMG_SUBFOLDER_NAME})
else ()
set(CONSOLE_INSTALL_DIR ".")
set(INTERFACE_INSTALL_DIR ".")
endif ()
if (WIN32)
set(INTERFACE_EXEC_PREFIX "interface")
@ -77,10 +89,11 @@ macro(SET_PACKAGING_PARAMETERS)
endif ()
if (APPLE)
set(CONSOLE_EXEC_NAME "Server Console.app")
set(CONSOLE_INSTALL_APP_PATH "${CONSOLE_EXEC_NAME}")
set(INTERFACE_INSTALL_APP_PATH "${INTERFACE_BUNDLE_NAME}.app")
set(CONSOLE_EXEC_NAME "Server Console.app")
set(CONSOLE_INSTALL_APP_PATH "${CONSOLE_INSTALL_DIR}/${CONSOLE_EXEC_NAME}")
set(INTERFACE_INSTALL_APP_PATH "${CONSOLE_INSTALL_DIR}/${INTERFACE_BUNDLE_NAME}.app")
set(INTERFACE_ICON_FILENAME "${INTERFACE_ICON_PREFIX}.icns")
endif()

View file

@ -184,9 +184,9 @@ var debug = argv.debug;
var binaryType = argv.binaryType;
interfacePath = pathFinder.discoveredPath("Interface", binaryType);
dsPath = pathFinder.discoveredPath("domain-server", binaryType);
acPath = pathFinder.discoveredPath("assignment-client", binaryType);
interfacePath = pathFinder.discoveredPath("Interface", binaryType, buildInfo.releaseType);
dsPath = pathFinder.discoveredPath("domain-server", binaryType, buildInfo.releaseType);
acPath = pathFinder.discoveredPath("assignment-client", binaryType, buildInfo.releaseType);
function binaryMissingMessage(displayName, executableName, required) {
var message = "The " + displayName + " executable was not found.\n";

View file

@ -1,9 +1,9 @@
var fs = require('fs');
var path = require('path');
exports.searchPaths = function(name, binaryType) {
exports.searchPaths = function(name, binaryType, releaseType) {
function platformExtension(name) {
if (name == "Interface") {
if (name == "Interface" || name == "High Fidelity") {
if (process.platform == "darwin") {
return ".app/Contents/MacOS/" + name
} else if (process.platform == "win32") {
@ -21,7 +21,7 @@ exports.searchPaths = function(name, binaryType) {
var paths = [];
if (binaryType == "local-release" || binaryType == "local-debug") {
if (!releaseType) {
// check in the developer build tree for binaries
paths = [
devBasePath + name + extension,
@ -35,11 +35,6 @@ exports.searchPaths = function(name, binaryType) {
// assume we're inside an app bundle on OS X
if (process.platform == "darwin") {
// this is a production build - on OS X Interface will be called High Fidelity
if (name == "Interface") {
name = "High Fidelity";
}
var contentPath = ".app/Contents/";
var contentEndIndex = __dirname.indexOf(contentPath);
@ -60,7 +55,7 @@ exports.searchPaths = function(name, binaryType) {
return paths;
}
exports.discoveredPath = function (name, binaryType) {
exports.discoveredPath = function (name, binaryType, releaseType) {
function binaryFromPaths(name, paths) {
for (var i = 0; i < paths.length; i++) {
var testPath = paths[i];
@ -80,6 +75,11 @@ exports.discoveredPath = function (name, binaryType) {
return null;
}
// for a released server console on OS X, assume the name of the interface executable is "High Fidelity"
if (releaseType && name == "Interface") {
name = "High Fidelity";
}
// attempt to find a binary at the usual paths, return null if it doesn't exist
return binaryFromPaths(name, this.searchPaths(name, binaryType));
return binaryFromPaths(name, this.searchPaths(name, binaryType, releaseType));
}