mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
OVR support via BGFX_USE_OVR
This commit is contained in:
@@ -40,6 +40,11 @@ target_include_directories( bgfx PUBLIC ${BGFX_DIR}/include )
|
||||
# bgfx depends on bx
|
||||
target_link_libraries( bgfx PUBLIC bx )
|
||||
|
||||
# ovr support
|
||||
if( BGFX_USE_OVR )
|
||||
target_link_libraries( bgfx PUBLIC ovr )
|
||||
endif()
|
||||
|
||||
# Link against psapi in Visual Studio
|
||||
if( MSVC )
|
||||
target_link_libraries( bgfx PUBLIC psapi )
|
||||
@@ -61,7 +66,6 @@ endif()
|
||||
# Excluded files from compilation
|
||||
set_source_files_properties( ${BGFX_DIR}/src/amalgamated.cpp PROPERTIES HEADER_FILE_ONLY ON )
|
||||
set_source_files_properties( ${BGFX_DIR}/src/amalgamated.mm PROPERTIES HEADER_FILE_ONLY ON )
|
||||
set_source_files_properties( ${BGFX_DIR}/src/hmd_ovr.cpp PROPERTIES HEADER_FILE_ONLY ON )
|
||||
set_source_files_properties( ${BGFX_DIR}/src/glcontext_ppapi.cpp PROPERTIES HEADER_FILE_ONLY ON )
|
||||
set_source_files_properties( ${BGFX_DIR}/src/glcontext_glx.cpp PROPERTIES HEADER_FILE_ONLY ON )
|
||||
set_source_files_properties( ${BGFX_DIR}/src/glcontext_egl.cpp PROPERTIES HEADER_FILE_ONLY ON )
|
||||
|
||||
47
cmake/ovr.cmake
Normal file
47
cmake/ovr.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# bgfx.cmake - bgfx building in cmake
|
||||
# Written in 2016 by Joshua Brookover <josh@jalb.me>
|
||||
|
||||
# To the extent possible under law, the author(s) have dedicated all copyright
|
||||
# and related and neighboring rights to this software to the public domain
|
||||
# worldwide. This software is distributed without any warranty.
|
||||
|
||||
# You should have received a copy of the CC0 Public Domain Dedication along with
|
||||
# this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
|
||||
# The ovr location is customizable via cache variable BGFX_OVR_DIR
|
||||
if( NOT BGFX_OVR_DIR )
|
||||
set( BGFX_OVR_DIR "${CMAKE_CURRENT_SOURCE_DIR}/LibOVR" CACHE STRING "Location of LibOVR." )
|
||||
endif()
|
||||
|
||||
# Ensure the directory exists
|
||||
if( NOT IS_DIRECTORY ${BGFX_OVR_DIR} )
|
||||
message( SEND_ERROR "Could not load LibOVR, directory does not exist. ${BGFX_OVR_DIR}" )
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Create the ovr target
|
||||
add_library( ovr INTERFACE )
|
||||
|
||||
# Add include directory of ovr
|
||||
target_include_directories( ovr INTERFACE ${BGFX_OVR_DIR}/Include )
|
||||
|
||||
# Add bgfx configuration define
|
||||
target_compile_definitions( ovr INTERFACE "BGFX_CONFIG_USE_OVR=1" )
|
||||
|
||||
# Build system specific configurations
|
||||
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set( ARCH "x64" )
|
||||
else()
|
||||
set( ARCH "Win32" )
|
||||
endif()
|
||||
if( MSVC10 )
|
||||
target_link_libraries( ovr INTERFACE ${BGFX_OVR_DIR}/Lib/Windows/${ARCH}/Release/VS2010/LibOVR.lib )
|
||||
elseif( MSVC11 )
|
||||
target_link_libraries( ovr INTERFACE ${BGFX_OVR_DIR}/Lib/Windows/${ARCH}/Release/VS2012/LibOVR.lib )
|
||||
elseif( MSVC12 )
|
||||
target_link_libraries( ovr INTERFACE ${BGFX_OVR_DIR}/Lib/Windows/${ARCH}/Release/VS2013/LibOVR.lib )
|
||||
elseif( MSVC14 )
|
||||
target_link_libraries( ovr INTERFACE ${BGFX_OVR_DIR}/Lib/Windows/${ARCH}/Release/VS2015/LibOVR.lib )
|
||||
else()
|
||||
message( STATUS "OVR not supported on this platform." )
|
||||
endif()
|
||||
Reference in New Issue
Block a user