From 1e65324a7b1193aa21c5c7e63b525750a5f04f7d Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 9 Mar 2015 14:46:43 -0700 Subject: [PATCH] Updating cmake config to build from pre-compiled Oculus SDK distribution --- cmake/externals/LibOVR/CMakeLists.txt | 84 ++++++++++++++++++++------- cmake/modules/FindLibOVR.cmake | 25 +------- 2 files changed, 66 insertions(+), 43 deletions(-) diff --git a/cmake/externals/LibOVR/CMakeLists.txt b/cmake/externals/LibOVR/CMakeLists.txt index 878af64053..3f5328f4ca 100644 --- a/cmake/externals/LibOVR/CMakeLists.txt +++ b/cmake/externals/LibOVR/CMakeLists.txt @@ -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= - 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() \ No newline at end of file + + 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= + 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) + diff --git a/cmake/modules/FindLibOVR.cmake b/cmake/modules/FindLibOVR.cmake index 820acadcf1..df45a639cf 100644 --- a/cmake/modules/FindLibOVR.cmake +++ b/cmake/modules/FindLibOVR.cmake @@ -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")