diff --git a/.azure-pipelines/build_jobs.yml b/.azure-pipelines/build_jobs.yml index cb7744d6a..1db20e1d8 100644 --- a/.azure-pipelines/build_jobs.yml +++ b/.azure-pipelines/build_jobs.yml @@ -99,7 +99,7 @@ jobs: displayName: Download dynamic libraries - download: current patterns: "**/*.lib" - displayName: Download static libraries and link import libraries + displayName: Download link import libraries - download: current patterns: "**/*.h" displayName: Download headers diff --git a/.azure-pipelines/generate_windows_matrix_build.py b/.azure-pipelines/generate_windows_matrix_build.py index 4ae1ebb53..5866203c6 100644 --- a/.azure-pipelines/generate_windows_matrix_build.py +++ b/.azure-pipelines/generate_windows_matrix_build.py @@ -3,39 +3,35 @@ from itertools import product -from shared import (BITS, TRUE_FALSE, VS_VERSIONS, make_win_artifact_name, +from shared import (PLATFORMS, TRUE_FALSE, VS_VERSION, make_win_artifact_name, output_json) if __name__ == "__main__": configs = {} - for vsver, bits, debug, dynamic in product(VS_VERSIONS.keys(), BITS, (False,), TRUE_FALSE): - label = [str(vsver)] + for platform, debug, uwp in product(PLATFORMS, (False,), TRUE_FALSE): + # No need to support ARM/ARM64 except for UWP. + if not uwp and (platform.lower() == 'arm' or platform.lower() == 'arm64'): + continue + + label = [platform] config = [] - generator = VS_VERSIONS[vsver] - if bits == 64: - config.append('-A x64') - else: - config.append('-A Win32') - label.append(str(bits)) - if dynamic: - label.append('dynamic') - config.append('-DDYNAMIC_LOADER=ON') - else: - label.append('static') - config.append('-DDYNAMIC_LOADER=OFF') + generator = VS_VERSION + config.append('-A ' + platform) + config.append('-DDYNAMIC_LOADER=ON') if debug: label.append('debug') + if uwp: + label.append('UWP') + config.append('-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0') name = '_'.join(label) configs[name] = { 'generator': generator, 'buildType': 'Debug' if debug else 'RelWithDebInfo', - 'cmakeArgs': ' '.join(config), - 'dynamic': dynamic, - 'bits': bits + 'cmakeArgs': ' '.join(config) } if not debug: configs[name]['artifactName'] = make_win_artifact_name( - vsver, dynamic, bits) + platform, uwp) output_json(configs) diff --git a/.azure-pipelines/organize_windows_artifacts.py b/.azure-pipelines/organize_windows_artifacts.py index 61f343e0c..f77565071 100644 --- a/.azure-pipelines/organize_windows_artifacts.py +++ b/.azure-pipelines/organize_windows_artifacts.py @@ -5,7 +5,7 @@ from pathlib import Path import sys -from shared import BITS, TRUE_FALSE, VS_VERSIONS, make_win_artifact_name +from shared import PLATFORMS, TRUE_FALSE, VS_VERSION, make_win_artifact_name CWD = Path.cwd() @@ -22,22 +22,24 @@ def move(src, dest): workspace = Path(sys.argv[1]) outbase = Path(sys.argv[2]) - for vsver, dynamic in product(VS_VERSIONS.keys(), TRUE_FALSE): - base = outbase / 'msvs{}_{}'.format(vsver, - 'dynamic' if dynamic else 'static') + + include_copied = False + + for platform, uwp in product(PLATFORMS, TRUE_FALSE): + base = outbase / '{}{}'.format(platform, + '_uwp' if uwp else '') base.mkdir(parents=True, exist_ok=True) - name_64 = make_win_artifact_name(vsver, dynamic, 64) - name_32 = make_win_artifact_name(vsver, dynamic, 32) - artifact_64 = workspace / name_64 - artifact_32 = workspace / name_32 - # Move over one set of includes - move(artifact_32 / 'include', base / 'include') + name = make_win_artifact_name(platform, uwp) + + artifact = workspace / name + + if not include_copied: + # Move over one set of includes to the base + move(artifact / 'include', outbase / 'include') + include_copied = True # lib files - move(artifact_32 / 'lib', base / 'lib32') - move(artifact_64 / 'lib', base / 'lib') + move(artifact / 'lib', base / 'lib') - if dynamic: - # dll files - move(artifact_32 / 'bin', base / 'bin32') - move(artifact_64 / 'bin', base / 'bin') + # dll files + move(artifact / 'bin', base / 'bin') diff --git a/.azure-pipelines/print_windows_artifact_names.py b/.azure-pipelines/print_windows_artifact_names.py index 930c3bcf7..23700ecb8 100644 --- a/.azure-pipelines/print_windows_artifact_names.py +++ b/.azure-pipelines/print_windows_artifact_names.py @@ -3,9 +3,9 @@ from itertools import product -from shared import BITS, TRUE_FALSE, VS_VERSIONS, make_win_artifact_name +from shared import PLATFORMS, TRUE_FALSE, VS_VERSION, make_win_artifact_name if __name__ == "__main__": - for vsver, bits, dynamic in product(VS_VERSIONS.keys(), BITS, TRUE_FALSE): - print(make_win_artifact_name(vsver, dynamic, bits)) + for platform, uwp in product(PLATFORMS, TRUE_FALSE): + print(make_win_artifact_name(platform, uwp)) diff --git a/.azure-pipelines/shared.py b/.azure-pipelines/shared.py index b95d8510c..d646859a2 100644 --- a/.azure-pipelines/shared.py +++ b/.azure-pipelines/shared.py @@ -3,21 +3,17 @@ import json import sys -VS_VERSIONS = { - 2019: 'Visual Studio 16 2019', - # 2017: 'Visual Studio 15 2017', -} +VS_VERSION = 'Visual Studio 16 2019' -BITS = (32, 64) +PLATFORMS = ('Win32', 'x64', 'ARM', 'ARM64') TRUE_FALSE = (True, False) -def make_win_artifact_name(vsver, dynamic, bits): - return 'loader_win{}_msvs{}_{}'.format( - bits, - vsver, - 'dynamic' if dynamic else 'static' +def make_win_artifact_name(platform, uwp): + return 'loader_{}{}'.format( + platform.lower(), + '_uwp' if uwp else '', ) diff --git a/changes/sdk/pr.175.gh.OpenXR-SDK-Source.md b/changes/sdk/pr.175.gh.OpenXR-SDK-Source.md new file mode 100644 index 000000000..4b6ee9ce0 --- /dev/null +++ b/changes/sdk/pr.175.gh.OpenXR-SDK-Source.md @@ -0,0 +1 @@ +Modifications to Azure DevOps build pipeline. Now builds UWP loader DLLs in addition to Win32 loader DLLs. No longer builds static loader libraries due to linkability concerns. Re-arranged release artifact zip to distinguish architecture from 32-bit or 64-bit. \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b7c18cb2d..6f708d398 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,12 +26,18 @@ include(GNUInstallDirs) ### Dependencies set(OpenGL_GL_PREFERENCE GLVND) +if (NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + # OpenGL package will be found for UWP apps but gl.h excludes UWP apps so it isn't actually usable. find_package(OpenGL) +endif() + if(OPENGL_FOUND) add_definitions(-DXR_USE_GRAPHICS_API_OPENGL) message(STATUS "Enabling OpenGL support") elseif(BUILD_ALL_EXTENSIONS) - message(FATAL_ERROR "OpenGL not found") + if (NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "OpenGL not found") + endif() endif() if(NOT CMAKE_VERSION VERSION_LESS 3.7.0) @@ -84,6 +90,11 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") add_definitions(-DXR_OS_LINUX) endif() +# /EHsc (support for C++ exceptions) is default in most configurations but seems missing when building arm/arm64. +IF(MSVC) + SET(CMAKE_CXX_FLAGS "/EHsc") +ENDIF(MSVC) + # This is a little helper library for setting up OpenGL if(OPENGL_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/gfxwrapper_opengl.c") add_library(openxr-gfxwrapper STATIC common/gfxwrapper_opengl.c common/gfxwrapper_opengl.h) @@ -107,6 +118,11 @@ endif() # Several files use these compile-time platform switches if(WIN32) add_definitions(-DXR_USE_PLATFORM_WIN32) + # TODO remove once work is done to get more stuff building for UWP. + if (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(BUILD_TESTS OFF) + set(BUILD_CONFORMANCE_TESTS OFF) + endif() elseif(PRESENTATION_BACKEND MATCHES "xlib") add_definitions(-DXR_USE_PLATFORM_XLIB) elseif(PRESENTATION_BACKEND MATCHES "xcb") diff --git a/src/tests/hello_xr/CMakeLists.txt b/src/tests/hello_xr/CMakeLists.txt index e942c8fb7..4f119f059 100644 --- a/src/tests/hello_xr/CMakeLists.txt +++ b/src/tests/hello_xr/CMakeLists.txt @@ -69,7 +69,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") target_compile_definitions(hello_xr PRIVATE _CRT_SECURE_NO_WARNINGS) target_compile_options(hello_xr PRIVATE /Zc:wchar_t /Zc:forScope /W4 /WX) endif() - target_link_libraries(hello_xr d3d11 d3d12 d3dcompiler dxgi ${OPENGL_gl_LIBRARY}) + target_link_libraries(hello_xr d3d11 d3d12 d3dcompiler dxgi ole32 ${OPENGL_gl_LIBRARY}) elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_compile_options(hello_xr PRIVATE -Wall) target_link_libraries(hello_xr m pthread) diff --git a/src/tests/list/CMakeLists.txt b/src/tests/list/CMakeLists.txt index b9bc8262b..204b5a1cb 100644 --- a/src/tests/list/CMakeLists.txt +++ b/src/tests/list/CMakeLists.txt @@ -37,7 +37,7 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "Windows") target_compile_options(runtime_list PRIVATE /Zc:wchar_t /Zc:forScope /W4 /WX) - target_link_libraries(runtime_list openxr_loader opengl32) + target_link_libraries(runtime_list openxr_loader) endif() if(CMAKE_SYSTEM_NAME STREQUAL "Linux")