OpenXR build and distribution (windows)

pull/615/head
Mads Buvik Sandvei 5 years ago
parent d76be4c8b4
commit 658b5033e6

@ -76,6 +76,8 @@ INSTALL_PREFIX="."
BULLET_DOUBLE=""
BULLET_DBL=""
BULLET_DBL_DISPLAY="Single precision"
SKIP_VR=""
OPENXR_INSTALL_ROOT=""
ACTIVATE_MSVC=""
SINGLE_CONFIG=""
@ -95,6 +97,9 @@ while [ $# -gt 0 ]; do
case $ARG in
V )
VERBOSE=true ;;
nVR )
SKIP_VR=true ;;
d )
SKIP_DOWNLOAD=true ;;
@ -511,6 +516,16 @@ if [ -z $SKIP_DOWNLOAD ]; then
git clone -b release-1.10.0 https://github.com/google/googletest.git
fi
fi
# OpenXR
if [ -z $SKIP_VR]; then
echo "OpenXR SDK 1.0.9..."
if [ -d OpenXR-SDK ]; then
printf "OpenXR SDK exists, skipping."
else
git clone -b release-1.0.9 https://github.com/KhronosGroup/OpenXR-SDK.git
fi
fi
fi
cd .. #/..
@ -818,6 +833,13 @@ printf "SDL 2.0.12... "
}
cd $DEPS
echo
if [ $CONFIGURATION == "Debug" ]; then
DEBUG_SUFFIX="d"
else
DEBUG_SUFFIX=""
fi
# Google Test and Google Mock
if [ ! -z $TEST_FRAMEWORK ]; then
printf "Google test 1.10.0 ..."
@ -830,11 +852,6 @@ if [ ! -z $TEST_FRAMEWORK ]; then
cd build
GOOGLE_INSTALL_ROOT="${DEPS_INSTALL}/GoogleTest"
if [ $CONFIGURATION == "Debug" ]; then
DEBUG_SUFFIX="d"
else
DEBUG_SUFFIX=""
fi
if [ ! -d $GOOGLE_INSTALL_ROOT ]; then
@ -862,6 +879,31 @@ if [ ! -z $TEST_FRAMEWORK ]; then
fi
# OpenXR SDK
if [ -Z $SKIP_VR ]; then
printf "OpenXR SDK 1.0.9 ..."
cd OpenXR-SDK
if [ ! -d build ]; then
mkdir -p build
fi
cd build
OPENXR_INSTALL_ROOT="${DEPS_INSTALL}/OpenXR-SDK"
if [ ! -d $OPENXR_INSTALL_ROOT ]; then
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${OPENXR_INSTALL_ROOT}" -G "${GENERATOR}" -DDYNAMIC_LOADER=ON
cmake --build . --config Release
cmake --build . --target install --config Release
fi
add_runtime_dlls "${OPENXR_INSTALL_ROOT}\bin\openxr_loader.dll"
add_cmake_opts -DBUILD_VR_OPENXR=on
add_cmake_opts -DOPENXR_ROOT="${OPENXR_INSTALL_ROOT}"
add_cmake_opts -DOPENXR_LIBRARY="${OPENXR_INSTALL_ROOT}/lib/openxr_loader.lib"
fi
echo
cd $DEPS_INSTALL/..
echo

@ -9,7 +9,7 @@ option(BUILD_BSATOOL "Build BSA extractor" ON)
option(BUILD_ESMTOOL "Build ESM inspector" ON)
option(BUILD_NIFTEST "Build nif file tester" ON)
option(BUILD_DOCS "Build documentation." OFF )
option(BUILD_VR_OPENXR "Build VR support using OpenXR" on)
option(BUILD_VR_OPENXR "Build VR support using OpenXR" OFF)
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
option(BULLET_USE_DOUBLES "Use double precision for Bullet" OFF)
@ -316,9 +316,8 @@ include_directories("."
)
if(BUILD_VR_OPENXR)
find_package(OpenXR REQUIRED)
message(STATUS "OpenXR_FOUND: ${OpenXR_FOUND}")
include_directories(${OpenXR_INCLUDE_DIR})
include_directories(${OPENXR_ROOT}/include)
link_directories(${OPENXR_ROOT}/lib)
endif(BUILD_VR_OPENXR)
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})

@ -672,3 +672,12 @@ may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/philosophy/why-not-lgpl.html>.
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
On Windows releases, this project bundles the openxr loader binary, which is
licensed under the apache 2.0 license. For license details, see:
https://github.com/KhronosGroup/OpenXR-SDK/blob/master/LICENSE
Bundled as:
- openxr_loader.dll

