2 #############################################################################
3 # print message depending on the setting of OSG_VERBOSE_BUILD_MESSAGES
6 IF(OSG_VERBOSE_BUILD_MESSAGES)
7 MESSAGE(STATUS "${MSG}")
8 ENDIF(OSG_VERBOSE_BUILD_MESSAGES)
11 #############################################################################
12 # includes _OSG_FILENAME if it exists, otherwise bails with an error.
14 MACRO(OSG_CHECKED_INCLUDE _OSG_FILENAME)
15 IF(NOT EXISTS "${_OSG_FILENAME}")
16 MESSAGE(FATAL_ERROR "File \"${_OSG_FILENAME}\" not found, "
17 "required by ${PROJECT_NAME}\n")
18 ENDIF(NOT EXISTS "${_OSG_FILENAME}")
20 INCLUDE("${_OSG_FILENAME}")
21 ENDMACRO(OSG_CHECKED_INCLUDE)
23 #############################################################################
24 # includes _OSG_FILENAME if it exists, otherwise just ignores it.
26 MACRO(OSG_OPTIONAL_INCLUDE _OSG_FILENAME)
27 IF(EXISTS "${_OSG_FILENAME}")
28 INCLUDE("${_OSG_FILENAME}")
29 ENDIF(EXISTS "${_OSG_FILENAME}")
30 ENDMACRO(OSG_OPTIONAL_INCLUDE)
32 ################################
35 MACRO(OSG_SYMLINK_CHECKED _OSG_SRC_FILENAME _OSG_DST_FILENAME)
36 IF(NOT EXISTS "${_OSG_DST_FILENAME}")
38 COMMAND "${CMAKE_COMMAND}" -E create_symlink
39 "${_OSG_SRC_FILENAME}"
40 "${_OSG_DST_FILENAME}")
41 ENDIF(NOT EXISTS "${_OSG_DST_FILENAME}")
42 ENDMACRO(OSG_SYMLINK_CHECKED)
44 #############################################################################
45 # given a list of OpenSG libraries (BASELIST) it determines the full list of
46 # OpenSG libs they depend upon (OUTDEPLIST) and any dependencies that could
47 # not be found (OUTDEPMISSINGLIST).
48 # Useful to get all the include dirs needed by a lib during the build.
50 FUNCTION(OSG_GET_ALL_DEP_OSG_LIB BASELIST OUTDEPLIST OUTDEPMISSINGLIST)
52 SET(_DEPLIST ${BASELIST})
56 # CMake has no do{ }while, duplicate the while loop body once
57 # outside the while loop:
59 FOREACH(DEP ${_DEPLIST})
60 SET(DEPFILE "${CMAKE_BINARY_DIR}/${DEP}.cmake")
62 IF(NOT EXISTS "${DEPFILE}")
63 LIST(APPEND _DEPMISSINGLIST ${DEP})
64 ENDIF(NOT EXISTS "${DEPFILE}")
66 OSG_OPTIONAL_INCLUDE("${DEPFILE}")
68 LIST(APPEND _DEPLISTNEW ${DEP})
69 LIST(APPEND _DEPLISTNEW ${${DEP}_DEP_OSG_LIB})
71 LIST(SORT _DEPLISTNEW)
72 LIST(REMOVE_DUPLICATES _DEPLISTNEW)
75 LIST(LENGTH _DEPLIST _DEPLISTLEN )
76 LIST(LENGTH _DEPLISTNEW _DEPLISTNEWLEN)
78 #MESSAGE("_DEPLIST : ${_DEPLIST}" )
79 #MESSAGE("_DEPLISTNEW: ${_DEPLISTNEW}")
81 # keep iterating as long as new elements are added
82 WHILE(${_DEPLISTNEWLEN} GREATER ${_DEPLISTLEN})
84 SET(_DEPLIST ${_DEPLISTNEW})
87 FOREACH(DEP ${_DEPLIST})
88 SET(DEPFILE "${CMAKE_BINARY_DIR}/${DEP}.cmake")
90 IF(NOT EXISTS "${DEPFILE}")
91 LIST(APPEND _DEPMISSINGLIST ${DEP})
92 ENDIF(NOT EXISTS "${DEPFILE}")
94 OSG_OPTIONAL_INCLUDE("${DEPFILE}")
96 LIST(APPEND _DEPLISTNEW ${DEP} )
97 LIST(APPEND _DEPLISTNEW ${${DEP}_DEP_OSG_LIB})
99 LIST(SORT _DEPLISTNEW)
100 LIST(REMOVE_DUPLICATES _DEPLISTNEW)
103 #MESSAGE("_DEPLIST : ${_DEPLIST}" )
104 #MESSAGE("_DEPLISTNEW: ${_DEPLISTNEW}")
106 LIST(LENGTH _DEPLIST _DEPLISTLEN )
107 LIST(LENGTH _DEPLISTNEW _DEPLISTNEWLEN)
108 ENDWHILE(${_DEPLISTNEWLEN} GREATER ${_DEPLISTLEN})
111 LIST(REMOVE_DUPLICATES _DEPMISSINGLIST)
112 ENDIF(_DEPMISSINGLIST)
114 SET(${OUTDEPLIST} "${_DEPLISTNEW}" PARENT_SCOPE)
115 SET(${OUTDEPMISSINGLIST} "${_DEPMISSINGLIST}" PARENT_SCOPE)
117 ENDFUNCTION(OSG_GET_ALL_DEP_OSG_LIB)
119 #############################################################################
120 # register project with build
122 MACRO(OSG_ADD_PROJECT PNAME)
124 IF(${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
125 OPTION(OSGBUILD_${PROJECT_NAME} "Build the ${PROJECT_NAME} library" ON)
126 IF(NOT OSG_DISABLE_SOURCE_GROUPS)
127 SET(${PROJECT_NAME}_SOURCE_GROUPS "" CACHE INTERNAL "" FORCE)
129 ENDIF(${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
130 ENDMACRO(OSG_ADD_PROJECT)
132 #############################################################################
135 MACRO(OSG_QT_MAKE_OUTPUT_FILE ARG1 ARG2 ARG3 ARG4)
138 QT4_MAKE_OUTPUT_FILE(${MOCFile} moc_ cpp MOCOutFile)
142 QT5_MAKE_OUTPUT_FILE(${MOCFile} moc_ cpp MOCOutFile)
147 #############################################################################
148 # select the current project as the one settings are added to
150 MACRO(OSG_SELECT_PROJECT)
152 IF(OSGBUILD_${PROJECT_NAME})
153 MESSAGE(STATUS "Processing ${PROJECT_NAME}")
154 ELSE(OSGBUILD_${PROJECT_NAME})
155 OSG_MSG("Skipping ${PROJECT_NAME}")
157 ENDIF(OSGBUILD_${PROJECT_NAME})
159 SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM TRUE)
161 SET(${PROJECT_NAME}_BUILD_FILE
162 "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.cmake")
163 SET(${PROJECT_NAME}_CONFIG_FILE
164 "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
167 IF(${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
168 FILE(WRITE ${${PROJECT_NAME}_BUILD_FILE}
169 "# ${PROJECT_NAME}.cmake -- auto generated\n\n")
171 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
172 "SET(${PROJECT_NAME}_SRC ${OSG_ADD_GLOBAL_SRC} ${${PROJECT_NAME}_ADD_SRC})\n")
173 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
174 "SET(${PROJECT_NAME}_HDR ${OSG_ADD_GLOBAL_HDR} ${${PROJECT_NAME}_ADD_HDR})\n")
175 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
176 "SET(${PROJECT_NAME}_HDR)\n")
177 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
178 "SET(${PROJECT_NAME}_INL)\n")
179 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
180 "SET(${PROJECT_NAME}_INS)\n")
181 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
182 "SET(${PROJECT_NAME}_FCD)\n")
183 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
184 "SET(${PROJECT_NAME}_LL)\n")
185 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
186 "SET(${PROJECT_NAME}_YY)\n")
187 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
188 "SET(${PROJECT_NAME}_MOC)\n")
189 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
190 "SET(${PROJECT_NAME}_UNITTEST_SRC)\n")
191 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
192 "SET(${PROJECT_NAME}_TEST_SRC)\n")
193 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
194 "SET(${PROJECT_NAME}_APP_SRC)\n")
195 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
196 "SET(${PROJECT_NAME}_INC)\n\n")
197 ENDIF(${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
199 # clear dependency variables
200 SET(${PROJECT_NAME}_DEP_OSG_LIB)
201 SET(${PROJECT_NAME}_DEP_TEST_OSG_LIB)
202 SET(${PROJECT_NAME}_DEP_TEST_OSG_EEX_LIB)
203 SET(${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB)
205 SET(${PROJECT_NAME}_DEP_LIB)
206 SET(${PROJECT_NAME}_DEP_LIBDIR)
207 SET(${PROJECT_NAME}_DEP_INCDIR)
208 SET(${PROJECT_NAME}_DEP_SYS_INCDIR)
209 SET(${PROJECT_NAME}_DEP_DEFS)
211 SET(${PROJECT_NAME}_DEP_TEST_LIB)
212 SET(${PROJECT_NAME}_DEP_TEST_LIBDIR)
213 SET(${PROJECT_NAME}_DEP_TEST_INCDIR)
214 SET(${PROJECT_NAME}_DEP_TEST_DEFS)
216 SET(${PROJECT_NAME}_DEP_UNITTEST_LIB)
217 SET(${PROJECT_NAME}_DEP_UNITTEST_LIBDIR)
218 SET(${PROJECT_NAME}_DEP_UNITTEST_INCDIR)
220 SET(${PROJECT_NAME}_DEP_ADD_INCDIR)
222 SET(${PROJECT_NAME}_EXCL_FILES)
224 SET(${PROJECT_NAME}_BASE_DIR)
226 SET(${PROJECT_NAME}_SRC_PATTERNS)
227 SET(${PROJECT_NAME}_HDR_PATTERNS)
228 SET(${PROJECT_NAME}_INL_PATTERNS)
230 SET(${PROJECT_NAME}_SUFFIX)
232 SET(${PROJECT_NAME}_NO_DOC)
234 SET(${PROJECT_NAME}_NO_PYTHON)
235 SET(${PROJECT_NAME}_NO_DBG_INSTALL FALSE)
236 SET(${PROJECT_NAME}_ENABLE_WRITE_PYTHON_TO_SOURCE)
238 ENDMACRO(OSG_SELECT_PROJECT)
240 #############################################################################
241 # Extract separate libs and paths from a list of files.
243 # cmake stores libraries as full paths to the library file, this splits
244 # this form into a library (suitable for use on the linker command line) and
245 # the path where that library can be found.
246 FUNCTION(OSG_EXTRACT_LIB_AND_LIBDIR INLIBS OUTLIBS OUTLIBDIRS)
248 FOREACH(INLIB ${INLIBS})
249 GET_FILENAME_COMPONENT(INLIB_LIB ${INLIB} NAME)
250 GET_FILENAME_COMPONENT(INLIB_LIBDIR ${INLIB} PATH)
252 STRING(REPLACE "${CMAKE_SHARED_LIBRARY_PREFIX}" "" INLIB_LIB ${INLIB_LIB})
253 STRING(REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}" "" INLIB_LIB ${INLIB_LIB})
255 LIST(APPEND OLIBS ${INLIB_LIB})
256 LIST(APPEND OLIBDIRS ${INLIB_LIBDIR})
259 SET(${OUTLIBS} ${OLIBS} PARENT_SCOPE)
260 SET(${OUTLIBDIRS} ${OLIBDIRS} PARENT_SCOPE)
262 ENDFUNCTION(OSG_EXTRACT_LIB_AND_LIBDIR)
264 FUNCTION(OSG_EXTRACT_LIBDIR INLIBDIRS OUTLIBDIRS)
266 FOREACH(INLIBDIR ${INLIBDIRS})
267 LIST(APPEND OLIBDIRS ${INLIBDIR})
270 SET(${OUTLIBDIRS} ${OLIBDIRS} PARENT_SCOPE)
271 ENDFUNCTION(OSG_EXTRACT_LIBDIR)
273 FUNCTION(OSG_EXTRACT_INCDIR ININCDIRS OUTINCDIRS)
275 FOREACH(ININCDIR ${ININCDIRS})
276 LIST(APPEND OINCDIRS ${ININCDIR})
279 SET(${OUTINCDIRS} ${OINCDIRS} PARENT_SCOPE)
280 ENDFUNCTION(OSG_EXTRACT_INCDIR)
282 #############################################################################
283 # write the dependecy variables to the ${${PROJECT_NAME}_BUILD_FILE} file
284 # for use during the build and to
285 # ${${PROJECT_NAME}_CONFIG_FILE} for constructing osg2-config
287 FUNCTION(OSG_STORE_PROJECT_DEPENDENCIES)
288 IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
290 ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
292 IF(OSG_ENABLE_WRITE_PYTHON_TO_SOURCE OR ${PROJECT_NAME}_ENABLE_WRITE_PYTHON_TO_SOURCE)
293 SET(OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/module" CACHE INTERNAL "" FORCE)
295 IF(OSG_PYTHON_MODULE_BASE_DIR)
296 SET(OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR "${OSG_PYTHON_MODULE_BASE_DIR}/${PROJECT_NAME}/module" CACHE INTERNAL "" FORCE)
298 SET(OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR "${CMAKE_BINARY_DIR}/Python/${PROJECT_NAME}/module" CACHE INTERNAL "" FORCE)
302 #########################################
303 # store dependencies for the build
305 # dependencies - OpenSG
306 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
307 "SET(${PROJECT_NAME}_DEP_OSG_LIB ${${PROJECT_NAME}_DEP_OSG_LIB})\n")
308 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
309 "SET(${PROJECT_NAME}_DEP_TEST_OSG_LIB ${${PROJECT_NAME}_DEP_TEST_OSG_LIB})\n\n")
310 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
311 "SET(${PROJECT_NAME}_DEP_TEST_OSG_EEX_LIB ${${PROJECT_NAME}_DEP_TEST_OSG_EEX_LIB})\n\n")
312 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
313 "SET(${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB ${${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB})\n\n")
315 # dependencies - external
317 LIST(APPEND ${PROJECT_NAME}_DEP_LIB ${OSG_GLOBAL_LIB})
318 ENDIF(OSG_GLOBAL_LIB)
319 IF(${PROJECT_NAME}_ADD_LIB)
320 LIST(APPEND ${PROJECT_NAME}_DEP_LIB ${${PROJECT_NAME}_ADD_LIB})
321 ENDIF(${PROJECT_NAME}_ADD_LIB)
323 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
324 "SET(${PROJECT_NAME}_DEP_LIB ${${PROJECT_NAME}_DEP_LIB})\n")
325 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
326 "SET(${PROJECT_NAME}_DEP_LIBDIR ${${PROJECT_NAME}_DEP_LIBDIR})\n")
327 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
328 "SET(${PROJECT_NAME}_DEP_INCDIR ${${PROJECT_NAME}_DEP_INCDIR})\n\n")
329 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
330 "SET(${PROJECT_NAME}_DEP_SYS_INCDIR ${${PROJECT_NAME}_DEP_SYS_INCDIR})\n\n")
332 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
333 "SET(${PROJECT_NAME}_DEP_TEST_LIB ${${PROJECT_NAME}_DEP_TEST_LIB})\n")
334 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
335 "SET(${PROJECT_NAME}_DEP_TEST_LIBDIR ${${PROJECT_NAME}_DEP_TEST_LIBDIR})\n")
336 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
337 "SET(${PROJECT_NAME}_DEP_TEST_INCDIR ${${PROJECT_NAME}_DEP_TEST_INCDIR})\n\n")
339 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
340 "SET(${PROJECT_NAME}_DEP_UNITTEST_LIB ${${PROJECT_NAME}_DEP_UNITTEST_LIB})\n")
341 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
342 "SET(${PROJECT_NAME}_DEP_UNITTEST_LIBDIR ${${PROJECT_NAME}_DEP_UNITTEST_LIBDIR})\n")
343 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
344 "SET(${PROJECT_NAME}_DEP_UNITTEST_INCDIR ${${PROJECT_NAME}_DEP_UNITTEST_INCDIR})\n\n")
346 # dependencies - additional
347 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
348 "SET(${PROJECT_NAME}_DEP_ADD_INCDIR ${${PROJECT_NAME}_DEP_ADD_INCDIR})\n\n")
349 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
350 "SET(${PROJECT_NAME}_DEP_DEFS ${${PROJECT_NAME}_DEP_DEFS})\n\n")
352 # for external projects
354 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
355 "SET(${PROJECT_NAME}_DEP_OSG_LIB ${${PROJECT_NAME}_DEP_OSG_LIB})\n\n")
357 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
358 "SET(${PROJECT_NAME}_DEP_LIB ${${PROJECT_NAME}_DEP_LIB})\n\n")
360 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
361 "LIST(APPEND STORED_PROJECTS ${PROJECT_NAME})\n\n")
365 #########################################################################
366 # Store dependencies for osg2-config.
367 # This is a bit lengthy as it writes a python dictionary
369 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
370 "############################################################\n")
371 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
372 "## Dependecies for ${PROJECT_NAME}\n\n")
374 # OpenSG libraries this lib depends on
375 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
376 "\"${PROJECT_NAME}\" : {\n")
377 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
378 " \"dep_osg_lib\" : [")
380 FOREACH(DEPOSGLIB ${${PROJECT_NAME}_DEP_OSG_LIB})
381 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
382 " \"${DEPOSGLIB}\", ")
383 ENDFOREACH(DEPOSGLIB)
385 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
388 # global dependencies
389 FOREACH(DEPLIB ${OSG_GLOBAL_DEP_LIBS})
390 OSG_EXTRACT_LIB_AND_LIBDIR("${${DEPLIB}}" LIBS LIBDIRS)
393 # if the lib is an import target, get the location and
394 # split that into library name and path
397 GET_TARGET_PROPERTY(_LIB_LOCATION ${LIB} IMPORTED_LOCATION)
399 OSG_EXTRACT_LIB_AND_LIBDIR("${_LIB_LOCATION}" _LIBS _LIBDIRS)
401 LIST(APPEND DEPLIBS ${_LIBS})
402 LIST(APPEND DEPLIBDIRS ${_LIBDIRS})
404 LIST(APPEND DEPLIBS ${LIB})
408 LIST(APPEND DEPLIBDIRS ${LIBDIRS})
411 FOREACH(DEPLIBDIR ${OSG_GLOBAL_DEP_LIBDIR})
412 OSG_EXTRACT_LIBDIR("${${DEPLIBDIR}}" LIBDIRS)
414 LIST(APPEND DEPLIBDIRS ${LIBDIRS})
415 ENDFOREACH(DEPLIBDIR)
417 FOREACH(DEPINCDIR ${OSG_GLOBAL_DEP_INCDIR})
418 OSG_EXTRACT_INCDIR("${${DEPINCDIR}}" INCDIRS)
420 LIST(APPEND DEPINCDIRS ${INCDIRS})
421 ENDFOREACH(DEPINCDIR)
423 FOREACH(DEPINCDIR ${OSG_SYSTEM_DEP_INCDIR})
424 OSG_EXTRACT_INCDIR("${${DEPINCDIR}}" INCDIRS)
426 LIST(APPEND DEPINCDIRS ${INCDIRS})
427 ENDFOREACH(DEPINCDIR)
429 # External libraries this lib depends on
430 # we build lists of libs, libdirs and incdirs then write them
431 FOREACH(DEPLIB ${${PROJECT_NAME}_DEP_LIB})
432 OSG_EXTRACT_LIB_AND_LIBDIR("${${DEPLIB}}" LIBS LIBDIRS)
435 # if the lib is an import target, get the location and
436 # split that into library name and path
439 GET_TARGET_PROPERTY(_LIB_LOCATION ${LIB} IMPORTED_LOCATION)
441 OSG_EXTRACT_LIB_AND_LIBDIR("${_LIB_LOCATION}" _LIBS _LIBDIRS)
443 LIST(APPEND DEPLIBS ${_LIBS})
444 LIST(APPEND DEPLIBDIRS ${_LIBDIRS})
446 LIST(APPEND DEPLIBS ${LIB})
450 LIST(APPEND DEPLIBDIRS ${LIBDIRS})
453 FOREACH(DEPLIBDIR ${${PROJECT_NAME}_DEP_LIBDIR})
454 OSG_EXTRACT_LIBDIR("${${DEPLIBDIR}}" LIBDIRS)
456 LIST(APPEND DEPLIBDIRS ${LIBDIRS})
457 ENDFOREACH(DEPLIBDIR)
459 FOREACH(DEPINCDIR ${${PROJECT_NAME}_DEP_INCDIR})
460 OSG_EXTRACT_INCDIR("${${DEPINCDIR}}" INCDIRS)
462 LIST(APPEND DEPINCDIRS ${INCDIRS})
463 ENDFOREACH(DEPINCDIR)
465 FOREACH(DEPINCDIR ${${PROJECT_NAME}_DEP_SYS_INCDIR})
466 OSG_EXTRACT_INCDIR("${${DEPINCDIR}}" INCDIRS)
468 LIST(APPEND DEPINCDIRS ${INCDIRS})
469 ENDFOREACH(DEPINCDIR)
472 LIST(REMOVE_DUPLICATES DEPLIBS)
476 LIST(REMOVE_DUPLICATES DEPLIBDIRS)
480 LIST(REMOVE_DUPLICATES DEPINCDIRS)
483 IF(DEPLIBS OR DEPLIBDIRS OR DEPINCDIRS)
484 OSG_MSG(" DEPLIBS: ${DEPLIBS}")
485 OSG_MSG(" DEPLIBDIRS: ${DEPLIBDIRS}")
486 OSG_MSG(" DEPINCDIRS: ${DEPINCDIRS}")
487 ENDIF(DEPLIBS OR DEPLIBDIRS OR DEPINCDIRS)
489 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
492 FOREACH(LIB ${DEPLIBS})
493 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
497 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
499 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
500 " \"dep_lib_dir\" : [")
502 FOREACH(LIBDIR ${DEPLIBDIRS})
503 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
507 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
510 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
511 " \"dep_inc_dir\" : [")
513 FOREACH(INCDIR ${DEPINCDIRS})
514 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
518 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
521 FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
524 ENDFUNCTION(OSG_STORE_PROJECT_DEPENDENCIES)
527 #############################################################################
528 # add directory DIRNAME to current project
530 FUNCTION(OSG_ADD_DIRECTORY DIRNAME)
532 IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
534 ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
536 OSG_MSG("Adding directory: ${DIRNAME}")
538 SET(_OSG_ADD_SRC_LOOKUP)
539 SET(_OSG_ADD_HDR_LOOKUP)
540 SET(_OSG_ADD_INL_LOOKUP)
541 SET(_OSG_ADD_INS_LOOKUP)
542 SET(_OSG_ADD_LL_LOOKUP)
543 SET(_OSG_ADD_YY_LOOKUP)
544 SET(_OSG_ADD_QTH_LOOKUP)
546 IF(EXISTS "${CMAKE_SOURCE_DIR}/${DIRNAME}")
547 SET(_OSG_CURR_DIRNAME "${CMAKE_SOURCE_DIR}/${DIRNAME}")
549 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
550 LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.cpp")
551 LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.mm")
554 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
555 LIST(APPEND _OSG_ADD_HDR_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.h")
558 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
559 LIST(APPEND _OSG_ADD_INL_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.inl")
562 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
563 LIST(APPEND _OSG_ADD_INS_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.ins")
566 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
567 LIST(APPEND _OSG_ADD_LL_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.ll")
570 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
571 LIST(APPEND _OSG_ADD_YY_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.yy")
574 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
575 LIST(APPEND _OSG_ADD_QTH_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*_qt.h")
579 FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_SRC_PATTERNS})
580 LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
583 FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_HDR_PATTERNS})
584 LIST(APPEND _OSG_ADD_HDR_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
587 FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_INL_PATTERNS})
588 LIST(APPEND _OSG_ADD_INL_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
591 FILE(GLOB LOCAL_SRC #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.cpp"
592 #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.mm"
593 ${_OSG_ADD_SRC_LOOKUP} )
594 FILE(GLOB LOCAL_HDR #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.h"
595 ${_OSG_ADD_HDR_LOOKUP} )
596 FILE(GLOB LOCAL_INL #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.inl"
597 ${_OSG_ADD_INL_LOOKUP} )
598 FILE(GLOB LOCAL_INS #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.ins"
599 ${_OSG_ADD_INS_LOOKUP} )
600 FILE(GLOB LOCAL_LL #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.ll"
601 ${_OSG_ADD_LL_LOOKUP} )
602 FILE(GLOB LOCAL_YY #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.yy"
603 ${_OSG_ADD_YY_LOOKUP} )
604 FILE(GLOB LOCAL_MOC #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*_qt.h"
605 ${_OSG_ADD_QTH_LOOKUP} )
607 FILE(GLOB LOCAL_FCD "${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.fcd")
608 FILE(GLOB LOCAL_UNITTEST_SRC "${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*Test.cpp")
609 FILE(GLOB LOCAL_TEST_SRC "${CMAKE_SOURCE_DIR}/${DIRNAME}/test*.cpp"
610 "${CMAKE_SOURCE_DIR}/${DIRNAME}/test*.mm")
611 FILE(GLOB LOCAL_APP_SRC "${CMAKE_SOURCE_DIR}/${DIRNAME}/app*.cpp")
612 FILE(GLOB BASE_MM "${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*Base.mm")
613 ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}")
614 SET(_OSG_CURR_DIRNAME "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}")
616 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
617 LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.cpp"
618 "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.mm")
621 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
622 LIST(APPEND _OSG_ADD_HDR_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.h")
625 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
626 LIST(APPEND _OSG_ADD_INL_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.inl")
629 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
630 LIST(APPEND _OSG_ADD_INS_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.ins")
633 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
634 LIST(APPEND _OSG_ADD_LL_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.ll")
637 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
638 LIST(APPEND _OSG_ADD_YY_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.yy")
641 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
642 LIST(APPEND _OSG_ADD_QTH_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*_qt.h")
646 FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_SRC_PATTERNS})
647 LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
650 FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_HDR_PATTERNS})
651 LIST(APPEND _OSG_ADD_HDR_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
654 FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_INL_PATTERNS})
655 LIST(APPEND _OSG_ADD_INL_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
658 FILE(GLOB LOCAL_SRC #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.cpp"
659 #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.mm"
660 ${_OSG_ADD_SRC_LOOKUP} )
661 FILE(GLOB LOCAL_HDR #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.h"
662 ${_OSG_ADD_HDR_LOOKUP} )
663 FILE(GLOB LOCAL_INL #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.inl"
664 ${_OSG_ADD_INL_LOOKUP} )
665 FILE(GLOB LOCAL_INS #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.ins"
666 ${_OSG_ADD_INS_LOOKUP} )
667 FILE(GLOB LOCAL_LL #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.ll"
668 ${_OSG_ADD_LL_LOOKUP} )
669 FILE(GLOB LOCAL_YY #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.yy"
670 ${_OSG_ADD_YY_LOOKUP} )
671 FILE(GLOB LOCAL_MOC #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*_qt.h"
672 ${_OSG_ADD_QTH_LOOKUP} )
674 FILE(GLOB LOCAL_FCD "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.fcd")
675 FILE(GLOB LOCAL_UNITTEST_SRC "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*Test.cpp")
676 FILE(GLOB LOCAL_TEST_SRC "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/test*.cpp"
677 "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/test*.mm")
678 FILE(GLOB LOCAL_APP_SRC "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/app*.cpp")
679 FILE(GLOB BASE_MM "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*Base.mm")
681 SET(_OSG_CURR_DIRNAME "${DIRNAME}")
683 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
684 LIST(APPEND _OSG_ADD_SRC_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.cpp"
685 "${DIRNAME}/${_OSG_FILE_PREFIX}*.mm")
688 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
689 LIST(APPEND _OSG_ADD_HDR_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.h")
692 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
693 LIST(APPEND _OSG_ADD_INL_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.inl")
696 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
697 LIST(APPEND _OSG_ADD_INS_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.ins")
700 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
701 LIST(APPEND _OSG_ADD_LL_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.ll")
704 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
705 LIST(APPEND _OSG_ADD_YY_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.yy")
708 FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
709 LIST(APPEND _OSG_ADD_QTH_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*_qt.h")
713 FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_SRC_PATTERNS})
714 LIST(APPEND _OSG_ADD_SRC_LOOKUP "${DIRNAME}/${_OSG_FILE_PATTERN}")
717 FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_HDR_PATTERNS})
718 LIST(APPEND _OSG_ADD_HDR_LOOKUP "${DIRNAME}/${_OSG_FILE_PATTERN}")
721 FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_INL_PATTERNS})
722 LIST(APPEND _OSG_ADD_INL_LOOKUP "${DIRNAME}/${_OSG_FILE_PATTERN}")
725 # Guess it's an absolute dir we got as the rel one is not there
726 FILE(GLOB LOCAL_SRC #"${DIRNAME}/OSG*.cpp"
727 #"${DIRNAME}/OSG*.mm"
728 ${_OSG_ADD_SRC_LOOKUP})
729 FILE(GLOB LOCAL_HDR #"${DIRNAME}/OSG*.h"
730 ${_OSG_ADD_HDR_LOOKUP})
731 FILE(GLOB LOCAL_INL #"${DIRNAME}/OSG*.inl"
732 ${_OSG_ADD_INL_LOOKUP})
733 FILE(GLOB LOCAL_INS #"${DIRNAME}/OSG*.ins"
734 ${_OSG_ADD_INS_LOOKUP})
735 FILE(GLOB LOCAL_LL #"${DIRNAME}/OSG*.ll"
736 ${_OSG_ADD_LL_LOOKUP} )
737 FILE(GLOB LOCAL_YY #"${DIRNAME}/OSG*.yy"
738 ${_OSG_ADD_YY_LOOKUP} )
739 FILE(GLOB LOCAL_MOC #"${DIRNAME}/OSG*_qt.h"
740 ${_OSG_ADD_QTH_LOOKUP})
742 FILE(GLOB LOCAL_FCD "${DIRNAME}/OSG*.fcd")
743 FILE(GLOB LOCAL_UNITTEST_SRC "${DIRNAME}/OSG*Test.cpp")
744 FILE(GLOB LOCAL_TEST_SRC "${DIRNAME}/test*.cpp"
745 "${DIRNAME}/test*.mm")
746 FILE(GLOB LOCAL_APP_SRC "${DIRNAME}/app*.cpp")
747 FILE(GLOB BASE_MM "${DIRNAME}/OSG*Base.mm")
751 FOREACH(BaseMMFile ${BASE_MM})
752 STRING(REGEX REPLACE mm$ cpp BaseMMFileCPP ${BaseMMFile})
753 LIST(APPEND BASE_MM_CPP ${BaseMMFileCPP})
758 LIST(REMOVE_ITEM LOCAL_SRC ${BASE_MM_CPP})
761 IF(${PROJECT_NAME}_EXCL_FILES)
762 LIST(REMOVE_ITEM LOCAL_SRC ${${PROJECT_NAME}_EXCL_FILES})
763 LIST(REMOVE_ITEM LOCAL_HDR ${${PROJECT_NAME}_EXCL_FILES})
764 LIST(REMOVE_ITEM LOCAL_INL ${${PROJECT_NAME}_EXCL_FILES})
765 LIST(REMOVE_ITEM LOCAL_INS ${${PROJECT_NAME}_EXCL_FILES})
766 LIST(REMOVE_ITEM LOCAL_FCD ${${PROJECT_NAME}_EXCL_FILES})
767 LIST(REMOVE_ITEM LOCAL_LL ${${PROJECT_NAME}_EXCL_FILES})
768 LIST(REMOVE_ITEM LOCAL_YY ${${PROJECT_NAME}_EXCL_FILES})
769 LIST(REMOVE_ITEM LOCAL_UNITTEST_SRC ${${PROJECT_NAME}_EXCL_FILES})
770 LIST(REMOVE_ITEM LOCAL_TEST_SRC ${${PROJECT_NAME}_EXCL_FILES})
771 LIST(REMOVE_ITEM LOCAL_APP_SRC ${${PROJECT_NAME}_EXCL_FILES})
772 ENDIF(${PROJECT_NAME}_EXCL_FILES)
774 # filter unittest sources out of library sources
775 IF(LOCAL_UNITTEST_SRC)
776 LIST(REMOVE_ITEM LOCAL_SRC ${LOCAL_UNITTEST_SRC})
777 ENDIF(LOCAL_UNITTEST_SRC)
780 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE} "# File lists for ${DIRNAME}\n\n")
784 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
785 "LIST(APPEND ${PROJECT_NAME}_SRC \"${LOCAL_SRC}\")\n\n")
789 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
790 "LIST(APPEND ${PROJECT_NAME}_HDR \"${LOCAL_HDR}\")\n\n")
794 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
795 "LIST(APPEND ${PROJECT_NAME}_INL \"${LOCAL_INL}\")\n\n")
799 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
800 "LIST(APPEND ${PROJECT_NAME}_INS \"${LOCAL_INS}\")\n\n")
804 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
805 "LIST(APPEND ${PROJECT_NAME}_FCD \"${LOCAL_FCD}\")\n\n")
809 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
810 "LIST(APPEND ${PROJECT_NAME}_LL \"${LOCAL_LL}\")\n\n")
814 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
815 "LIST(APPEND ${PROJECT_NAME}_YY \"${LOCAL_YY}\")\n\n")
819 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
820 "LIST(APPEND ${PROJECT_NAME}_MOC \"${LOCAL_MOC}\")\n\n")
823 IF(NOT OSG_DISABLE_SOURCE_GROUPS)
824 IF(NOT ${PROJECT_NAME}_BASE_DIR)
825 # Add the source files to the source group
826 #Strip the path down to a relative one
827 IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}")
828 FILE(RELATIVE_PATH THE_SOURCE_GROUP
829 ${CMAKE_CURRENT_SOURCE_DIR}/Source
830 ${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME})
831 ELSEIF(EXISTS "${CMAKE_SOURCE_DIR}/${DIRNAME}")
832 FILE(RELATIVE_PATH THE_SOURCE_GROUP
833 ${CMAKE_SOURCE_DIR}/Source
834 ${CMAKE_SOURCE_DIR}/${DIRNAME})
836 FILE(RELATIVE_PATH THE_SOURCE_GROUP
837 ${CMAKE_SOURCE_DIR}/Source
838 ${CMAKE_SOURCE_DIR}/${DIRNAME})
841 FILE(RELATIVE_PATH THE_SOURCE_GROUP
842 ${${PROJECT_NAME}_BASE_DIR}/
843 ${_OSG_CURR_DIRNAME})
847 STRING(REPLACE "/" "\\" THE_SOURCE_GROUP ${THE_SOURCE_GROUP})
848 ELSE(THE_SOURCE_GROUP)
849 SET(THE_SOURCE_GROUP "Source")
850 ENDIF(THE_SOURCE_GROUP)
852 IF(${THE_SOURCE_GROUP} STREQUAL "\\")
853 SET(THE_SOURCE_GROUP "Source")
856 LIST(APPEND ${PROJECT_NAME}_SOURCE_GROUPS ${THE_SOURCE_GROUP})
857 SET(${PROJECT_NAME}_SOURCE_GROUPS ${${PROJECT_NAME}_SOURCE_GROUPS}
858 CACHE INTERNAL "" FORCE)
860 STRING(REPLACE "\\" "_" THE_SOURCE_GROUP ${THE_SOURCE_GROUP})
861 LIST(APPEND ${PROJECT_NAME}_SOURCE_GROUP_${THE_SOURCE_GROUP}
871 SET(${PROJECT_NAME}_SOURCE_GROUP_${THE_SOURCE_GROUP}
872 ${${PROJECT_NAME}_SOURCE_GROUP_${THE_SOURCE_GROUP}}
873 CACHE INTERNAL "" FORCE)
875 ENDIF(NOT OSG_DISABLE_SOURCE_GROUPS)
878 IF(LOCAL_UNITTEST_SRC)
879 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
880 "LIST(APPEND ${PROJECT_NAME}_UNITTEST_SRC \"${LOCAL_UNITTEST_SRC}\")\n\n")
881 ENDIF(LOCAL_UNITTEST_SRC)
885 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
886 "LIST(APPEND ${PROJECT_NAME}_TEST_SRC \"${LOCAL_TEST_SRC}\")\n\n")
887 ENDIF(LOCAL_TEST_SRC)
891 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
892 "LIST(APPEND ${PROJECT_NAME}_APP_SRC \"${LOCAL_APP_SRC}\")\n\n")
895 IF(EXISTS "${CMAKE_SOURCE_DIR}/${DIRNAME}")
896 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
897 "LIST(APPEND ${PROJECT_NAME}_INC \"${CMAKE_SOURCE_DIR}/${DIRNAME}\")\n\n")
898 ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}")
899 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
900 "LIST(APPEND ${PROJECT_NAME}_INC \"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}\")\n\n")
902 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
903 "LIST(APPEND ${PROJECT_NAME}_INC \"${DIRNAME}\")\n\n")
905 ENDFUNCTION(OSG_ADD_DIRECTORY)
908 #############################################################################
909 # perform default actions for pass OSGSETUP
911 FUNCTION(OSG_SETUP_LIBRARY_BUILD PROJ_DEFINE)
913 IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUP")
915 ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUP")
917 IF(${PROJECT_NAME}_NO_LIB)
922 OSG_CHECKED_INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
928 IF(OSG_ENABLE_FCD2CODE AND PYTHONINTERP_FOUND)
930 FOREACH(FCDFile ${${PROJECT_NAME}_FCD})
931 GET_FILENAME_COMPONENT(FCDBase ${FCDFile} NAME_WE)
932 GET_FILENAME_COMPONENT(FCDDir ${FCDFile} PATH)
934 SET(FCDBaseHdr "${FCDBase}Base.h")
935 SET(FCDBaseCpp "${FCDBase}Base.cpp")
936 SET(FCDBaseInl "${FCDBase}Base.inl")
937 SET(FCDBaseFld "${FCDBase}Fields.h")
939 SET(FCDClassHdr "${FCDBase}.h")
940 SET(FCDClassCpp "${FCDBase}.cpp")
941 SET(FCDClassInl "${FCDBase}.inl")
943 IF(NOT EXISTS ${FCDDir}/${FCDBaseCpp})
944 SET(${PROJECT_NAME}_SRC ${${PROJECT_NAME}_SRC} ${FCDDir}/${FCDBaseCpp})
945 SET(${PROJECT_NAME}_HDR ${${PROJECT_NAME}_HDR} ${FCDDir}/${FCDBaseHdr})
946 SET(${PROJECT_NAME}_INL ${${PROJECT_NAME}_INL} ${FCDDir}/${FCDBaseInl})
947 SET(${PROJECT_NAME}_HDR ${${PROJECT_NAME}_HDR} ${FCDDir}/${FCDBaseFld})
949 IF(NOT EXISTS ${FCDDir}/${FCDClassHdr})
950 SET(${PROJECT_NAME}_SRC ${${PROJECT_NAME}_SRC} ${FCDDir}/${FCDClassCpp})
951 SET(${PROJECT_NAME}_HDR ${${PROJECT_NAME}_HDR} ${FCDDir}/${FCDClassHdr})
952 SET(${PROJECT_NAME}_INL ${${PROJECT_NAME}_INL} ${FCDDir}/${FCDClassInl})
954 SET(FCD_TMP_OUT ${FCDDir}/${FCDClassCpp}
955 ${FCDDir}/${FCDClassHdr}
956 ${FCDDir}/${FCDClassInl})
957 ENDIF(NOT EXISTS ${FCDDir}/${FCDClassHdr})
958 ENDIF(NOT EXISTS ${FCDDir}/${FCDBaseCpp})
960 SET(FCDBaseDir ${CMAKE_SOURCE_DIR}/Tools/fcd2code)
961 SET(FCDCommand ${CMAKE_SOURCE_DIR}/Tools/fcd2code/fcd2code)
962 SET(FCDRoot -r ${CMAKE_SOURCE_DIR})
965 SET(FCDPath ${CMAKE_SOURCE_DIR}/Tools/fcd2code)
967 IF(NOT EXISTS FCDPath AND OpenSG_DIR) #external setup
968 SET(FCDBaseDir ${OpenSG_DIR}/bin/fcd2code)
970 SET(FCDCommand ${OpenSG_DIR}/bin/fcd2code/fcd2code)
973 SET(FCDTemp -t ${FCDBaseDir})
974 ENDIF(NOT EXISTS FCDPath AND OpenSG_DIR)
976 IF(NOT EXISTS ${FCDDir}/${FCDClassHdr} AND
977 NOT EXISTS ${FCDDir}/${FCDClassCpp} AND
978 NOT EXISTS ${FCDDir}/${FCDClassInl} AND
979 OSG_FCD2CODE_WRITE_CLASS )
981 SET(_OSG_IGNORE_CLASSWRITE -1)
983 IF(OSG_IGNORE_CLASSBUILD)
984 LIST(FIND OSG_IGNORE_CLASSBUILD ${FCDBase} _OSG_IGNORE_CLASSWRITE)
985 ENDIF(OSG_IGNORE_CLASSBUILD)
987 IF(_OSG_IGNORE_CLASSWRITE EQUAL -1)
988 MESSAGE(STATUS "writing ${FCDDir}/${FCDClassHdr} ${FCDDir}/${FCDClassCpp} ${FCDDir}/${FCDClassInl}")
990 EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${FCDCommand} -c -f -d ${FCDFile} -p ${FCDDir} ${FCDRoot} ${FCDTemp})
991 ENDIF(_OSG_IGNORE_CLASSWRITE EQUAL -1)
996 OUTPUT ${FCDDir}/${FCDBaseHdr}
997 ${FCDDir}/${FCDBaseCpp}
998 ${FCDDir}/${FCDBaseInl}
999 ${FCDDir}/${FCDBaseFld}
1001 COMMAND ${PYTHON_EXECUTABLE} ${FCDCommand} -c -b -d ${FCDFile} -p ${FCDDir} ${FCDRoot} ${FCDTemp}
1002 MAIN_DEPENDENCY ${FCDFile}
1003 DEPENDS ${FCDBaseDir}/TemplateFieldContainerBase_h.txt
1004 ${FCDBaseDir}/TemplateFieldContainerBase_inl.txt
1005 ${FCDBaseDir}/TemplateFieldContainerBase_cpp.txt
1006 ${FCDBaseDir}/TemplateFieldContainerFields_h.txt)
1011 ENDIF(OSG_ENABLE_FCD2CODE AND PYTHONINTERP_FOUND)
1017 IF(${PROJECT_NAME}_MOC)
1018 # Here only the OSG_WITH_QT define is passes to qt moc.
1019 SET(moc_flags -DOSG_WITH_QT)
1021 SET(${PROJECT_NAME}_INC ${${PROJECT_NAME}_INC} ${CMAKE_CURRENT_BINARY_DIR})
1023 FOREACH(MOCFile ${${PROJECT_NAME}_MOC})
1024 GET_FILENAME_COMPONENT(MOCFile ${MOCFile} ABSOLUTE)
1025 OSG_QT_MAKE_OUTPUT_FILE(${MOCFile} moc_ cpp MOCOutFile)
1028 OUTPUT ${MOCOutFile}
1029 COMMAND ${QT_MOC_EXECUTABLE}
1030 ARGS ${moc_flags} ${moc_options} -o ${MOCOutFile} ${MOCFile}
1032 LIST(APPEND ${PROJECT_NAME}_SRC ${MOCOutFile})
1034 ENDIF(${PROJECT_NAME}_MOC)
1040 IF(OSG_ENABLE_SCANPARSE_REGEN AND FLEX_EXE AND BISON_EXE)
1042 FOREACH(YYFile ${${PROJECT_NAME}_YY})
1044 GET_FILENAME_COMPONENT(YYBase ${YYFile} NAME_WE)
1046 STRING(REPLACE "Parser" "_" YYOpt ${YYBase})
1048 SET(YYSrc ${CMAKE_CURRENT_BINARY_DIR}/${YYBase}.cpp)
1049 SET(YYHdr ${CMAKE_CURRENT_BINARY_DIR}/${YYBase}.hpp)
1052 OUTPUT ${YYSrc} ${YYHdr}
1053 COMMAND ${BISON_EXE} -d -v -p${YYOpt} -b${YYOpt} -o ${YYSrc} ${YYFile}
1054 MAIN_DEPENDENCY ${YYFile})
1056 LIST(APPEND ${PROJECT_NAME}_SRC ${YYSrc})
1057 LIST(APPEND ${PROJECT_NAME}_HDR ${YYHdr})
1061 FOREACH(LLFile ${${PROJECT_NAME}_LL})
1063 GET_FILENAME_COMPONENT(LLBase ${LLFile} NAME_WE)
1065 STRING(REPLACE "Scanner" "_" LLOpt ${LLBase})
1067 IF(OSG_USE_OSG2_NAMESPACE)
1068 STRING(REPLACE "OSG" "OSG2"
1072 SET(LLOpt_VERSIONED ${LLOpt})
1075 SET(LLSrc ${CMAKE_CURRENT_BINARY_DIR}/${LLBase}.cpp)
1079 COMMAND ${FLEX_EXE} -+ -P${LLOpt_VERSIONED} -t ${LLFile} > ${LLSrc}
1080 MAIN_DEPENDENCY ${LLFile})
1082 SET(${PROJECT_NAME}_SRC ${${PROJECT_NAME}_SRC} ${LLSrc})
1086 IF(${PROJECT_NAME}_YY OR ${PROJECT_NAME}_LL)
1087 SET(${PROJECT_NAME}_INC ${${PROJECT_NAME}_INC} ${CMAKE_CURRENT_BINARY_DIR})
1089 FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
1090 "LIST(APPEND ${PROJECT_NAME}_INC \"${CMAKE_CURRENT_BINARY_DIR}\")\n\n")
1092 ENDIF(${PROJECT_NAME}_YY OR ${PROJECT_NAME}_LL)
1094 ENDIF(OSG_ENABLE_SCANPARSE_REGEN AND FLEX_EXE AND BISON_EXE)
1100 ## LINK_DIRS have to go first, before the ADD_LIB statement
1102 FOREACH(LIBDIR ${OSG_GLOBAL_DEP_LIBDIR})
1103 OSG_MSG(" (global) - library dir ${LIBDIR} = ${${LIBDIR}}")
1104 LINK_DIRECTORIES(${${LIBDIR}})
1107 FOREACH(LIBDIR ${${PROJECT_NAME}_DEP_LIBDIR})
1108 OSG_MSG(" (global) - library dir ${LIBDIR} = ${${LIBDIR}}")
1109 LINK_DIRECTORIES(${${LIBDIR}})
1113 IF(NOT OSG_DISABLE_SOURCE_GROUPS)
1114 #Add Source Files to Source Groups
1115 #Loop through all of the groups for this Project
1116 FOREACH(PROJECT_SOURCE_GROUP_NAME ${${PROJECT_NAME}_SOURCE_GROUPS})
1117 STRING(REPLACE "\\" "_" THE_SOURCE_GROUP ${PROJECT_SOURCE_GROUP_NAME})
1118 SOURCE_GROUP(${PROJECT_SOURCE_GROUP_NAME} FILES
1119 ${${PROJECT_NAME}_SOURCE_GROUP_${THE_SOURCE_GROUP}})
1120 ENDFOREACH(PROJECT_SOURCE_GROUP_NAME)
1121 ENDIF(NOT OSG_DISABLE_SOURCE_GROUPS)
1124 ADD_LIBRARY(${PROJECT_NAME} STATIC
1125 ${${PROJECT_NAME}_SRC}
1126 ${${PROJECT_NAME}_HDR}
1127 ${${PROJECT_NAME}_INL}
1128 ${${PROJECT_NAME}_INS})
1130 ADD_LIBRARY(${PROJECT_NAME} SHARED
1131 ${${PROJECT_NAME}_SRC}
1132 ${${PROJECT_NAME}_HDR}
1133 ${${PROJECT_NAME}_INL}
1134 ${${PROJECT_NAME}_INS})
1137 ADD_DEPENDENCIES(OSGAllLibs ${PROJECT_NAME})
1138 ADD_DEPENDENCIES(${OSG_MAIN_LIB_TARGET} ${PROJECT_NAME})
1141 IF(${OSG_MAIN_LIB_TARGET} MATCHES OSGAllCoreLibs)
1142 SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER "OSGCoreLibraries")
1143 ELSEIF(${OSG_MAIN_LIB_TARGET} MATCHES OSGAllContribLibs)
1144 SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER "OSGContribLibraries")
1148 INCLUDE_DIRECTORIES(${${PROJECT_NAME}_INC})
1150 SET(_OSG_DEBUG_POSTFIX "")
1153 SET(_OSG_DEBUG_POSTFIX DEBUG_POSTFIX "D")
1156 IF(OSG_USE_OSG2_NAMESPACE)
1157 STRING(REGEX REPLACE "^OSG" "OSG2"
1158 PROJECT_NAME_VERSIONED
1161 SET(PROJECT_NAME_VERSIONED ${PROJECT_NAME})
1164 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
1165 DEFINE_SYMBOL ${PROJ_DEFINE}
1166 VERSION ${OSG_VERSION}
1167 SOVERSION ${OSG_VERSION}
1168 ${_OSG_DEBUG_POSTFIX}
1169 DEBUGOPT_POSTFIX "DO"
1170 RELEASENOOPT_POSTFIX "RN"
1171 OUTPUT_NAME ${PROJECT_NAME_VERSIONED})
1173 IF(${PROJECT_NAME}_SUFFIX)
1174 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
1175 SUFFIX ${${PROJECT_NAME}_SUFFIX})
1177 ENDIF(${PROJECT_NAME}_SUFFIX)
1179 # dependencies - OpenSG
1180 OSG_GET_ALL_DEP_OSG_LIB(
1181 "${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIST DEP_MISSING_LIST)
1183 # a lib with missing dependencies is fatal - it should not have made it here
1184 IF(DEP_MISSING_LIST)
1185 MESSAGE(FATAL_ERROR "Project ${PROJECT_NAME} has missing dependencies: ${DEP_MISSING_LIST}")
1186 ENDIF(DEP_MISSING_LIST)
1188 FOREACH(OSGDEP ${DEP_OSG_LIST})
1189 OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1190 INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
1193 FOREACH(OSGDEP ${${PROJECT_NAME}_DEP_OSG_LIB})
1194 OSG_CHECKED_INCLUDE ("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1196 SET(${_OSGDEP_IMPORTED} FALSE)
1198 IF(TARGET ${OSGDEP})
1199 GET_PROPERTY(_OSGDEP_IMPORTED TARGET ${OSGDEP} PROPERTY IMPORTED)
1200 ENDIF(TARGET ${OSGDEP})
1202 IF(NOT _OSGDEP_IMPORTED)
1203 ADD_DEPENDENCIES (${PROJECT_NAME} ${OSGDEP})
1204 ENDIF(NOT _OSGDEP_IMPORTED)
1206 IF(NOT APPLE OR NOT IOS)
1207 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OSGDEP})
1211 # dependencies - global
1212 FOREACH(INCDIR ${OSG_GLOBAL_DEP_INCDIR})
1213 OSG_MSG(" (global) - include dir ${INCDIR} = ${${INCDIR}}")
1214 INCLUDE_DIRECTORIES(${${INCDIR}})
1217 FOREACH(INCDIR ${OSG_SYSTEM_DEP_INCDIR})
1218 OSG_MSG(" (system) - include dir ${INCDIR} = ${${INCDIR}}")
1219 INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1222 FOREACH(LIB ${OSG_GLOBAL_DEP_LIBS})
1223 OSG_MSG(" (global) - library ${LIB} = ${${LIB}}")
1224 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${LIB}})
1227 IF(OSG_GLOBAL_DEP_DEFS)
1228 OSG_MSG(" (global) - definitions = ${OSG_GLOBAL_DEP_DEFS}")
1229 SET_PROPERTY(TARGET ${PROJECT_NAME}
1230 APPEND PROPERTY COMPILE_DEFINITIONS ${OSG_GLOBAL_DEP_DEFS})
1231 ENDIF(OSG_GLOBAL_DEP_DEFS)
1233 # dependencies - External
1234 FOREACH(INCDIR ${${PROJECT_NAME}_DEP_INCDIR})
1235 OSG_MSG(" (external) - include dir ${INCDIR} = ${${INCDIR}}")
1236 INCLUDE_DIRECTORIES(${${INCDIR}})
1239 FOREACH(INCDIR ${${PROJECT_NAME}_DEP_SYS_INCDIR})
1240 OSG_MSG(" (external sys) - include dir ${INCDIR} = ${${INCDIR}}")
1241 INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1244 FOREACH(LIB ${${PROJECT_NAME}_DEP_LIB})
1245 OSG_MSG(" (external) - library ${LIB} = ${${LIB}}")
1246 IF(NOT APPLE OR NOT IOS)
1247 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${LIB}})
1251 IF(${PROJECT_NAME}_DEP_DEFS)
1252 OSG_MSG(" (external) - definitions = ${${PROJECT_NAME}_DEP_DEFS}")
1253 SET_PROPERTY(TARGET ${PROJECT_NAME}
1254 APPEND PROPERTY COMPILE_DEFINITIONS ${${PROJECT_NAME}_DEP_DEFS})
1255 ENDIF(${PROJECT_NAME}_DEP_DEFS)
1257 IF(${PROJECT_NAME}_CXXFLAGS)
1258 SET_PROPERTY(TARGET ${PROJECT_NAME}
1259 APPEND PROPERTY COMPILE_FLAGS ${${PROJECT_NAME}_CXXFLAGS})
1260 ENDIF(${PROJECT_NAME}_CXXFLAGS)
1262 IF(OSG_IGNORE_INSTALL_${PROJECT_NAME})
1269 IF(OSG_INSTALL_SUBDIR)
1270 SET(_OSG_ISC "${OSG_INSTALL_SUBDIR}/")
1271 ELSE(OSG_INSTALL_SUBDIR)
1273 ENDIF(OSG_INSTALL_SUBDIR)
1275 IF(OSG_USE_SEPARATE_LIBDIRS)
1276 SET(_OSG_TARGET_BINDIR_REL bin/${_OSG_ISC}rel)
1277 SET(_OSG_TARGET_BINDIR_DBG bin/${_OSG_ISC}debug)
1278 SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC}relnoopt)
1279 SET(_OSG_TARGET_BINDIR_DBGO bin/${_OSG_ISC}debugopt)
1281 SET(_OSG_TARGET_LIBDIR_REL lib/${_OSG_ISC}rel)
1282 SET(_OSG_TARGET_LIBDIR_DBG lib/${_OSG_ISC}debug)
1283 SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC}relnoopt)
1284 SET(_OSG_TARGET_LIBDIR_DBGO lib/${_OSG_ISC}debugopt)
1285 ELSE(OSG_USE_SEPARATE_LIBDIRS)
1286 SET(_OSG_TARGET_BINDIR_REL bin/${_OSG_ISC})
1287 SET(_OSG_TARGET_BINDIR_DBG bin/${_OSG_ISC})
1288 SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC})
1289 SET(_OSG_TARGET_BINDIR_DBGO bin/${_OSG_ISC})
1291 SET(_OSG_TARGET_LIBDIR_REL lib/${_OSG_ISC})
1292 SET(_OSG_TARGET_LIBDIR_DBG lib/${_OSG_ISC})
1293 SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC})
1294 SET(_OSG_TARGET_LIBDIR_DBGO lib/${_OSG_ISC})
1295 ENDIF(OSG_USE_SEPARATE_LIBDIRS)
1297 INSTALL(TARGETS ${PROJECT_NAME}
1298 CONFIGURATIONS Release
1299 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_REL})
1300 # COMPONENT release_runtimes)
1302 INSTALL(TARGETS ${PROJECT_NAME}
1303 CONFIGURATIONS Release
1305 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_REL}
1306 # COMPONENT release_libraries
1308 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_REL})
1309 # COMPONENT release_libraries)
1311 IF(NOT ${PROJECT_NAME}_NO_DBG_INSTALL)
1312 INSTALL(TARGETS ${PROJECT_NAME}
1313 CONFIGURATIONS Debug
1314 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_DBG})
1315 # COMPONENT debug_runtimes)
1317 INSTALL(TARGETS ${PROJECT_NAME}
1318 CONFIGURATIONS Debug
1320 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_DBG}
1321 # COMPONENT debug_libraries
1323 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_DBG})
1324 # COMPONENT debug_libraries)
1327 INSTALL(TARGETS ${PROJECT_NAME}
1328 CONFIGURATIONS ReleaseNoOpt
1329 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_RELNO})
1330 # COMPONENT release_no_opt_runtimes)
1332 INSTALL(TARGETS ${PROJECT_NAME}
1333 CONFIGURATIONS ReleaseNoOpt
1335 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_RELNO}
1336 # COMPONENT release_no_opt_libraries
1338 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_RELNO})
1339 # COMPONENT release_no_opt_libraries)
1341 IF(NOT ${PROJECT_NAME}_NO_DBG_INSTALL)
1342 INSTALL(TARGETS ${PROJECT_NAME}
1343 CONFIGURATIONS DebugOpt
1344 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_DBGO})
1345 # COMPONENT debug_opt_runtimes)
1347 INSTALL(TARGETS ${PROJECT_NAME}
1348 CONFIGURATIONS DebugOpt
1350 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_DBGO}
1351 # COMPONENT debug_opt_libraries
1353 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_DBGO})
1354 # COMPONENT debug_opt_libraries)
1358 IF(OSG_INSTALL_PDB_FILES)
1360 GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME} Release_LOCATION)
1362 STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
1364 INSTALL(FILES ${_TMPVAL1}
1365 CONFIGURATIONS Release
1366 DESTINATION ${_OSG_TARGET_BINDIR_REL})
1367 # COMPONENT release_program_db)
1370 GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME} Debug_LOCATION)
1372 STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
1374 INSTALL(FILES ${_TMPVAL1}
1375 CONFIGURATIONS Debug
1376 DESTINATION ${_OSG_TARGET_BINDIR_DBG})
1377 # COMPONENT debug_program_db)
1380 GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME} ReleaseNoOpt_LOCATION)
1382 STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
1384 INSTALL(FILES ${_TMPVAL1}
1385 CONFIGURATIONS ReleaseNoOpt
1386 DESTINATION ${_OSG_TARGET_BINDIR_RELNO})
1387 # COMPONENT release_no_opt_program_db)
1390 GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME} DebugOpt_LOCATION)
1392 STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
1394 INSTALL(FILES ${_TMPVAL1}
1395 CONFIGURATIONS DebugOpt
1396 DESTINATION ${_OSG_TARGET_BINDIR_DBGO})
1397 # COMPONENT debug_opt_program_db)
1399 ENDIF(OSG_INSTALL_PDB_FILES)
1402 INSTALL(TARGETS ${PROJECT_NAME}
1403 CONFIGURATIONS MinSizeRel
1404 RUNTIME DESTINATION lib/minsizerel)
1405 # COMPONENT release_minsize_runtimes)
1407 INSTALL(TARGETS ${PROJECT_NAME}
1408 CONFIGURATIONS MinSizeRel
1409 LIBRARY DESTINATION lib/minsizerel
1410 # COMPONENT release_minsize_libraries
1411 ARCHIVE DESTINATION lib/minsizerel)
1412 # COMPONENT release_minsize_libraries)
1414 INSTALL(TARGETS ${PROJECT_NAME}
1415 CONFIGURATIONS RelWithDebInfo
1416 RUNTIME DESTINATION lib/relwithdbg)
1417 # COMPONENT release_with_debinfo_runtimes)
1419 INSTALL(TARGETS ${PROJECT_NAME}
1420 CONFIGURATIONS RelWithDebInfo
1421 LIBRARY DESTINATION lib/relwithdbg
1422 # COMPONENT release_with_debinfo_libraries
1423 ARCHIVE DESTINATION lib/relwithdbg)
1424 # COMPONENT release_with_debinfo_libraries)
1426 ELSEIF(APPLE AND IOS)
1427 INSTALL(TARGETS ${PROJECT_NAME}
1428 CONFIGURATIONS Release-iphoneos
1429 DESTINATION lib/Release-iphoneos)
1430 INSTALL(TARGETS ${PROJECT_NAME}
1431 CONFIGURATIONS Debug-iphoneos
1432 DESTINATION lib/Debug-iphoneos)
1433 INSTALL(TARGETS ${PROJECT_NAME}
1434 CONFIGURATIONS Release-iphonesimulator
1435 DESTINATION lib/Release-iphonesimulator)
1436 INSTALL(TARGETS ${PROJECT_NAME}
1437 CONFIGURATIONS Debug-iphonesimulator
1438 DESTINATION lib/Debug-iphonesimulator)
1439 ELSEIF(XCODE_VERSION)
1440 # INSTALL(TARGETS ${PROJECT_NAME}
1441 # CONFIGURATIONS Release
1442 # RUNTIME DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}
1443 # COMPONENT release_runtimes)
1445 INSTALL(TARGETS ${PROJECT_NAME}
1446 CONFIGURATIONS Release
1448 LIBRARY DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}
1449 # COMPONENT release_libraries
1451 ARCHIVE DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX})
1452 # COMPONENT release_libraries)
1454 # INSTALL(TARGETS ${PROJECT_NAME}
1455 # CONFIGURATIONS Debug
1456 # RUNTIME DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}/debug
1457 # COMPONENT debug_runtimes)
1459 INSTALL(TARGETS ${PROJECT_NAME}
1460 CONFIGURATIONS Debug
1462 LIBRARY DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}/debug
1463 # COMPONENT debug_libraries
1465 ARCHIVE DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}/debug)
1466 # COMPONENT debug_libraries)
1468 INSTALL(TARGETS ${PROJECT_NAME}
1470 RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX}
1471 # COMPONENT libraries
1473 LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX}
1474 # COMPONENT libraries
1476 ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX})
1477 # COMPONENT libraries)
1480 INSTALL(FILES ${${PROJECT_NAME}_HDR}
1481 DESTINATION include/OpenSG
1482 PERMISSIONS OWNER_WRITE OWNER_READ
1485 # COMPONENT code_headers)
1487 INSTALL(FILES ${${PROJECT_NAME}_INL}
1488 DESTINATION include/OpenSG
1489 PERMISSIONS OWNER_WRITE OWNER_READ
1492 # COMPONENT code_headers)
1494 INSTALL(FILES ${${PROJECT_NAME}_INS}
1495 DESTINATION include/OpenSG
1496 PERMISSIONS OWNER_WRITE OWNER_READ
1499 # COMPONENT code_headers)
1501 IF(NOT ${PROJECT_NAME}_NO_PYTHON)
1502 FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "libInfo[\"${PROJECT_NAME}\"] = [\n")
1503 FOREACH(OSG_DEP ${DEP_OSG_LIST})
1504 FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "\"${OSG_DEP}\",")
1506 FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "]\n\n\n")
1509 FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "fullLibInfo[\"${PROJECT_NAME}\"] = [\n")
1510 FOREACH(OSG_DEP ${DEP_OSG_LIST})
1511 FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "\"${OSG_DEP}\",")
1513 FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "]\n\n\n")
1515 ENDFUNCTION(OSG_SETUP_LIBRARY_BUILD)
1518 #############################################################################
1519 # perform default actions for pass OSGSETUPTEST
1521 FUNCTION(OSG_SETUP_TEST_BUILD)
1523 IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUPTEST")
1525 ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUPTEST")
1527 OSG_CHECKED_INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
1528 INCLUDE_DIRECTORIES(${${PROJECT_NAME}_INC})
1530 # dependencies - OpenSG
1531 OSG_GET_ALL_DEP_OSG_LIB(
1532 "${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIB DEP_MISSING_LIST)
1534 # if depencies are missing we skip the tests
1535 IF(DEP_MISSING_LIST)
1536 MESSAGE(STATUS "Tests for project ${PROJECT_NAME} have missing dependencies: ${DEP_MISSING_LIST} - skipping")
1538 ENDIF(DEP_MISSING_LIST)
1540 FOREACH(OSGDEP ${DEP_OSG_LIB})
1541 OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1542 INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
1545 # dependencies - test OpenSG
1546 OSG_GET_ALL_DEP_OSG_LIB(
1547 "${${PROJECT_NAME}_DEP_TEST_OSG_LIB}" DEP_TEST_OSG_LIB DEP_MISSING_LIST)
1549 # if depencies are missing we skip the tests
1550 IF(DEP_MISSING_LIST)
1551 MESSAGE(STATUS "Tests for project ${PROJECT_NAME} have missing dependencies: ${DEP_MISSING_LIST} - skipping")
1553 ENDIF(DEP_MISSING_LIST)
1555 FOREACH(OSGTESTDEP ${DEP_TEST_OSG_LIB})
1556 OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGTESTDEP}.cmake")
1557 INCLUDE_DIRECTORIES(${${OSGTESTDEP}_INC})
1558 ENDFOREACH(OSGTESTDEP)
1560 # dependencies - global
1561 FOREACH(INCDIR ${OSG_GLOBAL_DEP_INCDIR})
1562 OSG_MSG(" (global) - include dir ${INCDIR} = ${${INCDIR}}")
1563 INCLUDE_DIRECTORIES(${${INCDIR}})
1566 FOREACH(INCDIR ${OSG_SYSTEM_DEP_INCDIR})
1567 OSG_MSG(" (system) - include dir ${INCDIR} = ${${INCDIR}}")
1568 INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1571 FOREACH(LIBDIR ${OSG_GLOBAL_DEP_LIBDIR})
1572 OSG_MSG(" (global) - library dir ${LIBDIR} = ${${LIBDIR}}")
1573 LINK_DIRECTORIES(${${LIBDIR}})
1576 # dependencies - External
1577 FOREACH(INCDIR ${${PROJECT_NAME}_DEP_INCDIR})
1578 OSG_MSG(" (external) - include dir ${INCDIR} = ${${INCDIR}}")
1579 INCLUDE_DIRECTORIES(${${INCDIR}})
1582 FOREACH(INCDIR ${${PROJECT_NAME}_DEP_SYS_INCDIR})
1583 OSG_MSG(" (external system) - include dir ${INCDIR} = ${${INCDIR}}")
1584 INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1587 FOREACH(LIBDIR ${${PROJECT_NAME}_DEP_LIBDIR})
1588 OSG_MSG(" (external) - library dir ${LIBDIR} = ${${LIBDIR}}")
1589 LINK_DIRECTORIES(${${LIBDIR}})
1592 # dependencies - test External
1593 FOREACH(INCDIR ${${PROJECT_NAME}_DEP_TEST_INCDIR})
1594 OSG_MSG(" (test) - include dir ${INCDIR} = ${${INCDIR}}")
1595 INCLUDE_DIRECTORIES(${${INCDIR}})
1598 FOREACH(LIBDIR ${${PROJECT_NAME}_DEP_TEST_LIBDIR})
1599 OSG_MSG(" (test) - library dir ${LIBDIR} = ${${LIBDIR}}")
1600 LINK_DIRECTORIES(${${LIBDIR}})
1603 # build test programs
1604 FOREACH(EXE_SRC ${${PROJECT_NAME}_TEST_SRC} ${${PROJECT_NAME}_APP_SRC})
1605 GET_FILENAME_COMPONENT(EXE ${EXE_SRC} NAME_WE)
1607 ADD_EXECUTABLE(${EXE} ${OSGEXCLUDE_TESTS} ${EXE_SRC} )
1609 IF(OSG_ALL_TEST_TARGET)
1610 ADD_DEPENDENCIES(${OSG_ALL_TEST_TARGET} ${EXE})
1612 ADD_DEPENDENCIES(OSGAllTests ${EXE})
1615 FOREACH(OSGTESTDEP ${${PROJECT_NAME}_DEP_TEST_OSG_LIB})
1616 GET_PROPERTY(_OSGTESTDEP_IMPORTED TARGET ${OSGTESTDEP} PROPERTY IMPORTED)
1618 IF(NOT _OSGTESTDEP_IMPORTED)
1619 ADD_DEPENDENCIES(${EXE} ${OSGTESTDEP})
1620 ENDIF(NOT _OSGTESTDEP_IMPORTED)
1622 TARGET_LINK_LIBRARIES(${EXE} ${OSGTESTDEP})
1623 ENDFOREACH(OSGTESTDEP)
1625 FOREACH(OSGTESTDEP ${${PROJECT_NAME}_DEP_TEST_OSG_EEX_LIB})
1626 IF(TARGET ${OSGTESTDEP})
1627 GET_PROPERTY(_OSGTESTDEP_IMPORTED TARGET ${OSGTESTDEP} PROPERTY IMPORTED)
1629 IF(NOT _OSGTESTDEP_IMPORTED)
1630 ADD_DEPENDENCIES(${EXE} ${OSGTESTDEP})
1631 ENDIF(NOT _OSGTESTDEP_IMPORTED)
1633 TARGET_LINK_LIBRARIES(${EXE} ${OSGTESTDEP})
1634 ENDIF(TARGET ${OSGTESTDEP})
1635 ENDFOREACH(OSGTESTDEP)
1637 FOREACH(LIB ${${PROJECT_NAME}_DEP_TEST_LIB})
1638 OSG_MSG(" (test) - library ${LIB} = ${${LIB}}")
1639 TARGET_LINK_LIBRARIES(${EXE} ${${LIB}})
1642 IF(NOT ${PROJECT_NAME}_NO_LIB)
1643 TARGET_LINK_LIBRARIES(${EXE} ${PROJECT_NAME})
1644 ENDIF(NOT ${PROJECT_NAME}_NO_LIB)
1646 IF(${PROJECT_NAME}_DEP_DEFS)
1647 OSG_MSG(" (external) - definitions ${PROJECT_NAME}_DEP_DEFS = ${${PROJECT_NAME}_DEP_DEFS}")
1648 SET_PROPERTY(TARGET ${EXE} APPEND
1649 PROPERTY COMPILE_DEFINITIONS ${${PROJECT_NAME}_DEP_DEFS})
1650 ENDIF(${PROJECT_NAME}_DEP_DEFS)
1652 IF(${PROJECT_NAME}_CXXFLAGS)
1653 SET_PROPERTY(TARGET ${EXE}
1654 APPEND PROPERTY COMPILE_FLAGS ${${PROJECT_NAME}_CXXFLAGS})
1655 ENDIF(${PROJECT_NAME}_CXXFLAGS)
1657 IF(${PROJECT_NAME}_DEP_TEST_DEFS)
1658 OSG_MSG(" (test) - definitions ${PROJECT_NAME}_DEP_TEST_DEFS = ${${PROJECT_NAME}_DEP_TEST_DEFS}")
1659 SET_PROPERTY(TARGET ${EXE} APPEND
1660 PROPERTY COMPILE_DEFINITIONS ${${PROJECT_NAME}_DEP_TEST_DEFS})
1661 ENDIF(${PROJECT_NAME}_DEP_TEST_DEFS)
1663 IF(OSG_GLOBAL_DEP_DEFS)
1664 OSG_MSG(" (global) - definitions = ${OSG_GLOBAL_DEP_DEFS}")
1665 SET_PROPERTY(TARGET ${EXE}
1666 APPEND PROPERTY COMPILE_DEFINITIONS ${OSG_GLOBAL_DEP_DEFS})
1667 ENDIF(OSG_GLOBAL_DEP_DEFS)
1670 IF(EXE_SRC MATCHES ^.*/app.*.cpp$)
1672 SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER ${OSG_APP_FOLDER})
1674 SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER "Apps")
1678 SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER ${OSG_TEST_FOLDER})
1680 SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER "Tests")
1686 FOREACH(EXE_SRC ${${PROJECT_NAME}_APP_SRC})
1687 GET_FILENAME_COMPONENT(EXE ${EXE_SRC} NAME_WE)
1688 IF(OSG_ALL_APPS_TARGET)
1689 ADD_DEPENDENCIES(${OSG_ALL_APPS_TARGET} ${EXE})
1691 ADD_DEPENDENCIES(OSGAllApps ${EXE})
1695 FOREACH(EXE_SRC ${${PROJECT_NAME}_APP_SRC})
1696 GET_FILENAME_COMPONENT(EXE ${EXE_SRC} NAME_WE)
1698 SET_TARGET_PROPERTIES(${EXE} PROPERTIES EXCLUDE_FROM_ALL FALSE)
1701 IF(OSG_INSTALL_APPS)
1703 IF(OSG_INSTALL_SUBDIR)
1704 SET(_OSG_ISC "${OSG_INSTALL_SUBDIR}/")
1705 ELSE(OSG_INSTALL_SUBDIR)
1707 ENDIF(OSG_INSTALL_SUBDIR)
1709 IF(OSG_USE_SEPARATE_LIBDIRS)
1710 SET(_OSG_TARGET_BINDIR_REL bin/${_OSG_ISC}rel)
1711 SET(_OSG_TARGET_BINDIR_DBG bin/${_OSG_ISC}debug)
1712 SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC}relnoopt)
1713 SET(_OSG_TARGET_BINDIR_DBGO bin/${_OSG_ISC}debugopt)
1715 SET(_OSG_TARGET_LIBDIR_REL lib/${_OSG_ISC}rel)
1716 SET(_OSG_TARGET_LIBDIR_DBG lib/${_OSG_ISC}debug)
1717 SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC}relnoopt)
1718 SET(_OSG_TARGET_LIBDIR_DBGO lib/${_OSG_ISC}debugopt)
1719 ELSE(OSG_USE_SEPARATE_LIBDIRS)
1720 SET(_OSG_TARGET_BINDIR_REL bin/${_OSG_ISC})
1721 SET(_OSG_TARGET_BINDIR_DBG bin/${_OSG_ISC})
1722 SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC})
1723 SET(_OSG_TARGET_BINDIR_DBGO bin/${_OSG_ISC})
1725 SET(_OSG_TARGET_LIBDIR_REL lib/${_OSG_ISC})
1726 SET(_OSG_TARGET_LIBDIR_DBG lib/${_OSG_ISC})
1727 SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC})
1728 SET(_OSG_TARGET_LIBDIR_DBGO lib/${_OSG_ISC})
1729 ENDIF(OSG_USE_SEPARATE_LIBDIRS)
1732 FOREACH(EXE_SRC ${${PROJECT_NAME}_APP_SRC})
1733 GET_FILENAME_COMPONENT(EXE ${EXE_SRC} NAME_WE)
1735 SET_TARGET_PROPERTIES(${EXE} PROPERTIES EXCLUDE_FROM_ALL FALSE)
1739 INSTALL(TARGETS ${EXE}
1740 CONFIGURATIONS Release
1741 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_REL})
1742 # COMPONENT release_binaries)
1743 INSTALL(TARGETS ${EXE}
1744 CONFIGURATIONS Debug
1745 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_DBG})
1746 # COMPONENT debug_binaries)
1747 INSTALL(TARGETS ${EXE}
1748 CONFIGURATIONS ReleaseNoOpt
1749 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_RELNO})
1750 # COMPONENT release_no_opt_binaries)
1751 INSTALL(TARGETS ${EXE}
1752 CONFIGURATIONS DebugOpt
1753 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_DBGO})
1754 # COMPONENT debug_opt_binaries)
1758 INSTALL(TARGETS ${EXE}
1759 CONFIGURATIONS Release Debug DebugGV
1760 RUNTIME DESTINATION bin/${OSG_LIBDIR_BUILD_TYPE_SUFFIX})
1761 # COMPONENT binaries)
1765 ENDIF(OSG_INSTALL_APPS)
1767 ENDFUNCTION(OSG_SETUP_TEST_BUILD)
1770 #############################################################################
1771 # perform default actions for pass OSGSETUPUNITTEST
1773 FUNCTION(OSG_SETUP_UNITTEST_BUILD)
1774 IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUPUNITTEST")
1776 ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUPUNITTEST")
1778 INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
1780 # are there unittests to build?
1781 IF(NOT ${PROJECT_NAME}_UNITTEST_SRC)
1783 ENDIF(NOT ${PROJECT_NAME}_UNITTEST_SRC)
1785 INCLUDE_DIRECTORIES(${${PROJECT_NAME}_INC})
1786 INCLUDE_DIRECTORIES(${OSG_UNITTEST_INCLUDE_DIRS})
1788 # dependencies - OpenSG
1789 OSG_GET_ALL_DEP_OSG_LIB(
1790 "${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIB DEP_MISSING_LIST)
1792 # if depencies are missing we skip the unittests
1793 IF(DEP_MISSING_LIST)
1794 MESSAGE(STATUS "Unittests for project ${PROJECT_NAME} have missing dependencies: ${DEP_MISSING_LIST} - skipping")
1796 ENDIF(DEP_MISSING_LIST)
1798 FOREACH(OSGDEP ${DEP_OSG_LIB})
1799 OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1800 INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
1803 # dependencies - unittest OpenSG
1804 OSG_GET_ALL_DEP_OSG_LIB(
1805 "${${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB}" DEP_UNITTEST_OSG_LIB DEP_MISSING_LIST)
1807 # if depencies are missing we skip the unittests
1808 IF(DEP_MISSING_LIST)
1809 MESSAGE(STATUS "Unittests for project ${PROJECT_NAME} have missing dependencies: ${DEP_MISSING_LIST} - skipping")
1811 ENDIF(DEP_MISSING_LIST)
1813 FOREACH(OSGDEP ${DEP_UNITTEST_OSG_LIB})
1814 OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1815 INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
1818 # dependencies global
1819 FOREACH(INCDIR ${OSG_GLOBAL_DEP_INCDIR})
1820 OSG_MSG(" (global) - include dir ${INCDIR} = ${${INCDIR}}")
1821 INCLUDE_DIRECTORIES(${${INCDIR}})
1824 FOREACH(INCDIR ${OSG_SYSTEM_DEP_INCDIR})
1825 OSG_MSG(" (system) - include dir ${INCDIR} = ${${INCDIR}}")
1826 INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1829 FOREACH(LIBDIR ${OSG_GLOBAL_DEP_LIBDIR})
1830 OSG_MSG(" (global) - library dir ${LIBDIR} = ${${LIBDIR}}")
1831 LINK_DIRECTORIES(${${LIBDIR}})
1834 # dependencies - unittest External
1835 FOREACH(INCDIR ${${PROJECT_NAME}_DEP_UNITTEST_INCDIR})
1836 OSG_MSG(" (unittest) - include dir ${INCDIR} = ${${INCDIR}}")
1837 INCLUDE_DIRECTORIES(${${INCDIR}})
1840 FOREACH(LIBDIR ${${PROJECT_NAME}_DEP_UNITTEST_LIBDIR})
1841 OSG_MSG(" (unittest) - library dir ${LIBDIR} = ${${LIBDIR}}")
1842 LINK_DIRECTORIES(${${LIBDIR}})
1845 LINK_DIRECTORIES(${OSG_UNITTEST_LIBRARY_DIRS})
1847 # add the unittest runner source
1848 LIST(APPEND ${PROJECT_NAME}_UNITTEST_SRC
1849 "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTestRunner.cpp")
1851 # build unittest executable
1852 ADD_EXECUTABLE("UnitTest${PROJECT_NAME}"
1853 ${OSGEXCLUDE_UNITTESTS}
1854 ${${PROJECT_NAME}_UNITTEST_SRC})
1856 ADD_DEPENDENCIES(OSGAllUnitTests UnitTest${PROJECT_NAME})
1858 TARGET_LINK_LIBRARIES("UnitTest${PROJECT_NAME}" "${OSG_UNITTEST_LIBRARY}")
1859 TARGET_LINK_LIBRARIES("UnitTest${PROJECT_NAME}" ${PROJECT_NAME})
1861 FOREACH(OSGDEP ${${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB})
1862 ADD_DEPENDENCIES("UnitTest${PROJECT_NAME}" ${OSGDEP})
1863 TARGET_LINK_LIBRARIES("UnitTest${PROJECT_NAME}" ${OSGDEP})
1866 FOREACH(LIB ${${PROJECT_NAME}_DEP_UNITTEST_LIB})
1867 OSG_MSG(" (unittest) - library ${LIB} = ${${LIB}}")
1868 TARGET_LINK_LIBRARIES("UnitTest${PROJECT_NAME}" ${${LIB}})
1871 #MESSAGE("--------- ADDING TEST --------- ${PROJECT_NAME}") # Trips up ccmake
1872 ADD_TEST("UnitTest${PROJECT_NAME}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/UnitTest${PROJECT_NAME}")
1874 ENDFUNCTION(OSG_SETUP_UNITTEST_BUILD)
1876 #############################################################################
1877 # perform default actions for pass OSGPYTHON
1879 FUNCTION(OSG_SETUP_PYTHON_BUILD)
1881 IF(${PROJECT_NAME}_NO_PYTHON OR NOT PYTHONLIBS_FOUND)
1883 ENDIF(${PROJECT_NAME}_NO_PYTHON OR NOT PYTHONLIBS_FOUND)
1885 MESSAGE(" setup python for ${PROJECT_NAME} | ${OSG_CAN_REGEN_PYTHON_BINDINGS}")
1887 ##################################
1888 # Dependency includes
1889 ##################################
1891 OSG_GET_ALL_DEP_OSG_LIB("${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIST DEP_MISSING_LIST)
1894 FOREACH(OSGDEP ${DEP_OSG_LIST})
1895 OSG_CHECKED_INCLUDE(${CMAKE_BINARY_DIR}/${OSGDEP}.cmake)
1898 OSG_CHECKED_INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
1901 ##################################
1903 ##################################
1905 FILE(MAKE_DIRECTORY ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR})
1907 SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
1909 IF(OSG_CAN_REGEN_PYTHON_BINDINGS)
1911 SET(_OSG_GEN_CONFIG_FILE_IN "${OSG_PYTHON_SUPPORT_DIR}/osgGenBindings.py.in")
1912 SET(_OSG_GEN_CONFIG_FILE_OUT "${CMAKE_CURRENT_BINARY_DIR}/osgGenBindings_${PROJECT_NAME}.py")
1913 SET(_OSG_GEN_SETUP_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/osgSetupBindings_${PROJECT_NAME}.py.in")
1914 SET(_OSG_GEN_SETUP_FILE "${CMAKE_CURRENT_BINARY_DIR}/osgSetupBindings_${PROJECT_NAME}.py")
1916 IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/__init__.py.in")
1917 SET(_OSG_GEN_INIT_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/__init__.py.in")
1919 SET(_OSG_GEN_INIT_FILE_IN "${OSG_PYTHON_SUPPORT_DIR}/__init__.py.in")
1922 IF(OSGBUILD_PYTHON_DUMP_DECLS)
1923 SET(OSG_DO_DUMP_PYTHON_DECLS True)
1925 SET(OSG_DO_DUMP_PYTHON_DECLS False)
1928 CONFIGURE_FILE("${_OSG_GEN_CONFIG_FILE_IN}"
1929 "${_OSG_GEN_CONFIG_FILE_OUT}")
1931 CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1932 "${_OSG_GEN_INIT_FILE_OUT}")
1934 ##################################
1936 ##################################
1938 IF(EXISTS ${_OSG_GEN_SETUP_FILE_IN})
1939 CONFIGURE_FILE("${_OSG_GEN_SETUP_FILE_IN}"
1940 "${_OSG_GEN_SETUP_FILE}")
1941 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "\n\n###############################\n")
1942 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "#auto setup for python bindings\n\n")
1945 COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1946 "${CMAKE_SOURCE_DIR}/Bindings/Python/osgDefaultGen.py"
1947 "${_OSG_GEN_SETUP_FILE}")
1951 ##################################
1952 # Setup File ModuleHeader
1953 ##################################
1955 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleHeaders = \\\n[\n")
1957 LIST(INSERT ${PROJECT_NAME}_PYTHON_BIND_HEADERS 0 "pypp_aliases.h")
1958 LIST(INSERT ${PROJECT_NAME}_PYTHON_BIND_HEADERS 0 "PreBoostPython.h")
1960 FOREACH(_OSG_HEADER ${${PROJECT_NAME}_PYTHON_BIND_HEADERS})
1961 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${_OSG_HEADER}\",\n")
1964 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
1966 ##################################
1967 # Setup File ModuleFCs
1968 ##################################
1970 IF(${PROJECT_NAME}_PYTHON_BIND_FCS)
1971 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleFCs = \\\n[\n")
1973 FOREACH(_OSG_FC ${${PROJECT_NAME}_PYTHON_BIND_FCS})
1974 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${_OSG_FC}\",\n")
1977 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
1979 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleFCDFiles = None\n\n\n")
1981 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleFCs = None\n\n\n")
1983 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleFCDFiles = \\\n[\n")
1985 FOREACH(_OSG_FC ${${PROJECT_NAME}_FCD})
1986 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${_OSG_FC}\",\n")
1989 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
1992 ##################################
1993 # Setup File ModuleIncludes
1994 ##################################
1996 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleIncludes = \\\n[\n")
1998 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${PYTHON_INCLUDE_PATH}\",\n")
2000 IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/Wrapper")
2001 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/Wrapper\",\n")
2003 IF(EXISTS "${CMAKE_SOURCE_DIR}/Bindings/Python/Common")
2004 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${CMAKE_SOURCE_DIR}/Bindings/Python/Common\",\n")
2007 IF(${CMAKE_PROJECT_NAME} STREQUAL "OpenSG")
2008 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${CMAKE_BINARY_DIR}/Source/Base/Base\",\n")
2009 # SET(OSG_PYTHON_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/Bindings/Python")
2011 FOREACH(_INC_DIR ${OpenSG_INCLUDE_DIRS})
2012 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${_INC_DIR}\",\n")
2014 # SET(OSG_PYTHON_SUPPORT_DIR "${OpenSG_DIR}/share/OpenSG/python")
2017 FOREACH(_OSG_INC ${${PROJECT_NAME}_INC})
2018 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${_OSG_INC}\",\n")
2021 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
2023 ##################################
2024 # Setup File ModuleDepIncludes
2025 ##################################
2028 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleDepIncludes = \\\n[\n")
2030 FOREACH(OSGDEP ${DEP_OSG_LIST})
2031 FOREACH(_OSG_INC ${${OSGDEP}_INC})
2032 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${_OSG_INC}\",\n")
2036 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
2038 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleDepIncludes = None\n\n\n")
2041 ##################################
2042 # Setup File PythonModuleDeps
2043 ##################################
2046 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleDepencies = \\\n[\n")
2048 FOREACH(OSGDEP ${DEP_OSG_LIST})
2049 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${OSG_PYTHON_${OSGDEP}_MODULE_DIR}/generated\",\n")
2052 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
2054 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleDepencies = None\n\n\n")
2057 ##################################
2058 # Setup File NativeWinDependents
2059 ##################################
2061 IF(${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT)
2062 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWinDependends = \\\n[\n")
2064 FOREACH(_OSG_NATIVEWIN_DEP ${${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT})
2065 FILE(APPEND ${_OSG_GEN_SETUP_FILE} " \"${_OSG_NATIVEWIN_DEP}\",\n")
2068 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
2069 IF(UNIX AND NOT APPLE)
2070 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWin = \"XWindow\"\n\n\n")
2072 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWin = \"WIN32Window\"\n\n\n")
2073 ELSEIF(UNIX AND APPLE)
2074 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWin = \"CocoaWindow\"\n\n\n")
2077 FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWinDependends = None\n\n\n")
2081 ##################################
2082 # Bindings Gen Target
2083 ##################################
2085 ADD_CUSTOM_TARGET(${PROJECT_NAME}PyGenOnly COMMAND ${PYTHON_EXECUTABLE} osgGenBindings_${PROJECT_NAME}.py)
2086 ADD_CUSTOM_TARGET(${PROJECT_NAME}PyGen COMMAND ${PYTHON_EXECUTABLE} osgGenBindings_${PROJECT_NAME}.py)
2089 FOREACH(OSG_DEP ${${PROJECT_NAME}_DEP_OSG_LIB})
2090 ADD_DEPENDENCIES(${PROJECT_NAME}PyGen ${OSG_DEP}PyGen)
2093 ADD_DEPENDENCIES(OSGPyGen ${PROJECT_NAME}PyGen)
2095 ENDIF(OSG_CAN_REGEN_PYTHON_BINDINGS)
2097 ##################################
2098 # Bindings Lib Target
2099 ##################################
2101 IF(EXISTS "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated" AND NOT ${PROJECT_NAME}_PYTHON_GET_ONLY)
2102 FILE(GLOB _OSG_BIND_SRC "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/*.pypp.cpp")
2103 LIST(APPEND _OSG_BIND_SRC "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${PROJECT_NAME}Py.main.cpp")
2105 FILE(GLOB _OSG_BIND_SRC_TMP "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/Wrapper/*.cpp")
2107 LIST(APPEND _OSG_BIND_SRC ${_OSG_BIND_SRC_TMP})
2109 IF(${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT)
2111 FOREACH(_OSG_NATIVEWIN_DEP ${${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT})
2112 SET(_OSG_NATIVEWIN_DEP_IN ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${_OSG_NATIVEWIN_DEP}Base.pypp.cpp)
2113 SET(_OSG_NATIVEWIN_DEP_PATCHED ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${_OSG_NATIVEWIN_DEP}Base.pypp.cpp.patched)
2114 SET(_OSG_NATIVEWIN_DEP_OUT ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${_OSG_NATIVEWIN_DEP}Base.pypp.patched.cpp)
2116 LIST(REMOVE_ITEM _OSG_BIND_SRC ${_OSG_NATIVEWIN_DEP_IN})
2117 LIST(REMOVE_ITEM _OSG_BIND_SRC ${_OSG_NATIVEWIN_DEP_OUT})
2119 IF(EXISTS ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${_OSG_NATIVEWIN_DEP}Base.pypp.patched.cpp)
2120 LIST(APPEND _OSG_BIND_SRC ${_OSG_NATIVEWIN_DEP_OUT})
2125 ENDIF(${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT)
2128 ADD_LIBRARY(${PROJECT_NAME}Py SHARED EXCLUDE_FROM_ALL ${_OSG_BIND_SRC})
2130 SET_TARGET_PROPERTIES(${PROJECT_NAME}Py PROPERTIES PREFIX "")
2134 SET_TARGET_PROPERTIES(${PROJECT_NAME}Py PROPERTIES
2135 VERSION ${OSG_VERSION}
2136 SOVERSION ${OSG_VERSION}
2139 SET_PROPERTY(TARGET "${PROJECT_NAME}Py" PROPERTY FOLDER "PythonBindings")
2144 INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
2145 INCLUDE_DIRECTORIES(${OSG_PYTHON_COMMON_INCDIR})
2146 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/Wrapper)
2147 INCLUDE_DIRECTORIES(${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR})
2149 ADD_DEFINITIONS(-DBOOST_PYTHON_MAX_ARITY=21)
2151 FOREACH(OSGDEP ${DEP_OSG_LIST})
2152 INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
2155 INCLUDE_DIRECTORIES(${${PROJECT_NAME}_INC})
2156 # INCLUDE_DIRECTORIES(${OSG_BOOST_INCDIRS})
2158 # dependencies global
2159 FOREACH(INCDIR ${OSG_GLOBAL_DEP_INCDIR})
2160 OSG_MSG(" (global) - include dir ${INCDIR} = ${${INCDIR}}")
2161 INCLUDE_DIRECTORIES(${${INCDIR}})
2164 FOREACH(INCDIR ${OSG_SYSTEM_DEP_INCDIR})
2165 OSG_MSG(" (system) - include dir ${INCDIR} = ${${INCDIR}}")
2166 INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
2169 TARGET_LINK_LIBRARIES(${PROJECT_NAME}Py ${PROJECT_NAME})
2170 TARGET_LINK_LIBRARIES(${PROJECT_NAME}Py ${OSG_BOOST_PYTHON_LIBS})
2171 TARGET_LINK_LIBRARIES(${PROJECT_NAME}Py ${PYTHON_LIBRARY})
2175 IF(OSG_INSTALL_SUBDIR)
2176 SET(_OSG_ISC "${OSG_INSTALL_SUBDIR}/")
2177 ELSE(OSG_INSTALL_SUBDIR)
2179 ENDIF(OSG_INSTALL_SUBDIR)
2181 SET(_OSG_TARGET_BINDIR_REL bin/${_OSG_ISC}rel)
2182 SET(_OSG_TARGET_BINDIR_DBG bin/${_OSG_ISC}debug)
2183 SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC}relnoopt)
2184 SET(_OSG_TARGET_BINDIR_DBGO bin/${_OSG_ISC}debugopt)
2186 SET(_OSG_TARGET_LIBDIR_REL lib/${_OSG_ISC}rel)
2187 SET(_OSG_TARGET_LIBDIR_DBG lib/${_OSG_ISC}debug)
2188 SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC}relnoopt)
2189 SET(_OSG_TARGET_LIBDIR_DBGO lib/${_OSG_ISC}debugopt)
2191 SET(_OSG_TARGET_PYLIBDIR_REL lib/python/${_OSG_ISC}rel/osg2/${PROJECT_NAME})
2192 SET(_OSG_TARGET_PYLIBDIR_DBG lib/python/${_OSG_ISC}debug/osg2/${PROJECT_NAME})
2193 SET(_OSG_TARGET_PYLIBDIR_RELNO lib/python/${_OSG_ISC}relnoopt/osg2/${PROJECT_NAME})
2194 SET(_OSG_TARGET_PYLIBDIR_DBGO lib/python/${_OSG_ISC}debugopt/osg2/${PROJECT_NAME})
2196 INSTALL(TARGETS ${PROJECT_NAME}Py
2197 CONFIGURATIONS Release
2198 RUNTIME DESTINATION ${_OSG_TARGET_PYLIBDIR_REL}
2199 # COMPONENT release_runtimes
2202 INSTALL(TARGETS ${PROJECT_NAME}Py
2203 CONFIGURATIONS Release
2205 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_REL}
2206 # COMPONENT release_libraries
2209 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_REL}
2210 # COMPONENT release_libraries
2213 INSTALL(TARGETS ${PROJECT_NAME}Py
2214 CONFIGURATIONS Debug
2215 RUNTIME DESTINATION ${_OSG_TARGET_PYLIBDIR_DBG}
2216 # COMPONENT debug_runtimes
2219 INSTALL(TARGETS ${PROJECT_NAME}Py
2220 CONFIGURATIONS Debug
2222 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_DBG}
2223 # COMPONENT debug_libraries
2226 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_DBG}
2227 # COMPONENT debug_libraries
2230 INSTALL(TARGETS ${PROJECT_NAME}Py
2231 CONFIGURATIONS ReleaseNoOpt
2232 RUNTIME DESTINATION ${_OSG_TARGET_PYLIBDIR_RELNO}
2233 # COMPONENT release_no_opt_runtimes
2236 INSTALL(TARGETS ${PROJECT_NAME}Py
2237 CONFIGURATIONS ReleaseNoOpt
2239 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_RELNO}
2240 # COMPONENT release_no_opt_libraries
2243 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_RELNO}
2244 # COMPONENT release_no_opt_libraries
2247 INSTALL(TARGETS ${PROJECT_NAME}Py
2248 CONFIGURATIONS DebugOpt
2249 RUNTIME DESTINATION ${_OSG_TARGET_PYLIBDIR_DBGO}
2250 # COMPONENT debug_opt_runtimes
2253 INSTALL(TARGETS ${PROJECT_NAME}Py
2254 CONFIGURATIONS DebugOpt
2256 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_DBGO}
2257 # COMPONENT debug_opt_libraries
2260 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_DBGO}
2261 # COMPONENT debug_opt_libraries
2265 IF(OSG_INSTALL_PDB_FILES)
2267 GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME}Py Release_LOCATION)
2269 STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
2271 INSTALL(FILES ${_TMPVAL1}
2272 CONFIGURATIONS Release
2273 DESTINATION ${_OSG_TARGET_PYLIBDIR_REL}
2274 # COMPONENT release_program_db
2278 GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME}Py Debug_LOCATION)
2280 STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
2282 INSTALL(FILES ${_TMPVAL1}
2283 CONFIGURATIONS Debug
2284 DESTINATION ${_OSG_TARGET_PYLIBDIR_DBG}
2285 # COMPONENT debug_program_db
2289 GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME}Py ReleaseNoOpt_LOCATION)
2291 STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
2293 INSTALL(FILES ${_TMPVAL1}
2294 CONFIGURATIONS ReleaseNoOpt
2295 DESTINATION ${_OSG_TARGET_PYLIBDIR_RELNO}
2296 # COMPONENT release_no_opt_program_db
2300 GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME}Py DebugOpt_LOCATION)
2302 STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
2304 INSTALL(FILES ${_TMPVAL1}
2305 CONFIGURATIONS DebugOpt
2306 DESTINATION ${_OSG_TARGET_PYLIBDIR_DBGO}
2307 # COMPONENT debug_opt_program_db
2310 ENDIF(OSG_INSTALL_PDB_FILES)
2312 SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
2314 INSTALL(FILES ${_OSG_GEN_INIT_FILE_OUT}
2315 DESTINATION ${_OSG_TARGET_PYLIBDIR_REL}
2316 CONFIGURATIONS Release
2317 # COMPONENT release_runtimes
2320 SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
2322 INSTALL(FILES ${_OSG_GEN_INIT_FILE_OUT}
2323 DESTINATION ${_OSG_TARGET_PYLIBDIR_DBG}
2324 CONFIGURATIONS Debug
2325 # COMPONENT debug_runtimes
2328 SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
2330 INSTALL(FILES ${_OSG_GEN_INIT_FILE_OUT}
2331 DESTINATION ${_OSG_TARGET_PYLIBDIR_DBGO}
2332 CONFIGURATIONS DebugOpt
2333 # COMPONENT debug_opt_runtimes
2336 SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
2338 INSTALL(FILES ${_OSG_GEN_INIT_FILE_OUT}
2339 DESTINATION ${_OSG_TARGET_PYLIBDIR_RELNO}
2340 CONFIGURATIONS ReleaseNoOpt
2341 # COMPONENT release_no_opt_runtimes
2346 GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
2348 SET(_OSG_PY_INST_BASE
2349 "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2/${PROJECT_NAME}")
2351 INSTALL(TARGETS ${PROJECT_NAME}Py
2353 RUNTIME DESTINATION ${_OSG_PY_INST_BASE}
2354 # COMPONENT libraries
2357 LIBRARY DESTINATION ${_OSG_PY_INST_BASE}
2358 # COMPONENT libraries
2361 ARCHIVE DESTINATION ${_OSG_PY_INST_BASE}
2362 # COMPONENT libraries
2366 INSTALL(FILES ${_OSG_GEN_INIT_FILE_OUT}
2367 DESTINATION ${_OSG_PY_INST_BASE}
2368 # COMPONENT libraries
2372 GET_PROPERTY(_OSG_CURR_SO_PATH TARGET ${PROJECT_NAME}Py PROPERTY LOCATION)
2374 GET_FILENAME_COMPONENT(_OSG_CURR_SO_NAME ${_OSG_CURR_SO_PATH} NAME)
2376 FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Python/lib/osg2/${PROJECT_NAME})
2378 OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
2379 ${CMAKE_BINARY_DIR}/Python/lib/osg2/${PROJECT_NAME}/__init__.py)
2380 OSG_SYMLINK_CHECKED(${_OSG_CURR_SO_PATH}
2381 ${CMAKE_BINARY_DIR}/Python/lib/osg2/${PROJECT_NAME}/${_OSG_CURR_SO_NAME})
2385 ADD_DEPENDENCIES(OSGPy ${PROJECT_NAME}Py)
2388 ENDFUNCTION(OSG_SETUP_PYTHON_BUILD)
2390 #############################################################################
2391 # perform default actions for pass OSGDOXYDOC
2393 FUNCTION(OSG_SETUP_SEPARATE_LIBS_DOXYDOC)
2394 IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGDOXYDOC")
2398 IF(${PROJECT_NAME}_NO_DOC)
2400 ENDIF(${PROJECT_NAME}_NO_DOC)
2402 # set up variables for the config file
2403 SET(OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
2404 SET(OSG_${PROJECT_NAME}_DOC_DIRECTORY "${OSG_DOXY_HTML_DIR}/${PROJECT_NAME}")
2405 SET(OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}-doxy")
2407 SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES"")
2408 SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS")
2409 SET(OSG_${PROJECT_NAME}_DEP_DOCS "")
2411 # dependencies - OpenSG
2412 OSG_GET_ALL_DEP_OSG_LIB("${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIST DEP_MISSING_LIST)
2414 FOREACH(OSGDEP ${DEP_OSG_LIST})
2415 SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES "${OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES} ./${OSGDEP}_DOXYGEN_TAGS=../../${OSGDEP}/html")
2416 LIST(APPEND OSG_${PROJECT_NAME}_DEP_DOCS "${OSGDEP}Doc")
2419 IF(EXISTS "${CMAKE_BINARY_DIR}/Doc/Include/${PROJECT_NAME}.include")
2420 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/${PROJECT_NAME}.include")
2423 # write doxygen config file
2424 CONFIGURE_FILE("${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE_IN}"
2425 "${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}")
2427 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
2429 IF(DOXYGEN_EXECUTABLE)
2430 #ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
2431 #ADD_DEPENDENCIES(DocUpload Doc)
2433 SET(OSG_DOC_PIPES "")
2435 IF(OSG_DOXY_STDOUT_LOG)
2436 SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG}.${PROJECT_NAME})
2437 ENDIF(OSG_DOXY_STDOUT_LOG)
2439 ADD_CUSTOM_TARGET(${PROJECT_NAME}DocOnly
2441 COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES}
2442 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Doc")
2444 ADD_CUSTOM_TARGET(${PROJECT_NAME}Doc
2446 COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES}
2447 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Doc")
2449 FOREACH(OSGDEPDOC ${OSG_${PROJECT_NAME}_DEP_DOCS})
2450 ADD_DEPENDENCIES(${PROJECT_NAME}Doc ${OSGDEPDOC})
2453 ADD_DEPENDENCIES(Doc ${PROJECT_NAME}Doc)
2456 INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
2460 # FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2461 # "#############################################################################\n")
2463 # IF(${PROJECT_NAME}_DOXY_EXTRA_INC)
2464 # FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2465 # "# doc input files for ${PROJECT_NAME}\n\n")
2467 # FOREACH(DOXYFILE ${${PROJECT_NAME}_DOXY_EXTRA_INC})
2468 # FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2469 # "INPUT += ${DOXYFILE}\n")
2472 # FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE} "\n")
2475 FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2476 "# source code input files for ${PROJECT_NAME}\n\n")
2478 FOREACH(INCDIR ${${PROJECT_NAME}_INC})
2479 FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2480 "INPUT += ${INCDIR}\n")
2483 FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE} "\n")
2485 ENDFUNCTION(OSG_SETUP_SEPARATE_LIBS_DOXYDOC)
2487 #############################################################################
2488 # perform default actions for pass OSGDOXYDOC
2490 FUNCTION(OSG_SETUP_DOXYDOC)
2491 IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGDOXYDOC")
2493 ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGDOXYDOC")
2495 IF(${PROJECT_NAME}_NO_DOC)
2497 ENDIF(${PROJECT_NAME}_NO_DOC)
2500 INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
2502 FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
2503 "#############################################################################\n"
2505 FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
2506 "# doc input files for ${PROJECT_NAME}\n\n"
2509 FOREACH(INCDIR ${${PROJECT_NAME}_INC})
2510 FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
2511 "INPUT += ${INCDIR}\n")
2514 FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE} "\n")
2516 ENDFUNCTION(OSG_SETUP_DOXYDOC)
2518 #############################################################################
2519 # perform default actions for build passes
2521 FUNCTION(OSG_SETUP_PROJECT PROJ_DEFINE)
2523 FOREACH(_OSG_${PROJECT_NAME}_EXT_DIR ${${PROJECT_NAME}_EXT_DIRS})
2524 OSG_ADD_DIRECTORY(${_OSG_${PROJECT_NAME}_EXT_DIR})
2525 ENDFOREACH(_OSG_${PROJECT_NAME}_EXT_DIR ${${PROJECT_NAME}_EXT_DIRS})
2527 IF(OSG_CMAKE_PASS STREQUAL "OSGSETUP")
2528 OSG_SETUP_LIBRARY_BUILD(${PROJ_DEFINE})
2530 ELSEIF(OSG_CMAKE_PASS STREQUAL "OSGSETUPTEST")
2531 OSG_SETUP_TEST_BUILD()
2533 ELSEIF(OSG_CMAKE_PASS STREQUAL "OSGSETUPUNITTEST")
2534 OSG_SETUP_UNITTEST_BUILD()
2536 ELSEIF(OSG_CMAKE_PASS STREQUAL "OSGDOXYDOC" AND NOT OSG_DOXY_INPUTS)
2537 IF(OSG_GENERATE_SEPARATE_LIB_DOC)
2538 OSG_SETUP_SEPARATE_LIBS_DOXYDOC()
2543 ELSEIF(OSG_CMAKE_PASS STREQUAL "OSGPYTHON")
2544 OSG_SETUP_PYTHON_BUILD()
2546 ENDIF(OSG_CMAKE_PASS STREQUAL "OSGSETUP")
2548 ENDFUNCTION(OSG_SETUP_PROJECT)
2550 #############################################################################
2551 # setup import targets so the debug/debugopt build type works correctly
2553 FUNCTION(OSG_SETUP_IMPORT_LIB_WINDOWS NEW_LIB)
2555 IF(${NEW_LIB}_RELEASE)
2556 GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR ${${NEW_LIB}_RELEASE} PATH)
2557 ENDIF(${NEW_LIB}_RELEASE)
2559 IF(NOT OSG_TMP_LIB_DIR AND ${NEW_LIB}_DEBUG)
2560 GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR ${${NEW_LIB}_DEBUG} PATH)
2561 ENDIF(NOT OSG_TMP_LIB_DIR AND ${NEW_LIB}_DEBUG)
2563 IF(NOT ${NEW_LIB}_DEBUG)
2564 MESSAGE(" warning not debug lib for ${NEW_LIB}")
2566 IF(NOT EXISTS "${CMAKE_BINARY_DIR}/osgDummyLinkLib.c")
2567 FILE(WRITE "${CMAKE_BINARY_DIR}/osgDummyLinkLib.c" "")
2570 IF(NOT TARGET OSGDummyLinkLib)
2571 ADD_LIBRARY(OSGDummyLinkLib STATIC osgDummyLinkLib.c)
2574 SET_TARGET_PROPERTIES(OSG_${NEW_LIB}_TARGET PROPERTIES
2575 IMPORTED_IMPLIB_RELEASE ${${NEW_LIB}_RELEASE}
2576 IMPORTED_LOCATION_RELEASE ${OSG_TMP_LIB_DIR}
2577 IMPORTED_IMPLIB_RELEASENOOPT ${${NEW_LIB}_RELEASE}
2578 IMPORTED_LOCATION_RELEASENOOPT ${OSG_TMP_LIB_DIR}
2579 IMPORTED_IMPLIB_DEBUG "${CMAKE_BINARY_DIR}/bin/Debug/OSGDummyLinkLib.lib"
2580 IMPORTED_LOCATION_DEBUG "${CMAKE_BINARY_DIR}/bin/Debug"
2581 IMPORTED_IMPLIB_DEBUGOPT "${CMAKE_BINARY_DIR}/bin/Debug/OSGDummyLinkLib.lib"
2582 IMPORTED_LOCATION_DEBUGOPT "${CMAKE_BINARY_DIR}/bin/Debug")
2584 ADD_DEPENDENCIES(OSG_${NEW_LIB}_TARGET OSGDummyLinkLib)
2588 SET_TARGET_PROPERTIES(OSG_${NEW_LIB}_TARGET PROPERTIES
2589 IMPORTED_IMPLIB_RELEASE ${${NEW_LIB}_RELEASE}
2590 IMPORTED_LOCATION_RELEASE ${OSG_TMP_LIB_DIR}
2591 IMPORTED_IMPLIB_RELEASENOOPT ${${NEW_LIB}_RELEASE}
2592 IMPORTED_LOCATION_RELEASENOOPT ${OSG_TMP_LIB_DIR}
2593 IMPORTED_IMPLIB_DEBUG ${${NEW_LIB}_DEBUG}
2594 IMPORTED_LOCATION_DEBUG ${OSG_TMP_LIB_DIR}
2595 IMPORTED_IMPLIB_DEBUGOPT ${${NEW_LIB}_DEBUG}
2596 IMPORTED_LOCATION_DEBUGOPT ${OSG_TMP_LIB_DIR})
2600 ENDFUNCTION(OSG_SETUP_IMPORT_LIB_WINDOWS)
2602 FUNCTION(OSG_SETUP_IMPORT_LIB_UNIX NEW_LIB)
2604 IF(${NEW_LIB}_RELEASE)
2605 GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR ${${NEW_LIB}_RELEASE} PATH)
2606 ENDIF(${NEW_LIB}_RELEASE)
2608 IF(NOT OSG_TMP_LIB_DIR AND ${NEW_LIB}_DEBUG)
2609 GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR ${${NEW_LIB}_DEBUG} PATH)
2610 ENDIF(NOT OSG_TMP_LIB_DIR AND ${NEW_LIB}_DEBUG)
2612 IF(${NEW_LIB}_RELEASE AND NOT ${NEW_LIB}_DEBUG)
2613 SET(${NEW_LIB}_DEBUG ${${NEW_LIB}_RELEASE} CACHE FILEPATH "" FORCE)
2614 ENDIF(${NEW_LIB}_RELEASE AND NOT ${NEW_LIB}_DEBUG)
2616 IF(NOT ${NEW_LIB}_RELEASE AND ${NEW_LIB}_DEBUG)
2617 SET(${NEW_LIB}_RELEASE ${${NEW_LIB}_DEBUG} CACHE FILEPATH "" FORCE)
2618 ENDIF(NOT ${NEW_LIB}_RELEASE AND ${NEW_LIB}_DEBUG)
2620 SET_TARGET_PROPERTIES(OSG_${NEW_LIB}_TARGET PROPERTIES
2621 IMPORTED_LOCATION ${${NEW_LIB}_RELEASE}
2622 IMPORTED_LOCATION_DEBUG ${${NEW_LIB}_DEBUG}
2623 IMPORTED_LOCATION_DEBUGGV ${${NEW_LIB}_DEBUG})
2625 ENDFUNCTION(OSG_SETUP_IMPORT_LIB_UNIX)
2627 MACRO(OSG_ADD_IMPORT_LIB LIB_LIST NEW_LIB)
2629 IF(NOT TARGET OSG_${NEW_LIB}_TARGET)
2630 ADD_LIBRARY(OSG_${NEW_LIB}_TARGET SHARED IMPORTED)
2633 OSG_SETUP_IMPORT_LIB_WINDOWS(${NEW_LIB})
2635 OSG_SETUP_IMPORT_LIB_UNIX(${NEW_LIB})
2637 OSG_ADD_OPT(${NEW_LIB}_RELEASE)
2638 OSG_ADD_OPT(${NEW_LIB}_DEBUG)
2639 OSG_ADD_OPT(OSG_${NEW_LIB}_TARGET)
2642 LIST(APPEND ${LIB_LIST} OSG_${NEW_LIB}_TARGET)
2645 ENDMACRO(OSG_ADD_IMPORT_LIB)
2647 ##########################################################################
2648 # write settings so different variants can be build with the same settings
2650 MACRO(OSG_OPTION NAME DESC VALUE)
2651 LIST(APPEND OSG_OPTION_LIST ${NAME})
2652 OSG_MSG("adding option ${NAME} = ${VALUE}")
2654 OPTION(${NAME} "${DESC}" ${VALUE})
2655 ENDMACRO(OSG_OPTION)
2657 MACRO(OSG_SET_CACHE NAME VALUE TYPE DESC)
2658 LIST(APPEND OSG_OPTION_LIST ${NAME})
2660 SET(${NAME} ${VALUE} CACHE ${TYPE} "${DESC}")
2661 ENDMACRO(OSG_SET_CACHE)
2663 MACRO(OSG_SET NAME VALUE)
2664 LIST(APPEND OSG_OPTION_LIST ${NAME})
2666 SET(${NAME} ${VALUE})
2669 MACRO(OSG_ADD_OPT NAME)
2670 LIST(APPEND OSG_OPTION_LIST ${NAME})
2671 ENDMACRO(OSG_ADD_OPT)
2673 MACRO(OSG_ADD_OPT_SUBDIR NAME)
2674 LIST(APPEND OSG_OPTION_LIST ${NAME})
2676 SET(OSG_OPTION_LIST "${OSG_OPTION_LIST}" PARENT_SCOPE)
2677 ENDMACRO(OSG_ADD_OPT_SUBDIR)
2679 MACRO(OSG_FIND_PACKAGE NAME)
2680 FIND_PACKAGE(${NAME})
2683 OSG_ADD_OPT(${NAME}_LIBRARIES)
2684 OSG_ADD_OPT(${NAME}_INCLUDE_DIR)
2685 ENDIF(${NAME}_FOUND)
2687 OSG_ADD_OPT(${NAME}_FOUND)
2688 ENDMACRO(OSG_FIND_PACKAGE)
2690 MACRO(OSG_FIND_PACKAGE_QUIET NAME)
2691 FIND_PACKAGE(${NAME} QUIET)
2694 OSG_ADD_OPT(${NAME}_LIBRARIES)
2695 OSG_ADD_OPT(${NAME}_INCLUDE_DIR)
2696 ENDIF(${NAME}_FOUND)
2698 OSG_ADD_OPT(${NAME}_FOUND)
2699 ENDMACRO(OSG_FIND_PACKAGE_QUIET)
2701 MACRO(OSG_BOOST_DEP_SETUP)
2702 SET(Boost_USE_MULTITHREAD ON )
2703 SET(Boost_USE_STATIC_LIBS OFF)
2705 SET(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "" FORCE)
2706 SET(Boost_ADDITIONAL_VERSIONS "1.54.0"
2723 FIND_PACKAGE(Boost COMPONENTS filesystem system)
2727 IF(PYTHON_INCLUDE_PATH AND PYTHON_LIBRARY)
2728 FIND_PACKAGE(Boost COMPONENTS python)
2729 ENDIF(PYTHON_INCLUDE_PATH AND PYTHON_LIBRARY)
2731 # We ignore if boost python fails, we catch that somewhere else
2732 # so if we get here Boost_FOUND was true in the first place
2733 SET(Boost_FOUND TRUE)
2736 SET(Boost_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY}
2738 SET(Boost_FILESYSTEM_LIBRARY_DEBUG ${Boost_FILESYSTEM_LIBRARY_DEBUG}
2740 SET(Boost_FILESYSTEM_LIBRARY_RELEASE
2741 ${Boost_FILESYSTEM_LIBRARY_RELEASE}
2744 SET(Boost_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY}
2746 SET(Boost_SYSTEM_LIBRARY_DEBUG ${Boost_SYSTEM_LIBRARY_DEBUG}
2748 SET(Boost_SYSTEM_LIBRARY_RELEASE
2749 ${Boost_SYSTEM_LIBRARY_RELEASE}
2752 SET(Boost_PYTHON_LIBRARY ${Boost_PYTHON_LIBRARY}
2754 SET(Boost_PYTHON_LIBRARY_DEBUG ${Boost_PYTHON_LIBRARY_DEBUG}
2756 SET(Boost_PYTHON_LIBRARY_RELEASE
2757 ${Boost_PYTHON_LIBRARY_RELEASE}
2761 SET(Boost_INCLUDE_DIR ${Boost_INCLUDE_DIR}
2764 SET(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS}
2767 SET(Boost_USE_MULTITHREADED ${Boost_USE_MULTI_THREADED}
2771 INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIR} )
2774 LINK_DIRECTORIES (${Boost_LIBRARY_DIRS})
2777 IF(NOT Boost_USE_STATIC_LIBS)
2778 ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
2779 ENDIF(NOT Boost_USE_STATIC_LIBS)
2781 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
2782 CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
2784 SET(OSG_BOOST_LIBS ${Boost_FILESYSTEM_LIBRARY_DEBUG}
2785 ${Boost_SYSTEM_LIBRARY_DEBUG})
2787 SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
2791 SET(OSG_BOOST_LIBS ${Boost_FILESYSTEM_LIBRARY_RELEASE}
2792 ${Boost_SYSTEM_LIBRARY_RELEASE})
2794 SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
2798 SET(OSG_BOOST_INCDIRS ${Boost_INCLUDE_DIR})
2801 ENDMACRO(OSG_BOOST_DEP_SETUP)
2803 FUNCTION(OSG_WRITE_SETTINGS FILENAME)
2804 FILE(WRITE ${FILENAME}
2805 "# CMake.settings -- auto generated\n\n")
2807 FOREACH(OSG_OPT ${OSG_OPTION_LIST})
2808 IF(TARGET ${OSG_OPT})
2809 STRING(REPLACE _TARGET "" _OSG_OPT_BASE ${OSG_OPT})
2810 STRING(REPLACE OSG_ "" _OSG_OPT_OSGBASE ${_OSG_OPT_BASE})
2812 IF(NOT ${_OSG_OPT_OSGBASE}_DEBUG)
2813 SET(${_OSG_OPT_OSGBASE}_DEBUG ${OSG_${_OSG_OPT_OSGBASE}_DEBUG})
2815 IF(NOT ${_OSG_OPT_OSGBASE}_RELEASE)
2816 SET(${_OSG_OPT_OSGBASE}_RELEASE ${OSG_${_OSG_OPT_OSGBASE}_RELEASE})
2819 FILE(APPEND ${FILENAME}
2820 "ADD_LIBRARY(${_OSG_OPT_BASE}_TARGET SHARED IMPORTED)\n"
2821 "SET_TARGET_PROPERTIES(${_OSG_OPT_BASE}_TARGET PROPERTIES\n"
2822 " IMPORTED_LOCATION ${${_OSG_OPT_OSGBASE}_RELEASE}\n"
2823 " IMPORTED_LOCATION_DEBUG ${${_OSG_OPT_OSGBASE}_DEBUG}\n"
2824 " IMPORTED_LOCATION_DEBUGGV ${${_OSG_OPT_OSGBASE}_DEBUG})\n")
2826 FILE(APPEND ${FILENAME}
2827 "SET(${OSG_OPT} \"${${OSG_OPT}}\" CACHE INTERNAL \"\")\n")
2829 ENDFOREACH(OSG_OPT ${OSG_OPTION_LIST})
2831 ENDFUNCTION(OSG_WRITE_SETTINGS FILENAME)
2833 FUNCTION(OSG_WRITE_OSGBUILD FILENAME)
2835 FILE(WRITE ${FILENAME}
2836 "# CMake.build.settings -- auto generated\n\n")
2838 GET_CMAKE_PROPERTY(_variableNames VARIABLES)
2840 FOREACH(_variableName ${_variableNames})
2841 IF(_variableName MATCHES "^OSGBUILD_")
2842 FILE(APPEND ${FILENAME}
2843 "SET(${_variableName} ${${_variableName}} CACHE BOOL \"\" FORCE)\n")
2846 ENDFUNCTION(OSG_WRITE_OSGBUILD FILENAME)
2848 FUNCTION(OSG_WRITE_OSGGLOBALSETUP FILENAME)
2850 FILE(WRITE ${FILENAME}
2851 "# CMake.build.settings -- auto generated\n\n")
2853 FILE(APPEND ${FILENAME}
2854 "SET(OSG_ENABLE_C++11 ${OSG_ENABLE_C++11} CACHE BOOL \"\" FORCE)\n")
2855 FILE(APPEND ${FILENAME}
2856 "SET(CUDA_PROPAGATE_HOST_FLAGS ${CUDA_PROPAGATE_HOST_FLAGS} CACHE BOOL \"\" FORCE)\n")
2857 ENDFUNCTION(OSG_WRITE_OSGGLOBALSETUP FILENAME)
2859 FUNCTION(CHECK_BUILD_DIR)
2860 IF("${${CMAKE_PROJECT_NAME}_SOURCE_DIR}" STREQUAL "${${CMAKE_PROJECT_NAME}_BINARY_DIR}")
2861 MESSAGE(FATAL_ERROR "${CMAKE_PROJECT_NAME} requires an out of source Build. \n"
2862 "Please create a separate binary directory and run "
2864 ENDIF("${${CMAKE_PROJECT_NAME}_SOURCE_DIR}" STREQUAL "${${CMAKE_PROJECT_NAME}_BINARY_DIR}")
2865 ENDFUNCTION(CHECK_BUILD_DIR)
2867 MACRO(OSG_CHECK_INSTALL)
2869 MESSAGE(STATUS "process ignore install ${OSG_IGNORE_INSTALL}")
2871 IF(OSG_IGNORE_INSTALL)
2872 FOREACH(OSG_IGNORE_PRJ ${OSG_IGNORE_INSTALL})
2873 SET(OSG_IGNORE_INSTALL_${OSG_IGNORE_PRJ} TRUE)
2875 ENDIF(OSG_IGNORE_INSTALL)
2876 ENDMACRO(OSG_CHECK_INSTALL)
2878 ##########################################################################
2879 # Add Tutorial builds as tests
2881 FUNCTION(OSG_ADD_TUTORIAL_TESTS TUTORIALS_NAME TUTORIAL_SOURCE_DIR)
2882 IF(NOT OSGBUILD_UNITTESTS)
2886 FILE(GLOB TUTORIAL_SOURCES "${TUTORIAL_SOURCE_DIR}/[0-9][0-9]*.cpp")
2888 FOREACH(TUTORIAL ${TUTORIAL_SOURCES})
2889 #Get the path to the tutorial executable
2890 STRING(LENGTH ${TUTORIAL} SOURCE_PATH_LENGTH)
2891 MATH(EXPR SOURCE_PATH_LENGTH '${SOURCE_PATH_LENGTH}-4')
2892 STRING(SUBSTRING ${TUTORIAL} 0 ${SOURCE_PATH_LENGTH} TUTORIAL_EXE_PATH )
2893 SET(TUTORIAL_EXE_PATH "${TUTORIAL_EXE_PATH}${CMAKE_EXECUTABLE_SUFFIX}")
2895 #Extract a short name for the tutorial test
2896 STRING(REGEX MATCH "([0-9][0-9].*)[.]cpp" TUTORIAL_NAME ${TUTORIAL})
2897 SET(TUTORIAL_NAME ${CMAKE_MATCH_1})
2899 #Add a test to see if the tutorial exists
2900 ADD_TEST(NAME "${TUTORIALS_NAME}-${TUTORIAL_NAME}"
2901 COMMAND test -e ${TUTORIAL_EXE_PATH})