fixed: osx compile error, compiler warning
[opensg.git] / CMake / CMakeLists.packaging.unix.txt
blobeabb3b49aad44ce249714db0fc080cc3ff7e3396
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
4 PROJECT(OpenSGPack)
6 IF("${${PROJECT_NAME}_SOURCE_DIR}"  STREQUAL "${${PROJECT_NAME}_BINARY_DIR}")
7   MESSAGE(FATAL_ERROR "OpenSG requires an out of source Build. \n"
8                       "Please create a separate binary directory and run "
9                       "CMake there.")
10 ENDIF("${${PROJECT_NAME}_SOURCE_DIR}"  STREQUAL "${${PROJECT_NAME}_BINARY_DIR}")
12 IF(CMAKE_INSTALL_PREFIX STREQUAL /usr/local)
13   SET(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Pack.install 
14                            CACHE PATH "" FORCE)
15 ENDIF()
17 ################
18 # Ref Dir
19 ################
21 STRING(REGEX REPLACE /[^/]*/[^/]*/[^/]*$ "" _BASE_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR})
23 #MESSAGE("BASE DIR : ${_BASE_INSTALL_DIR}")
25 ################
26 # includes 
27 ################
29 FILE(GLOB_RECURSE _${PROJECT_NAME}_INCLUDES 
30                   RELATIVE ${_BASE_INSTALL_DIR}
31                   ${_BASE_INSTALL_DIR}/include/*)
33 #MESSAGE("INC : ${_${PROJECT_NAME}_INCLUDES}")
35 FOREACH(_INCLUDE_ELEM ${_${PROJECT_NAME}_INCLUDES})
37   STRING(REGEX REPLACE /[^/]*$ "" _INST_PATH ${_INCLUDE_ELEM})
39   INSTALL(FILES ${_BASE_INSTALL_DIR}/${_INCLUDE_ELEM}
40                 DESTINATION ${_INST_PATH}
41                 PERMISSIONS OWNER_WRITE OWNER_READ
42                             GROUP_READ
43                             WORLD_READ
44                 COMPONENT headers)
46 ENDFOREACH()
48 ################
49 # libs 
50 ################
52 FILE(GLOB_RECURSE _${PROJECT_NAME}_LIBS
53                   RELATIVE ${_BASE_INSTALL_DIR}
54                   ${_BASE_INSTALL_DIR}/lib@OSG_LIBDIR_BASE_SUFFIX@/*)
57 FOREACH(_LIB_ELEM ${_${PROJECT_NAME}_LIBS})
59   STRING(REGEX REPLACE /[^/]*$ "" _INST_PATH ${_LIB_ELEM})
61   SET(_ELEM_COMPONENT libraries)
63   IF(${_INST_PATH} MATCHES /python[1-9]\\.[0-9]/)
64     IF(${_INST_PATH} MATCHES /debug/)
65       SET(_ELEM_COMPONENT python_debug)
66     ELSE()
67       SET(_ELEM_COMPONENT python)
68     ENDIF()
69   ELSEIF(${_INST_PATH} MATCHES /debug$)
70     SET(_ELEM_COMPONENT libraries_debug)
71   ENDIF()
73 #  MESSAGE("LIB : ${_LIB_ELEM} ${_ELEM_COMPONENT} ${_INST_PATH}")
75   INSTALL(FILES ${_BASE_INSTALL_DIR}/${_LIB_ELEM}
76                 DESTINATION ${_INST_PATH}
77                 PERMISSIONS OWNER_WRITE OWNER_READ
78                             GROUP_READ
79                             WORLD_READ
80                 COMPONENT ${_ELEM_COMPONENT})
82 ENDFOREACH()
85 ################
86 # bin
87 ################
89 FILE(GLOB_RECURSE _${PROJECT_NAME}_BIN
90                   RELATIVE ${_BASE_INSTALL_DIR}
91                   ${_BASE_INSTALL_DIR}/bin/*)
94 FOREACH(_BIN_ELEM ${_${PROJECT_NAME}_BIN})
96   STRING(REGEX REPLACE /[^/]*$ "" _INST_PATH ${_BIN_ELEM})
98   SET(_ELEM_COMPONENT development_tools)
100   IF(${_BIN_ELEM} MATCHES bin/app.*$)
101     SET(_ELEM_COMPONENT apps)
102   ELSEIF(${_BIN_ELEM} MATCHES bin/debug/app.*$)
103     SET(_ELEM_COMPONENT apps_debug)
104   ENDIF()
106 #  MESSAGE("BIN : ${_BIN_ELEM} ${_ELEM_COMPONENT} ${_INST_PATH}")
108   INSTALL(FILES ${_BASE_INSTALL_DIR}/${_BIN_ELEM}
109                 DESTINATION ${_INST_PATH}
110                 PERMISSIONS OWNER_WRITE OWNER_READ
111                             GROUP_READ
112                             WORLD_READ
113                 COMPONENT ${_ELEM_COMPONENT})
115 ENDFOREACH()
118 ################
119 # share 
120 ################
122 FILE(GLOB_RECURSE _${PROJECT_NAME}_SHARE
123                   RELATIVE ${_BASE_INSTALL_DIR}
124                   ${_BASE_INSTALL_DIR}/share/*)
126 #MESSAGE("SHARE IN : ${_${PROJECT_NAME}_SHARE}")
128 FOREACH(_SHARE_ELEM ${_${PROJECT_NAME}_SHARE})
130   STRING(REGEX REPLACE /[^/]*$ "" _INST_PATH ${_SHARE_ELEM})
132   SET(_ELEM_COMPONENT Unknown)
134   IF(NOT ${_INST_PATH} MATCHES /Packaging)
136     IF(${_INST_PATH} MATCHES /cmake)
137       SET(_ELEM_COMPONENT development_config)
138     ENDIF()
140     IF(${_INST_PATH} MATCHES /Doc)
141       SET(_ELEM_COMPONENT doc)
142     ENDIF()
144     IF(${_INST_PATH} MATCHES /Doc$)
145       SET(BASE_DOC_DIR ${_INST_PATH})
146     ENDIF()
148     IF(${_INST_PATH} MATCHES /Examples/)
149       IF(${_INST_PATH} MATCHES /bin$)
150         SET(_ELEM_COMPONENT examples_rel)
151       ELSEIF(${_INST_PATH} MATCHES /bin/debug$)
152         SET(_ELEM_COMPONENT examples_debug)
153       ELSEIF(${_INST_PATH} MATCHES /CSM/)
154         SET(_ELEM_COMPONENT app_data)
155       ELSE()
156         SET(_ELEM_COMPONENT example_projects)
157       ENDIF()
158     ENDIF()
160 #    MESSAGE("SHARE : ${_SHARE_ELEM} ${_ELEM_COMPONENT} ${_INST_PATH}")
162     INSTALL(FILES ${_BASE_INSTALL_DIR}/${_SHARE_ELEM}
163                   DESTINATION ${_INST_PATH}
164                   PERMISSIONS OWNER_WRITE OWNER_READ
165                               GROUP_READ
166                               WORLD_READ
167                   COMPONENT ${_ELEM_COMPONENT})
168   ENDIF()
170 ENDFOREACH()
174 STRING(REGEX REPLACE ".*\\.(fc[1-9][0-9])\\..*" "\\1" 
175              _OSG_FC_VERSION ${CMAKE_SYSTEM_VERSION})
177 SET(OSG_HOST_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME})
179 IF(_OSG_FC_VERSION)
180   SET(OSG_HOST_SYSTEM_NAME ${_OSG_FC_VERSION})
181 ENDIF()
183 SET(SYSTEM_SPEC ${OSG_HOST_SYSTEM_NAME}.${CMAKE_HOST_SYSTEM_PROCESSOR})
186 SET(CPACK_PACKAGE_NAME                "OpenSG")
187 SET(CPACK_PACKAGE_VERSION             @OSG_VERSION@)
188 SET(CPACK_PACKAGE_VERSION_MAJOR       @OSG_VERSION_MAJOR@)
189 SET(CPACK_PACKAGE_VERSION_MINOR       @OSG_VERSION_MINOR@)
190 SET(CPACK_PACKAGE_VERSION_PATCH       @OSG_VERSION_PATCH@)
191 SET(CPACK_PACKAGE_VENDOR              "OpenSG")
192 SET(CPACK_PACKAGE_CONTACT             "Dirk Reiners <dirk@www.opensg.org>")
193 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSG provides the libraries OpenSG uses")
195 SET(CPACK_COMPONENTS_GROUPING ONE_PER_GROUP)
197 IF(NOT OSG_SINGLE_PACKAGE)
198   SET(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
199   SET(CPACK_RPM_COMPONENT_INSTALL     ON)
200 ENDIF()
202 SET(CPACK_PACKAGE_FILE_NAME           "OpenSG.@OSG_VERSION@.${SYSTEM_SPEC}")
204 #MESSAGE("CPFN : ${CPACK_PACKAGE_FILE_NAME}")
206 # Determine package type
207 IF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
208   IF(WIN32)
209     SET(OSGBUILD_PACKAGE_TYPE "ZIP")
210   ELSE(WIN32)
211     SET(OSGBUILD_PACKAGE_TYPE "TBZ2")
212   ENDIF(WIN32)
213 ENDIF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
215 STRING(TOUPPER ${OSGBUILD_PACKAGE_TYPE} CPACK_GENERATOR)
217 SET(CPACK_COMPONENTS_ALL libraries
218                          libraries_debug
220                          headers
221                          development_tools
222                          
223                          python
224                          python_debug
226                          apps
227                          app_data
228                          apps_debug
230 #doc
232                         examples_rel
233                         examples_debug
234                         example_projects)
236 SET(CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION        "Suport Files needed to execute software with OpenSG.")
237 SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION          "Development files needed to develop software with OpenSG.")
238 SET(CPACK_COMPONENT_GROUP_EXAMPLES_DESCRIPTION       "Development Examples files needed to develop software with OpenSG.")
240 SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME           "Release Runtime Libs")
241 SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION            "Release Runtime Libraries Description")
242 SET(CPACK_COMPONENT_LIBRARIES_GROUP                  "runtime")
243 SET(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES          Full Developer Runtime)
245 SET(CPACK_COMPONENT_APPS_DISPLAY_NAME                "Release Runtime Apps")
246 SET(CPACK_COMPONENT_APPS_DESCRIPTION                 "Release Runtime Apps Description")
247 SET(CPACK_COMPONENT_APPS_GROUP                       "runtime")
248 SET(CPACK_COMPONENT_APPS_INSTALL_TYPES               Full Developer Runtime)
250 SET(CPACK_COMPONENT_APP_DATA_DISPLAY_NAME            "Release Runtime App Data")
251 SET(CPACK_COMPONENT_APP_DATA_DESCRIPTION             "Release Runtime App Data Description")
252 SET(CPACK_COMPONENT_APP_DATA_GROUP                   "runtime")
253 SET(CPACK_COMPONENT_APP_DATA_INSTALL_TYPES           Full Developer Runtime)
255 SET(CPACK_COMPONENT_PYHTON_DISPLAY_NAME              "Release Runtime Python")
256 SET(CPACK_COMPONENT_PYTHON_DESCRIPTION               "Release Runtime Python Description")
257 SET(CPACK_COMPONENT_PYTHON_GROUP                     "runtime")
258 SET(CPACK_COMPONENT_PYTHON_INSTALL_TYPES             Full Developer Runtime)
260 SET(CPACK_COMPONENT_LIBRARIES_DEBUG_DISPLAY_NAME     "Debug Runtime Libs")
261 SET(CPACK_COMPONENT_LIBRARIES_DEBUG_DESCRIPTION      "Debug Runtimes Libraries Description")
262 SET(CPACK_COMPONENT_LIBRARIES_DEBUG_GROUP            "devel")
263 SET(CPACK_COMPONENT_LIBRARIES_DEBUG_INSTALL_TYPES    Full Developer Runtime)
265 SET(CPACK_COMPONENT_APPS_DEBUG_DISPLAY_NAME          "Debug Runtime Apps")
266 SET(CPACK_COMPONENT_APPS_DEBUG_DESCRIPTION           "Debug Runtimes Apps Description")
267 SET(CPACK_COMPONENT_APPS_DEBUG_GROUP                 "devel")
268 SET(CPACK_COMPONENT_APPS_DEBUG_INSTALL_TYPES         Full Developer Runtime)
270 SET(CPACK_COMPONENT_PYTHON_DEBUG_DISPLAY_NAME        "Debug Runtime Python")
271 SET(CPACK_COMPONENT_PYTHON_DEBUG_DESCRIPTION         "Debug Runtimes Python Description")
272 SET(CPACK_COMPONENT_PYTHON_DEBUG_GROUP               "devel")
273 SET(CPACK_COMPONENT_PYTHON_DEBUG_INSTALL_TYPES       Full Developer Runtime)
275 SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME             "Headers")
276 SET(CPACK_COMPONENT_HEADERS_DESCRIPTION              "Headers Description")
277 SET(CPACK_COMPONENT_HEADERS_GROUP                    "devel")
278 SET(CPACK_COMPONENT_HEADER_INSTALL_TYPES             Full Developer)
280 SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DISPLAY_NAME   "Dev Tools")
281 SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DESCRIPTION    "Dev Tools Description")
282 SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_GROUP          "devel")
283 SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_INSTALL_TYPES  Full Developer)
286 SET(CPACK_COMPONENT_EXAMPLES_REL_DISPLAY_NAME        "Examples")
287 SET(CPACK_COMPONENT_EXAMPLES_REL_DESCRIPTION         "Examples Description")
288 SET(CPACK_COMPONENT_EXAMPLES_REL_GROUP               "examples")
289 SET(CPACK_COMPONENT_EXAMPLES_REL_INSTALL_TYPES       Full Developer Runtime)
291 SET(CPACK_COMPONENT_EXAMPLES_DEBUG_DISPLAY_NAME      "Examples")
292 SET(CPACK_COMPONENT_EXAMPLES_DEBUG_DESCRIPTION       "Examples Description")
293 SET(CPACK_COMPONENT_EXAMPLES_DEBUG_GROUP             "examples")
294 SET(CPACK_COMPONENT_EXAMPLES_DEBUG_INSTALL_TYPES     Full Developer Runtime)
296 SET(CPACK_COMPONENT_EXAMPLE_PROJECTS_DISPLAY_NAME    "Examples")
297 SET(CPACK_COMPONENT_EXAMPLE_PROJECTS_DESCRIPTION     "Examples Description")
298 SET(CPACK_COMPONENT_EXAMPLE_PROJECTS_GROUP           "examples")
299 SET(CPACK_COMPONENT_EXAMPLE_PROJECTS_INSTALL_TYPES   Full Developer Runtime)
302 IF(CPACK_GENERATOR STREQUAL "RPM")
303   SET(CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
304   SET(CPACK_RPM_PACKAGE_REQUIRES "OpenSGSupport-runtime >= 2.0.0, boost >= 1.46.0, expat >= 2.1.0, libxml2 >= 2.7.8, zlib >= 1.2.5")
305   SET(CPACK_RPM_devel_PACKAGE_REQUIRES "OpenSG-runtime >= 2.0.0, OpenSG-devel >= 2.0.0 boost-devel >= 1.46.0, expat-devel >= 2.1.0, libxml2-devel >= 2.7.8, zlib-devel >= 1.2.5")
306   SET(CPACK_PACKAGING_INSTALL_PREFIX    "/usr/local")
307 ENDIF()
309 INCLUDE(CPack)