[Bf-blender-cvs] [e65ba62c37c] soc-2019-openxr: Windows: OpenXR Linking via OpenXR Loader
Julian Eisel
noreply at git.blender.org
Tue May 28 01:37:09 CEST 2019
Commit: e65ba62c37c7cc5f4ab61e3b3db7140ef87e38e4
Author: Julian Eisel
Date: Tue May 28 01:17:08 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBe65ba62c37c7cc5f4ab61e3b3db7140ef87e38e4
Windows: OpenXR Linking via OpenXR Loader
Adds needed headers for OpenXR, the loader from the OpenXR SDK and
JsonCpp into extern. Took a while to get this to compile/link, but on
Win10 it works fine now without patching #includes. Linux probably
needs more work.
Added a compile option WITH_OPENXR to toggle XR feature compiling.
Also does a dummy xrCreateInstance() call to test linking.
===================================================================
M CMakeLists.txt
M build_files/cmake/config/blender_full.cmake
M build_files/cmake/config/blender_lite.cmake
M build_files/cmake/config/blender_release.cmake
M extern/CMakeLists.txt
A extern/jsoncpp/CMakeLists.txt
A extern/jsoncpp/include/CMakeLists.txt
A extern/jsoncpp/include/json/allocator.h
A extern/jsoncpp/include/json/assertions.h
A extern/jsoncpp/include/json/autolink.h
A extern/jsoncpp/include/json/config.h
A extern/jsoncpp/include/json/features.h
A extern/jsoncpp/include/json/forwards.h
A extern/jsoncpp/include/json/json.h
A extern/jsoncpp/include/json/reader.h
A extern/jsoncpp/include/json/value.h
A extern/jsoncpp/include/json/version.h
A extern/jsoncpp/include/json/writer.h
A extern/jsoncpp/src/CMakeLists.txt
A extern/jsoncpp/src/json_reader.cpp
A extern/jsoncpp/src/json_tool.h
A extern/jsoncpp/src/json_value.cpp
A extern/jsoncpp/src/json_valueiterator.inl
A extern/jsoncpp/src/json_writer.cpp
A extern/jsoncpp/src/sconscript
A extern/jsoncpp/src/version.h.in
A extern/openxr/CMakeLists.txt
A extern/openxr/LICENSE
A extern/openxr/common/filesystem_utils.cpp
A extern/openxr/common/filesystem_utils.hpp
A extern/openxr/common/gfxwrapper_opengl.c
A extern/openxr/common/gfxwrapper_opengl.h
A extern/openxr/common/loader_interfaces.h
A extern/openxr/common/platform_utils.hpp
A extern/openxr/common/xr_dependencies.h
A extern/openxr/common/xr_linear.h
A extern/openxr/common_cmake_config.h
A extern/openxr/include/openxr/openxr.h
A extern/openxr/include/openxr/openxr_platform.h
A extern/openxr/include/openxr/openxr_platform_defines.h
A extern/openxr/loader/CMakeLists.txt
A extern/openxr/loader/api_layer_interface.cpp
A extern/openxr/loader/api_layer_interface.hpp
A extern/openxr/loader/loader.rc
A extern/openxr/loader/loader_core.cpp
A extern/openxr/loader/loader_instance.cpp
A extern/openxr/loader/loader_instance.hpp
A extern/openxr/loader/loader_logger.cpp
A extern/openxr/loader/loader_logger.hpp
A extern/openxr/loader/loader_platform.hpp
A extern/openxr/loader/manifest_file.cpp
A extern/openxr/loader/manifest_file.hpp
A extern/openxr/loader/openxr.pc.in
A extern/openxr/loader/runtime_interface.cpp
A extern/openxr/loader/runtime_interface.hpp
A extern/openxr/loader/xr_generated_loader.cpp
A extern/openxr/loader/xr_generated_loader.hpp
A extern/openxr/xr_generated_dispatch_table.c
A extern/openxr/xr_generated_dispatch_table.h
A extern/openxr/xr_generated_utilities.c
A extern/openxr/xr_generated_utilities.h
M release/scripts/addons
M release/scripts/addons_contrib
M source/blender/windowmanager/CMakeLists.txt
M source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f55ae5f5b8a..17e195d946f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -234,6 +234,7 @@ option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
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)
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
@@ -1756,6 +1757,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_OPENCOLORIO)
+ info_cfg_option(WITH_OPENXR)
info_cfg_option(WITH_OPENVDB)
info_cfg_option(WITH_ALEMBIC)
diff --git a/build_files/cmake/config/blender_full.cmake b/build_files/cmake/config/blender_full.cmake
index 6786cb5ce37..6523fc97126 100644
--- a/build_files/cmake/config/blender_full.cmake
+++ b/build_files/cmake/config/blender_full.cmake
@@ -40,6 +40,7 @@ set(WITH_AUDASPACE ON CACHE BOOL "" FORCE)
set(WITH_OPENAL ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO ON CACHE BOOL "" FORCE)
+set(WITH_OPENXR ON CACHE BOOL "" FORCE)
set(WITH_OPENMP ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index b85176d37f3..38a500dbfa8 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -45,6 +45,7 @@ set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
+set(WITH_OPENXR OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake
index 24032b6aed6..eeaa158e9e8 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -41,6 +41,7 @@ set(WITH_AUDASPACE ON CACHE BOOL "" FORCE)
set(WITH_OPENAL ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO ON CACHE BOOL "" FORCE)
+set(WITH_OPENXR ON CACHE BOOL "" FORCE)
set(WITH_OPENMP ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 3b2a8c172aa..94b9ac4a909 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -105,3 +105,8 @@ if(WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE)
set(AUDASPACE_CMAKE_CFG ${CMAKE_CURRENT_SOURCE_DIR}/audaspace/blender_config.cmake)
add_subdirectory(audaspace)
endif()
+
+if(WITH_OPENXR)
+ add_subdirectory(jsoncpp)
+ add_subdirectory(openxr)
+endif()
\ No newline at end of file
diff --git a/extern/jsoncpp/CMakeLists.txt b/extern/jsoncpp/CMakeLists.txt
new file mode 100644
index 00000000000..66dee80170e
--- /dev/null
+++ b/extern/jsoncpp/CMakeLists.txt
@@ -0,0 +1,21 @@
+# ***** 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.
+#
+# All rights reserved.
+# ***** END GPL LICENSE BLOCK *****
+
+add_subdirectory(src)
+add_subdirectory(include)
diff --git a/extern/jsoncpp/include/CMakeLists.txt b/extern/jsoncpp/include/CMakeLists.txt
new file mode 100644
index 00000000000..cc866f173d7
--- /dev/null
+++ b/extern/jsoncpp/include/CMakeLists.txt
@@ -0,0 +1,2 @@
+FILE(GLOB INCLUDE_FILES "json/*.h")
+INSTALL(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/json)
diff --git a/extern/jsoncpp/include/json/allocator.h b/extern/jsoncpp/include/json/allocator.h
new file mode 100644
index 00000000000..2492758cd71
--- /dev/null
+++ b/extern/jsoncpp/include/json/allocator.h
@@ -0,0 +1,98 @@
+// Copyright 2007-2010 Baptiste Lepilleur
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED
+#define CPPTL_JSON_ALLOCATOR_H_INCLUDED
+
+#include <cstring>
+#include <memory>
+
+#pragma pack(push, 8)
+
+namespace Json {
+template<typename T>
+class SecureAllocator {
+ public:
+ // Type definitions
+ using value_type = T;
+ using pointer = T*;
+ using const_pointer = const T*;
+ using reference = T&;
+ using const_reference = const T&;
+ using size_type = std::size_t;
+ using difference_type = std::ptrdiff_t;
+
+ /**
+ * Allocate memory for N items using the standard allocator.
+ */
+ pointer allocate(size_type n) {
+ // allocate using "global operator new"
+ return static_cast<pointer>(::operator new(n * sizeof(T)));
+ }
+
+ /**
+ * Release memory which was allocated for N items at pointer P.
+ *
+ * The memory block is filled with zeroes before being released.
+ * The pointer argument is tagged as "volatile" to prevent the
+ * compiler optimizing out this critical step.
+ */
+ void deallocate(volatile pointer p, size_type n) {
+ std::memset(p, 0, n * sizeof(T));
+ // free using "global operator delete"
+ ::operator delete(p);
+ }
+
+ /**
+ * Construct an item in-place at pointer P.
+ */
+ template<typename... Args>
+ void construct(pointer p, Args&&... args) {
+ // construct using "placement new" and "perfect forwarding"
+ ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
+ }
+
+ size_type max_size() const {
+ return size_t(-1) / sizeof(T);
+ }
+
+ pointer address( reference x ) const {
+ return std::addressof(x);
+ }
+
+ const_pointer address( const_reference x ) const {
+ return std::addressof(x);
+ }
+
+ /**
+ * Destroy an item in-place at pointer P.
+ */
+ void destroy(pointer p) {
+ // destroy using "explicit destructor"
+ p->~T();
+ }
+
+ // Boilerplate
+ SecureAllocator() {}
+ template<typename U> SecureAllocator(const SecureAllocator<U>&) {}
+ template<typename U> struct rebind { using other = SecureAllocator<U>; };
+};
+
+
+template<typename T, typename U>
+bool operator==(const SecureAllocator<T>&, const SecureAllocator<U>&) {
+ return true;
+}
+
+template<typename T, typename U>
+bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
+ return false;
+}
+
+} //namespace Json
+
+#pragma pack(pop)
+
+#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED
diff --git a/extern/jsoncpp/include/json/assertions.h b/extern/jsoncpp/include/json/assertions.h
new file mode 100644
index 00000000000..9c5f8bc0fe5
--- /dev/null
+++ b/extern/jsoncpp/include/json/assertions.h
@@ -0,0 +1,54 @@
+// Copyright 2007-2010 Baptiste Lepilleur
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
+#define CPPTL_JSON_ASSERTIONS_H_INCLUDED
+
+#include <stdlib.h>
+#include <sstream>
+
+#if !defined(JSON_IS_AMALGAMATION)
+#include "config.h"
+#endif // if !defined(JSON_IS_AMALGAMATION)
+
+/** It should not be possible for a maliciously designed file to
+ * cause an abort() or seg-fault, so these macros are used only
+ * for pre-condition violations and internal logic errors.
+ */
+#if JSON_USE_EXCEPTION
+
+// @todo <= add detail about condition in exception
+# define JSON_ASSERT(condition) \
+ {if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
+
+# define JSON_FAIL_MESSAGE(message) \
+ { \
+ JSONCPP_OSTRINGSTREAM oss; oss << message; \
+ Json::throwLogicError(oss.str()); \
+ abort(); \
+ }
+
+#else // JSON_USE_EXCEPTION
+
+# define JSON_ASSERT(condition) assert(condition)
+
+// The call to assert() will show the failure message in debug builds. In
+// release builds we abort, for a core-dump or debugger.
+# define JSON_FAIL_MESSAGE(message) \
+ { \
+ JSONCPP_OSTRINGSTREAM oss; oss << message; \
+ assert(false && oss.str().c_str()); \
+ abort(); \
+ }
+
+
+#endif
+
+#define JSON_ASSERT_MESSAGE(condition, message) \
+ if (!(condition)) { \
+ JSON_FAIL_MESSAGE(message); \
+ }
+
+#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
diff --git a/extern/jsoncpp/include/json/autolink.h b/extern/jsoncpp/include/
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list