Skip to content

Commit 8e62df7

Browse files
authored
Merge pull request #224 from rpavlik/arch-subdirs
Arch subdirs
2 parents bc54434 + c4e88bc commit 8e62df7

File tree

10 files changed

+110
-18
lines changed

10 files changed

+110
-18
lines changed

.azure-pipelines/build_jobs.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
sourceDir: ${{parameters.sourceDir}}
6565
buildType: $(buildType)
6666
generator: "$(generator)"
67-
cmakeArgs: $(cmakeArgs) -DBUILD_ALL_EXTENSIONS=ON
67+
cmakeArgs: $(cmakeArgs) -DBUILD_ALL_EXTENSIONS=ON -DINSTALL_TO_ARCHITECTURE_PREFIXES=ON
6868
useVulkan: "true"
6969

7070
- task: PublishPipelineArtifact@1
@@ -104,7 +104,16 @@ jobs:
104104
- download: current
105105
patterns: "**/*.h"
106106
displayName: Download headers
107-
107+
- download: current
108+
patterns: "**/*.cmake"
109+
displayName: Download CMake scripts
110+
- download: current
111+
patterns: "**/*.exe"
112+
displayName: Download executables scripts
113+
# Use the specified version of Python from the tool cache
114+
- task: UsePythonVersion@0
115+
inputs:
116+
versionSpec: '3.9'
108117
- task: PythonScript@0
109118
displayName: Move artifact contents
110119
inputs:

.azure-pipelines/generate_windows_matrix_build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
# Copyright (c) 2019 The Khronos Group Inc.
3+
# SPDX-License-Identifier: Apache-2.0
34

45
from itertools import product
56

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env python3
22
# Copyright (c) 2019 The Khronos Group Inc.
3+
# SPDX-License-Identifier: Apache-2.0
34

45
from itertools import product
56
from pathlib import Path
7+
import shutil
68
import sys
79

810
from shared import PLATFORMS, TRUE_FALSE, VS_VERSION, make_win_artifact_name
@@ -22,28 +24,25 @@ def move(src, dest):
2224
workspace = Path(sys.argv[1])
2325
outbase = Path(sys.argv[2])
2426

25-
26-
include_copied = False
27+
common_copied = False
2728

2829
for platform, uwp in product(PLATFORMS, TRUE_FALSE):
2930
# ARM/ARM64 is only built for the UWP platform.
3031
if not uwp and (platform.lower() == 'arm' or platform.lower() == 'arm64'):
3132
continue
3233

33-
base = outbase / '{}{}'.format(platform,
34-
'_uwp' if uwp else '')
35-
base.mkdir(parents=True, exist_ok=True)
34+
platform_dirname = '{}{}'.format(platform,
35+
'_uwp' if uwp else '')
36+
3637
name = make_win_artifact_name(platform, uwp)
3738

3839
artifact = workspace / name
3940

40-
if not include_copied:
41-
# Move over one set of includes to the base
42-
move(artifact / 'include', outbase / 'include')
43-
include_copied = True
41+
if not common_copied:
42+
# Start by copying the full tree over.
43+
shutil.copytree(artifact, outbase, dirs_exist_ok=True)
44+
common_copied = True
45+
continue
4446

4547
# lib files
46-
move(artifact / 'lib', base / 'lib')
47-
48-
# dll files
49-
move(artifact / 'bin', base / 'bin')
48+
shutil.copytree(artifact / platform_dirname, outbase / platform_dirname, dirs_exist_ok=True)

.azure-pipelines/print_windows_artifact_names.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
# Copyright (c) 2019 The Khronos Group Inc.
3+
# SPDX-License-Identifier: Apache-2.0
34

45
from itertools import product
56

.azure-pipelines/shared.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright (c) 2019 The Khronos Group Inc.
2+
# SPDX-License-Identifier: Apache-2.0
23

34
import json
45
import sys
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fix: The D3D12 and Vulcan graphics plugins sometimes did not update their swapchain image context maps due to rare key collisions.
1+
hello_xr: The D3D12 and Vulkan graphics plugins sometimes did not update their swapchain image context maps due to rare key collisions.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- issue.185.gh.OpenXR-SDK-Source
3+
---
4+
build/ci: Have Windows loader artifacts organize themselves by architecture/platform, and bundle the CMake config files and a "meta" CMake config.

src/CMakeLists.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,38 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2929
include(GNUInstallDirs)
3030
include(StdFilesystemFlags)
3131

