From 660e904a538c60e1de05ebd139d6ca41eaeb60b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Mon, 9 Sep 2013 21:42:25 -0400 Subject: [PATCH] cmake: fix package generation on Mac OS X --- .gitignore | 3 ++ CMakeCPack.cmake | 96 ++++++++++++++++++++++++++++++++++++++ CMakeCPackOptions.cmake.in | 10 ++++ CMakeLists.txt | 91 +----------------------------------- 4 files changed, 110 insertions(+), 90 deletions(-) create mode 100644 CMakeCPack.cmake create mode 100644 CMakeCPackOptions.cmake.in diff --git a/.gitignore b/.gitignore index b6f8ca4cd..56412d950 100755 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,9 @@ cmake_install.cmake CPackConfig.cmake CPackSourceConfig.cmake DartConfiguration.tcl +CMakeCPackOptions.cmake _CPack_Packages +LICENSE.txt external/* !external/README @@ -28,6 +30,7 @@ external/* *.sh *.deb *.rpm +*.dmg *.tar.Z *.tar.gz diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake new file mode 100644 index 000000000..f33be3db1 --- /dev/null +++ b/CMakeCPack.cmake @@ -0,0 +1,96 @@ + +# Generate .txt license file for CPack (PackageMaker requires a file extension) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt @ONLY) + +SET(CPACK_BINARY_ZIP "ON") + +# Workaround to remove c++ compiler macros and defines for Eclipse. +# If c++ macros/defines are set __cplusplus is also set which causes +# problems when compiling freerdp/jni. To prevent this problem we set the macros to "". + +if (ANDROID AND CMAKE_EXTRA_GENERATOR STREQUAL "Eclipse CDT4") + set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "") + message(STATUS "Disabled CXX system defines for eclipse (workaround).") +endif() + +set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;/\\\\.gitignore;/CMakeCache.txt") + +if(NOT WIN32) + if(APPLE AND (NOT IOS)) + + if(WITH_SERVER) + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "mfreerdp-server") + endif() + endif() + + if(WITH_X11) + set(CPACK_PACKAGE_EXECUTABLES "xfreerdp") + + if(WITH_SERVER) + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "xfreerdp-server") + endif() + endif() +endif() + +set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") +set(CPACK_TOPLEVEL_TAG "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") + +string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_lower) +set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_lower}-${FREERDP_VERSION_FULL}-${CPACK_SYSTEM_NAME}") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_lower}-${FREERDP_VERSION_FULL}-${CPACK_SYSTEM_NAME}") + +set(CPACK_PACKAGE_NAME "FreeRDP") +set(CPACK_PACKAGE_VENDOR "FreeRDP") +set(CPACK_PACKAGE_VERSION ${FREERDP_VERSION_FULL}) +set(CPACK_PACKAGE_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${FREERDP_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${FREERDP_VERSION_REVISION}) +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FreeRDP: A Remote Desktop Protocol Implementation") + +set(CPACK_PACKAGE_CONTACT "Marc-Andre Moreau") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "marcandre.moreau@gmail.com") +set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) + +set(CPACK_PACKAGE_INSTALL_DIRECTORY "FreeRDP") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt") + +set(CPACK_NSIS_MODIFY_PATH ON) +set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources\\\\FreeRDP_Install.bmp") +set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/resources\\\\FreeRDP_Icon_96px.ico") +set(CPACK_NSIS_MUI_UNICON "${CMAKE_SOURCE_DIR}/resource\\\\FreeRDP_Icon_96px.ico") + +set(CPACK_COMPONENTS_ALL client server libraries headers) + +if(MSVC) + if(MSVC_RUNTIME STREQUAL "dynamic") + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) + include(InstallRequiredSystemLibraries) + + install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT libraries) + endif() +endif() + +set(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client") +set(CPACK_COMPONENT_CLIENT_GROUP "Applications") + +set(CPACK_COMPONENT_SERVER_DISPLAY_NAME "Server") +set(CPACK_COMPONENT_SERVER_GROUP "Applications") + +set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") +set(CPACK_COMPONENT_LIBRARIES_GROUP "Runtime") + +set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Headers") +set(CPACK_COMPONENT_HEADERS_GROUP "Development") + +set(CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "Runtime") +set(CPACK_COMPONENT_GROUP_APPLICATIONS_DESCRIPTION "Applications") +set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development") + +configure_file("${CMAKE_SOURCE_DIR}/CMakeCPackOptions.cmake.in" + "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY) +set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake") + +include(CPack) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in new file mode 100644 index 000000000..826eaa10d --- /dev/null +++ b/CMakeCPackOptions.cmake.in @@ -0,0 +1,10 @@ +# This file is configured at cmake time, and loaded at cpack time. +# To pass variables to cpack from cmake, they must be configured in this file. + +if("${CPACK_GENERATOR}" STREQUAL "PackageMaker") + if(CMAKE_PACKAGE_QTGUI) + set(CPACK_PACKAGE_DEFAULT_LOCATION "/Applications") + else() + set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr") + endif() +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index f16363632..25d11493d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -496,93 +496,4 @@ if(WITH_SERVER) endif() # Packaging - -SET(CPACK_BINARY_ZIP "ON") - -set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;/\\\\.gitignore;/CMakeCache.txt") - -if(NOT WIN32) - if(APPLE AND (NOT IOS)) - - if(WITH_SERVER) - set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "mfreerdp-server") - endif() - endif() - - if(WITH_X11) - set(CPACK_PACKAGE_EXECUTABLES "xfreerdp") - - if(WITH_SERVER) - set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "xfreerdp-server") - endif() - endif() -endif() - -set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") -set(CPACK_TOPLEVEL_TAG "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") - -string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_lower) -set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_lower}-${FREERDP_VERSION_FULL}-${CPACK_SYSTEM_NAME}") -set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_lower}-${FREERDP_VERSION_FULL}-${CPACK_SYSTEM_NAME}") - -set(CPACK_PACKAGE_NAME "FreeRDP") -set(CPACK_PACKAGE_VENDOR "FreeRDP") -set(CPACK_PACKAGE_VERSION ${FREERDP_VERSION_FULL}) -set(CPACK_PACKAGE_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${FREERDP_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${FREERDP_VERSION_REVISION}) -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FreeRDP: A Remote Desktop Protocol Implementation") - -set(CPACK_PACKAGE_CONTACT "Marc-Andre Moreau") -set(CPACK_DEBIAN_PACKAGE_MAINTAINER "marcandre.moreau@gmail.com") -set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) - -set(CPACK_PACKAGE_INSTALL_DIRECTORY "FreeRDP") -set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/LICENSE") -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") - -set(CPACK_NSIS_MODIFY_PATH ON) -set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources\\\\FreeRDP_Install.bmp") -set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/resources\\\\FreeRDP_Icon_96px.ico") -set(CPACK_NSIS_MUI_UNICON "${CMAKE_SOURCE_DIR}/resource\\\\FreeRDP_Icon_96px.ico") - -set(CPACK_COMPONENTS_ALL client server libraries headers) - -if(MSVC) - if(MSVC_RUNTIME STREQUAL "dynamic") - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) - include(InstallRequiredSystemLibraries) - - install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT libraries) - endif() -endif() - -set(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client") -set(CPACK_COMPONENT_CLIENT_GROUP "Applications") - -set(CPACK_COMPONENT_SERVER_DISPLAY_NAME "Server") -set(CPACK_COMPONENT_SERVER_GROUP "Applications") - -set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") -set(CPACK_COMPONENT_LIBRARIES_GROUP "Runtime") - -set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Headers") -set(CPACK_COMPONENT_HEADERS_GROUP "Development") - -set(CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "Runtime") -set(CPACK_COMPONENT_GROUP_APPLICATIONS_DESCRIPTION "Applications") -set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development") - -# Workaround to remove c++ compiler macros and defines for Eclipse. -# If c++ macros/defines are set __cplusplus is also set which causes -# problems when compiling freerdp/jni. To prevent this problem -# we set the macros to "". -if (ANDROID AND CMAKE_EXTRA_GENERATOR STREQUAL "Eclipse CDT4") - set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "") - message(STATUS "Disabled CXX system defines for eclipse (workaround).") -endif() - -include(CPack) - +include(CMakeCPack.cmake)