Skip to content

Commit 610ba5b

Browse files
committed
Merge branch 'cmake_export_postfix'
2 parents 3ea73fc + 6abd9cc commit 610ba5b

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cmake: Debug library uses d suffix on Windows. CMake OPENXR_DEBUG_POSTFIX variable can be set to something else to change it.

src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ option(
130130
ON
131131
)
132132

133+
if(WIN32)
134+
set(OPENXR_DEBUG_POSTFIX d CACHE STRING "OpenXR loader debug postfix.")
135+
else()
136+
set(OPENXR_DEBUG_POSTFIX "" CACHE STRING "OpenXR loader debug postfix.")
137+
endif()
138+
133139
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
134140
option(DYNAMIC_LOADER "Build the loader as a .dll library" OFF)
135141
else()

src/loader/CMakeLists.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ target_include_directories(
103103
# for target-specific generated files
104104
${CMAKE_CURRENT_SOURCE_DIR}
105105
${CMAKE_CURRENT_BINARY_DIR}
106+
INTERFACE $<INSTALL_INTERFACE:include>
106107
)
107108

108109
if(Vulkan_FOUND)
@@ -127,6 +128,8 @@ endif()
127128
target_compile_definitions(openxr_loader PRIVATE API_NAME="OpenXR")
128129
openxr_add_filesystem_utils(openxr_loader)
129130

131+
set_target_properties(openxr_loader PROPERTIES DEBUG_POSTFIX "${OPENXR_DEBUG_POSTFIX}")
132+
130133
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
131134
set(FALLBACK_CONFIG_DIRS
132135
"/etc/xdg"
@@ -193,8 +196,8 @@ elseif(WIN32)
193196

194197
# Need to copy DLL to client directories so clients can easily load it.
195198
if(DYNAMIC_LOADER AND (CMAKE_GENERATOR MATCHES "^Visual Studio.*"))
196-
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/openxr_loader.dll COPY_DLL_SRC_PATH)
197-
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/openxr_loader.pdb COPY_PDB_SRC_PATH)
199+
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/openxr_loader$<$<CONFIG:Debug>:${OPENXR_DEBUG_POSTFIX}>.dll COPY_DLL_SRC_PATH)
200+
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/openxr_loader$<$<CONFIG:Debug>:${OPENXR_DEBUG_POSTFIX}>.pdb COPY_PDB_SRC_PATH)
198201
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/../tests/hello_xr/$<CONFIGURATION>/
199202
COPY_DST_HELLO_XR_PATH
200203
)
@@ -244,11 +247,14 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
244247
endif()
245248
endif()
246249

250+
add_library(headers INTERFACE)
251+
target_include_directories(headers INTERFACE $<INSTALL_INTERFACE:include>)
252+
247253
install(
248-
TARGETS openxr_loader EXPORT openxr_loader_export
249-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}$<$<CONFIG:Debug>:/Debug>
250-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}$<$<CONFIG:Debug>:/Debug>
251-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}$<$<CONFIG:Debug>:/Debug>
254+
TARGETS openxr_loader headers EXPORT openxr_loader_export
255+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
256+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
257+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
252258
)
253259

254260
export(

src/loader/OpenXRConfig.cmake.in

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44

55
@PACKAGE_INIT@
66

7-
# The header openxr.h is not added to the export target so we add the include directory here
87
include("${CMAKE_CURRENT_LIST_DIR}/OpenXRTargets.cmake")
9-
set_and_check(OpenXR_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
10-
target_include_directories(OpenXR::openxr_loader INTERFACE ${OpenXR_INCLUDE_DIR})
118

12-
add_library(OpenXR::headers INTERFACE IMPORTED)
13-
target_include_directories(OpenXR::headers SYSTEM INTERFACE ${OpenXR_INCLUDE_DIR})
9+
# Provide this variable as a convenience.
10+
set_and_check(OpenXR_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
1411

1512
check_required_components(OpenXR)

0 commit comments

Comments
 (0)