[CMake] Cmake/MacPackaging

Alin M Elena alin.elena at qub.ac.uk
Wed Apr 30 13:58:13 EDT 2008


Hi,

I try to package an application on Mac.

The tar get generated correctly but not the .dmg or .pkg files.

1. In the case of .dmg I get a file but not the one that I expect.
the binary file that gets added in the dmg is not my target binary.

the structure of the .dmg file is

aten-0.97.1-Darwin
 Contents/
---->Info.plist
---->MacOS/
------->aten-0.97.1-Darwin (some strange binary)
---->Resources
------->bin/
---------->aten (the good binary)
------->RuntimeScript
-------> share (all good stuff as expected)

2. In the case of the .pkg file I get a very strange error
CPack: Create package using PackageMaker
CPack: Install projects
CPack: - Run preinstall target for: aten
CPack: - Install project: aten
CPack: Compress package
CPack Error: Bad file extension specified: . Currently only .rtfd, .rtf, 
.html, and .txt files allowed.
CPack Error: Problem copying the resource files
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: aten
make: *** [package] Error 1


I attach the CMakeLists.txt file and the CPack.Config.cmake


Any idea what I do wrong?

Alin







-- 
______________________________________________________________________ 
 "...if the universities will not study useless subjects, who will?" 
                           G. F. Fitzgerald, Nature, 45/46, 392 (1892)
______________________________________________________________________
Mr. Alin M. ELENA
Atomistic Simulation Centre
School of Mathematics and Physics
Queen's University Belfast
Office: +44 (0)28 9097 1428
Fax: +44 (0)28 9097 5359
http://titus.phy.qub.ac.uk/group/Alin/
alin.elena at yahoo.co.uk 
alin.elena at qub.ac.uk
______________________________________________________________________
-------------- next part --------------
# This file will be configured to contain variables for CPack. These variables
# should be set in the CMake list file of the project before CPack module is
# included. Example variables are:
#   CPACK_GENERATOR                     - Generator used to create package
#   CPACK_INSTALL_CMAKE_PROJECTS        - For each project (path, name, component)
#   CPACK_CMAKE_GENERATOR               - CMake Generator used for the projects
#   CPACK_INSTALL_COMMANDS              - Extra commands to install components
#   CPACK_INSTALL_DIRECTORIES           - Extra directories to install
#   CPACK_PACKAGE_DESCRIPTION_FILE      - Description file for the package
#   CPACK_PACKAGE_DESCRIPTION_SUMMARY   - Summary of the package
#   CPACK_PACKAGE_EXECUTABLES           - List of pairs of executables and labels
#   CPACK_PACKAGE_FILE_NAME             - Name of the package generated
#   CPACK_PACKAGE_ICON                  - Icon used for the package
#   CPACK_PACKAGE_INSTALL_DIRECTORY     - Name of directory for the installer
#   CPACK_PACKAGE_NAME                  - Package project name
#   CPACK_PACKAGE_VENDOR                - Package project vendor
#   CPACK_PACKAGE_VERSION               - Package project version
#   CPACK_PACKAGE_VERSION_MAJOR         - Package project version (major)
#   CPACK_PACKAGE_VERSION_MINOR         - Package project version (minor)
#   CPACK_PACKAGE_VERSION_PATCH         - Package project version (patch)

# There are certain generator specific ones

# NSIS Generator:
#   CPACK_PACKAGE_INSTALL_REGISTRY_KEY  - Name of the registry key for the installer
#   CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra commands used during uninstall
#   CPACK_NSIS_EXTRA_INSTALL_COMMANDS   - Extra commands used during install


