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