Skip to content

Commit 6a38361

Browse files
authored
Merge pull request #175 from brycehutchings/bryceh/build_uwp_and_remove_static
Build pipeline: Remove static libraries, and build arm+arm64 along with UWP
2 parents 308ad0c + 162f19b commit 6a38361

9 files changed

Lines changed: 63 additions & 52 deletions

File tree

.azure-pipelines/build_jobs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
displayName: Download dynamic libraries
100100
- download: current
101101
patterns: "**/*.lib"
102-
displayName: Download static libraries and link import libraries
102+
displayName: Download link import libraries
103103
- download: current
104104
patterns: "**/*.h"
105105
displayName: Download headers

.azure-pipelines/generate_windows_matrix_build.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,35 @@
33

44
from itertools import product
55

6-
from shared import (BITS, TRUE_FALSE, VS_VERSIONS, make_win_artifact_name,
6+
from shared import (PLATFORMS, TRUE_FALSE, VS_VERSION, make_win_artifact_name,
77
output_json)
88

99
if __name__ == "__main__":
1010

1111
configs = {}
12-
for vsver, bits, debug, dynamic in product(VS_VERSIONS.keys(), BITS, (False,), TRUE_FALSE):
13-
label = [str(vsver)]
12+
for platform, debug, uwp in product(PLATFORMS, (False,), TRUE_FALSE):
13+
# No need to support ARM/ARM64 except for UWP.
14+
if not uwp and (platform.lower() == 'arm' or platform.lower() == 'arm64'):
15+
continue
16+
17+
label = [platform]
1418
config = []
15-
generator = VS_VERSIONS[vsver]
16-
if bits == 64:
17-
config.append('-A x64')
18-
else:
19-
config.append('-A Win32')
20-
label.append(str(bits))
21-
if dynamic:
22-
label.append('dynamic')
23-
config.append('-DDYNAMIC_LOADER=ON')
24-
else:
25-
label.append('static')
26-
config.append('-DDYNAMIC_LOADER=OFF')
19+
generator = VS_VERSION
20+
config.append('-A ' + platform)
21+
config.append('-DDYNAMIC_LOADER=ON')
2722
if debug:
2823
label.append('debug')
24+
if uwp:
25+
label.append('UWP')
26+
config.append('-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0')
2927
name = '_'.join(label)
3028
configs[name] = {
3129
'generator': generator,
3230
'buildType': 'Debug' if debug else 'RelWithDebInfo',
33-
'cmakeArgs': ' '.join(config),
34-
'dynamic': dynamic,
35-
'bits': bits
31+
'cmakeArgs': ' '.join(config)
3632
}
3733
if not debug:
3834
configs[name]['artifactName'] = make_win_artifact_name(
39-
vsver, dynamic, bits)
35+
platform, uwp)
4036

4137
output_json(configs)

.azure-pipelines/organize_windows_artifacts.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66
import sys
77

8-
from shared import BITS, TRUE_FALSE, VS_VERSIONS, make_win_artifact_name
8+
from shared import PLATFORMS, TRUE_FALSE, VS_VERSION, make_win_artifact_name
99

1010
CWD = Path.cwd()
1111

@@ -22,22 +22,24 @@ def move(src, dest):
2222
workspace = Path(sys.argv[1])
2323
outbase = Path(sys.argv[2])
2424

25-
for vsver, dynamic in product(VS_VERSIONS.keys(), TRUE_FALSE):
26-
base = outbase / 'msvs{}_{}'.format(vsver,
27-
'dynamic' if dynamic else 'static')
25+
26+
include_copied = False
27+
28+
for platform, uwp in product(PLATFORMS, TRUE_FALSE):
29+
base = outbase / '{}{}'.format(platform,
30+
'_uwp' if uwp else '')
2831
base.mkdir(parents=True, exist_ok=True)
29-
name_64 = make_win_artifact_name(vsver, dynamic, 64)
30-
name_32 = make_win_artifact_name(vsver, dynamic, 32)
31-
artifact_64 = workspace / name_64
32-
artifact_32 = workspace / name_32
33-
# Move over one set of includes
34-
move(artifact_32 / 'include', base / 'include')
32+
name = make_win_artifact_name(platform, uwp)
33+
34+
artifact = workspace / name
35+
36+
if not include_copied:
37+
# Move over one set of includes to the base
38+
move(artifact / 'include', outbase / 'include')
39+
include_copied = True
3540

3641
# lib files
37-
move(artifact_32 / 'lib', base / 'lib32')
38-
move(artifact_64 / 'lib', base / 'lib')
42+
move(artifact / 'lib', base / 'lib')
3943

40-
if dynamic:
41-
# dll files
42-
move(artifact_32 / 'bin', base / 'bin32')
43-
move(artifact_64 / 'bin', base / 'bin')
44+
# dll files
45+
move(artifact / 'bin', base / 'bin')

