Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using d suffix for debug library in Windows #229

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/sdk/pr.229.gh.OpenXR-SDK-Source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cmake: Debug library uses d suffix on Windows. CMake OPENXR_DEBUG_POSTFIX variable can be set to something else to change it.
25 changes: 17 additions & 8 deletions src/loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ target_include_directories(
# for target-specific generated files
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
INTERFACE $<INSTALL_INTERFACE:include>
)

if(VulkanHeaders_FOUND)
Expand All @@ -121,6 +122,13 @@ target_link_libraries(
target_compile_definitions(openxr_loader PRIVATE API_NAME="OpenXR")
openxr_add_filesystem_utils(openxr_loader)

if(WIN32)
set(OPENXR_DEBUG_POSTFIX d CACHE STRING "OpenXR loader debug postfix.")
rpavlik marked this conversation as resolved.
Show resolved Hide resolved
else()
set(OPENXR_DEBUG_POSTFIX "" CACHE STRING "OpenXR loader debug postfix.")
endif()
set_target_properties(openxr_loader PROPERTIES DEBUG_POSTFIX "${OPENXR_DEBUG_POSTFIX}")

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(FALLBACK_CONFIG_DIRS
"/etc/xdg"
Expand Down Expand Up @@ -187,8 +195,8 @@ elseif(WIN32)

# Need to copy DLL to client directories so clients can easily load it.
if(DYNAMIC_LOADER AND (CMAKE_GENERATOR MATCHES "^Visual Studio.*"))
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/openxr_loader.dll COPY_DLL_SRC_PATH)
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/openxr_loader.pdb COPY_PDB_SRC_PATH)
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/openxr_loader$<$<CONFIG:Debug>:${OPENXR_DEBUG_POSTFIX}>.dll COPY_DLL_SRC_PATH)
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/openxr_loader$<$<CONFIG:Debug>:${OPENXR_DEBUG_POSTFIX}>.pdb COPY_PDB_SRC_PATH)
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/../tests/hello_xr/$<CONFIGURATION>/
COPY_DST_HELLO_XR_PATH
)
Expand Down Expand Up @@ -238,11 +246,14 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
endif()

add_library(headers INTERFACE)
target_include_directories(headers INTERFACE $<INSTALL_INTERFACE:include>)

install(
TARGETS openxr_loader EXPORT openxr_loader_export
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}$<$<CONFIG:Debug>:/Debug>
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}$<$<CONFIG:Debug>:/Debug>
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}$<$<CONFIG:Debug>:/Debug>
TARGETS openxr_loader headers EXPORT openxr_loader_export
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

export(
Expand All @@ -265,12 +276,10 @@ install(
)

include(CMakePackageConfigHelpers)
set(INCLUDE_INSTALL_DIR include/)
configure_package_config_file(
OpenXRConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/OpenXRConfig.cmake
INSTALL_DESTINATION ${TARGET_DESTINATION}
PATH_VARS INCLUDE_INSTALL_DIR
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/OpenXRConfigVersion.cmake
Expand Down
5 changes: 0 additions & 5 deletions src/loader/OpenXRConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,5 @@

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

add_library(OpenXR::headers INTERFACE IMPORTED)
rpavlik marked this conversation as resolved.
Show resolved Hide resolved
target_include_directories(OpenXR::headers SYSTEM INTERFACE ${OpenXR_INCLUDE_DIR})

check_required_components(OpenXR)