cmake_minimum_required(VERSION 2.8) PROJECT(osgVisual) #SET(CMAKE_MODULE_PATH "${osgVisual_SOURCE_DIR}/../CMakeModules;${CMAKE_MODULE_PATH}") # Get OSG Settings # SET(OpenSceneGraph_MARK_AS_ADVANCED ON) FIND_PACKAGE(OpenSceneGraph 2.9.7 REQUIRED osgViewer OpenThreads osgDB osgTerrain osgGA osgText osgSim osgUtil) FIND_PACKAGE(OpenGL REQUIRED) # Module sky-silverlining - At the moment only for Win32, will be opened to Unix asap # OPTION( OPTION_VAR "description string" [initial value] ) IF ( WIN32 ) SET(USE_SKY_SILVERLINING ON CACHE BOOL "Enable to use Sundog-soft's Silverlining SDK for sky & weather") IF(USE_SKY_SILVERLINING ) SET(SOURCES ${SOURCES} include/sky_Silverlining/skySilverLining_AtmosphereReference.h include/sky_Silverlining/skySilverlining_cloudLayerSlot.h include/sky_Silverlining/skySilverLining_cloudsDrawable.h include/sky_Silverlining/skySilverLining_ProjectionMatrixCallback.h include/sky_Silverlining/skySilverLining_skyDrawable.h include/sky_Silverlining/visual_skySilverLining.h src/sky_Silverlining/skySilverLining_cloudsDrawable.cpp src/sky_Silverlining/skySilverLining_skyDrawable.cpp src/sky_Silverlining/visual_skySilverLining.cpp ) 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." ) 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." ) 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" ) 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." ) 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." ) INCLUDE_DIRECTORIES(${SILVERLINING_INCLUDE_DIR} include/sky_Silverlining) ADD_DEFINITIONS( "-DUSE_SKY_SILVERLINING" ) ADD_DEFINITIONS( "-DSILVERLINING_LICENSEE=\"${SILVERLINING_LICENSEE}\"" ) ADD_DEFINITIONS( "-DSILVERLINING_LICENSE=\"${SILVERLINING_LICENSE}\"" ) ELSE(USE_SKY_SILVERLINING) UNSET(SILVERLINING_LIBRARY_RELEASE CACHE) UNSET(SILVERLINING_LIBRARY_DEBUG CACHE) UNSET(SILVERLINING_INCLUDE_DIR CACHE) UNSET(SILVERLINING_LICENSEE) UNSET(SILVERLINING_LICENSE) ENDIF(USE_SKY_SILVERLINING) ENDIF(WIN32) # Module distortion SET(USE_DISTORTION OFF CACHE BOOL "Enable to use distortion with Projection Designer's distortion maps") IF(USE_DISTORTION) SET(SOURCES ${SOURCES} include/distortion/visual_distortion.h src/distortion/visual_distortion.cpp ) INCLUDE_DIRECTORIES(include/distortion) ADD_DEFINITIONS( "-DUSE_DISTORTION" ) ENDIF(USE_DISTORTION) # Module Vista2D - Only available under Win32 if( WIN32 ) SET(USE_VISTA2D OFF CACHE BOOL "Enable to use Vista2D by Wetzel Technology") IF( USE_VISTA2D ) INCLUDE_DIRECTORIES( include/vista2D ) SET(SOURCES ${SOURCES} include/vista2D/visual_vista2D.h src/vista2D/visual_vista2D.cpp ) SET(VISTA2D_INCLUDE_DIR . CACHE PATH "Select the INCLUDE directory path for Vista2D by Wetzel Technology." ) SET(VISTA2D_LIBRARY_DEBUG . CACHE FILEPATH "Select debug LIBRARY path for linking against Vista2D by Wetzel Technology." ) SET(VISTA2D_LIBRARY_RELEASE . CACHE FILEPATH "Select release LIBRARY path for linking against Vista2D by Wetzel Technology." ) INCLUDE_DIRECTORIES(${VISTA2D_INCLUDE_DIR}) ADD_DEFINITIONS( "-DUSE_VISTA2D" ) ELSE(USE_VISTA2D) UNSET(VISTA2D_INCLUDE_DIR CACHE) UNSET(VISTA2D_LIBRARY_DEBUG CACHE) UNSET(VISTA2D_LIBRARY_RELEASE CACHE) ENDIF(USE_VISTA2D) ENDIF(WIN32) # Module Spacenavigator manipulator - ONLY under WIN32 if( WIN32 ) # No header or linking required, because WIN32 COM interface used. SET(USE_SPACEMOUSE ON CACHE BOOL "Enable to use camera manipulator based on Spacenavigator by 3DConnexion") IF( USE_SPACEMOUSE ) SET(SOURCES ${SOURCES} include/manip_Spacemouse/manip_spaceMouse.h include/manip_Spacemouse/manip_freeSpaceMouse.h include/manip_Spacemouse/manip_nodeTrackerSpaceMouse.h src/manip_Spacemouse/manip_spaceMouse.cpp src/manip_Spacemouse/manip_freeSpaceMouse.cpp src/manip_Spacemouse/manip_nodeTrackerSpaceMouse.cpp ) INCLUDE_DIRECTORIES(include/manip_Spacemouse) ADD_DEFINITIONS( "-DUSE_SPACENAVIGATOR" ) ENDIF(USE_SPACEMOUSE) ENDIF(WIN32) # Module cluster SET(USE_CLUSTER_UDP ON CACHE BOOL "Enable to use the UDP Implementation for the cluster interface") IF( USE_CLUSTER_UDP ) SET(SOURCES ${SOURCES} include/cluster/dataIO_cluster.h include/cluster/dataIO_clusterUDP.h include/cluster/dataIO_clusterUDP_Transmission.h src/cluster/dataIO_clusterUDP.cpp src/cluster/dataIO_clusterUDP_Transmission.cpp ) ADD_DEFINITIONS( "-DUSE_CLUSTER_UDP" ) ELSE(USE_CLUSTER_UDP) SET(SOURCES ${SOURCES} include/cluster/dataIO_cluster.h include/cluster/dataIO_clusterDummy.h src/cluster/dataIO_clusterDummy.cpp ) ADD_DEFINITIONS( "-DUSE_CLUSTER_DUMMY" ) ENDIF(USE_CLUSTER_UDP) # Module extLink SET(SOURCES ${SOURCES} include/extLink/dataIO_extLink.h include/extLink/manip_extLink.h src/extLink/manip_extLink.cpp ) IF ( WIN32 ) SET(USE_EXTLINK_VCL ON CACHE BOOL "Enable to use the VCL Implementation for the externalLink interface") IF( USE_EXTLINK_VCL ) SET(EXTLINK_VCL_INCLUDE_DIR ../VCL_1.0.3.4/source/include/VCL CACHE PATH "Select the INCLUDE directory path for extLink VCL Implementation." ) SET(SOURCES ${SOURCES} include/extLink/dataIO_extLinkVCL.h src/extLink/dataIO_extLinkVCL.cpp ) INCLUDE_DIRECTORIES(${EXTLINK_VCL_INCLUDE_DIR}) ADD_DEFINITIONS( "-DUSE_EXTLINK_VCL" ) ELSE(USE_EXTLINK_VCL) SET(SOURCES ${SOURCES} include/extLink/dataIO_extLinkDummy.h src/extLink/dataIO_extLinkDummy.cpp ) UNSET(EXTLINK_VCL_INCLUDE_DIR CACHE) ADD_DEFINITIONS( "-DUSE_EXTLINK_DUMMY" ) ENDIF(USE_EXTLINK_VCL) ELSE(WIN32) UNSET(EXTLINK_VCL_INCLUDE_DIR CACHE) SET(SOURCES ${SOURCES} include/extLink/dataIO_extLinkDummy.h src/extLink/dataIO_extLinkDummy.cpp ) ADD_DEFINITIONS( "-DUSE_EXTLINK_DUMMY" ) ENDIF(WIN32) # Set core sources SET(SOURCES ${SOURCES} # Core include/core/visual_core.h src/core/visual_core.cpp src/core/osgVisual.cpp # Util include/util/visual_util.h src/util/visual_util.cpp # Draw 2D include/draw2D/visual_draw2D.h src/draw2D/visual_draw2D.cpp # Debug HUD include/draw2D/visual_debug_hud.h src/draw2D/visual_debug_hud.cpp # Example HUD include/draw2D/visual_hud.h src/draw2D/visual_hud.cpp # Draw 3D include/draw3D/visual_draw3D.h src/draw3D/visual_draw3D.cpp # Object Mounted Manipulator include/manip_ObjectMounted/manip_objectMounted.h src/manip_ObjectMounted/manip_objectMounted.cpp # Objects include/object/visual_object.h include/object/object_updater.h src/object/visual_object.cpp src/object/object_updater.cpp # DataIO include/dataIO/visual_dataIO.h include/dataIO/dataIO_transportContainer.h include/dataIO/dataIO_slot.h include/dataIO/dataIO_executer.h src/dataIO/visual_dataIO.cpp src/dataIO/dataIO_transportContainer.cpp src/dataIO/dataIO_slot.cpp src/dataIO/dataIO_executer.cpp ) INCLUDE_DIRECTORIES(include/core include/util include/draw2D include/draw3D include/object include/manip_ObjectMounted include/manip_Spacemouse) INCLUDE_DIRECTORIES(include/dataIO include/cluster include/extLink ${OPENSCENEGRAPH_INCLUDE_DIRS} .) # Executable Output SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) ADD_EXECUTABLE(osgVisual ${SOURCES}) # Linking TARGET_LINK_LIBRARIES(osgVisual ${OPENSCENEGRAPH_LIBRARIES} "OpenGL32.lib") IF(USE_SKY_SILVERLINING ) TARGET_LINK_LIBRARIES(osgVisual "winmm.lib" debug ${SILVERLINING_LIBRARY_DEBUG} optimized ${SILVERLINING_LIBRARY_RELEASE}) ENDIF(USE_SKY_SILVERLINING) IF(USE_VISTA2D) TARGET_LINK_LIBRARIES(osgVisual debug ${VISTA2D_LIBRARY_DEBUG} optimized ${VISTA2D_LIBRARY_RELEASE}) ENDIF(USE_VISTA2D) # CMAKE Fix for VS to not prepend build type to path. SET_TARGET_PROPERTIES(osgVisual PROPERTIES PREFIX "../") SET_TARGET_PROPERTIES( osgVisual PROPERTIES DEBUG_POSTFIX d ) # 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 IF (MSVC) # Set up a default .user file that contains the debugging setup ## Find user and system name SET(SYSTEM_NAME $ENV{USERDOMAIN} CACHE STRING "Build System Name") SET(USER_NAME $ENV{USERNAME} CACHE STRING "Build System UserName") SET(USERFILE_COMMAND_DEBUG "$(TargetPath)" CACHE STRING "Command to execute on debugging (VS Project settings)" ) SET(USERFILE_WORKING_DIRECTORY_DEBUG "bin" CACHE STRING "Working directory on debugging (VS Project settings)" ) 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)" ) SET(USERFILE_REMOTE_MACHINE_DEBUG ${USER_NAME} CACHE STRING "Remote Debugging Machine (VS Project settings)") # Only do this if one doesn't already exist SET (USER_FILE ${PROJECT_NAME}.vcproj.${SYSTEM_NAME}.${USER_NAME}.user) IF (NOT EXISTS "${USER_FILE}") message (STATUS "Creating ${USER_FILE} with default debug settings") # These are the configuration variables IF (CMAKE_GENERATOR MATCHES "Win64") SET (USERFILE_PLATFORM "x64") ELSE () SET (USERFILE_PLATFORM "Win32") ENDIF () # Configure the template file # MSC_VER 1300: MSC 13.0, VC 7.0, VS 2002 # MSC_VER 1310: MSC 13.1, VC 7.1, VS 2003 # MSC_VER 1400: MSC 14.0, VC 8.0, VS 2005 # MSC_VER 1500: MSC 15.0, VC 9.0, VS 2008 # MSC_VER 1600: MSC ??.0, VC 10.0, VS 2010 IF (MSVC_VERSION EQUAL 1400) CONFIGURE_FILE(VC80.vcproj.user.template ${USER_FILE} @ONLY) ENDIF() IF (MSVC_VERSION EQUAL 1500) CONFIGURE_FILE(VC90.vcproj.user.template ${USER_FILE} @ONLY) ENDIF() ELSE() message (STATUS "Userfile ${USER_FILE} already exist: Skipping") ENDIF() ENDIF()