diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ba214cce..1f2877c10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -396,8 +396,22 @@ if (GUI) endif() +if (APPLE) -#unset(TARGET_PLATFORM CACHE) + add_custom_target(appdmg + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} + -DAPP_DMG_EXE=${ETH_APP_DMG} + -DAPP_DMG_FILE=appdmg.json.in + -DAPP_DMG_ICON="alethzero/alethzero.icns" + -DAPP_DMG_BACKGROUND="bg.png" + -DETH_BUILD_DIR="${CMAKE_BINARY_DIR}" + -DETH_MIX_APP="$" + -DETH_ALETHZERO_APP="$" + -P "${ETH_SCRIPTS_DIR}/appdmg.cmake" + ) + +endif () if (WIN32) # packaging stuff diff --git a/appdmg.json.in b/appdmg.json.in new file mode 100644 index 000000000..4fb9a6e33 --- /dev/null +++ b/appdmg.json.in @@ -0,0 +1,13 @@ +{ + "title": "Ethereum", + "icon": "appdmg_icon.icns", + "background": "appdmg_background.png", + "icon-size": 80, + "contents": [ + { "x": 600, "y": 170, "type": "link", "path": "/Applications" }, + { "x": 150, "y": 90, "type": "file", "path": "${ETH_ALETHZERO_APP}" }, + { "x": 150, "y": 260, "type": "file", "path": "${ETH_MIX_APP}" } + ] +} + + diff --git a/bg.png b/bg.png new file mode 100644 index 000000000..869290c2b Binary files /dev/null and b/bg.png differ diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 1e4651d3d..7f0578c1f 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -159,6 +159,11 @@ if (GUI) message(" - windeployqt path: ${WINDEPLOYQT_APP}") endif() + if (APPLE) + find_program(ETH_APP_DMG appdmg) + message(" - appdmg location : ${ETH_APP_DMG}") + endif() + if (USENPM) # TODO check node && npm version diff --git a/cmake/scripts/appdmg.cmake b/cmake/scripts/appdmg.cmake new file mode 100644 index 000000000..d9826ae9d --- /dev/null +++ b/cmake/scripts/appdmg.cmake @@ -0,0 +1,17 @@ + +if (NOT APP_DMG_EXE) + message(FATAL_ERROR "Please install appdmg! https://github.com/LinusU/node-appdmg") +endif() + +string(REPLACE "/Contents/MacOS" "" ETH_MIX_APP "${ETH_MIX_APP}") +string(REPLACE "/Contents/MacOS" "" ETH_ALETHZERO_APP "${ETH_ALETHZERO_APP}") + +set(OUTFILE "${ETH_BUILD_DIR}/appdmg.json") + +configure_file(${APP_DMG_FILE} ${OUTFILE}) + +execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${APP_DMG_ICON}" "${ETH_BUILD_DIR}/appdmg_icon.icns") +execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${APP_DMG_BACKGROUND}" "${ETH_BUILD_DIR}/appdmg_background.png") +execute_process(COMMAND ${CMAKE_COMMAND} -E remove "${ETH_BUILD_DIR}/Ethereum.dmg") +execute_process(COMMAND ${APP_DMG_EXE} ${OUTFILE} "${ETH_BUILD_DIR}/Ethereum.dmg") +