From de9b70874d3c01a056d8d835646aa1bdb0027837 Mon Sep 17 00:00:00 2001 From: Bryce Hutchings Date: Wed, 8 Apr 2020 13:56:01 -0700 Subject: [PATCH 1/6] Only build dynamic libraries and include UWP versions --- .azure-pipelines/build_jobs.yml | 2 +- .../generate_windows_matrix_build.py | 30 ++++++---------- .../organize_windows_artifacts.py | 34 ++++++++++--------- .../print_windows_artifact_names.py | 6 ++-- .azure-pipelines/shared.py | 16 ++++----- 5 files changed, 39 insertions(+), 49 deletions(-) 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..cade8f273 100644 --- a/.azure-pipelines/generate_windows_matrix_build.py +++ b/.azure-pipelines/generate_windows_matrix_build.py @@ -3,39 +3,31 @@ 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): + 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 '', ) From 8acf1f526cc38d199bc2b6e4ea90ab6894a5e910 Mon Sep 17 00:00:00 2001 From: Bryce Hutchings Date: Wed, 8 Apr 2020 15:40:32 -0700 Subject: [PATCH 2/6] exclude gfx helper for windows store --- src/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b7c18cb2d..af5931fba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -85,7 +85,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") endif() # This is a little helper library for setting up OpenGL -if(OPENGL_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/gfxwrapper_opengl.c") +if(OPENGL_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/gfxwrapper_opengl.c" + AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") add_library(openxr-gfxwrapper STATIC common/gfxwrapper_opengl.c common/gfxwrapper_opengl.h) target_include_directories(openxr-gfxwrapper PUBLIC ${PROJECT_SOURCE_DIR}/external/include) if(TARGET OpenGL::OpenGL) From 6f401bc8a6582a8d568f88135d45dd3a8820cb82 Mon Sep 17 00:00:00 2001 From: Bryce Hutchings Date: Wed, 8 Apr 2020 18:09:34 -0700 Subject: [PATCH 3/6] fixes --- .azure-pipelines/generate_windows_matrix_build.py | 4 ++++ src/CMakeLists.txt | 14 +++++++++++--- src/tests/hello_xr/CMakeLists.txt | 6 +++++- src/tests/list/CMakeLists.txt | 5 ++++- src/tests/loader_test/CMakeLists.txt | 7 ++++++- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/generate_windows_matrix_build.py b/.azure-pipelines/generate_windows_matrix_build.py index cade8f273..56c419f83 100644 --- a/.azure-pipelines/generate_windows_matrix_build.py +++ b/.azure-pipelines/generate_windows_matrix_build.py @@ -10,6 +10,10 @@ configs = {} for platform, debug, uwp in product(PLATFORMS, (False,), TRUE_FALSE): + # No need to support ARM/ARM64 except for UWP. + if uwp and (platform.lower() == 'arm' or platform.lower() == 'arm64'): + continue + label = [platform] config = [] generator = VS_VERSION diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index af5931fba..321189cbc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,7 +26,11 @@ include(GNUInstallDirs) ### Dependencies set(OpenGL_GL_PREFERENCE GLVND) -find_package(OpenGL) +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") @@ -84,9 +88,13 @@ 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" - AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +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) target_include_directories(openxr-gfxwrapper PUBLIC ${PROJECT_SOURCE_DIR}/external/include) if(TARGET OpenGL::OpenGL) diff --git a/src/tests/hello_xr/CMakeLists.txt b/src/tests/hello_xr/CMakeLists.txt index e942c8fb7..dfee7c1ed 100644 --- a/src/tests/hello_xr/CMakeLists.txt +++ b/src/tests/hello_xr/CMakeLists.txt @@ -69,7 +69,11 @@ 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) + + if(OPENGL_FOUND) + target_link_libraries(hello_xr ${OPENGL_gl_LIBRARY}) + endif() 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..441cf1bc1 100644 --- a/src/tests/list/CMakeLists.txt +++ b/src/tests/list/CMakeLists.txt @@ -37,7 +37,10 @@ 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) + if(OPENGL_FOUND) + target_link_libraries(runtime_list ${OPENGL_gl_LIBRARY}) + endif() endif() if(CMAKE_SYSTEM_NAME STREQUAL "Linux") diff --git a/src/tests/loader_test/CMakeLists.txt b/src/tests/loader_test/CMakeLists.txt index 18d39f9a1..6a47376bd 100644 --- a/src/tests/loader_test/CMakeLists.txt +++ b/src/tests/loader_test/CMakeLists.txt @@ -45,7 +45,12 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "Windows") target_compile_definitions(loader_test PRIVATE _CRT_SECURE_NO_WARNINGS) target_compile_options(loader_test PRIVATE /Zc:wchar_t /Zc:forScope /W4 /WX) - target_link_libraries(loader_test openxr_loader opengl32 d3d11) + target_link_libraries(loader_test openxr_loader d3d11) + + if(OPENGL_FOUND) + target_link_libraries(loader_test ${OPENGL_gl_LIBRARY}) + endif() + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_compile_options( loader_test PRIVATE -Wall -Wno-unused-function -Wno-format-truncation From da1a461785a9fdade072b7dc8e9fbbbd06267ff6 Mon Sep 17 00:00:00 2001 From: Bryce Hutchings Date: Wed, 8 Apr 2020 18:48:00 -0700 Subject: [PATCH 4/6] fixes --- .azure-pipelines/generate_windows_matrix_build.py | 2 +- src/CMakeLists.txt | 11 +++++++++-- src/tests/hello_xr/CMakeLists.txt | 6 +----- src/tests/list/CMakeLists.txt | 3 --- src/tests/loader_test/CMakeLists.txt | 7 +------ 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.azure-pipelines/generate_windows_matrix_build.py b/.azure-pipelines/generate_windows_matrix_build.py index 56c419f83..5866203c6 100644 --- a/.azure-pipelines/generate_windows_matrix_build.py +++ b/.azure-pipelines/generate_windows_matrix_build.py @@ -11,7 +11,7 @@ configs = {} for platform, debug, uwp in product(PLATFORMS, (False,), TRUE_FALSE): # No need to support ARM/ARM64 except for UWP. - if uwp and (platform.lower() == 'arm' or platform.lower() == 'arm64'): + if not uwp and (platform.lower() == 'arm' or platform.lower() == 'arm64'): continue label = [platform] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 321189cbc..6f708d398 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,14 +28,16 @@ include(GNUInstallDirs) 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) +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) @@ -116,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 dfee7c1ed..4f119f059 100644 --- a/src/tests/hello_xr/CMakeLists.txt +++ b/src/tests/hello_xr/CMakeLists.txt @@ -69,11 +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 ole32) - - if(OPENGL_FOUND) - target_link_libraries(hello_xr ${OPENGL_gl_LIBRARY}) - endif() + 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 441cf1bc1..204b5a1cb 100644 --- a/src/tests/list/CMakeLists.txt +++ b/src/tests/list/CMakeLists.txt @@ -38,9 +38,6 @@ 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) - if(OPENGL_FOUND) - target_link_libraries(runtime_list ${OPENGL_gl_LIBRARY}) - endif() endif() if(CMAKE_SYSTEM_NAME STREQUAL "Linux") diff --git a/src/tests/loader_test/CMakeLists.txt b/src/tests/loader_test/CMakeLists.txt index 6a47376bd..6b5fc910f 100644 --- a/src/tests/loader_test/CMakeLists.txt +++ b/src/tests/loader_test/CMakeLists.txt @@ -45,12 +45,7 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "Windows") target_compile_definitions(loader_test PRIVATE _CRT_SECURE_NO_WARNINGS) target_compile_options(loader_test PRIVATE /Zc:wchar_t /Zc:forScope /W4 /WX) - target_link_libraries(loader_test openxr_loader d3d11) - - if(OPENGL_FOUND) - target_link_libraries(loader_test ${OPENGL_gl_LIBRARY}) - endif() - + target_link_libraries(loader_test openxr_loader) elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_compile_options( loader_test PRIVATE -Wall -Wno-unused-function -Wno-format-truncation From 817e5ea239688e1064627645164b3fa812fb2595 Mon Sep 17 00:00:00 2001 From: Bryce Hutchings Date: Wed, 8 Apr 2020 19:00:57 -0700 Subject: [PATCH 5/6] fix the fix --- src/tests/loader_test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/loader_test/CMakeLists.txt b/src/tests/loader_test/CMakeLists.txt index 6b5fc910f..18d39f9a1 100644 --- a/src/tests/loader_test/CMakeLists.txt +++ b/src/tests/loader_test/CMakeLists.txt @@ -45,7 +45,7 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "Windows") target_compile_definitions(loader_test PRIVATE _CRT_SECURE_NO_WARNINGS) target_compile_options(loader_test PRIVATE /Zc:wchar_t /Zc:forScope /W4 /WX) - target_link_libraries(loader_test openxr_loader) + target_link_libraries(loader_test openxr_loader opengl32 d3d11) elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_compile_options( loader_test PRIVATE -Wall -Wno-unused-function -Wno-format-truncation From 162f19bd587f7c1e59805d00d381b8f36a6cfc0d Mon Sep 17 00:00:00 2001 From: Bryce Hutchings Date: Tue, 28 Apr 2020 12:31:58 -0700 Subject: [PATCH 6/6] Add proclamation change --- changes/sdk/pr.175.gh.OpenXR-SDK-Source.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/sdk/pr.175.gh.OpenXR-SDK-Source.md 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