fixed: auto_ptr -> unique_ptr
[opensg.git] / Examples / Advanced / CMakeLists.fromosg.txt
blob6f2bbfeec7e64165300cb9dc80339aaefb9228b0
2 IF(OSG_OGL_COREONLY AND NOT OSG_CHECK_COREONLY)
3   RETURN()
4 ENDIF()
6 PROJECT(OpenSGAdvancedExamples)
8 MESSAGE(STATUS "Building advanced examples integrated")
10 #############################################################################
11 # find sources
13 FILE(GLOB SRCFILES "*.cpp")
15 #############################################################################
16 # get dependencies
18 SET(OSG_COMPONENTS OSGBase
19                    OSGCluster
20                    OSGDrawable
21                    OSGDynamics
22                    OSGFileIO
23                    OSGGroup
24                    OSGEffectGroups
25                    OSGImageFileIO
26                    OSGState
27                    OSGSystem
28                    OSGUtil
29                    OSGWindow
30                    OSGWindowGLUT
31                    OSGContribBackgroundLoader
32                    OSGContribTrapezoidalShadowMaps
33                    OSGContribComputeBase
34                    OSGContribTechniques)
36 IF(UNIX)
37     IF(APPLE)
38         LIST(APPEND OSG_COMPONENTS OSGWindowCocoa)
39     ELSE(APPLE)
40         LIST(APPEND OSG_COMPONENTS OSGWindowX)
41     ENDIF(APPLE)
42 ENDIF(UNIX)
44 IF(WIN32)
45     LIST(APPEND OSG_COMPONENTS OSGWindowWIN32)
46 ENDIF(WIN32)
48 SET(DEP_INCLUDE_DIRS)
49 SET(DEP_LIBRARY_DIRS)
50 SET(DEP_LIBRARIES)
52 SET(OSG_EXTERNAL_COMPONENTS Boost GLUT)
54 #############
55 #### X11 (optional)
57 IF(X11_FOUND AND NOT APPLE)
58     LIST(APPEND OSG_EXTERNAL_COMPONENTS X11)
59     LIST(APPEND OSG_COMPONENTS OSGWindowX)
60 ENDIF(X11_FOUND AND NOT APPLE)
62 #############
63 #### OpenSG
65 FOREACH(OSGDEP ${OSG_COMPONENTS})
66     IF(NOT EXISTS "${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
67         MESSAGE(STATUS "Dependency (${OSGDEP}) not found, "
68                        "can not build ${PROJECT_NAME}\n")
69         RETURN()
70     ENDIF(NOT EXISTS "${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
72     INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
73     INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
74 ENDFOREACH()
76 FOREACH(OSGEXTDEP ${OSG_EXTERNAL_COMPONENTS})
77     IF(NOT ${OSGEXTDEP}_FOUND)
78         MESSAGE(FATAL_ERROR "Dependency (${OSGEXTDEP}) not found, "
79                             "can not build ${PROJECT_NAME}\n")
80         RETURN()
81     ENDIF()
83     INCLUDE_DIRECTORIES(SYSTEM ${${OSGEXTDEP}_INCLUDE_DIR})
84 ENDFOREACH()
86 set(OSG_ADDON_LIBRARIES "")
88 IF(ANTTWEAKBAR_FOUND)
89     INCLUDE_DIRECTORIES(AFTER ${ANTTWEAKBAR_INCLUDE_DIR})
90     LIST(APPEND OSG_ADDON_LIBRARIES ${ANTTWEAKBAR_LIBRARIES})
91     add_definitions(-DOSG_WITH_ANTTWEAKBAR)
92 ENDIF()
94 IF(QHULL_FOUND)
95     INCLUDE_DIRECTORIES(AFTER ${QHULL_INCLUDE_DIR})
96     LIST(APPEND OSG_ADDON_LIBRARIES ${QHULL_LIBRARIES})
97     add_definitions(-DOSG_WITH_QHULL)
98 ENDIF()
100 OSG_FIND_PACKAGE(Glm_OpenSG)
101 IF(GLM_FOUND)
102     INCLUDE_DIRECTORIES(AFTER ${GLM_INCLUDE_DIR})
103     add_definitions(-DOSG_WITH_GLM)
104 ENDIF(GLM_FOUND)
106 OSG_FIND_PACKAGE(VMath_OpenSG)
107 IF(VMATH_FOUND)
108     INCLUDE_DIRECTORIES(AFTER ${VMATH_INCLUDE_DIR})
109     add_definitions(-DOSG_WITH_VMATH)
110 ENDIF(VMATH_FOUND)
112 #############################################################################
113 # build executables
115 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
117 FOREACH(GLOBAL_INC ${OSG_GLOBAL_DEP_INCDIR})
118   INCLUDE_DIRECTORIES(${${GLOBAL_INC}})
119 ENDFOREACH()
121 FOREACH(SRC ${SRCFILES})
123     GET_FILENAME_COMPONENT(EXE ${SRC} NAME_WE)
125     ADD_EXECUTABLE(${EXE} ${OSGEXCLUDE_EXAMPLES_ADVANCED} 
126                           ${SRC} ${OSG_ADD_GLOBAL_EXE_SRC})
128     ADD_DEPENDENCIES(OSGAllAdvancedExamples ${EXE})
130     FOREACH(OSGDEP ${OSG_COMPONENTS})
131         ADD_DEPENDENCIES(${EXE} ${OSGDEP})
133         TARGET_LINK_LIBRARIES(${EXE} ${OSGDEP})
134     ENDFOREACH()
136     TARGET_LINK_LIBRARIES(${EXE} ${OSG_ADDON_LIBRARIES})
138     IF(LINUX AND CMAKE_BUILD_TYPE STREQUAL "DebugGV" AND OSG_ADD_CXX_FLAGS_GV)
139         SET_PROPERTY(TARGET ${EXE}
140                      APPEND PROPERTY COMPILE_FLAGS ${OSG_ADD_CXX_FLAGS_GV})
141     ENDIF()
142     
143     IF(WIN32)
144       SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER "Examples/Advanced")
145     ENDIF()
146     
147     #Install
148     IF(OSG_INSTALL_EXAMPLES_EXE)
149       IF(WIN32)
150         INSTALL(TARGETS ${EXE}
151                 CONFIGURATIONS Release
152                 RUNTIME DESTINATION share/OpenSG/Examples/Advanced/bin/rel)
153         INSTALL(TARGETS ${EXE}
154                 CONFIGURATIONS Debug
155                 RUNTIME DESTINATION share/OpenSG/Examples/Advanced/bin/debug)
156         INSTALL(TARGETS ${EXE}
157                 CONFIGURATIONS ReleaseNoOpt
158                 RUNTIME DESTINATION share/OpenSG/Examples/Advanced/bin/relnoopt)
159         INSTALL(TARGETS ${EXE}
160                 CONFIGURATIONS DebugOpt
161                 RUNTIME DESTINATION share/OpenSG/Examples/Advanced/bin/debugopt)
162       ELSE()
163         INSTALL(TARGETS ${EXE}
164                 CONFIGURATIONS Release
165                 DESTINATION share/OpenSG/Examples/Advanced/bin
166                 COMPONENT examples_basic)
168         INSTALL(TARGETS ${EXE}
169                 CONFIGURATIONS Debug
170                 DESTINATION share/OpenSG/Examples/Advanced/bin/debug
171                 COMPONENT examples_basic)
173         INSTALL(TARGETS ${EXE}
174                 CONFIGURATIONS DebugGV
175                 DESTINATION share/OpenSG/Examples/Advanced/bin/debug
176                 COMPONENT examples_basic)
177       ENDIF()
178     ENDIF()
179     IF(OSG_INSTALL_EXAMPLES)
180         INSTALL(FILES "${SRC}"
181                 DESTINATION share/OpenSG/Examples/Advanced
182                 COMPONENT examples_basic)
183     ENDIF()
184 ENDFOREACH(SRC)
185     
187 IF(OSG_INSTALL_EXAMPLES)
188     INSTALL(FILES CMakeLists.standalone.txt
189             DESTINATION share/OpenSG/Examples/Advanced
190             RENAME CMakeLists.txt
191             COMPONENT examples_basic)
192 ENDIF()