SET(CPACK_BINARY_CYGWIN "")
SET(CPACK_BINARY_DEB "")
SET(CPACK_BINARY_NSIS "")
SET(CPACK_BINARY_OSXX11 "")
SET(CPACK_BINARY_PACKAGEMAKER "")
SET(CPACK_BINARY_RPM "")
SET(CPACK_BINARY_STGZ "")
SET(CPACK_BINARY_TBZ2 "")
SET(CPACK_BINARY_TGZ "")
SET(CPACK_BINARY_TZ "")
SET(CPACK_BINARY_ZIP "")
SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
SET(CPACK_GENERATOR "TGZ;TBZ2;OSXX11;PackageMaker")
SET(CPACK_INSTALL_CMAKE_PROJECTS "/Users/pashov_d/dev/atentest;aten;ALL;/")
SET(CPACK_INSTALL_PREFIX "/usr/local")
SET(CPACK_MODULE_PATH "/Users/pashov_d/dev/aten")
SET(CPACK_NSIS_DISPLAY_NAME "aten0.97")
SET(CPACK_NSIS_INSTALLER_ICON_CODE "")
SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
SET(CPACK_OUTPUT_CONFIG_FILE "/Users/pashov_d/dev/atentest/CPackConfig.cmake")
SET(CPACK_PACKAGE_CONTACT "Tristan Youngs")
SET(CPACK_PACKAGE_DEFAULT_LOCATION "/")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "/Users/pashov_d/dev/aten/README")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Aten - Atomic configuration builder and editor")
SET(CPACK_PACKAGE_FILE_NAME "aten-0.97.1-Darwin")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "aten0.97")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "aten 0.97.1")
SET(CPACK_PACKAGE_NAME "aten")
SET(CPACK_PACKAGE_RELOCATABLE "true")
SET(CPACK_PACKAGE_VENDOR "Tristan Youngs")
SET(CPACK_PACKAGE_VERSION "0.97.1")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "97")
SET(CPACK_PACKAGE_VERSION_PATCH "1")
SET(CPACK_RESOURCE_FILE_LICENSE "/Users/pashov_d/dev/aten/COPYING")
SET(CPACK_RESOURCE_FILE_README "/usr/local/CMake 2.7-20080430.app/Contents/share/cmake-2.7/Templates/CPack.GenericDescription.txt")
SET(CPACK_RESOURCE_FILE_WELCOME "/usr/local/CMake 2.7-20080430.app/Contents/share/cmake-2.7/Templates/CPack.GenericWelcome.txt")
SET(CPACK_SET_DESTDIR "OFF")
SET(CPACK_SOURCE_CYGWIN "")
SET(CPACK_SOURCE_GENERATOR "TGZ;TBZ2;TZ")
SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/Users/pashov_d/dev/atentest/CPackSourceConfig.cmake")
SET(CPACK_SOURCE_TBZ2 "ON")
SET(CPACK_SOURCE_TGZ "ON")
SET(CPACK_SOURCE_TZ "ON")
SET(CPACK_SOURCE_ZIP "OFF")
SET(CPACK_SYSTEM_NAME "Darwin")
SET(CPACK_TOPLEVEL_TAG "Darwin")
-------------- next part --------------
project(aten)


set(DESCRIPTION "Aten - Atomic configuration builder and editor")
set(AUTHOR "Tristan Youngs")
set(VERSION_MAJOR "0")
set(VERSION_MINOR "97")
set(VERSION_PATCH "1")

set(CMAKE_BUILD_TYPE "Release")

cmake_minimum_required(VERSION 2.4.8)
if(COMMAND cmake_policy)
  cmake_policy(VERSION 2.6)
endif(COMMAND cmake_policy)

set (target_name aten)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
find_package(Qt4 REQUIRED) # find and setup Qt4 for this project
find_package(READLINE REQUIRED)
IF(WIN32 OR APPLE)
find_package(OPENGL REQUIRED)
endif(WIN32 OR APPLE)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(SRCS src/)
#ADD_DEFINITIONS(-DQT_SHARED)

# tell cmake to process CMakeLists.txt in that subdirectory
add_subdirectory(${SRCS})

If(APPLE)
  set(MACOSX_BUNDLE_ICON_FILE  "${CMAKE_SOURCE_DIR}/src/gui/icons/aten.png")
  set(MACOSX_BUNDLE_GUI_IDENTIFIER  "Aten")
  set(MACOSX_BUNDLE_LONG_VERSION_STRING "0.x.0"  )
  set(MACOSX_BUNDLE_BUNDLE_NAME  "aten" )
  set(MACOSX_BUNDLE_SHORT_VERSION_STRING "0.+")
  set(MACOSX_BUNDLE_BUNDLE_VERSION  "almost 1")
  set(MACOSX_BUNDLE_COPYRIGHT "Tristan Youngs")
endif(APPLE)

include_directories(
${CMAKE_SOURCE_DIR} 
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src
${SRCS}/templates/
${SRCS}/
${QT_INCLUDE_DIR}
${READLINE_INCLUDE_DIR}
)
add_executable(${target_name} 
${SRCS}/main.cpp
)


