Commit d2b6e339 authored by René J.V. Bertin's avatar René J.V. Bertin
Browse files

updated install logic for Mac (and a select general changes)

This implements a first draft of a minimal build and install
procedure on Mac, meaning with as little changes as possible from
a standard Linux install but still providing a complete "Mac
experience".
A hook is provided for a future optional build as a standalone,
all-encompassing .app bundle
The application icon is generated on the fly from the available
png and svgz images (with a new enough ECM library).
parent 4e0ac7cd
......@@ -4,11 +4,15 @@ ENDIF(NOT ${PROJECT_NAME} STREQUAL "rkward")
INCLUDE(SetVersionNumber.cmake)
IF(Q_WS_MAC)
SET(CPACK_BUNDLE_ICON rkward.icns)
SET(CPACK_BUNDLE_NAME RKWard)
SET(CPACK_BUNDLE_STARTUP_COMMAND rkward)
ENDIF(Q_WS_MAC)
IF(APPLE)
SET(CPACK_BUNDLE_ICON rkward.icns)
SET(CPACK_BUNDLE_NAME RKWard)
SET(CPACK_BUNDLE_STARTUP_COMMAND rkward)
ENDIF()
SET(RKWARD_FRONTEND_LOCATION ${KDE_INSTALL_LIBEXECDIR})
# once tested and working this could become the default on Mac:
OPTION(APPLE_STANDALONE_BUNDLE "Generate a standalone app bundle when building on Mac" OFF)
ADD_FEATURE_INFO("App Bundle" APPLE_STANDALONE_BUNDLE "Generate a standalone app bundle when building on Mac. Do not use for now.")
ADD_SUBDIRECTORY( dataeditor )
ADD_SUBDIRECTORY( settings )
......@@ -38,11 +42,20 @@ GET_DIRECTORY_PROPERTY(R_EXECUTABLE DIRECTORY rbackend DEFINITION R_EXECUTABLE)
GET_DIRECTORY_PROPERTY(R_SHAREDLIBDIR DIRECTORY rbackend LINK_DIRECTORIES)
LINK_DIRECTORIES(${R_SHAREDLIBDIR})
ADD_CUSTOM_COMMAND (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/rkward.ico"
IF(APPLE)
# create the application icon from the available sources. This should work on MS Windows
# too but I don't want to start modifying things I cannot test.
FILE(GLOB ICON_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/icons/app-icon/*-apps-rkward.png")
# recent ECM versions will prefer the scalable version: prepend it to the icon source list:
ECM_ADD_APP_ICON(RKWard_Sources ICONS ${CMAKE_CURRENT_SOURCE_DIR}/icons/app-icon/sc-apps-rkward.svgz ${ICON_SRCS})
ADD_EXECUTABLE(rkward ${RKWard_Sources})
ELSE()
ADD_CUSTOM_COMMAND (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/rkward.ico"
COMMAND cmake -E copy "${CMAKE_CURRENT_SOURCE_DIR}/icons/app-icon/rkward.ico"
"${CMAKE_CURRENT_BINARY_DIR}/rkward.ico")
ADD_EXECUTABLE(rkward ${RKWard_Sources} rkward_windows_icon.rc rkward.ico)
ENDIF()
ADD_EXECUTABLE(rkward ${RKWard_Sources} rkward_windows_icon.rc rkward.ico)
# NOTE: These definitions are needed for the startup procedure (main.cpp), only.
# We should switch with to target_compile_definitions once we require CMAKE 2.6+
ADD_DEFINITIONS(-DR_EXECUTABLE="${R_EXECUTABLE}")
......@@ -51,14 +64,14 @@ ADD_DEFINITIONS(-DR_LIBS="${R_LIBDIR}")
SET_TARGET_PROPERTIES(rkward PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "RKWard")
IF(Q_WS_MAC)
IF(APPLE)
SET(RKWARD_INFOPLIST_TEMPLATE Info.plist.in)
SET(RKWARD_INFOPLIST_FILE ${CMAKE_SOURCE_DIR}/rkward/Info.plist)
CONFIGURE_FILE(
${RKWARD_INFOPLIST_TEMPLATE}
${RKWARD_INFOPLIST_FILE}
@ONLY)
ENDIF(Q_WS_MAC)
ENDIF(APPLE)
TARGET_LINK_LIBRARIES(rkward windows ${RKWARD_ADDLIBS} agents dialogs plugin settings dataeditor core scriptbackends rbackend misc KF5::WindowSystem Qt5::Widgets KF5::XmlGui ${LibIntl_LIBRARIES})
IF(KF5Crash_FOUND)
......@@ -73,12 +86,29 @@ INSTALL(DIRECTORY plugins/ pages DESTINATION ${DATA_INSTALL_DIR}/rkward
INSTALL(FILES rkwardui.rc rkconsolepart.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/rkward)
INSTALL(FILES resource.ver DESTINATION ${DATA_INSTALL_DIR}/rkward)
INSTALL(TARGETS rkward DESTINATION ${BIN_INSTALL_DIR})
IF(Q_WS_MAC)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/rkward/icons/app-icon/rkward.icns DESTINATION ${BUNDLE_INSTALL_DIR}/${CPACK_BUNDLE_NAME}.app/Contents/Resources)
INSTALL(FILES ${RKWARD_INFOPLIST_FILE} DESTINATION ${BUNDLE_INSTALL_DIR}/${CPACK_BUNDLE_NAME}.app/Contents)
ENDIF(Q_WS_MAC)
IF(APPLE)
INSTALL(TARGETS rkward DESTINATION ${BUNDLE_INSTALL_DIR})
if(APPLE_STANDALONE_BUNDLE)
# INSTALL(FILES ${CMAKE_SOURCE_DIR}/rkward/icons/app-icon/rkward.icns DESTINATION ${BUNDLE_INSTALL_DIR}/${CPACK_BUNDLE_NAME}.app/Contents/Resources)
# INSTALL(FILES ${RKWARD_INFOPLIST_FILE} DESTINATION ${BUNDLE_INSTALL_DIR}/${CPACK_BUNDLE_NAME}.app/Contents)
ENDIF()
# the MacOSX bundle display name property (CFBundleDisplayName) is not currently supported by cmake,
# so has to be set for all targets in this cmake file
SET(MACOSX_BUNDLE_DISPLAY_NAME RKWard)
# We provide our own Info.plist, but for the wrapper only
set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${RKWARD_INFOPLIST_FILE})
set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.kde.RKWard")
set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "RKWard")
set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_DISPLAY_NAME "RKWard")
set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_INFO_STRING "Frontend to the R statistics language")
set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_LONG_VERSION_STRING "RKWard ${RKVERSION_NUMBER}")
set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STRING "${RKVERSION_NUMBER}")
set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_BUNDLE_VERSION "${RKVERSION_NUMBER}")
set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_COPYRIGHT "RKWard Team")
ELSE()
INSTALL(TARGETS rkward DESTINATION ${BIN_INSTALL_DIR})
ENDIF()
INSTALL(FILES org.kde.rkward.desktop org.kde.rkward-open.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
INSTALL(FILES vnd.rkward.r.xml DESTINATION ${XDG_MIME_INSTALL_DIR})
......
......@@ -54,9 +54,10 @@ SET (
rktransmitter.cpp
)
ADD_DEFINITIONS (-DRKWARD_SPLIT_PROCESS)
ADD_DEFINITIONS (-DRKWARD_BACKEND_PATH="${CMAKE_INSTALL_PREFIX}/${LIBEXEC_INSTALL_DIR}")
ADD_DEFINITIONS (-DRKWARD_BACKEND_PATH="${KDE_INSTALL_LIBEXECDIR}")
LINK_DIRECTORIES(${R_SHAREDLIBDIR})
ADD_EXECUTABLE(rkward.rbackend ${rbackend_BACKEND_SRCS})
ECM_MARK_NONGUI_EXECUTABLE(rkward.rbackend)
TARGET_LINK_LIBRARIES(rkward.rbackend rkgraphicsdevice.backend ${R_USED_LIBS} ${CMAKE_THREAD_LIBS_INIT} Qt5::Network Qt5::Core ${LibIntl_LIBRARIES})
IF(WIN32)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment