2020-03-03 23:24:39 +00:00
|
|
|
# Copyright 2019-2020, Collabora, Ltd.
|
2019-04-18 12:02:30 +00:00
|
|
|
# SPDX-License-Identifier: BSL-1.0
|
|
|
|
|
2020-06-01 08:54:15 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
# Binding generation
|
|
|
|
#
|
|
|
|
|
|
|
|
function(bindings_gen output)
|
|
|
|
add_custom_command(OUTPUT ${output}
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bindings.json
|
|
|
|
${output}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bindings.json
|
|
|
|
)
|
|
|
|
endfunction(bindings_gen)
|
|
|
|
|
|
|
|
bindings_gen(${CMAKE_CURRENT_BINARY_DIR}/oxr_generated_bindings.h)
|
|
|
|
bindings_gen(${CMAKE_CURRENT_BINARY_DIR}/oxr_generated_bindings.c)
|
|
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
# Main code
|
|
|
|
#
|
|
|
|
|
2019-04-18 12:02:30 +00:00
|
|
|
set(OXR_SOURCE_FILES
|
2020-06-01 08:54:15 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/oxr_generated_bindings.h
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/oxr_generated_bindings.c
|
2019-04-18 12:02:30 +00:00
|
|
|
oxr_api_action.c
|
|
|
|
oxr_api_funcs.h
|
|
|
|
oxr_api_instance.c
|
|
|
|
oxr_api_negotiate.c
|
|
|
|
oxr_api_session.c
|
|
|
|
oxr_api_space.c
|
|
|
|
oxr_api_swapchain.c
|
|
|
|
oxr_api_system.c
|
|
|
|
oxr_api_verify.h
|
2019-09-02 21:04:13 +00:00
|
|
|
oxr_binding.c
|
2019-06-03 19:12:01 +00:00
|
|
|
oxr_chain.h
|
2019-10-08 14:35:16 +00:00
|
|
|
oxr_event.c
|
2019-08-19 17:37:50 +00:00
|
|
|
oxr_extension_support.h
|
2019-04-18 12:02:30 +00:00
|
|
|
oxr_handle_base.c
|
2019-05-07 12:47:18 +00:00
|
|
|
oxr_input.c
|
2020-06-15 15:58:48 +00:00
|
|
|
oxr_input_transform.c
|
|
|
|
oxr_input_transform.h
|
2019-04-18 12:02:30 +00:00
|
|
|
oxr_instance.c
|
2019-10-08 14:35:16 +00:00
|
|
|
oxr_logger.c
|
2019-04-18 12:02:30 +00:00
|
|
|
oxr_logger.h
|
|
|
|
oxr_objects.h
|
|
|
|
oxr_path.c
|
|
|
|
oxr_session.c
|
|
|
|
oxr_space.c
|
|
|
|
oxr_swapchain.c
|
|
|
|
oxr_system.c
|
|
|
|
oxr_two_call.h
|
2019-10-08 14:40:40 +00:00
|
|
|
oxr_verify.c
|
2019-05-07 12:47:18 +00:00
|
|
|
oxr_xdev.c
|
2019-04-18 12:02:30 +00:00
|
|
|
)
|
|
|
|
|
2020-07-16 10:17:30 +00:00
|
|
|
if(XRT_HAVE_VULKAN)
|
|
|
|
list(APPEND OXR_SOURCE_FILES
|
|
|
|
oxr_session_vk.c
|
|
|
|
oxr_swapchain_vk.c
|
|
|
|
oxr_vulkan.c
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-04-29 23:11:43 +00:00
|
|
|
if(XRT_HAVE_OPENGL)
|
2020-07-16 22:22:59 +00:00
|
|
|
add_definitions(-DXR_USE_GRAPHICS_API_OPENGL)
|
|
|
|
endif()
|
|
|
|
if(XRT_HAVE_OPENGLES)
|
|
|
|
add_definitions(-DXR_USE_GRAPHICS_API_OPENGL_ES)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES)
|
2019-12-03 22:33:16 +00:00
|
|
|
list(APPEND OXR_SOURCE_FILES
|
|
|
|
oxr_session_gl.c
|
|
|
|
oxr_swapchain_gl.c
|
|
|
|
)
|
2019-12-03 23:40:38 +00:00
|
|
|
endif()
|
|
|
|
|
2020-04-29 23:11:43 +00:00
|
|
|
if(XRT_HAVE_XLIB)
|
2019-12-03 23:40:38 +00:00
|
|
|
add_definitions(-DXR_USE_PLATFORM_XLIB)
|
|
|
|
endif()
|
|
|
|
|
2020-04-29 23:11:43 +00:00
|
|
|
if(XRT_HAVE_EGL)
|
2019-12-03 23:40:38 +00:00
|
|
|
add_definitions(-DXR_USE_PLATFORM_EGL)
|
2019-12-03 22:33:16 +00:00
|
|
|
list(APPEND OXR_SOURCE_FILES oxr_session_egl.c)
|
2019-12-03 23:40:38 +00:00
|
|
|
endif()
|
|
|
|
|
2020-07-16 22:24:02 +00:00
|
|
|
|
|
|
|
if(ANDROID)
|
|
|
|
add_definitions(-DXR_USE_PLATFORM_ANDROID)
|
2020-08-14 23:07:14 +00:00
|
|
|
list(APPEND OXR_SOURCE_FILES
|
|
|
|
oxr_session_gles_android.c
|
|
|
|
)
|
2020-07-16 22:24:02 +00:00
|
|
|
endif()
|
|
|
|
|
2020-03-03 23:24:39 +00:00
|
|
|
add_library(st_oxr STATIC ${OXR_SOURCE_FILES})
|
2020-06-01 08:54:15 +00:00
|
|
|
target_link_libraries(st_oxr PRIVATE
|
|
|
|
xrt-interfaces
|
|
|
|
xrt-external-openxr
|
|
|
|
aux_util
|
|
|
|
aux_math
|
|
|
|
comp_client
|
2020-07-16 03:10:37 +00:00
|
|
|
PUBLIC
|
|
|
|
aux_os
|
|
|
|
Vulkan::Vulkan
|
2020-06-01 08:54:15 +00:00
|
|
|
)
|
2020-07-16 10:17:30 +00:00
|
|
|
if(XRT_HAVE_VULKAN)
|
|
|
|
target_link_libraries(st_oxr PRIVATE Vulkan::Vulkan)
|
|
|
|
endif()
|
2020-08-14 23:07:14 +00:00
|
|
|
if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES)
|
|
|
|
target_link_libraries(st_oxr PRIVATE aux_ogl)
|
|
|
|
endif()
|
2020-08-19 20:56:38 +00:00
|
|
|
if(ANDROID)
|
|
|
|
target_link_libraries(st_oxr PRIVATE aux_android)
|
|
|
|
endif()
|
2020-06-15 15:58:48 +00:00
|
|
|
target_include_directories(st_oxr
|
|
|
|
PRIVATE
|
2020-06-01 08:54:15 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2020-06-15 15:58:48 +00:00
|
|
|
INTERFACE
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/..)
|