fixed: auto_ptr -> unique_ptr
[opensg.git] / Examples / Tutorial / CMakeLists.fromosg.txt
blob6f0a0df26d2aebe1f6212294d0e38f7c00f382f6
2 IF(OSG_OGL_COREONLY AND NOT OSG_CHECK_COREONLY)
3   RETURN()
4 ENDIF()
6 PROJECT(OpenSGTutorialExamples)
8 MESSAGE(STATUS "Building tutorial examples integrated")
10 #############################################################################
11 # find sources
13 FILE(GLOB SRCFILES "*.cpp")
15 # stuff that is broken -- these examples need to be fixed
17 #############################################################################
18 # get dependencies
20 SET(OSG_COMPONENTS OSGBase
21                    OSGCluster
22                    OSGDrawable
23                    OSGFileIO
24                    OSGGroup
25                    OSGImageFileIO
26                    OSGState
27                    OSGSystem
28                    OSGUtil
29                    OSGText
30                    OSGWindow
31                    OSGWindowGLUT)
33 IF(UNIX)
34     IF(APPLE)
35         LIST(APPEND OSG_COMPONENTS OSGWindowCocoa)
36     ELSE(APPLE)
37         LIST(APPEND OSG_COMPONENTS OSGWindowX)
38     ENDIF(APPLE)
39 ENDIF(UNIX)
41 IF(WIN32)
42     LIST(APPEND OSG_COMPONENTS OSGWindowWIN32)
43 ENDIF(WIN32)
45 SET(DEP_INCLUDE_DIRS)
46 SET(DEP_LIBRARY_DIRS)
47 SET(DEP_LIBRARIES)
49 SET(OSG_EXTERNAL_COMPONENTS Boost GLUT)
51 #############
52 #### X11 (optional)
54 IF(X11_FOUND AND NOT APPLE)
55     LIST(APPEND OSG_EXTERNAL_COMPONENTS X11)
56     LIST(APPEND OSG_COMPONENTS OSGWindowX)
57 ELSE(X11_FOUND AND NOT APPLE)
58     LIST(REMOVE_ITEM SRCFILES "${PROJECT_SOURCE_DIR}/clusterserverx.cpp")
59 ENDIF(X11_FOUND AND NOT APPLE)
61 #############
62 #### OpenSG
64 FOREACH(OSGDEP ${OSG_COMPONENTS})
65     IF(NOT EXISTS "${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
66         MESSAGE(STATUS "Dependency (${OSGDEP}) not found, "
67                        "can not build ${PROJECT_NAME}\n")
68         RETURN()
69     ENDIF(NOT EXISTS "${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
71     INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
72     INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
73 ENDFOREACH()
75 FOREACH(OSGEXTDEP ${OSG_EXTERNAL_COMPONENTS})
76     IF(NOT ${OSGEXTDEP}_FOUND)
77         MESSAGE(FATAL_ERROR "Dependency (${OSGEXTDEP}) not found, "
78                             "can not build ${PROJECT_NAME}\n")
79         RETURN()
80     ENDIF()
82     INCLUDE_DIRECTORIES(SYSTEM ${${OSGEXTDEP}_INCLUDE_DIR})
83 ENDFOREACH()
86 #############################################################################
87 # build executables
89 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
91 FOREACH(GLOBAL_INC ${OSG_GLOBAL_DEP_INCDIR})
92   INCLUDE_DIRECTORIES(${${GLOBAL_INC}})
93 ENDFOREACH()
95 FOREACH(SRC ${SRCFILES})
97     GET_FILENAME_COMPONENT(EXE ${SRC} NAME_WE)
99     ADD_EXECUTABLE(${EXE} ${OSGEXCLUDE_EXAMPLES_SIMPLE} 
100                           ${SRC} ${OSG_ADD_GLOBAL_EXE_SRC})
102     ADD_DEPENDENCIES(OSGAllTutorialExamples ${EXE})
104     FOREACH(OSGDEP ${OSG_COMPONENTS})
105         ADD_DEPENDENCIES(${EXE} ${OSGDEP})
107         TARGET_LINK_LIBRARIES(${EXE} ${OSGDEP})
108     ENDFOREACH()
110     IF(LINUX AND CMAKE_BUILD_TYPE STREQUAL "DebugGV" AND OSG_ADD_CXX_FLAGS_GV)
111         SET_PROPERTY(TARGET ${EXE}
112                      APPEND PROPERTY COMPILE_FLAGS ${OSG_ADD_CXX_FLAGS_GV})
113     ENDIF()
114     
115     IF(WIN32)
116       SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER "Examples/Tutorial")
117     ENDIF()
118     
119     #Install
120     IF(OSG_INSTALL_EXAMPLES_EXE)
121       IF(WIN32)
122         INSTALL(TARGETS ${EXE}
123                 CONFIGURATIONS Release
124                 RUNTIME DESTINATION share/OpenSG/Examples/Tutorial/bin/rel)
125         INSTALL(TARGETS ${EXE}
126                 CONFIGURATIONS Debug
127                 RUNTIME DESTINATION share/OpenSG/Examples/Tutorial/bin/debug)
128         INSTALL(TARGETS ${EXE}
129                 CONFIGURATIONS ReleaseNoOpt
130                 RUNTIME DESTINATION share/OpenSG/Examples/Tutorial/bin/relnoopt)
131         INSTALL(TARGETS ${EXE}
132                 CONFIGURATIONS DebugOpt
133                 RUNTIME DESTINATION share/OpenSG/Examples/Tutorial/bin/debugopt)
134       ELSE()
135         INSTALL(TARGETS ${EXE}
136                 CONFIGURATIONS Release
137                 DESTINATION share/OpenSG/Examples/Tutorial/bin
138                 COMPONENT examples_basic)
140         INSTALL(TARGETS ${EXE}
141                 CONFIGURATIONS Debug
142                 DESTINATION share/OpenSG/Examples/Tutorial/bin/debug
143                 COMPONENT examples_basic)
145         INSTALL(TARGETS ${EXE}
146                 CONFIGURATIONS DebugGV
147                 DESTINATION share/OpenSG/Examples/Tutorial/bin/debug
148                 COMPONENT examples_basic)
149       ENDIF()
150     ENDIF()
151     IF(OSG_INSTALL_EXAMPLES)
152         INSTALL(FILES "${SRC}"
153                 DESTINATION share/OpenSG/Examples/Tutorial
154                 COMPONENT examples_basic)
155     ENDIF()
156 ENDFOREACH(SRC)
157     
159 IF(OSG_INSTALL_EXAMPLES)
160     INSTALL(FILES CMakeLists.standalone.txt
161             DESTINATION share/OpenSG/Examples/Tutorial
162             RENAME CMakeLists.txt
163             COMPONENT examples_basic)
165     INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Examples/Tutorial/Data"
166             DESTINATION share/OpenSG/Examples/Tutorial
167             COMPONENT examples_basic)
168 ENDIF()