From Mattias Helsing, ""

* Use the CPack ZIP generator on windows (WIN32)
* Reformatted according to Philip Lowman's recent submissions"
This commit is contained in:
Robert Osfield 2009-04-09 15:56:04 +00:00
parent 68d80873a0
commit 37ef864bdd

View File

@ -30,7 +30,6 @@ IF(MSVC)
SET(SYSTEM_NAME "win32") SET(SYSTEM_NAME "win32")
ENDIF() ENDIF()
ENDIF() ENDIF()
# Guess the compiler (is this desired for other platforms than windows?) # Guess the compiler (is this desired for other platforms than windows?)
IF(NOT DEFINED OSG_CPACK_COMPILER) IF(NOT DEFINED OSG_CPACK_COMPILER)
INCLUDE(OsgDetermineCompiler) INCLUDE(OsgDetermineCompiler)
@ -50,7 +49,11 @@ ENDIF()
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENSCENEGRAPH_VERSION}") SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENSCENEGRAPH_VERSION}")
# these goes for all platforms. Setting these stops the CPack.cmake script from generating options about other package compression formats (.z .tz, etc.) # these goes for all platforms. Setting these stops the CPack.cmake script from generating options about other package compression formats (.z .tz, etc.)
IF(WIN32)
SET(CPACK_GENERATOR "ZIP")
ELSE()
SET(CPACK_GENERATOR "TGZ") SET(CPACK_GENERATOR "TGZ")
ENDIF()
SET(CPACK_SOURCE_GENERATOR "TGZ") SET(CPACK_SOURCE_GENERATOR "TGZ")
@ -81,10 +84,6 @@ ENDIF()
SET(PACKAGE_ALL_TARGETNAME "${PACKAGE_TARGET_PREFIX}ALL") SET(PACKAGE_ALL_TARGETNAME "${PACKAGE_TARGET_PREFIX}ALL")
ADD_CUSTOM_TARGET(${PACKAGE_ALL_TARGETNAME}) ADD_CUSTOM_TARGET(${PACKAGE_ALL_TARGETNAME})
#=============================
# Macro:
# GENERATE_PACKAGING_TARGET()
#
MACRO(GENERATE_PACKAGING_TARGET package_name) MACRO(GENERATE_PACKAGING_TARGET package_name)
SET(CPACK_PACKAGE_NAME ${package_name}) SET(CPACK_PACKAGE_NAME ${package_name})
@ -103,31 +102,36 @@ MACRO(GENERATE_PACKAGING_TARGET package_name)
SET(PACKAGE_TARGETNAME "${PACKAGE_TARGET_PREFIX}${package_name}") SET(PACKAGE_TARGETNAME "${PACKAGE_TARGET_PREFIX}${package_name}")
# This is naive and will probably need fixing eventually # This is naive and will probably need fixing eventually
IF(WIN32) IF(MSVC)
SET(MOVE_COMMAND "move") SET(MOVE_COMMAND "move")
ELSE() ELSE()
SET(MOVE_COMMAND "mv") SET(MOVE_COMMAND "mv")
ENDIF() ENDIF()
# Set in and out archive filenames. Windows = zip, others = tar.gz
IF(WIN32)
SET(ARCHIVE_EXT "zip")
ELSE()
SET(ARCHIVE_EXT "tar.gz")
ENDIF()
# Create a target that creates the current package # Create a target that creates the current package
# and rename the package to give it proper filename # and rename the package to give it proper filename
ADD_CUSTOM_TARGET(${PACKAGE_TARGETNAME}) ADD_CUSTOM_TARGET(${PACKAGE_TARGETNAME})
ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_TARGETNAME} ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_TARGETNAME}
COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake
COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.tar.gz" "${OSG_PACKAGE_FILE_NAME}.tar.gz" COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" "${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}"
COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.tar.gz -> ${OSG_PACKAGE_FILE_NAME}.tar.gz" COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT} -> ${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}"
COMMENT "Run CPack packaging for ${package_name}..." COMMENT "Run CPack packaging for ${package_name}..."
) )
# Add the exact same custom command to the all package generating target. # Add the exact same custom command to the all package generating target.
# I can't use add_dependencies to do this because it would allow parallell building of packages so am going brute here # I can't use add_dependencies to do this because it would allow parallell building of packages so am going brute here
ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_ALL_TARGETNAME} ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_ALL_TARGETNAME}
COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake
COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.tar.gz" "${OSG_PACKAGE_FILE_NAME}.tar.gz" COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" "${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}"
COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.tar.gz -> ${OSG_PACKAGE_FILE_NAME}.tar.gz" COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT} -> ${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}"
) )
ENDMACRO(GENERATE_PACKAGING_TARGET) ENDMACRO(GENERATE_PACKAGING_TARGET)
#
#=============================
# Create configs and targets for a package including all components # Create configs and targets for a package including all components
SET(OSG_CPACK_COMPONENT ALL) SET(OSG_CPACK_COMPONENT ALL)