Skip to content

Commit

Permalink
Merge pull request #175 from brycehutchings/bryceh/build_uwp_and_remo…
Browse files Browse the repository at this point in the history
…ve_static

Build pipeline: Remove static libraries, and build arm+arm64 along with UWP
  • Loading branch information
rpavlik committed Apr 28, 2020
2 parents 308ad0c + 162f19b commit 6a38361
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/build_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 15 additions & 19 deletions .azure-pipelines/generate_windows_matrix_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
34 changes: 18 additions & 16 deletions .azure-pipelines/organize_windows_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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')
6 changes: 3 additions & 3 deletions .azure-pipelines/print_windows_artifact_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
16 changes: 6 additions & 10 deletions .azure-pipelines/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '',
)


Expand Down
1 change: 1 addition & 0 deletions changes/sdk/pr.175.gh.OpenXR-SDK-Source.md
Original file line number Diff line number Diff line change
@@ -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.
18 changes: 17 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/tests/hello_xr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/tests/list/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 6a38361

Please sign in to comment.