Updating cmake config to build from pre-compiled Oculus SDK distribution

This commit is contained in:
Brad Davis 2015-03-09 14:46:43 -07:00
parent 4fa5a0eca4
commit 1e65324a7b
2 changed files with 66 additions and 43 deletions

View file

@ -1,26 +1,70 @@
set(EXTERNAL_NAME LibOVR)
include(ExternalProject)
ExternalProject_Add(
${EXTERNAL_NAME}
PREFIX ${EXTERNAL_NAME}
GIT_REPOSITORY https://github.com/jherico/OculusSDK.git
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
LOG_DOWNLOAD ON
)
include(SelectLibraryConfigurations)
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
message(${INSTALL_DIR})
set(EXTERNAL_NAME LibOVR)
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE STRING)
if (WIN32)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/ovr.lib CACHE TYPE FILEPATH)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/ovrd.lib CACHE TYPE FILEPATH)
else()
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libovr.a CACHE TYPE FILEPATH)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/libovrd.a CACHE TYPE FILEPATH)
endif()
ExternalProject_Add(
${EXTERNAL_NAME}
URL http://static.oculus.com/sdk-downloads/ovr_sdk_win_0.4.4.zip
URL_MD5 bcc9f41346ce13bd4334a8bc94875728
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
# Different Oculus SDKs have different layouts, so we can't combine the include directories below
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/OculusSDK/LibOVR/Include ${SOURCE_DIR}/OculusSDK/LibOVR/Src CACHE TYPE INTERNAL)
# FIXME need to account for different architectures
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/OculusSDK/LibOVR/Lib/Win32/VS2013/libovr.lib CACHE TYPE INTERNAL)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${SOURCE_DIR}/OculusSDK/LibOVR/Lib/Win32/VS2013/libovrd.lib CACHE TYPE INTERNAL)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_EXTRAS setupapi winmm ws2_32)
elseif(APPLE)
ExternalProject_Add(
${EXTERNAL_NAME}
URL http://static.oculus.com/sdk-downloads/ovr_sdk_macos_0.4.4.tar.gz
URL_MD5 3cf8576d225798608a2aa7219b7ea11e
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/LibOVR/Include ${SOURCE_DIR}/LibOVR/Src CACHE TYPE INTERNAL)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/LibOVR/Lib/Mac/Release/libovr.a CACHE TYPE INTERNAL)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${SOURCE_DIR}/LibOVR/Lib/Mac/Debug/libovr.a CACHE TYPE INTERNAL)
find_library(COCOA_LIBRARY Cocoa)
find_library(IOKIT_LIBRARY IOKit)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_EXTRAS ${COCOA_LIBRARY} ${IOKIT_LIBRARY})
elseif(NOT ANDROID)
# http://static.oculus.com/sdk-downloads/ovr_sdk_linux_0.4.4.tar.xz
# ec3bd8cff4a1461b4e21210e7feb0572
ExternalProject_Add(
${EXTERNAL_NAME}
PREFIX ${EXTERNAL_NAME}
GIT_REPOSITORY https://github.com/jherico/OculusSDK.git
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
LOG_DOWNLOAD ON
)
endif()
select_library_configurations(${EXTERNAL_NAME_UPPER})
set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${${EXTERNAL_NAME_UPPER}_LIBRARY} ${${EXTERNAL_NAME_UPPER}_LIBRARY_EXTRAS} CACHE TYPE INTERNAL)

View file

@ -18,32 +18,11 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
hifi_library_search_hints("libovr")
find_library(LIBOVR_LIBRARY_RELEASE ovr PATH_SUFFIXES "lib" HINTS ${LIBOVR_SEARCH_DIRS})
find_library(LIBOVR_LIBRARY_DEBUG ovr PATH_SUFFIXES "lib" HINTS ${LIBOVR_SEARCH_DIRS})
include(SelectLibraryConfigurations)
select_library_configurations(LIBOVR)
if (NOT ANDROID)
include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
hifi_library_search_hints("libovr")
find_path(LIBOVR_INCLUDE_DIRS OVR_CAPI.h PATH_SUFFIXES include HINTS ${LIBOVR_SEARCH_DIRS})
find_library(LIBOVR_LIBRARIES ovr PATH_SUFFIXES lib HINTS ${LIBOVR_SEARCH_DIRS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBOVR DEFAULT_MSG LIBOVR_INCLUDE_DIRS LIBOVR_LIBRARIES)
if (WIN32)
list(APPEND LIBOVR_LIBRARIES setupapi winmm ws2_32)
elseif(APPLE)
find_library(COCOA_LIBRARY Cocoa)
find_library(IOKIT_LIBRARY IOKit)
list(APPEND LIBOVR_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBOVR DEFAULT_MSG LIBOVR_INCLUDE_DIRS LIBOVR_LIBRARIES)
else (NOT ANDROID)
set(_VRLIB_JNI_DIR "VRLib/jni")