@ -115,6 +115,29 @@ else ()
)
endif ()
set(OPENMW_LINK_TARGETS
${OSG_LIBRARIES}
${OPENTHREADS_LIBRARIES}
${OSGPARTICLE_LIBRARIES}
${OSGUTIL_LIBRARIES}
${OSGDB_LIBRARIES}
${OSGVIEWER_LIBRARIES}
${OSGGA_LIBRARIES}
${OSGSHADOW_LIBRARIES}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${OPENAL_LIBRARY}
${FFmpeg_LIBRARIES}
${MyGUI_LIBRARIES}
${SDL2_LIBRARY}
${RecastNavigation_LIBRARIES}
"osg-ffmpeg-videoplayer"
"oics"
components
)
if(BUILD_VR_OPENXR)
# TODO: Move this into something akin to add_openmw_dir instead of breaking pattern.
# Later, openmw and openmw_vr should preferrably share game code as a static or shared library
@ -167,6 +190,7 @@ if(BUILD_VR_OPENXR)
# Preprocessor variable used to control code paths to vr code
target_compile_options(openmw_vr PUBLIC -DUSE_OPENXR -DXR_USE_GRAPHICS_API_OPENGL -DXR_USE_PLATFORM_WIN32)
target_link_libraries(openmw_vr ${OPENMW_LINK_TARGETS} ${OPENXR_LIBRARY})
endif()
# Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING
@ -175,31 +199,7 @@ include_directories(
${FFmpeg_INCLUDE_DIRS}
)
set(OPENMW_LINK_TARGETS
${OSG_LIBRARIES}
${OPENTHREADS_LIBRARIES}
${OSGPARTICLE_LIBRARIES}
${OSGUTIL_LIBRARIES}
${OSGDB_LIBRARIES}
${OSGVIEWER_LIBRARIES}
${OSGGA_LIBRARIES}
${OSGSHADOW_LIBRARIES}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${OPENAL_LIBRARY}
${FFmpeg_LIBRARIES}
${MyGUI_LIBRARIES}
${SDL2_LIBRARY}
${RecastNavigation_LIBRARIES}
"osg-ffmpeg-videoplayer"
"oics"
components
)
target_link_libraries(openmw ${OPENMW_LINK_TARGETS})
target_link_libraries(openmw_vr ${OPENMW_LINK_TARGETS} ${OpenXR_LIBRARIES})
if (ANDROID)
set (OSG_PLUGINS
@ -228,18 +228,24 @@ endif (ANDROID)
if (USE_SYSTEM_TINYXML)
target_link_libraries(openmw ${TinyXML_LIBRARIES})
target_link_libraries(openmw_vr ${TinyXML_LIBRARIES})
if(BUILD_VR_OPENXR)
target_link_libraries(openmw_vr ${TinyXML_LIBRARIES})
endif()
endif()
if (NOT UNIX)
target_link_libraries(openmw ${SDL2MAIN_LIBRARY})
target_link_libraries(openmw_vr ${SDL2MAIN_LIBRARY})
target_link_libraries(openmw ${SDL2MAIN_LIBRARY})
if(BUILD_VR_OPENXR)
target_link_libraries(openmw_vr ${SDL2MAIN_LIBRARY})
endif()
endif()
# Fix for not visible pthreads functions for linker with glibc 2.15
if (UNIX AND NOT APPLE)
target_link_libraries(openmw ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(openmw_vr ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(openmw ${CMAKE_THREAD_LIBS_INIT})
if(BUILD_VR_OPENXR)
target_link_libraries(openmw_vr ${CMAKE_THREAD_LIBS_INIT})
endif()
endif()
if(APPLE)
@ -258,27 +264,35 @@ if(APPLE)
POST_BUILD
COMMAND cp "${OpenMW_BINARY_DIR}/resources/version" "${BUNDLE_RESOURCES_DIR}/resources")
add_custom_command(TARGET openmw_vr
POST_BUILD
COMMAND cp "${OpenMW_BINARY_DIR}/resources/version" "${BUNDLE_RESOURCES_DIR}/resources")
if(BUILD_VR_OPENXR)
add_custom_command(TARGET openmw_vr
POST_BUILD
COMMAND cp "${OpenMW_BINARY_DIR}/resources/version" "${BUNDLE_RESOURCES_DIR}/resources")
endif()
find_library(COCOA_FRAMEWORK Cocoa)
find_library(IOKIT_FRAMEWORK IOKit)
target_link_libraries(openmw ${COCOA_FRAMEWORK} ${IOKIT_FRAMEWORK})
target_link_libraries(openmw_vr ${COCOA_FRAMEWORK} ${IOKIT_FRAMEWORK})
if(BUILD_VR_OPENXR)
target_link_libraries(openmw_vr ${COCOA_FRAMEWORK} ${IOKIT_FRAMEWORK})
endif()
if (FFmpeg_FOUND)
find_library(COREVIDEO_FRAMEWORK CoreVideo)
find_library(VDA_FRAMEWORK VideoDecodeAcceleration)
target_link_libraries(openmw z ${COREVIDEO_FRAMEWORK} ${VDA_FRAMEWORK})
target_link_libraries(openmw_vr z ${COREVIDEO_FRAMEWORK} ${VDA_FRAMEWORK})
if(BUILD_VR_OPENXR)
target_link_libraries(openmw_vr z ${COREVIDEO_FRAMEWORK} ${VDA_FRAMEWORK})
endif()
endif()
endif(APPLE)
if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(openmw gcov)
target_link_libraries(openmw_vr gcov)
add_definitions (--coverage)
target_link_libraries(openmw gcov)
if(BUILD_VR_OPENXR)
target_link_libraries(openmw_vr gcov)
endif()
endif()
if (MSVC)
@ -290,5 +304,7 @@ endif (MSVC)
if (WIN32)
INSTALL(TARGETS openmw RUNTIME DESTINATION ".")
INSTALL(TARGETS openmw_vr RUNTIME DESTINATION ".")
if(BUILD_VR_OPENXR)
INSTALL(TARGETS openmw_vr RUNTIME DESTINATION ".")
endif()
endif (WIN32)

Loading…
Cancel
Save