############################################################################## # Check if CAVESceneManager is built within inVRs or by itself # If it is built within inVRs the libraries and headers are installed in # different locations than when built independently. ############################################################################## if (NOT INVRS_SOURCE_DIR) ####################################################################### # Set minimum cmake version ####################################################################### cmake_minimum_required (VERSION 2.6) ###################################################################### # The name of our project is "CAVESCENEMANAGER". CMakeLists files in # this project refer to the root source directory of the project as # ${CAVESCENEMANAGER_SOURCE_DIR} and to the root binary directory of # the project as ${CAVESCENEMANAGER_BINARY_DIR}. ###################################################################### project (CAVESCENEMANAGER) ####################################################################### # Define target paths for installation ####################################################################### set (TARGET_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include) set (TARGET_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib) set (TARGET_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin) ####################################################################### # Include user-defined configuration ####################################################################### include (${CMAKE_CURRENT_SOURCE_DIR}/user.cmake OPTIONAL) else (NOT INVRS_SOURCE_DIR) ####################################################################### # If CAVESceneManager is built within inVRs then install the libraries # and header files in the inVRs target directories ####################################################################### set (TARGET_INCLUDE_DIR ${INVRS_TARGET_INCLUDE_DIR}) set (TARGET_LIB_DIR ${INVRS_TARGET_LIB_DIR}) set (TARGET_BIN_DIR ${INVRS_TARGET_BIN_DIR}) endif (NOT INVRS_SOURCE_DIR) ############################################################################### # Include config.cmake ############################################################################### include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake) ############################################################################### # Add include directory for CAVESceneManager ############################################################################### include_directories (include) ############################################################################## # Store all source-files in the CAVESCENEMANAGER_SRCS variable ############################################################################## aux_source_directory(src CAVESCENEMANAGER_SRCS) ############################################################################## # Define the sources of the render-servers ############################################################################## set (RENDERSERVER-MONO renderserver-src/server-mono.cpp) set (RENDERSERVER-STEREO renderserver-src/server-stereo.cpp) ############################################################################## # Set definition for exporting DLL information ############################################################################## add_definitions (-DCAVESCENEMANAGER_COMPILELIB) find_package(OpenSG REQUIRED COMPONENTS OSGDrawable OSGWindowGLUT OSGCluster OSGUtil) include_directories(${OpenSG_INCLUDE_DIRS}) add_definitions(${OpenSG_DEFINITIONS}) find_package(GLUT REQUIRED) include_directories(${GLUT_INCLUDE_DIRS}) add_definitions(${GLUT_DEFINITIONS}) find_package(OpenGL REQUIRED) include_directories(${OPENGL_INCLUDE_DIRS}) add_definitions(${OPENGL_DEFINITIONS}) ############################################################################## # Build library for CAVESceneManager ############################################################################## add_library(CAVESceneManager SHARED ${CAVESCENEMANAGER_SRCS}) target_link_libraries(CAVESceneManager ${OpenSG_LIBRARIES}) target_link_libraries(CAVESceneManager ${GLUT_LIBRARIES}) ############################################################################### # Define target folder if built separately ############################################################################### if (NOT INVRS_SOURCE_DIR) set_target_properties (CAVESceneManager PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) endif (NOT INVRS_SOURCE_DIR) ############################################################################## # Build executables for server-mono and server-stereo ############################################################################## add_executable (server-mono ${RENDERSERVER-MONO}) add_executable (server-stereo ${RENDERSERVER-STEREO}) add_dependencies (server-mono CAVESceneManager) add_dependencies (server-stereo CAVESceneManager) target_link_libraries (server-mono CAVESceneManager ${OpenSG_LIBRARIES} ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) target_link_libraries (server-stereo CAVESceneManager ${OpenSG_LIBRARIES} ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) ############################################################################### # Define target folder if built separately ############################################################################### if (NOT INVRS_SOURCE_DIR) set_target_properties (server-mono PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) set_target_properties (server-stereo PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) endif (NOT INVRS_SOURCE_DIR) ############################################################################## # Install headers, libraries, and binaries in the target directories ############################################################################## install (DIRECTORY include/OpenSG DESTINATION ${TARGET_INCLUDE_DIR} PATTERN ".svn" EXCLUDE) install (TARGETS CAVESceneManager DESTINATION ${TARGET_LIB_DIR}) install (TARGETS server-mono server-stereo DESTINATION ${TARGET_BIN_DIR}) if (NOT INVRS_SOURCE_DIR) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake") endif (NOT INVRS_SOURCE_DIR)