fixed: auto_ptr -> unique_ptr
[opensg.git] / Examples / Simple / CMakeLists.standalone.txt
blobd3d035fa9809221cc401e134ef9e73f45c91a618
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
4 PROJECT(OpenSGSimpleExamples)
6 MESSAGE(STATUS "Building simple examples standalone")
8 IF(EXISTS "${${PROJECT_NAME}_SOURCE_DIR}/../../CMake")
9   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${${PROJECT_NAME}_SOURCE_DIR}/../../CMake")
10 ENDIF()
12 IF(EXISTS "${${PROJECT_NAME}_SOURCE_DIR}/../../cmake")
13   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${${PROJECT_NAME}_SOURCE_DIR}/../../cmake")
14 ENDIF()
16 # show build command lines
17 SET(CMAKE_VERBOSE_MAKEFILE ON)
19 OPTION(OSG_USE_OSGSUPPORT_LIBS "" OFF)
21 IF(NOT OSG_SUPPORT_ROOT)
22   SET(OSG_SUPPORT_ROOT "" CACHE PATH "")
23 ENDIF()
25 IF(NOT OpenSG_DIR)
26   SET(OpenSG_DIR "" CACHE PATH "")
27 ENDIF()
29 #############################################################################
30 # find sources
32 FILE(GLOB SRCFILES "*.cpp")
34 # stuff that is broken -- these examples need to be fixed
35 LIST(REMOVE_ITEM SRCFILES "${PROJECT_SOURCE_DIR}/clusterclientshader.cpp")
36 LIST(REMOVE_ITEM SRCFILES "${PROJECT_SOURCE_DIR}/geometryshader.cpp")
38 #############################################################################
39 # get dependencies
41 SET(OSG_COMPONENTS OSGBase 
42                    OSGCluster 
43                    OSGDrawable 
44                    OSGFileIO 
45                    OSGGroup 
46                    OSGEffectGroups
47                    OSGImageFileIO
48                    OSGState 
49                    OSGSystem 
50                    OSGUtil 
51                    OSGWindow 
52                    OSGWindowGLUT)
54 IF(UNIX)
55     IF(APPLE)
56         LIST(APPEND OSG_COMPONENTS OSGWindowCarbon)
57     ELSE(APPLE)
58         LIST(APPEND OSG_COMPONENTS OSGWindowX)
59     ENDIF(APPLE)
60 ENDIF(UNIX)
62 IF(WIN32)
63     LIST(APPEND OSG_COMPONENTS OSGWindowWIN32)
64 ENDIF(WIN32)
66 SET(DEP_INCLUDE_DIRS)
67 SET(DEP_LIBRARY_DIRS)
68 SET(DEP_LIBRARIES)
70 #############
71 #### GLUT
73 FIND_PACKAGE(GLUT REQUIRED)
74 LIST(APPEND DEP_INCLUDE_DIRS ${GLUT_INCLUDE_DIR})
75 LIST(APPEND DEP_LIBRARIES ${GLUT_LIBRARIES})
77 #############
78 #### OpenGL
80 FIND_PACKAGE(OpenGL REQUIRED)
81 LIST(APPEND DEP_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
82 LIST(APPEND DEP_LIBRARIES ${OPENGL_LIBRARIES})
84 #############
85 #### X11 (optional)
87 FIND_PACKAGE(X11)
89 IF(X11_FOUND)
90     LIST(APPEND DEP_INCLUDE_DIRS ${X11_X11_INCLUDE_PATH})
91     LIST(APPEND DEP_LIBRARIES ${X11_X11_LIB})
92 ELSE(X11_FOUND)
93     LIST(REMOVE_ITEM SRCFILES "${PROJECT_SOURCE_DIR}/clusterserverx.cpp")
94 ENDIF(X11_FOUND)
96 #############
97 #### Collada (optional, depending on how OpenSG was built)
99 FIND_PACKAGE(Collada)
101 IF(COLLADA_FOUND)
102     LIST(APPEND DEP_INCLUDE_DIRS ${COLLADA_INCLUDE_DIRS})
103     LIST(APPEND DEP_LIBRARY_DIRS ${COLLADA_LIBRARY_DIRS})
104 ENDIF(COLLADA_FOUND)
106 #############
107 #### Boost
109 SET(Boost_USE_MULTITHREAD ON)
110 SET(Boost_STATIC_LIBS OFF)
112 SET(Boost_COMPONENTS system ${Boost_COMPONENTS})
114 IF(COLLADA_FOUND)
115     LIST(APPEND Boost_COMPONENTS filesystem)
116 ENDIF(COLLADA_FOUND)
118 FIND_PACKAGE(Boost COMPONENTS ${Boost_COMPONENTS} REQUIRED)
120 IF(Boost_FOUND)
121     LIST(APPEND DEP_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
122     LIST(APPEND DEP_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
123     LIST(APPEND DEP_LIBRARIES ${Boost_LIBRARIES})
124 ENDIF(Boost_FOUND)
126 ##################
127 #### AntTweakBar
129 FIND_PACKAGE(AntTweakBar)
130 IF(ANTTWEAKBAR_FOUND)
131     LIST(APPEND DEP_INCLUDE_DIRS ${ANTTWEAKBAR_INCLUDE_DIRS})
132     LIST(APPEND DEP_LIBRARY_DIRS ${ANTTWEAKBAR_LIBRARY_DIRS})
133     LIST(APPEND DEP_LIBRARIES    ${ANTTWEAKBAR_LIBRARIES})
134 ENDIF(ANTTWEAKBAR_FOUND)
136 #############
137 #### OpenSG
139 FIND_PACKAGE(OpenSG REQUIRED COMPONENTS ${OSG_COMPONENTS})
142 #############################################################################
143 # build executables
145 FOREACH(SRC ${SRCFILES})
147     GET_FILENAME_COMPONENT(EXE ${SRC} NAME_WE)
149     INCLUDE_DIRECTORIES(${OpenSG_INCLUDE_DIRS})
150     INCLUDE_DIRECTORIES(${DEP_INCLUDE_DIRS})
152     LINK_DIRECTORIES(${OpenSG_LIBRARY_DIRS})
153     LINK_DIRECTORIES(${DEP_LIBRARY_DIRS})
155     ADD_EXECUTABLE(${EXE} ${SRC} ${OSG_ADD_GLOBAL_EXE_SRC})
157     TARGET_LINK_LIBRARIES(${EXE} ${OpenSG_LIBRARIES})
158     TARGET_LINK_LIBRARIES(${EXE} ${DEP_LIBRARIES})
159 ENDFOREACH(SRC)