mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-21 03:14:06 +00:00
Use FetchContent feature of CMake to include openxr dependency instead of the old way.
This commit is contained in:
parent
01b7e9da25
commit
cdb8505f1d
3 changed files with 37 additions and 60 deletions
|
@ -77,7 +77,6 @@ BULLET_DOUBLE=""
|
||||||
BULLET_DBL=""
|
BULLET_DBL=""
|
||||||
BULLET_DBL_DISPLAY="Single precision"
|
BULLET_DBL_DISPLAY="Single precision"
|
||||||
SKIP_VR=""
|
SKIP_VR=""
|
||||||
OPENXR_INSTALL_ROOT=""
|
|
||||||
|
|
||||||
ACTIVATE_MSVC=""
|
ACTIVATE_MSVC=""
|
||||||
SINGLE_CONFIG=""
|
SINGLE_CONFIG=""
|
||||||
|
@ -516,16 +515,6 @@ if [ -z $SKIP_DOWNLOAD ]; then
|
||||||
git clone -b release-1.10.0 https://github.com/google/googletest.git
|
git clone -b release-1.10.0 https://github.com/google/googletest.git
|
||||||
fi
|
fi
|
||||||
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
|
fi
|
||||||
|
|
||||||
cd .. #/..
|
cd .. #/..
|
||||||
|
@ -834,12 +823,6 @@ printf "SDL 2.0.12... "
|
||||||
cd $DEPS
|
cd $DEPS
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if [ $CONFIGURATION == "Debug" ]; then
|
|
||||||
DEBUG_SUFFIX="d"
|
|
||||||
else
|
|
||||||
DEBUG_SUFFIX=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Google Test and Google Mock
|
# Google Test and Google Mock
|
||||||
if [ ! -z $TEST_FRAMEWORK ]; then
|
if [ ! -z $TEST_FRAMEWORK ]; then
|
||||||
printf "Google test 1.10.0 ..."
|
printf "Google test 1.10.0 ..."
|
||||||
|
@ -852,6 +835,11 @@ if [ ! -z $TEST_FRAMEWORK ]; then
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
GOOGLE_INSTALL_ROOT="${DEPS_INSTALL}/GoogleTest"
|
GOOGLE_INSTALL_ROOT="${DEPS_INSTALL}/GoogleTest"
|
||||||
|
if [ $CONFIGURATION == "Debug" ]; then
|
||||||
|
DEBUG_SUFFIX="d"
|
||||||
|
else
|
||||||
|
DEBUG_SUFFIX=""
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d $GOOGLE_INSTALL_ROOT ]; then
|
if [ ! -d $GOOGLE_INSTALL_ROOT ]; then
|
||||||
|
|
||||||
|
@ -879,29 +867,9 @@ if [ ! -z $TEST_FRAMEWORK ]; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# OpenXR SDK
|
# VR build
|
||||||
if [ -Z $SKIP_VR ]; then
|
if [ ! -Z $SKIP_VR ]; then
|
||||||
printf "OpenXR SDK 1.0.9 ..."
|
add_cmake_opts -DBUILD_VR_OPENXR=no
|
||||||
|
|
||||||
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
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
@ -919,6 +887,7 @@ if [ ! -z $CI ]; then
|
||||||
-DBUILD_MWINIIMPORTER=no \
|
-DBUILD_MWINIIMPORTER=no \
|
||||||
-DBUILD_OPENCS=no \
|
-DBUILD_OPENCS=no \
|
||||||
-DBUILD_OPENMW=no \
|
-DBUILD_OPENMW=no \
|
||||||
|
-DBUILD_OPENMW_VR=no \
|
||||||
-DBUILD_WIZARD=no
|
-DBUILD_WIZARD=no
|
||||||
;;
|
;;
|
||||||
openmw )
|
openmw )
|
||||||
|
@ -927,6 +896,7 @@ if [ ! -z $CI ]; then
|
||||||
-DBUILD_LAUNCHER=no \
|
-DBUILD_LAUNCHER=no \
|
||||||
-DBUILD_MWINIIMPORTER=no \
|
-DBUILD_MWINIIMPORTER=no \
|
||||||
-DBUILD_OPENCS=no \
|
-DBUILD_OPENCS=no \
|
||||||
|
-DBUILD_OPENMW_VR=no \
|
||||||
-DBUILD_WIZARD=no
|
-DBUILD_WIZARD=no
|
||||||
;;
|
;;
|
||||||
vr )
|
vr )
|
||||||
|
@ -943,12 +913,14 @@ if [ ! -z $CI ]; then
|
||||||
-DBUILD_LAUNCHER=no \
|
-DBUILD_LAUNCHER=no \
|
||||||
-DBUILD_MWINIIMPORTER=no \
|
-DBUILD_MWINIIMPORTER=no \
|
||||||
-DBUILD_OPENMW=no \
|
-DBUILD_OPENMW=no \
|
||||||
|
-DBUILD_OPENMW_VR=no \
|
||||||
-DBUILD_WIZARD=no
|
-DBUILD_WIZARD=no
|
||||||
;;
|
;;
|
||||||
misc )
|
misc )
|
||||||
echo " Building subprojects: Misc."
|
echo " Building subprojects: Misc."
|
||||||
add_cmake_opts -DBUILD_OPENCS=no \
|
add_cmake_opts -DBUILD_OPENCS=no \
|
||||||
-DBUILD_OPENMW=no
|
-DBUILD_OPENMW=no \
|
||||||
|
-DBUILD_OPENMW_VR=no
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -9,7 +9,7 @@ option(BUILD_BSATOOL "Build BSA extractor" ON)
|
||||||
option(BUILD_ESMTOOL "Build ESM inspector" ON)
|
option(BUILD_ESMTOOL "Build ESM inspector" ON)
|
||||||
option(BUILD_NIFTEST "Build nif file tester" ON)
|
option(BUILD_NIFTEST "Build nif file tester" ON)
|
||||||
option(BUILD_DOCS "Build documentation." OFF )
|
option(BUILD_DOCS "Build documentation." OFF )
|
||||||
option(BUILD_VR_OPENXR "Build VR support using OpenXR" OFF)
|
option(BUILD_OPENMW_VR "Build VR support using OpenXR" ON)
|
||||||
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
||||||
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
|
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
|
||||||
option(BULLET_USE_DOUBLES "Use double precision for Bullet" OFF)
|
option(BULLET_USE_DOUBLES "Use double precision for Bullet" OFF)
|
||||||
|
@ -21,7 +21,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# set the minimum required version across the board
|
# set the minimum required version across the board
|
||||||
cmake_minimum_required(VERSION 3.1.0)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
project(OpenMW)
|
project(OpenMW)
|
||||||
|
|
||||||
|
@ -315,11 +315,6 @@ include_directories("."
|
||||||
${BULLET_INCLUDE_DIRS}
|
${BULLET_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(BUILD_VR_OPENXR)
|
|
||||||
include_directories(${OPENXR_ROOT}/include)
|
|
||||||
link_directories(${OPENXR_ROOT}/lib)
|
|
||||||
endif(BUILD_VR_OPENXR)
|
|
||||||
|
|
||||||
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})
|
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})
|
||||||
|
|
||||||
if(MYGUI_STATIC)
|
if(MYGUI_STATIC)
|
||||||
|
@ -587,7 +582,7 @@ add_subdirectory (components)
|
||||||
target_compile_definitions(components PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")
|
target_compile_definitions(components PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")
|
||||||
|
|
||||||
# Apps and tools
|
# Apps and tools
|
||||||
if (BUILD_OPENMW OR BUILD_VR_OPENXR)
|
if (BUILD_OPENMW OR BUILD_OPENMW_VR)
|
||||||
add_subdirectory( apps/openmw )
|
add_subdirectory( apps/openmw )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -657,17 +652,17 @@ if (WIN32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# TODO: properties and link targets should be copied from openmw to openmw_vr instead of duplicating every line
|
# TODO: properties and link targets should be copied from openmw to openmw_vr instead of duplicating every line
|
||||||
if (USE_DEBUG_CONSOLE AND BUILD_VR_OPENXR)
|
if (USE_DEBUG_CONSOLE AND BUILD_OPENMW_VR)
|
||||||
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
|
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
|
||||||
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
|
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
|
||||||
set_target_properties(openmw_vr PROPERTIES COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_CONSOLE>)
|
set_target_properties(openmw_vr PROPERTIES COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_CONSOLE>)
|
||||||
elseif (BUILD_VR_OPENXR)
|
elseif (BUILD_OPENMW_VR)
|
||||||
# Turn off debug console, debug output will be written to visual studio output instead
|
# Turn off debug console, debug output will be written to visual studio output instead
|
||||||
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
|
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
|
||||||
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:WINDOWS")
|
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:WINDOWS")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_VR_OPENXR)
|
if (BUILD_OPENMW_VR)
|
||||||
# Release builds don't use the debug console
|
# Release builds don't use the debug console
|
||||||
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
|
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
|
||||||
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
|
set_target_properties(openmw_vr PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
|
||||||
|
@ -773,7 +768,7 @@ if (WIN32)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_VR_OPENXR)
|
if (BUILD_OPENMW_VR)
|
||||||
if (OPENMW_UNITY_BUILD)
|
if (OPENMW_UNITY_BUILD)
|
||||||
set_target_properties(openmw_vr PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD} /bigobj")
|
set_target_properties(openmw_vr PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD} /bigobj")
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -235,9 +235,8 @@ if(BUILD_OPENMW)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUILD_VR_OPENXR)
|
if(BUILD_OPENMW_VR)
|
||||||
# TODO: Move this into something akin to add_openmw_dir instead of breaking pattern.
|
# TODO: Openmw and openmw_vr should preferrably share game code as a static or shared library
|
||||||
# Later, openmw and openmw_vr should preferrably share game code as a static or shared library
|
|
||||||
# instead of being compiled separately, though for now that's not possible as i depend on
|
# instead of being compiled separately, though for now that's not possible as i depend on
|
||||||
# USE_OPENXR preprocessor switches.
|
# USE_OPENXR preprocessor switches.
|
||||||
set(OPENMW_VR_FILES
|
set(OPENMW_VR_FILES
|
||||||
|
@ -256,9 +255,20 @@ if(BUILD_VR_OPENXR)
|
||||||
${APPLE_BUNDLE_RESOURCES}
|
${APPLE_BUNDLE_RESOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Import the OpenXR SDK
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(
|
||||||
|
OpenXR
|
||||||
|
GIT_REPOSITORY https://github.com/KhronosGroup/OpenXR-SDK.git
|
||||||
|
GIT_TAG release-1.0.9
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(OpenXR)
|
||||||
|
target_link_libraries(openmw_vr openxr_loader)
|
||||||
|
target_include_directories(openmw_vr PRIVATE ${openxr_SOURCE_DIR}/include)
|
||||||
|
|
||||||
# Preprocessor variable used to control code paths to vr code
|
# 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_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})
|
target_link_libraries(openmw_vr ${OPENMW_LINK_TARGETS})
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_custom_command(TARGET openmw_vr
|
add_custom_command(TARGET openmw_vr
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
|
|
Loading…
Reference in a new issue