Skip to content

Commit

Permalink
Merge branch 'refs/heads/Rift'
Browse files Browse the repository at this point in the history
  • Loading branch information
jriegel committed Sep 19, 2014
2 parents fbeb7be + 3d00535 commit 6561b99
Show file tree
Hide file tree
Showing 12 changed files with 1,110 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Expand Up @@ -151,6 +151,7 @@ OPTION(BUILD_SPREADSHEET "Build the FreeCAD spreadsheet module" ON)
OPTION(BUILD_START "Build the FreeCAD start module" ON)
OPTION(BUILD_TEST "Build the FreeCAD test module" ON)
OPTION(BUILD_WEB "Build the FreeCAD web module" ON)
OPTION(BUILD_VR "Build the FreeCAD Oculus Rift support (need Oculus SDK 4.x or higher)" OFF)

if(MSVC)
OPTION(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
Expand Down Expand Up @@ -647,6 +648,10 @@ else(FREECAD_LIBPACK_USE)

endif(FREECAD_LIBPACK_USE)

if(BUILD_VR)
find_package(Rift)
endif(BUILD_VR)

# copy build convenient files for M$
if(WIN32)
if (EXISTS BuildAll.bat)
Expand Down Expand Up @@ -680,7 +685,7 @@ IF(MSVC)
SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /EHa")
SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFC_DEBUG")
# set default libs
SET (CMAKE_C_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib SHFolder.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ")
SET (CMAKE_C_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib SHFolder.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib winmm.lib comsupp.lib Ws2_32.lib dbghelp.lib ")
set (CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}")
# set linker flag /nodefaultlib
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB")
Expand Down
100 changes: 100 additions & 0 deletions cMake/FindRift.cmake
@@ -0,0 +1,100 @@
# Find OCULUS
#
# This module defines
# OCULUS_FOUND
# OCULUS_INCLUDE_DIRS
# OCULUS_LIBRARIES
#
# Copyright (c) 2012 I-maginer
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place - Suite 330, Boston, MA 02111-1307, USA, or go to
# http://www.gnu.org/copyleft/lesser.txt
#

# On a new cmake run, we do not need to be verbose
IF(OCULUS_INCLUDE_DIR AND OCULUS_LIBRARY)
SET(OCULUS_FIND_QUIETLY FALSE)
ENDIF()

# If OCULUS_ROOT was defined in the environment, use it.
if (NOT OCULUS_ROOT)
if(NOT "$ENV{OCULUS_ROOT}" STREQUAL "")
set(OCULUS_ROOT $ENV{OCULUS_ROOT})
else()
set(OCULUS_ROOT $ENV{SCOL_DEPENDENCIES_PATH}/oculus/LibOVR)
endif()
endif()

# concat all the search paths
IF(OCULUS_ROOT)
SET(OCULUS_INCLUDE_SEARCH_DIRS
${OCULUS_INCLUDE_SEARCH_DIRS}
${OCULUS_ROOT}/include
)
SET(OCULUS_LIBRARY_SEARCH_RELEASE_DIRS
${OCULUS_LIBRARY_SEARCH_DIRS}
${OCULUS_ROOT}/Lib/x64/VS2012
)
SET(OCULUS_LIBRARY_SEARCH_DEBUG_DIRS
${OCULUS_LIBRARY_SEARCH_DIRS}
${OCULUS_ROOT}/Lib/x64/VS2012
)
ENDIF()

# log message
IF (NOT OCULUS_FIND_QUIETLY)
MESSAGE(STATUS "Checking for OCULUS library")
ENDIF()

# Search for header files
FIND_PATH(OCULUS_INCLUDE_DIR OVR.h
PATHS ${OCULUS_INCLUDE_SEARCH_DIRS})

# Search for libraries files (release mode)
FIND_LIBRARY(OCULUS_LIBRARY_RELEASE libovr64
PATHS ${OCULUS_LIBRARY_SEARCH_RELEASE_DIRS})

# Search for libraries files (debug mode)
FIND_LIBRARY(OCULUS_LIBRARY_DEBUG libovr64d
PATHS ${OCULUS_LIBRARY_SEARCH_DEBUG_DIRS})

# Configure libraries for debug/release
SET(OCULUS_INCLUDE_DIRS ${OCULUS_INCLUDE_DIR} CACHE PATH "Directory containing OCULUS header files")
SET(OCULUS_LIBRARY debug ${OCULUS_LIBRARY_DEBUG} optimized ${OCULUS_LIBRARY_RELEASE})
SET(OCULUS_LIBRARIES ${OCULUS_LIBRARY} CACHE STRING "OCULUS libraries files")

#IF(OCULUS_INCLUDE_DIR AND OCULUS_LIBRARY)
SET(OCULUS_FOUND TRUE)
#ENDIF()

# Hide those variables in GUI
SET(OCULUS_INCLUDE_DIR ${OCULUS_INCLUDE_DIR} CACHE INTERNAL "")
SET(OCULUS_LIBRARY_RELEASE ${OCULUS_LIBRARY_RELEASE} CACHE INTERNAL "")
SET(OCULUS_LIBRARY_DEBUG ${OCULUS_LIBRARY_DEBUG} CACHE INTERNAL "")
SET(OCULUS_LIBRARY ${OCULUS_LIBRARY} CACHE INTERNAL "")

# log find result
IF(OCULUS_FOUND)
IF(NOT OCULUS_FIND_QUIETLY)
MESSAGE(STATUS " libraries: ${OCULUS_LIBRARIES}")
MESSAGE(STATUS " includes: ${OCULUS_INCLUDE_DIRS}")
ENDIF()
ELSE(OCULUS_FOUND)
IF(NOT OCULUS_LIBRARIES)
MESSAGE(STATUS, "OCULUS library or one of it dependencies could not be found.")
ENDIF()
IF(NOT OCULUS_INCLUDE_DIRS)
MESSAGE(STATUS "OCULUS include files could not be found.")
ENDIF()
ENDIF(OCULUS_FOUND)
24 changes: 22 additions & 2 deletions src/Gui/CMakeLists.txt
@@ -1,13 +1,17 @@
#add_subdirectory(Icons)

if(WIN32)
add_definitions(-DFCGui -DQIIS_MAKEDLL)
add_definitions(-DFCGui -DQIIS_MAKEDLL -DOVR_OS_WIN32)
endif(WIN32)

if (FREECAD_USE_3DCONNEXION)
add_definitions(-D_USE_3DCONNEXION_SDK)
add_definitions(-D_USE_3DCONNEXION_SDK)
endif(FREECAD_USE_3DCONNEXION)

if (BUILD_VR)
add_definitions(-DBUILD_VR )
endif(BUILD_VR)

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
Expand Down Expand Up @@ -61,6 +65,17 @@ IF(SPNAV_FOUND)
)
ENDIF(SPNAV_FOUND)

IF(OCULUS_FOUND)
add_definitions(-DOCULUS_FOUND)
include_directories(
${OCULUS_INCLUDE_DIRS}
)
set(FreeCADGui_LIBS
${FreeCADGui_LIBS}
${OCULUS_LIBRARIES}
)
ENDIF(OCULUS_FOUND)

if(SHIBOKEN_INCLUDE_DIR)
add_definitions(-DHAVE_SHIBOKEN)
include_directories(
Expand Down Expand Up @@ -645,6 +660,8 @@ SET(View3D_CPP_SRCS
View3DInventor.cpp
View3DInventorExamples.cpp
View3DInventorViewer.cpp
View3DInventorRiftViewer.cpp
CoinRiftWidget.cpp
View3DPy.cpp
)
SET(View3D_SRCS
Expand All @@ -659,6 +676,9 @@ SET(View3D_SRCS
View3DInventorExamples.h
View3DInventorViewer.h
View3DPy.h
View3DInventorRiftViewer.h
CoinRiftWidget.h

)
SOURCE_GROUP("View3D" FILES ${View3D_SRCS})

Expand Down

0 comments on commit 6561b99

Please sign in to comment.