link_directories (${LIBRARY_OUTPUT_PATH})
IF(WIN32 OR APPLE)
target_link_libraries(${target_name} 
gui base command render methods model
sg parse classes energy fourier math
${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
${READLINE_LIBRARY}
)
ELSE(WIN32 OR APPLE)
target_link_libraries(${target_name} 
gui base command render methods model 
sg parse classes energy fourier math
${QT_QTOPENGL_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
${READLINE_LIBRARY}
)
ENDIF(WIN32 OR APPLE)

####################
####install target
####################

if(NOT ${PREFIX})
MESSAGE("Install folder ${PREFIX}")
set(CMAKE_INSTALL_PREFIX "${PREFIX}")
endif(NOT ${PREFIX})

if(UNIX AND NOT APPLE)
configure_file(${CMAKE_SOURCE_DIR}/desktop.cmake Aten.desktop)
install(FILES ${CMAKE_BINARY_DIR}/Aten.desktop 
        DESTINATION "/usr/share/applications/")
install(FILES ${CMAKE_SOURCE_DIR}/src/gui/icons/aten.png
        DESTINATION share/aten)
endif(UNIX AND NOT APPLE)

install(TARGETS ${target_name}
      RUNTIME DESTINATION bin
)

install(DIRECTORY  "${CMAKE_HOME_DIRECTORY}/data/" 
     DESTINATION share/aten
     REGEX ".svn" EXCLUDE
)

if(WIN32)
FIND_FILE(Rline readline5.dll ENV PATH)
FIND_FILE(HRline history5.dll ENV PATH)
Find_File(qtgui QtGui4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtgl QtOpenGL4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtcore QtCore4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtsvg QtSvg4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtxml QtXml4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qsvg qsvg4.dll PATHS ${QT_PLUGINS_DIR}/iconengines NO_DEFAULT_PATH)
install(FILES ${qtgui} ${qtgl} ${qtcore} ${Rline} ${HRline} ${qtsvg} ${qtxml} ${CMAKE_CURRENT_SOURCE_DIR}/src/gui/icons/aten.ico
DESTINATION bin
)
install(FILES ${qsvg} 
DESTINATION bin/iconengines
)


ENDIF(WIN32)


#######################
## uninstall target
#######################

CONFIGURE_FILE(
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
###########################

INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${DESCRIPTION})
SET(CPACK_PACKAGE_VENDOR ${AUTHOR})
SET(CPACK_PACKAGE_CONTACT ${CPACK_PACKAGE_VENDOR})
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
SET(CPACK_PACKAGE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "aten${VERSION_MAJOR}.${VERSION_MINOR}")
IF(WIN32)
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Aten-${VERSION_MAJOR}.${VERSION_MINOR}")
  # There is a bug in NSI that does not handle full unix paths properly. Make
  # sure there is at least one set of four (4) backlasshes.
  set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/src/gui/icons\\\\aten.ico")
  set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/src/gui/icons\\\\uninstall.ico")
  SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/src/gui/icons\\\\aten.bmp")
  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\aten.ico")  
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Aten")
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.projectaten.org")
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.projectaten.org")
  SET(CPACK_NSIS_CONTACT "tris at projectaten.org")
  SET(CPACK_NSIS_MODIFY_PATH ON)  
  SET(CPACK_PACKAGE_EXECUTABLES "aten" "aten")
  set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\aten.lnk\\\" \\\"$INSTDIR\\\\bin\\\\aten.exe\\\" \\\"\\\" \\\"$INSTDIR\\\\bin\\\\aten.ico\\\"
      StrCmp $INSTALL_DESKTOP \\\"1\\\" 0 +2
      CreateShortCut \\\"$DESKTOP\\\\aten.lnk\\\" \\\"$INSTDIR\\\\bin\\\\aten.exe\\\" \\\"\\\" \\\"$INSTDIR\\\\bin\\\\aten.ico\\\"
"
  )
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
    Push \\\"ATENDATA\\\"
    Push \\\"$INSTDIR\\\\share\\\\aten\\\"
    Call WriteEnvStr      
"
  )
  set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "    
    Push \\\"ATENDATA\\\"
    Call un.DeleteEnvStr 
    StrCmp $INSTALL_DESKTOP \\\"1\\\" 0 +2
    Delete \\\"$DESKTOP\\\\aten.lnk\\\"    
"
)
Endif(WIN32)

IF(UNIX)
SET(CPACK_GENERATOR "TGZ;TBZ2;RPM;DEB")
Endif(UNIX)

IF(APPLE)
SET(CPACK_GENERATOR "TGZ;TBZ2;OSXX11;PackageMaker")
Endif(APPLE)

SET(CPACK_CMAKE_GENERATOR ${CMAKE_GENERATOR})

INCLUDE(CPack)




More information about the CMake mailing list