.azure-pipelines/print_windows_artifact_names.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
from itertools import product
55

6-
from shared import BITS, TRUE_FALSE, VS_VERSIONS, make_win_artifact_name
6+
from shared import PLATFORMS, TRUE_FALSE, VS_VERSION, make_win_artifact_name
77

88
if __name__ == "__main__":
99

10-
for vsver, bits, dynamic in product(VS_VERSIONS.keys(), BITS, TRUE_FALSE):
11-
print(make_win_artifact_name(vsver, dynamic, bits))
10+
for platform, uwp in product(PLATFORMS, TRUE_FALSE):
11+
print(make_win_artifact_name(platform, uwp))

.azure-pipelines/shared.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@
33
import json
44
import sys
55

6-
VS_VERSIONS = {
7-
2019: 'Visual Studio 16 2019',
8-
# 2017: 'Visual Studio 15 2017',
9-
}
6+
VS_VERSION = 'Visual Studio 16 2019'
107

11-
BITS = (32, 64)
8+
PLATFORMS = ('Win32', 'x64', 'ARM', 'ARM64')
129

1310
TRUE_FALSE = (True, False)
1411

1512

16-
def make_win_artifact_name(vsver, dynamic, bits):
17-
return 'loader_win{}_msvs{}_{}'.format(
18-
bits,
19-
vsver,
20-
'dynamic' if dynamic else 'static'
13+
def make_win_artifact_name(platform, uwp):
14+
return 'loader_{}{}'.format(
15+
platform.lower(),
16+
'_uwp' if uwp else '',
2117
)
2218

2319

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

src/CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ include(GNUInstallDirs)
2626

2727
### Dependencies
2828
set(OpenGL_GL_PREFERENCE GLVND)
29+
if (NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
30+
# OpenGL package will be found for UWP apps but gl.h excludes UWP apps so it isn't actually usable.
2931
find_package(OpenGL)
32+
endif()
33+
3034
if(OPENGL_FOUND)
3135
add_definitions(-DXR_USE_GRAPHICS_API_OPENGL)
3236
message(STATUS "Enabling OpenGL support")
3337
elseif(BUILD_ALL_EXTENSIONS)
34-
message(FATAL_ERROR "OpenGL not found")
38+
if (NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
39+
message(FATAL_ERROR "OpenGL not found")
40+
endif()
3541
endif()
3642

3743
if(NOT CMAKE_VERSION VERSION_LESS 3.7.0)
@@ -84,6 +90,11 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
8490
add_definitions(-DXR_OS_LINUX)
8591
endif()
8692

93+
# /EHsc (support for C++ exceptions) is default in most configurations but seems missing when building arm/arm64.
94+
IF(MSVC)
95+
SET(CMAKE_CXX_FLAGS "/EHsc")
96+
ENDIF(MSVC)
97+
8798
# This is a little helper library for setting up OpenGL
8899
if(OPENGL_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/gfxwrapper_opengl.c")
89100
add_library(openxr-gfxwrapper STATIC common/gfxwrapper_opengl.c common/gfxwrapper_opengl.h)
@@ -107,6 +118,11 @@ endif()
107118
# Several files use these compile-time platform switches
108119
if(WIN32)
109120
add_definitions(-DXR_USE_PLATFORM_WIN32)
121+
# TODO remove once work is done to get more stuff building for UWP.
122+
if (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
123+
set(BUILD_TESTS OFF)
124+
set(BUILD_CONFORMANCE_TESTS OFF)
125+
endif()
110126
elseif(PRESENTATION_BACKEND MATCHES "xlib")
111127
add_definitions(-DXR_USE_PLATFORM_XLIB)
112128
elseif(PRESENTATION_BACKEND MATCHES "xcb")

src/tests/hello_xr/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
6969
target_compile_definitions(hello_xr PRIVATE _CRT_SECURE_NO_WARNINGS)
7070
target_compile_options(hello_xr PRIVATE /Zc:wchar_t /Zc:forScope /W4 /WX)
7171
endif()
72-
target_link_libraries(hello_xr d3d11 d3d12 d3dcompiler dxgi ${OPENGL_gl_LIBRARY})
72+
target_link_libraries(hello_xr d3d11 d3d12 d3dcompiler dxgi ole32 ${OPENGL_gl_LIBRARY})
7373
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
7474
target_compile_options(hello_xr PRIVATE -Wall)
7575
target_link_libraries(hello_xr m pthread)

src/tests/list/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ endif()
3737

3838
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
3939
target_compile_options(runtime_list PRIVATE /Zc:wchar_t /Zc:forScope /W4 /WX)
40-
target_link_libraries(runtime_list openxr_loader opengl32)
40+
target_link_libraries(runtime_list openxr_loader)
4141
endif()
4242

4343
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")

0 commit comments

Comments
 (0)