@ -15,44 +15,51 @@ SET(SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
# message ( STATUS "CMAKE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}" )
# message ( STATUS "CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}" )
SET ( OSG_CPACK_COMPILER "" CACHE STRING "This ia short string (vc90, vc80sp1, g++-4.3, ...) describing your compiler. The string is used for creating package filenames" )
# W i n d o w s s p e c i f i c s e t t i n g s .
# F o r w i n d o w s t h e c o m p i l e r n e e d s t o b e s p e c i f i e d i n t h e p a c k a g e f i l e n a m e
IF ( WIN32 )
IF ( MSVC )
# message ( STATUS "MSVC_VERSION ${MSVC_VERSION}" )
# V i s u a l C + + , 3 2 - b i t , v e r s i o n 6 . 0 1 2 0 0
# V i s u a l C + + , 3 2 - b i t , v e r s i o n . n e t 2 0 0 2 1 3 0 0
# V i s u a l C + + , 3 2 - b i t , v e r s i o n . n e t 2 0 0 3 1 3 1 0
# V i s u a l C + + , 3 2 - b i t , v e r s i o n 2 0 0 5 1400 ( vc80 )
# V i s u a l C + + , 3 2 - b i t , v e r s i o n 2 0 0 5 S P 1 1 4 ? ? ( v c 8 0 _ s p 1 )
# V i s u a l C + + , 3 2 - b i t , v e r s i o n 2 0 0 8 1500 ( vc90 )
IF ( MSVC_VERSION EQUAL 1500 )
SET ( OSG_CPACK_COMPILER "vc90" )
ENDIF ( MSVC_VERSION EQUAL 1500 )
IF ( MSVC_VERSION EQUAL 1400 ) # T h i s d o e s n ' t w o r k w i t h m y 2 0 0 5 v c 8 0 s p 1 c o m p i l e r
# P l a t f o r m s p e c i f i c s e t t i n g s .
# I n c l u d e s s e t t i n g t h e c o m p i l e r a n d s p e c i f y i n g d e b u g / r e l e a s e b u i l d
# f o r w i n d o w s t h e S Y S T E M _ N A M E i s s e t w i n 3 2 / 6 4 i n s t e a d o f w i n d o w s
IF ( MSVC )
# V i s u a l C + + , 3 2 - b i t , v e r s i o n 6 . 0 1 2 0 0
# V i s u a l C + + , 3 2 - b i t , v e r s i o n . n e t 2 0 0 2 1 3 0 0
# V i s u a l C + + , 3 2 - b i t , v e r s i o n . n e t 2 0 0 3 1 3 1 0
# V i s u a l C + + , 3 2 - b i t , v e r s i o n 2 0 0 5 1400 ( vc80 )
# V i s u a l C + + , 3 2 - b i t , v e r s i o n 2 0 0 5 S P 1 1400 ( vc80_sp1 )
# V i s u a l C + + , 3 2 - b i t , v e r s i o n 2 0 0 8 1500 ( vc90 )
IF ( MSVC_VERSION EQUAL 1500 )
SET ( OSG_CPACK_COMPILER "vc90" )
ELSE ( MSVC_VERSION EQUAL 1500 )
# T h i s i f d o e s n ' t d e t e c t m y 2 0 0 5 v c 8 0 s p 1 c o m p i l e r . H a v e t o r e l y o n C O M P I L E R _ 2 0 0 5
IF ( MSVC_VERSION EQUAL 1400 )
SET ( OSG_CPACK_COMPILER "vc80" )
ELSE ( MSVC_VERSION EQUAL 1400 )
IF ( CMAKE_COMPILER_2005 )
SET ( OSG_CPACK_COMPILER "vc80" )
ENDIF ( CMAKE_COMPILER_2005 )
ENDIF ( MSVC_VERSION EQUAL 1400 )
IF ( MSVC_VERSION EQUAL 1310 )
SET ( OSG_CPACK_COMPILER "vc70" )
ENDIF ( MSVC_VERSION EQUAL 1310 )
# c h e c k a r c h b i t c o u n t a n d i n c l u d e t h i s i n t h e s y s t e m n a m e
IF ( CMAKE_CL_64 )
SET ( SYSTEM_NAME "win64" )
ELSE ( CMAKE_CL_64 )
SET ( SYSTEM_NAME "win32" )
ENDIF ( CMAKE_CL_64 )
ENDIF ( MSVC )
ENDIF ( WIN32 )
ENDIF ( MSVC_VERSION EQUAL 1500 )
IF ( MSVC_VERSION EQUAL 1310 )
SET ( OSG_CPACK_COMPILER "vc70" )
ENDIF ( MSVC_VERSION EQUAL 1310 )
# c h e c k a r c h b i t c o u n t
IF ( CMAKE_CL_64 )
SET ( SYSTEM_NAME "win64" )
ELSE ( CMAKE_CL_64 )
SET ( SYSTEM_NAME "win32" )
ENDIF ( CMAKE_CL_64 )
ELSE ( MSVC )
# o n u n * x a n e m p t y C M A K E _ B U I L D _ T Y P E m e a n s r e l e a s e
IF ( CMAKE_BUILD_TYPE )
SET ( SYSTEM_BUILD_TYPE ${ CMAKE_BUILD_TYPE } )
ELSE ( CMAKE_BUILD_TYPE )
SET ( SYSTEM_BUILD_TYPE "Release" )
ENDIF ( CMAKE_BUILD_TYPE )
ENDIF ( MSVC )
# e x p o s e t h e c o m p i l e r s e t t i n g t o t h e u s e r
SET ( OSG_CPACK_COMPILER "${OSG_CPACK_COMPILER}" CACHE STRING "This ia short string (vc90, vc80sp1, gcc-4.3, ...) describing your compiler. The string is used for creating package filenames" )
IF ( OSG_CPACK_COMPILER )
SET ( OSG_CPACK_SYSTEM_SPEC_STRING ${ SYSTEM_NAME } - ${ SYSTEM_ARCH } - ${ OSG_CPACK_COMPILER } )
@ -60,78 +67,96 @@ ELSE(OSG_CPACK_COMPILER)
SET ( OSG_CPACK_SYSTEM_SPEC_STRING ${ SYSTEM_NAME } - ${ SYSTEM_ARCH } )
ENDIF ( OSG_CPACK_COMPILER )
# message ( STATUS "OSG_CPACK_SYSTEM_SPEC_STRING ${OSG_CPACK_SYSTEM_SPEC_STRING}" )
# e x p o s e t h i s t o t h e u s e r / p a c k a g e r
SET ( CPACK_PACKAGE_CONTACT "" CACHE STRING "Supply contact information (email) here" )
# # v a r i a b l e s t h a t a p p l y t o a l l p a c k a g e s
SET ( CPACK_PACKAGE_NAME ${ CMAKE_PROJECT_NAME } )
SET ( CPACK_PACKAGE_FILE_NAME "openscenegraph-all-${OPENSCENEGRAPH_VERSION}-${OSG_CPACK_SYSTEM_SPEC_STRING}" )
# SET ( CPACK_PACKAGE_FILE_NAME "openscenegraph-all-${OPENSCENEGRAPH_VERSION}-${OSG_CPACK_SYSTEM_SPEC_STRING}" )
SET ( CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}" )
SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "The OpenSceneGraph is an open source high performance 3d graphics toolkit" )
SET ( CPACK_PACKAGE_VENDOR "The OpenSceneGraph authors" )
SET ( CPACK_PACKAGE_DESCRIPTION_FILE "${OpenSceneGraph_SOURCE_DIR}/README.txt" )
SET ( CPACK_RESOURCE_FILE_LICENSE "${OpenSceneGraph_SOURCE_DIR}/LICENSE.txt" )
SET ( CPACK_PACKAGE_VENDOR "The OpenSceneGraph developers and contributors lead by Robert Osfield" )
SET ( CPACK_PACKAGE_VERSION_MAJOR ${ OPENSCENEGRAPH_MAJOR_VERSION } )
SET ( CPACK_PACKAGE_VERSION_MINOR ${ OPENSCENEGRAPH_MINOR_VERSION } )
SET ( CPACK_PACKAGE_VERSION_PATCH ${ OPENSCENEGRAPH_PATCH_VERSION } )
SET ( CPACK_PACKAGE_INSTALL_DIRECTORY "OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}" )
SET ( CPACK_TOPLEVEL_TAG ${ CPACK_PACKAGE_NAME } - ${ OPENSCENEGRAPH_VERSION } )
SET ( CPACK_SOURCE_TOPLEVEL_TAG ${ CPACK_PACKAGE_NAME } - ${ OPENSCENEGRAPH_VERSION } -src )
SET ( CPACK_SOURCE_PACKAGE_FILE_NAME "openscenegraph-${OPENSCENEGRAPH_VERSION}-src" )
# A d d t h e b u i l d d i r e c t o r y t o t h e i g n o r e p a t t e r n s a n d e x p o s e v a r t o t h e u s e r s
# N . B . T h i s i s e s p e c i a l l y i m p o r t a n t i f y o u r a r e b u i l d i n g o u t - o f - s o u r c e b u t u n d e r t h e s o u r c e tree ( i.e <OpenSceneGraphSrcDir>/build ) .
# I f y o u d o n ' t n a m e y o u r b u i l d d i r h e r e i t w i l l g e t p u l l e d i n t o t h e s r c p a c k a g e . S i z e o f m y b u i l d t r e e i s g i g a b y t e s s o y o u d o n t w a n t t h i s
SET ( CPACK_SOURCE_IGNORE_FILES "/\\\\\\\\.svn/;\\\\\\\\.swp$;\\\\\\\\.#;/#;build" CACHE STRING "Add ignore patterns that will left out of the src package" )
# t h e s e g o e s f o r a l l p l a t f o r m s . S e t t i n g t h e s e s t o p s t h e C P a c k . c m a k e s c r i p t f r o m g e n e r a t i n g o p t i o n s a b o u t o t h e r p a c k a g e c o m p r e s s i o n formats ( .z .tz, etc. )
SET ( CPACK_GENERATOR "TGZ" )
SET ( CPACK_SOURCE_GENERATOR "TGZ" )
IF ( WIN32 AND NOT UNIX )
OPTION ( BUILD_NSIS_PACKAGE "Turn this ON if you want to generate a visual installer using NSIS (nsis.sourceforge.net)" OFF )
IF ( BUILD_NSIS_PACKAGE )
# T h e r e i s a b u g i n N S I S t h a t d o e s n o t h a n d l e f u l l u n i x p a t h s p r o p e r l y . M a k e
# s u r e t h e r e i s a t l e a s t o n e s e t o f four ( 4 ) b a c k l a s s h e s .
SET ( CPACK_PACKAGE_ICON "${OpenSceneGraph_SOURCE_DIR}/PlatformSpecifics/Windows/icons\\\\osg.ico" )
SET ( CPACK_NSIS_INSTALLED_ICON_NAME "" )
SET ( CPACK_NSIS_DISPLAY_NAME "OpenSceneGraph ${OPENSCENEGRAPH_VERSION}" )
SET ( CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.openscenegraph.org/projects/osg/wiki/Support" )
SET ( CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.openscenegraph.org/projects/osg/wiki/About" )
SET ( CPACK_NSIS_CONTACT "" )
SET ( CPACK_NSIS_MODIFY_PATH ON )
SET ( CPACK_GENERATOR "NSIS" )
ENDIF ( BUILD_NSIS_PACKAGE )
ELSE ( WIN32 AND NOT UNIX )
SET ( CPACK_STRIP_FILES ON )
SET ( CPACK_SOURCE_STRIP_FILES ON )
ENDIF ( WIN32 AND NOT UNIX )
# STRING ( TOLOWER "${CMAKE_SYSTEM_NAME}" CPACK_SYSTEM_NAME )
# I n c l u d i n g C P a c k w i l l g e n e r a t e C P a c k C o n f i g . c m a k e a n d C P a c k S o u r c e C o n f i g . c m a k e a n d m a k e t a r g e t s r e g a r d l e s s o f h o w i c a l l i t
# T h e f i r s t i d e a w a s t o n o t u s e i t a t a l l a n d t h a t m i g h t b e w h e r e w e ' r e g o i n g . F o r n o w i t a l s o d e f i n e s s o m e u s e f u l m a c r o s , e s p e c i a l l y
# f o r t h e v i s u a l i n s t a l l e r s , s o I d e c i d e d t o i n c l u d e i t t o h a v e t h e p o s s i b i l i t y t o c r e a t e v i s u a l i n s t a l l e r s f o r m s a n d m a c a n d t h e n t r y t o
# m a k e t h e b e s t u s e I c o u l d o f t h e t a r g e t s t h a t i n c l u d i n g C P a c k i m p l i e s
INCLUDE ( CPack )
# i n c l u d i n g C P a c k a l s o h a s t h e b e n e f i t o f c r e a t i n g t h i s n i c e v a r i a b l e w h i c h i s a c o l l e c t i o n o f a l l d e f i n e d C O M P O N E N T S
# C r e a t e c o n f i g s a n d t a r g e t s f o r e a c h c o m p o n e n t
FOREACH ( package ${ CPACK_COMPONENTS_ALL } )
# f o r m s v c w e u s e i t ' s i n t e r n a l l y d e f i n e d v a r i a b l e t o g e t t h e configuration ( debug,release, ... )
IF ( MSVC )
SET ( OSG_CPACK_CONFIGURATION "$(OutDir)" )
SET ( PACKAGE_TARGET_PREFIX "Package " )
ELSE ( MSVC )
SET ( OSG_CPACK_CONFIGURATION "${SYSTEM_BUILD_TYPE}" )
SET ( PACKAGE_TARGET_PREFIX "package_" )
ENDIF ( MSVC )
# G e t a l l d e f i n e d c o m p o n e n t s
IF ( CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4 AND CMAKE_PATCH_VERSION GREATER 0 )
GET_CMAKE_PROPERTY ( CPACK_COMPONENTS_ALL COMPONENTS )
ELSE ( CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4 AND CMAKE_PATCH_VERSION GREATER 0 )
# c m a k e 2 . 6 . 0 d i d n ' t s u p p l y t h e C O M P O N E N T S p r o p e r t y .
# I s e t i t m a n u a l l y t o b e t h e p a c k a g e s t h a t c a n a l w a y s b e p a c k a g e d
MESSAGE ( "When building packages please consider using cmake version 2.6.1 or above" )
SET ( CPACK_COMPONENTS_ALL libopenscenegraph openscenegraph libopenthreads libopenscenegraph-dev libopenthreads-dev )
ENDIF ( CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4 AND CMAKE_PATCH_VERSION GREATER 0 )
# C r e a t e a t a r g e t t h a t w i l l b e u s e d t o g e n e r a t e a l l p a c k a g e s d e f i n e d b e l o w
SET ( PACKAGE_ALL_TARGETNAME "${PACKAGE_TARGET_PREFIX}ALL" )
ADD_CUSTOM_TARGET ( ${ PACKAGE_ALL_TARGETNAME } )
MACRO ( GENERATE_PACKAGING_TARGET package_name )
SET ( CPACK_PACKAGE_NAME ${ package_name } )
# t h e d o c p a c k a g e s d o n ' t n e e d a s y s t e m - a r c h s p e c i f i c a t i o n
IF ( ${ package } MATCHES -doc )
SET ( CPACK_PACKAGE_FILE_NAME ${ packag e} - ${ OPENSCENEGRAPH_VERSION } )
SET ( OSG_PACKAGE_FILE_NAME ${ package_name } - ${ OPENSCENEGRAPH_VERSION } )
ELSE ( ${ package } MATCHES -doc )
SET ( CPACK_PACKAGE_FILE_NAME ${ packag e} - ${ OPENSCENEGRAPH_VERSION } - ${ OSG_CPACK_SYSTEM_SPEC_STRING } )
SET ( OSG_PACKAGE_FILE_NAME ${ package_name } - ${ OPENSCENEGRAPH_VERSION } - ${ OSG_CPACK_SYSTEM_SPEC_STRING } - ${ OSG_CPACK_CONFIGURATION } )
ENDIF ( ${ package } MATCHES -doc )
SET ( OSG_CPACK_COMPONENT ${ package } )
CONFIGURE_FILE ( "${OpenSceneGraph_SOURCE_DIR}/CMakeModules/OsgCPackConfig.cmake.in" "${OpenSceneGraph_BINARY_DIR}/CPackConfig-${OSG_CPACK_COMPONENT}.cmake" IMMEDIATE )
CONFIGURE_FILE ( "${OpenSceneGraph_SOURCE_DIR}/CMakeModules/OsgCPackConfig.cmake.in" "${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake" IMMEDIATE )
ADD_CUSTOM_TARGET ( "package_${package}"
C O M M A N D $ { C M A K E _ C P A C K _ C O M M A N D } - - c o n f i g $ { O p e n S c e n e G r a p h _ B I N A R Y _ D I R } / C P a c k C o n f i g - $ { O S G _ C P A C K _ C O M P O N E N T } . c m a k e
C O M M E N T R u n C P a c k p a c k a g i n g f o r $ { p a c k a g e } . . .
SET ( PACKAGE_TARGETNAME "${PACKAGE_TARGET_PREFIX}${package_name}" )
# C r e a t e a t a r g e t t h a t c r e a t e s t h e c u r r e n t p a c k a g e
ADD_CUSTOM_TARGET ( ${ PACKAGE_TARGETNAME } )
ADD_CUSTOM_COMMAND ( TARGET ${ PACKAGE_TARGETNAME }
C O M M A N D $ { C M A K E _ C P A C K _ C O M M A N D } - C $ { O S G _ C P A C K _ C O N F I G U R A T I O N } - - c o n f i g $ { O p e n S c e n e G r a p h _ B I N A R Y _ D I R } / C P a c k C o n f i g - $ { p a c k a g e _ n a m e } . c m a k e
C O M M E N T " R u n C P a c k p a c k a g i n g f o r $ { p a c k a g e _ n a m e } . . . "
)
ADD_CUSTOM_COMMAND ( TARGET ${ PACKAGE_ALL_TARGETNAME }
C O M M A N D $ { C M A K E _ C P A C K _ C O M M A N D } - C $ { O S G _ C P A C K _ C O N F I G U R A T I O N } - - c o n f i g $ { O p e n S c e n e G r a p h _ B I N A R Y _ D I R } / C P a c k C o n f i g - $ { p a c k a g e _ n a m e } . c m a k e
)
# T h i s i s n a i v e a n d w i l l p r o b a b l y n e e d f i x i n g e v e n t u a l l y
IF ( MSVC )
SET ( MOVE_COMMAND "move" )
ELSE ( MSVC )
SET ( MOVE_COMMAND "mv" )
ENDIF ( MSVC )
# R e n a m e t h e p a c k a g e t o g e t t h e p r o p e r f i l e n a m e < p a c k a g e > - < p l a t f o r m > - < a r c h > [ c o m p i l e r ] - < b u i l d t y p e > . t a r . g z
ADD_CUSTOM_COMMAND ( TARGET ${ PACKAGE_TARGETNAME }
# C O M M A N D " $ { M O V E _ C O M M A N D } " " $ { C P A C K _ P A C K A G E _ F I L E _ N A M E } . t a r . g z " " $ { O S G _ P A C K A G E _ F I L E _ N A M E } - $ ( O u t D i r ) . t a r . g z "
C O M M A N D " $ { M O V E _ C O M M A N D } " " $ { C P A C K _ P A C K A G E _ F I L E _ N A M E } . t a r . g z " " $ { O S G _ P A C K A G E _ F I L E _ N A M E } . t a r . g z "
)
# A d d t h e e x a c t s a m e c u s t o m c o m m a n d t o t h e a l l p a c k a g e g e n e r a t i n g t a r g e t .
# I c a n ' t u s e a d d _ d e p e n d e n c i e s t o d o t h i s b e c a u s e i t w o u l d a l l o w p a r a l l e l l b u i l d i n g o f p a c k a g e s s o a m g o i n g b r u t e h e r e
ADD_CUSTOM_COMMAND ( TARGET ${ PACKAGE_ALL_TARGETNAME }
C O M M A N D " $ { M O V E _ C O M M A N D } " " $ { C P A C K _ P A C K A G E _ F I L E _ N A M E } . t a r . g z " " $ { O S G _ P A C K A G E _ F I L E _ N A M E } . t a r . g z "
)
ENDMACRO ( GENERATE_PACKAGING_TARGET )
# C r e a t e c o n f i g s a n d t a r g e t s f o r a p a c k a g e i n c l u d i n g a l l c o m p o n e n t s
SET ( OSG_CPACK_COMPONENT ALL )
GENERATE_PACKAGING_TARGET ( openscenegraph-all )
# C r e a t e c o n f i g s a n d t a r g e t s f o r e a c h c o m p o n e n t
FOREACH ( package ${ CPACK_COMPONENTS_ALL } )
SET ( OSG_CPACK_COMPONENT ${ package } )
GENERATE_PACKAGING_TARGET ( ${ package } )
ENDFOREACH ( package ${ CPACK_COMPONENTS_ALL } )