Show
Ignore:
Timestamp:
04/09/09 17:56:22 (6 years ago)
Author:
robert
Message:

From Mattias Helsing, "
* Use the CPack ZIP generator on windows (WIN32)
* Reformatted according to Philip Lowman's recent submissions"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/branches/OpenSceneGraph-2.8/CMakeModules/OsgCPack.cmake

    r9528 r10009  
    1414IF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686") 
    1515    SET(SYSTEM_ARCH "i386") 
    16 ELSE("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686") 
     16ELSE() 
    1717    SET(SYSTEM_ARCH ${CMAKE_SYSTEM_PROCESSOR}) 
    18 ENDIF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686") 
     18ENDIF() 
    1919 
    2020# set a default system name - use CMake setting (Linux|Windows|...) 
     
    2727    IF(CMAKE_CL_64) 
    2828        SET(SYSTEM_NAME "win64") 
    29     ELSE(CMAKE_CL_64) 
     29    ELSE() 
    3030        SET(SYSTEM_NAME "win32") 
    31     ENDIF(CMAKE_CL_64) 
    32 ENDIF(MSVC) 
     31    ENDIF() 
     32ENDIF() 
    3333# Guess the compiler (is this desired for other platforms than windows?) 
    3434IF(NOT DEFINED OSG_CPACK_COMPILER) 
    3535    INCLUDE(OsgDetermineCompiler) 
    36 ENDIF(NOT DEFINED OSG_CPACK_COMPILER) 
     36ENDIF() 
    3737 
    3838# expose the compiler setting to the user 
     
    4141IF(OSG_CPACK_COMPILER) 
    4242  SET(OSG_CPACK_SYSTEM_SPEC_STRING ${SYSTEM_NAME}-${SYSTEM_ARCH}-${OSG_CPACK_COMPILER}) 
    43 ELSE(OSG_CPACK_COMPILER) 
     43ELSE() 
    4444  SET(OSG_CPACK_SYSTEM_SPEC_STRING ${SYSTEM_NAME}-${SYSTEM_ARCH}) 
    45 ENDIF(OSG_CPACK_COMPILER) 
     45ENDIF() 
    4646 
    4747 
     
    5050 
    5151# these goes for all platforms. Setting these stops the CPack.cmake script from generating options about other package compression formats (.z .tz, etc.) 
    52 SET(CPACK_GENERATOR "TGZ") 
     52IF(WIN32) 
     53    SET(CPACK_GENERATOR "ZIP") 
     54ELSE() 
     55    SET(CPACK_GENERATOR "TGZ") 
     56ENDIF() 
    5357SET(CPACK_SOURCE_GENERATOR "TGZ") 
    5458 
     
    5862    SET(OSG_CPACK_CONFIGURATION "$(OutDir)") 
    5963    SET(PACKAGE_TARGET_PREFIX "Package ") 
    60 ELSE(MSVC_IDE) 
     64ELSE() 
    6165    # on un*x an empty CMAKE_BUILD_TYPE means release 
    6266    IF(CMAKE_BUILD_TYPE) 
    6367        SET(OSG_CPACK_CONFIGURATION ${CMAKE_BUILD_TYPE}) 
    64     ELSE(CMAKE_BUILD_TYPE) 
     68    ELSE() 
    6569        SET(OSG_CPACK_CONFIGURATION "Release") 
    66     ENDIF(CMAKE_BUILD_TYPE) 
     70    ENDIF() 
    6771    SET(PACKAGE_TARGET_PREFIX "package_") 
    68 ENDIF(MSVC_IDE) 
     72ENDIF() 
    6973 
    7074# Get all defined components 
     
    7579  MESSAGE("When building packages please consider using cmake version 2.6.1 or above") 
    7680  SET(CPACK_COMPONENTS_ALL libopenscenegraph libopenthreads openscenegraph libopenscenegraph-dev libopenthreads-dev) 
    77 ENDIF(NOT CPACK_COMPONENTS_ALL) 
     81ENDIF() 
    7882 
    7983# Create a target that will be used to generate all packages defined below 
     
    8791    IF(${package} MATCHES -doc) 
    8892        SET(OSG_PACKAGE_FILE_NAME ${package_name}-${OPENSCENEGRAPH_VERSION}) 
    89     ELSE(${package} MATCHES -doc) 
     93    ELSE() 
    9094        SET(OSG_PACKAGE_FILE_NAME ${package_name}-${OPENSCENEGRAPH_VERSION}-${OSG_CPACK_SYSTEM_SPEC_STRING}-${OSG_CPACK_CONFIGURATION}) 
    9195        IF(NOT DYNAMIC_OPENSCENEGRAPH) 
    9296            SET(OSG_PACKAGE_FILE_NAME ${OSG_PACKAGE_FILE_NAME}-static) 
    93         ENDIF(NOT DYNAMIC_OPENSCENEGRAPH) 
    94     ENDIF(${package} MATCHES -doc) 
     97        ENDIF() 
     98    ENDIF() 
    9599 
    96100    CONFIGURE_FILE("${OpenSceneGraph_SOURCE_DIR}/CMakeModules/OsgCPackConfig.cmake.in" "${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake" IMMEDIATE) 
     
    101105    IF(MSVC) 
    102106        SET(MOVE_COMMAND "move") 
    103     ELSE(MSVC) 
     107    ELSE() 
    104108        SET(MOVE_COMMAND "mv") 
    105     ENDIF(MSVC) 
     109    ENDIF() 
     110 
     111    # Set in and out archive filenames. Windows = zip, others = tar.gz 
     112    IF(WIN32) 
     113        SET(ARCHIVE_EXT "zip") 
     114    ELSE() 
     115        SET(ARCHIVE_EXT "tar.gz") 
     116    ENDIF() 
    106117     
    107118    # Create a target that creates the current package 
     
    110121    ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_TARGETNAME} 
    111122        COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake 
    112         COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.tar.gz" "${OSG_PACKAGE_FILE_NAME}.tar.gz" 
    113         COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.tar.gz -> ${OSG_PACKAGE_FILE_NAME}.tar.gz" 
     123        COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" "${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" 
     124        COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT} -> ${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" 
    114125        COMMENT "Run CPack packaging for ${package_name}..." 
    115126    ) 
     
    118129    ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_ALL_TARGETNAME} 
    119130        COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake 
    120         COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.tar.gz" "${OSG_PACKAGE_FILE_NAME}.tar.gz" 
    121         COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.tar.gz -> ${OSG_PACKAGE_FILE_NAME}.tar.gz" 
     131        COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" "${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" 
     132        COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT} -> ${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" 
    122133    ) 
    123134ENDMACRO(GENERATE_PACKAGING_TARGET) 
     
    131142    SET(OSG_CPACK_COMPONENT ${package}) 
    132143    GENERATE_PACKAGING_TARGET(${package}) 
    133 ENDFOREACH(package ${CPACK_COMPONENTS_ALL}) 
     144ENDFOREACH()