32+
string(TOUPPER "${CMAKE_GENERATOR_PLATFORM}" CMAKE_GENERATOR_PLATFORM_UPPER)
33+
34+
# Artifact organization
35+
if(WIN32)
36+
option(INSTALL_TO_ARCHITECTURE_PREFIXES "Install platform-specific files to architecture-specific directories." OFF)
37+
if(INSTALL_TO_ARCHITECTURE_PREFIXES)
38+
unset(_UWP_SUFFIX)
39+
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
40+
set(_UWP_SUFFIX _uwp)
41+
endif()
42+
if(CMAKE_GENERATOR_PLATFORM_UPPER MATCHES "ARM.*")
43+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
44+
set(_PLATFORM ARM64)
45+
else()
46+
set(_PLATFORM ARM)
47+
endif()
48+
else()
49+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
50+
set(_PLATFORM x64)
51+
else()
52+
set(_PLATFORM Win32)
53+
endif()
54+
endif()
55+
56+
set(CMAKE_INSTALL_BINDIR ${_PLATFORM}${_UWP_SUFFIX}/${CMAKE_INSTALL_BINDIR})
57+
set(CMAKE_INSTALL_LIBDIR ${_PLATFORM}${_UWP_SUFFIX}/${CMAKE_INSTALL_LIBDIR})
58+
endif()
59+
endif()
60+
3261
### Dependencies
3362

3463
# CMake will detect OpenGL/Vulkan which are not compatible with UWP and ARM/ARM64 on Windows so skip it in these cases.
35-
string(TOUPPER "${CMAKE_GENERATOR_PLATFORM}" CMAKE_GENERATOR_PLATFORM_UPPER)
3664
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR (WIN32 AND CMAKE_GENERATOR_PLATFORM_UPPER MATCHES "ARM.*"))
3765
set(OPENGL_INCOMPATIBLE TRUE)
3866
set(VULKAN_INCOMPATIBLE TRUE)

src/cmake/metaconfig.cmake.in

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2017 The Khronos Group Inc.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# @WARNING@
6+
7+
unset(_UWP_SUFFIX)
8+
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
9+
set(_UWP_SUFFIX _uwp)
10+
endif()
11+
if(CMAKE_GENERATOR_PLATFORM_UPPER MATCHES "ARM.*")
12+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
13+
set(_PLATFORM ARM64)
14+
else()
15+
set(_PLATFORM ARM)
16+
endif()
17+
else()
18+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
19+
set(_PLATFORM x64)
20+
else()
21+
set(_PLATFORM Win32)
22+
endif()
23+
endif()
24+
25+
include("${CMAKE_CURRENT_LIST_DIR}/${_PLATFORM}${_UWP_SUFFIX}/lib/@TARGET_SUBDIR@/@[email protected]")

src/loader/CMakeLists.txt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export(
251251
NAMESPACE OpenXR::
252252
)
253253

254-
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
254+
if(WIN32 AND NOT INSTALL_TO_ARCHITECTURE_PREFIXES)
255255
set(TARGET_DESTINATION cmake)
256256
else()
257257
set(TARGET_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/openxr/)
@@ -282,3 +282,27 @@ install(
282282
${CMAKE_CURRENT_BINARY_DIR}/OpenXRConfigVersion.cmake
283283
DESTINATION ${TARGET_DESTINATION}
284284
)
285+
286+
287+
# Make the "meta" cmake config/version file to redirect to the right arch/build
288+
if(WIN32 AND INSTALL_TO_ARCHITECTURE_PREFIXES)
289+
set(TARGET_SUBDIR cmake/openxr)
290+
set(WARNING "This is a generated file - do not edit!")
291+
set(FN OpenXRConfig)
292+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/metaconfig.cmake.in
293+
${CMAKE_CURRENT_BINARY_DIR}/metaconfig.cmake
294+
@ONLY)
295+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/metaconfig.cmake
296+
DESTINATION .
297+
RENAME OpenXRConfig.cmake
298+
)
299+
300+
set(FN OpenXRConfigVersion)
301+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/metaconfig.cmake.in
302+
${CMAKE_CURRENT_BINARY_DIR}/metaconfigversion.cmake
303+
@ONLY)
304+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/metaconfigversion.cmake
305+
DESTINATION .
306+
RENAME OpenXRConfigVersion.cmake
307+
)
308+
endif()

0 commit comments

Comments
 (0)