source: osgVisual/CMakeLists.txt @ 42

Last change on this file since 42 was 28, checked in by Torben Dannhauer, 15 years ago
File size: 10.5 KB
RevLine 
[28]1cmake_minimum_required(VERSION 2.8)
2
3PROJECT(osgVisual)
4#SET(CMAKE_MODULE_PATH "${osgVisual_SOURCE_DIR}/../CMakeModules;${CMAKE_MODULE_PATH}")
5
6# Get OSG Settings
7# SET(OpenSceneGraph_MARK_AS_ADVANCED ON)
8FIND_PACKAGE(OpenSceneGraph 2.9.7 REQUIRED osgViewer OpenThreads osgDB osgTerrain osgGA osgText osgSim osgUtil)
9FIND_PACKAGE(OpenGL REQUIRED)
10
11# Module sky-silverlining - At the moment only for Win32, will be opened to Unix asap
12# OPTION( OPTION_VAR "description string" [initial value] )
13IF ( WIN32 )
14       
15        SET(USE_SKY_SILVERLINING ON CACHE BOOL "Enable to use Sundog-soft's Silverlining SDK for sky & weather")
16        IF(USE_SKY_SILVERLINING )
17                SET(SOURCES
18                        ${SOURCES}
19                        include/sky_Silverlining/skySilverLining_AtmosphereReference.h
20                        include/sky_Silverlining/skySilverlining_cloudLayerSlot.h
21                        include/sky_Silverlining/skySilverLining_cloudsDrawable.h
22                        include/sky_Silverlining/skySilverLining_ProjectionMatrixCallback.h
23                        include/sky_Silverlining/skySilverLining_skyDrawable.h
24                        include/sky_Silverlining/visual_skySilverLining.h
25                        src/sky_Silverlining/skySilverLining_cloudsDrawable.cpp
26                        src/sky_Silverlining/skySilverLining_skyDrawable.cpp
27                        src/sky_Silverlining/visual_skySilverLining.cpp                 
28                )
29               
30                SET(SILVERLINING_LIBRARY_RELEASE $ENV{SILVERLINING_PATH}\\lib\\vc8\\win32\\SilverLining-MT-DLL.lib CACHE FILEPATH "Select the release library of Sundog-Soft's Silverlining SDK to link against." )
31                SET(SILVERLINING_LIBRARY_DEBUG $ENV{SILVERLINING_PATH}\\lib\\vc8\\win32\\SilverLining-MTD-DLL.lib CACHE FILEPATH "Select the debug library of Sundog-Soft's Silverlining SDK to link against." )
32                SET(SILVERLINING_INCLUDE_DIR "$ENV{SILVERLINING_PATH}\\Public Headers" CACHE PATH "Enter the path to the the public Include directory of Sundog-Soft's Silverlining SDK" )
33                SET(SILVERLINING_LICENSEE "Your user name" CACHE STRING "Enter your Silverlining licensee name. If you license available, osgVisual will work with silverlining as 5 minute demo with the default value." )
34                SET(SILVERLINING_LICENSE "Your license code" CACHE STRING "Enter your Silverlining license key. If you license available, osgVisual will work with silverlining as 5 minute demo with the default value." )
35                INCLUDE_DIRECTORIES(${SILVERLINING_INCLUDE_DIR} include/sky_Silverlining)
36                ADD_DEFINITIONS( "-DUSE_SKY_SILVERLINING" )
37                ADD_DEFINITIONS( "-DSILVERLINING_LICENSEE=\"${SILVERLINING_LICENSEE}\"" )
38                ADD_DEFINITIONS( "-DSILVERLINING_LICENSE=\"${SILVERLINING_LICENSE}\"" )
39               
40        ELSE(USE_SKY_SILVERLINING)
41                UNSET(SILVERLINING_LIBRARY_RELEASE CACHE)
42                UNSET(SILVERLINING_LIBRARY_DEBUG CACHE)
43                UNSET(SILVERLINING_INCLUDE_DIR CACHE)
44                UNSET(SILVERLINING_LICENSEE)
45                UNSET(SILVERLINING_LICENSE)
46        ENDIF(USE_SKY_SILVERLINING)
47ENDIF(WIN32)
48
49
50# Module distortion
51SET(USE_DISTORTION OFF CACHE BOOL "Enable to use distortion with Projection Designer's distortion maps")
52IF(USE_DISTORTION)
53        SET(SOURCES
54                ${SOURCES}
55                include/distortion/visual_distortion.h
56                src/distortion/visual_distortion.cpp
57        )
58        INCLUDE_DIRECTORIES(include/distortion)
59        ADD_DEFINITIONS( "-DUSE_DISTORTION" )
60ENDIF(USE_DISTORTION)
61
62
63# Module Vista2D - Only available under Win32
64if( WIN32 )
65        SET(USE_VISTA2D OFF CACHE BOOL "Enable to use Vista2D by Wetzel Technology")
66        IF( USE_VISTA2D )
67                INCLUDE_DIRECTORIES( include/vista2D )
68                SET(SOURCES
69                        ${SOURCES}
70                        include/vista2D/visual_vista2D.h
71                        src/vista2D/visual_vista2D.cpp 
72                )
73                SET(VISTA2D_INCLUDE_DIR . CACHE PATH "Select the INCLUDE directory path for Vista2D by Wetzel Technology." )
74                SET(VISTA2D_LIBRARY_DEBUG . CACHE FILEPATH "Select debug LIBRARY path for linking against Vista2D by Wetzel Technology." )
75                SET(VISTA2D_LIBRARY_RELEASE . CACHE FILEPATH "Select release LIBRARY path for linking against Vista2D by Wetzel Technology." )
76                INCLUDE_DIRECTORIES(${VISTA2D_INCLUDE_DIR})
77                ADD_DEFINITIONS( "-DUSE_VISTA2D" )
78        ELSE(USE_VISTA2D)
79                UNSET(VISTA2D_INCLUDE_DIR CACHE)
80                UNSET(VISTA2D_LIBRARY_DEBUG CACHE)
81                UNSET(VISTA2D_LIBRARY_RELEASE CACHE)
82        ENDIF(USE_VISTA2D)
83ENDIF(WIN32)
84
85
86# Module Spacenavigator manipulator - ONLY under WIN32
87if( WIN32 )
88        # No header or linking required, because WIN32 COM interface used.
89        SET(USE_SPACEMOUSE ON CACHE BOOL "Enable to use camera manipulator based on Spacenavigator by 3DConnexion")
90        IF( USE_SPACEMOUSE )
91                SET(SOURCES
92                        ${SOURCES}
93                        include/manip_Spacemouse/manip_spaceMouse.h
94                        include/manip_Spacemouse/manip_freeSpaceMouse.h
95                        include/manip_Spacemouse/manip_nodeTrackerSpaceMouse.h
96                        src/manip_Spacemouse/manip_spaceMouse.cpp
97                        src/manip_Spacemouse/manip_freeSpaceMouse.cpp
98                        src/manip_Spacemouse/manip_nodeTrackerSpaceMouse.cpp
99                )
100                INCLUDE_DIRECTORIES(include/manip_Spacemouse)
101                ADD_DEFINITIONS( "-DUSE_SPACENAVIGATOR" )
102        ENDIF(USE_SPACEMOUSE)
103ENDIF(WIN32)
104
105
106# Module cluster
107SET(USE_CLUSTER_UDP ON CACHE BOOL "Enable to use the UDP Implementation for the cluster interface")
108IF( USE_CLUSTER_UDP )
109                SET(SOURCES
110                        ${SOURCES}
111                        include/cluster/dataIO_cluster.h
112                        include/cluster/dataIO_clusterUDP.h
113                        include/cluster/dataIO_clusterUDP_Transmission.h
114                        src/cluster/dataIO_clusterUDP.cpp
115                        src/cluster/dataIO_clusterUDP_Transmission.cpp
116                )
117                ADD_DEFINITIONS( "-DUSE_CLUSTER_UDP" )
118ELSE(USE_CLUSTER_UDP)
119                SET(SOURCES
120                        ${SOURCES}
121                        include/cluster/dataIO_cluster.h
122                        include/cluster/dataIO_clusterDummy.h
123                        src/cluster/dataIO_clusterDummy.cpp
124                )
125                ADD_DEFINITIONS( "-DUSE_CLUSTER_DUMMY" )
126ENDIF(USE_CLUSTER_UDP)
127
128
129# Module extLink
130SET(SOURCES
131        ${SOURCES}
132        include/extLink/dataIO_extLink.h
133        include/extLink/manip_extLink.h
134        src/extLink/manip_extLink.cpp
135)
136IF ( WIN32 )
137        SET(USE_EXTLINK_VCL ON CACHE BOOL "Enable to use the VCL Implementation for the externalLink interface")
138        IF( USE_EXTLINK_VCL )
139                SET(EXTLINK_VCL_INCLUDE_DIR ../VCL_1.0.3.4/source/include/VCL CACHE PATH "Select the INCLUDE directory path for extLink VCL Implementation." )
140                SET(SOURCES
141                        ${SOURCES}
142                        include/extLink/dataIO_extLinkVCL.h
143                        src/extLink/dataIO_extLinkVCL.cpp
144                )
145                INCLUDE_DIRECTORIES(${EXTLINK_VCL_INCLUDE_DIR})
146                ADD_DEFINITIONS( "-DUSE_EXTLINK_VCL" )
147        ELSE(USE_EXTLINK_VCL)
148                SET(SOURCES
149                        ${SOURCES}
150                        include/extLink/dataIO_extLinkDummy.h
151                        src/extLink/dataIO_extLinkDummy.cpp
152                )
153                UNSET(EXTLINK_VCL_INCLUDE_DIR CACHE)
154                ADD_DEFINITIONS( "-DUSE_EXTLINK_DUMMY" )
155        ENDIF(USE_EXTLINK_VCL)
156ELSE(WIN32)
157        UNSET(EXTLINK_VCL_INCLUDE_DIR CACHE)
158        SET(SOURCES
159                ${SOURCES}
160                include/extLink/dataIO_extLinkDummy.h
161                src/extLink/dataIO_extLinkDummy.cpp
162        )
163        ADD_DEFINITIONS( "-DUSE_EXTLINK_DUMMY" )
164ENDIF(WIN32)
165
166
167
168# Set core sources
169SET(SOURCES
170        ${SOURCES}
171        # Core
172        include/core/visual_core.h
173        src/core/visual_core.cpp
174        src/core/osgVisual.cpp
175        # Util
176        include/util/visual_util.h
177        src/util/visual_util.cpp
178        # Draw 2D
179        include/draw2D/visual_draw2D.h
180        src/draw2D/visual_draw2D.cpp
181        # Debug HUD
182        include/draw2D/visual_debug_hud.h
183        src/draw2D/visual_debug_hud.cpp
184        # Example HUD
185        include/draw2D/visual_hud.h
186        src/draw2D/visual_hud.cpp
187        # Draw 3D
188        include/draw3D/visual_draw3D.h
189        src/draw3D/visual_draw3D.cpp
190        # Object Mounted Manipulator
191        include/manip_ObjectMounted/manip_objectMounted.h
192        src/manip_ObjectMounted/manip_objectMounted.cpp
193        # Objects
194        include/object/visual_object.h
195        include/object/object_updater.h
196        src/object/visual_object.cpp
197        src/object/object_updater.cpp
198        # DataIO
199        include/dataIO/visual_dataIO.h
200        include/dataIO/dataIO_transportContainer.h
201        include/dataIO/dataIO_slot.h
202        include/dataIO/dataIO_executer.h
203        src/dataIO/visual_dataIO.cpp
204        src/dataIO/dataIO_transportContainer.cpp
205        src/dataIO/dataIO_slot.cpp
206        src/dataIO/dataIO_executer.cpp
207)
208
209INCLUDE_DIRECTORIES(include/core include/util include/draw2D include/draw3D include/object include/manip_ObjectMounted include/manip_Spacemouse)
210INCLUDE_DIRECTORIES(include/dataIO include/cluster include/extLink ${OPENSCENEGRAPH_INCLUDE_DIRS} .)
211
212
213# Executable Output
214SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
215ADD_EXECUTABLE(osgVisual ${SOURCES})
216
217
218# Linking
219TARGET_LINK_LIBRARIES(osgVisual ${OPENSCENEGRAPH_LIBRARIES} "OpenGL32.lib")
220IF(USE_SKY_SILVERLINING )
221        TARGET_LINK_LIBRARIES(osgVisual "winmm.lib" debug ${SILVERLINING_LIBRARY_DEBUG} optimized ${SILVERLINING_LIBRARY_RELEASE})
222ENDIF(USE_SKY_SILVERLINING)
223               
224IF(USE_VISTA2D)
225        TARGET_LINK_LIBRARIES(osgVisual  debug ${VISTA2D_LIBRARY_DEBUG} optimized ${VISTA2D_LIBRARY_RELEASE})
226ENDIF(USE_VISTA2D)
227
228
229
230# CMAKE Fix for VS to not prepend build type to path.
231SET_TARGET_PROPERTIES(osgVisual PROPERTIES PREFIX "../")
232SET_TARGET_PROPERTIES( osgVisual PROPERTIES DEBUG_POSTFIX d )
233
234
235# Generating vcproj file, if MSVC to preset debugging parameter  - based on http://stackoverflow.com/questions/1005901/how-to-set-path-environment-variable-using-cmake-and-visual-studio-to-run-test
236IF (MSVC)
237    # Set up a default .user file that contains the debugging setup
238    ## Find user and system name
239        SET(SYSTEM_NAME $ENV{USERDOMAIN} CACHE STRING "Build System Name")
240        SET(USER_NAME $ENV{USERNAME} CACHE STRING "Build System UserName")
241        SET(USERFILE_COMMAND_DEBUG "$(TargetPath)" CACHE STRING "Command to execute on debugging (VS Project settings)" )
242        SET(USERFILE_WORKING_DIRECTORY_DEBUG "bin" CACHE STRING "Working directory on debugging (VS Project settings)" )
243        SET(USERFILE_COMMAND_ARGUMENTS_DEBUG "-C center --window 100 100 800 600 -m D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive -p salzburg.path" CACHE STRING "Command arguments (VS Project settings)" )
244        SET(USERFILE_REMOTE_MACHINE_DEBUG ${USER_NAME} CACHE STRING "Remote Debugging Machine (VS Project settings)")
245
246    # Only do this if one doesn't already exist
247    SET (USER_FILE ${PROJECT_NAME}.vcproj.${SYSTEM_NAME}.${USER_NAME}.user)
248    IF (NOT EXISTS "${USER_FILE}")
249        message (STATUS "Creating ${USER_FILE} with default debug settings")
250        # These are the configuration variables
251        IF (CMAKE_GENERATOR MATCHES "Win64")
252            SET (USERFILE_PLATFORM "x64")
253        ELSE ()
254            SET (USERFILE_PLATFORM "Win32")
255        ENDIF ()
256
257                # Configure the template file
258                # MSC_VER 1300: MSC 13.0, VC 7.0, VS 2002
259                # MSC_VER 1310: MSC 13.1, VC 7.1, VS 2003
260                # MSC_VER 1400: MSC 14.0, VC 8.0, VS 2005
261                # MSC_VER 1500: MSC 15.0, VC 9.0, VS 2008
262                # MSC_VER 1600: MSC ??.0, VC 10.0, VS 2010
263                IF (MSVC_VERSION EQUAL 1400)
264                        CONFIGURE_FILE(VC80.vcproj.user.template ${USER_FILE} @ONLY)
265                ENDIF()
266                IF (MSVC_VERSION EQUAL 1500)
267                        CONFIGURE_FILE(VC90.vcproj.user.template ${USER_FILE} @ONLY)
268                ENDIF()         
269        ELSE()
270                message (STATUS "Userfile ${USER_FILE} already exist: Skipping")
271    ENDIF()
272ENDIF()
273
274
Note: See TracBrowser for help on using the repository browser.