[Bf-blender-cvs] [d0177fc5411] soc-2019-openxr: Integrate the OpenXR SDK better into dependency management
Julian Eisel
noreply at git.blender.org
Sun Aug 18 13:09:00 CEST 2019
Commit: d0177fc54113a501233bfc1d246478615e7f5f34
Author: Julian Eisel
Date: Sun Aug 18 02:36:58 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBd0177fc54113a501233bfc1d246478615e7f5f34
Integrate the OpenXR SDK better into dependency management
Adds the SDK so that `make deps` works, on all platforms. On Windows,
the SDK headers and libraries are now assumed to be in the usual lib\
directory.
Also fixes a mistake in install_deps.sh
Note that none of this is tested as it requires an older Visual Studio
version than I have.
===================================================================
M CMakeLists.txt
M build_files/build_environment/CMakeLists.txt
M build_files/build_environment/cmake/harvest.cmake
A build_files/build_environment/cmake/openxr.cmake
M build_files/build_environment/cmake/versions.cmake
M build_files/build_environment/install_deps.sh
M build_files/cmake/platform/platform_apple.cmake
M build_files/cmake/platform/platform_unix.cmake
M build_files/cmake/platform/platform_win32.cmake
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da417266545..434beb44308 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -237,13 +237,6 @@ option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported
mark_as_advanced(WITH_SYSTEM_BULLET)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
option(WITH_OPENXR "Enable VR features through the OpenXR specification" ON)
-if(WITH_OPENXR)
- find_package(OpenXR-SDK)
- if(NOT OPENXR_SDK_FOUND)
- message(WARNING "OpenXR-SDK was not found, disabling WITH_OPENXR")
- set(WITH_OPENXR OFF)
- endif()
-endif()
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt
index 1b387cb86a2..38be119a3f9 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -98,6 +98,7 @@ else()
include(cmake/pugixml.cmake)
endif()
include(cmake/openimagedenoise.cmake)
+include(cmake/openxr.cmake)
if(WITH_WEBP)
include(cmake/webp.cmake)
diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake
index 97e4a6b69d4..dd30ffbd730 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -174,6 +174,8 @@ harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/lib openvdb/lib "*.a")
+harvest(openxr_sdk/include/openxr openxr_sdk/include/openxr "*.h")
+harvest(openxr_sdk/lib openxr_sdk/src/loader "*.a")
harvest(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")
diff --git a/build_files/build_environment/cmake/openxr.cmake b/build_files/build_environment/cmake/openxr.cmake
new file mode 100644
index 00000000000..001527c78f1
--- /dev/null
+++ b/build_files/build_environment/cmake/openxr.cmake
@@ -0,0 +1,55 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+
+set(OPENXR_SDK_EXTRA_ARGS
+ -DBUILD_API_LAYERS=ON
+ -DBUILD_FORCE_GENERATION=ON
+ -DBUILD_LOADER=ON
+ -DBUILD_SPECIFICATION=OFF
+ -DBUILD_TESTS=OFF
+ -DDYNAMIC_LOADER=OFF
+)
+
+ExternalProject_Add(external_openxr_sdk
+ URL ${OPENXR_SDK_URI}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ URL_HASH MD5=${OPENXR_SDK_HASH}
+ PREFIX ${BUILD_DIR}/openxr_sdk
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openxr_sdk ${DEFAULT_CMAKE_FLAGS} ${OPENXR_SDK_EXTRA_ARGS}
+ PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/openxr_sdk/src/external_openxr_sdk < ${PATCH_DIR}/openxr_sdk.diff
+ INSTALL_DIR ${LIBDIR}/openxr_sdk
+)
+
+add_dependencies(external_openxr_sdk)
+
+if(WIN32)
+ if(BUILD_MODE STREQUAL Release)
+ ExternalProject_Add_Step(external_openxr_sdk after_install
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openxr_sdk/include/openxr ${HARVEST_TARGET}/openxr_sdk/include/openxr
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openxr_sdk/lib/openxr_loader-*.lib ${HARVEST_TARGET}/openxr_sdk/lib/openxr_loader-*.lib
+ DEPENDEES install
+ )
+ endif()
+ if(BUILD_MODE STREQUAL Debug)
+ ExternalProject_Add_Step(external_openxr_sdk after_install
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openxr_sdk/lib/openxr_loader-*.lib ${HARVEST_TARGET}/openxr_sdk/lib/openxr_loader-*.lib
+ DEPENDEES install
+ )
+ endif()
+endif()
diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake
index c3b713096d6..f73d492f574 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -306,3 +306,7 @@ set(EMBREE_HASH 3d4a1147002ff43939d45140aa9d6fb8)
set(OIDN_VERSION 1.0.0)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.zip)
set(OIDN_HASH 19fe67b0164e8f020ac8a4f520defe60)
+
+set(OPENXR_SDK_VERSION 1.0.0)
+set(OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK-Source/archive/release-${OPENXR_VERSION}.tar.gz)
+set(OPENXR_SDK_HASH 348912bf9bfaf445ac2974bda19fd0d50496460b)
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index c769177ae3a..8db9a588ccd 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -312,7 +312,7 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
Unconditionally skip OpenImageDenoise installation/building.
--skip-ffmpeg
- Unconditionally skip FFMpeg installation/building.\""
+ Unconditionally skip FFMpeg installation/building.
--skip-openxr
Unconditionally skip OpenXR-SDK installation/building.\""
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index e79359e9f3b..4b3d2cee705 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -416,6 +416,14 @@ if(WITH_OPENMP)
endif()
endif()
+if(WITH_OPENXR)
+ find_package(OpenXR-SDK)
+ if(NOT OPENXR_SDK_FOUND)
+ message(WARNING "OpenXR-SDK was not found, disabling WITH_OPENXR")
+ set(WITH_OPENXR OFF)
+ endif()
+endif()
+
set(EXETYPE MACOSX_BUNDLE)
set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index 1b3f9cf3fad..52ca11a6d10 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -416,6 +416,15 @@ if(WITH_OPENSUBDIV)
endif()
endif()
+if(WITH_OPENXR)
+ find_package(OpenXR-SDK)
+ if(NOT OPENXR_SDK_FOUND)
+ message(WARNING "OpenXR-SDK was not found, disabling WITH_OPENXR")
+ set(WITH_OPENXR OFF)
+ endif()
+endif()
+
+
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
if(HAIKU)
list(APPEND PLATFORM_LINKLIBS -lnetwork)
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 42ac285f88d..f16dad63b5a 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -691,3 +691,10 @@ if(WINDOWS_PYTHON_DEBUG)
</Project>")
endif()
endif()
+
+if(WITH_OPENXR)
+ set(OPENXR_SDK ${LIBDIR}/openxr_sdk)
+ set(OPENXR_SDK_LIBPATH ${LIBDIR}/openxr_sdk/lib)
+ set(OPENXR_SDK_INCLUDE_DIRS ${OPENXR_SDK}/include)
+ set(OPENXR_SDK_LIBRARIES ${OPENXR_SDK_LIBPATH}/openxr_loader-1_0.lib)
+endif()
More information about the Bf-blender-cvs
mailing list