-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into openxr_layer
- Loading branch information
Showing
2,585 changed files
with
469,519 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
set(PACKAGE_VERSION "23.4.0") | ||
set(${PACKAGE_FIND_NAME}_VERSION_PRERELEASE "" PARENT_SCOPE) | ||
|
||
# Prerelease versions cannot be passed in directly via the find_package command, | ||
# so we allow users to specify it in a variable | ||
if(NOT DEFINED "${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE") | ||
set("${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}" "") | ||
else() | ||
set(PACKAGE_FIND_VERSION ${PACKAGE_FIND_VERSION}-${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}) | ||
endif() | ||
set(PACKAGE_FIND_VERSION_PRERELEASE "${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}") | ||
|
||
# VERSION_EQUAL ignores the prerelease strings, so we use STREQUAL. | ||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) | ||
set(PACKAGE_VERSION_EXACT TRUE) | ||
endif() | ||
|
||
set(PACKAGE_VERSION_COMPATIBLE TRUE) #Assume true until shown otherwise | ||
|
||
if(PACKAGE_FIND_VERSION) #Only perform version checks if one is given | ||
if(NOT PACKAGE_FIND_VERSION_MAJOR EQUAL "4") | ||
set(PACKAGE_VERSION_COMPATIBLE FALSE) | ||
elseif(PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) | ||
set(PACKAGE_VERSION_COMPATIBLE FALSE) | ||
elseif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) | ||
# Do not match prerelease versions to non-prerelease version requests. | ||
if(NOT "" STREQUAL "" AND PACKAGE_FIND_VERSION_PRERELEASE STREQUAL "") | ||
message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAME}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '' or greater.") | ||
set(PACKAGE_VERSION_COMPATIBLE FALSE) | ||
endif() | ||
|
||
# Not robustly SemVer compliant, but protobuf never uses '.' separated prerelease identifiers. | ||
if(PACKAGE_FIND_VERSION_PRERELEASE STRGREATER "") | ||
set(PACKAGE_VERSION_COMPATIBLE FALSE) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
# Check and save build options used to create this package | ||
macro(_check_and_save_build_option OPTION VALUE) | ||
if(DEFINED ${PACKAGE_FIND_NAME}_${OPTION} AND | ||
NOT ${PACKAGE_FIND_NAME}_${OPTION} STREQUAL ${VALUE}) | ||
set(PACKAGE_VERSION_UNSUITABLE TRUE) | ||
endif() | ||
set(${PACKAGE_FIND_NAME}_${OPTION} ${VALUE} PARENT_SCOPE) | ||
endmacro() | ||
_check_and_save_build_option(WITH_ZLIB OFF) | ||
_check_and_save_build_option(MSVC_STATIC_RUNTIME OFF) | ||
_check_and_save_build_option(BUILD_SHARED_LIBS OFF) | ||
|
||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: | ||
if(CMAKE_SIZEOF_VOID_P AND "8") | ||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching: | ||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL "8") | ||
math(EXPR installedBits "8 * 8") | ||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") | ||
set(PACKAGE_VERSION_UNSUITABLE TRUE) | ||
endif() | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# User options | ||
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake") | ||
|
||
# Depend packages | ||
|
||
if(NOT TARGET absl::strings) | ||
find_package(absl CONFIG) | ||
endif() | ||
if(NOT TARGET utf8_range) | ||
find_package(utf8_range CONFIG) | ||
endif() | ||
|
||
# Imported targets | ||
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake") | ||
|
||
# protobuf-generate function | ||
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-generate.cmake") | ||
|
||
# CMake FindProtobuf module compatible file | ||
if(protobuf_MODULE_COMPATIBLE) | ||
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
function(protobuf_generate) | ||
include(CMakeParseArguments) | ||
|
||
set(_options APPEND_PATH) | ||
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES) | ||
if(COMMAND target_sources) | ||
list(APPEND _singleargs TARGET) | ||
endif() | ||
set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS) | ||
|
||
cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") | ||
|
||
if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET) | ||
message(SEND_ERROR "Error: protobuf_generate called without any targets or source files") | ||
return() | ||
endif() | ||
|
||
if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET) | ||
message(SEND_ERROR "Error: protobuf_generate called without a target or output variable") | ||
return() | ||
endif() | ||
|
||
if(NOT protobuf_generate_LANGUAGE) | ||
set(protobuf_generate_LANGUAGE cpp) | ||
endif() | ||
string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE) | ||
|
||
if(NOT protobuf_generate_PROTOC_OUT_DIR) | ||
set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) | ||
endif() | ||
|
||
if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) | ||
set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}") | ||
endif() | ||
|
||
foreach(_option ${_dll_export_decl} ${protobuf_generate_PLUGIN_OPTIONS}) | ||
# append comma - not using CMake lists and string replacement as users | ||
# might have semicolons in options | ||
if(_plugin_options) | ||
set( _plugin_options "${_plugin_options},") | ||
endif() | ||
set(_plugin_options "${_plugin_options}${_option}") | ||
endforeach() | ||
|
||
if(protobuf_generate_PLUGIN) | ||
set(_plugin "--plugin=${protobuf_generate_PLUGIN}") | ||
endif() | ||
|
||
if(NOT protobuf_generate_GENERATE_EXTENSIONS) | ||
if(protobuf_generate_LANGUAGE STREQUAL cpp) | ||
set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc) | ||
elseif(protobuf_generate_LANGUAGE STREQUAL python) | ||
set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py) | ||
else() | ||
message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") | ||
return() | ||
endif() | ||
endif() | ||
|
||
if(protobuf_generate_TARGET) | ||
get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) | ||
foreach(_file ${_source_list}) | ||
if(_file MATCHES "proto$") | ||
list(APPEND protobuf_generate_PROTOS ${_file}) | ||
endif() | ||
endforeach() | ||
endif() | ||
|
||
if(NOT protobuf_generate_PROTOS) | ||
message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") | ||
return() | ||
endif() | ||
|
||
if(protobuf_generate_APPEND_PATH) | ||
# Create an include path for each file specified | ||
foreach(_file ${protobuf_generate_PROTOS}) | ||
get_filename_component(_abs_file ${_file} ABSOLUTE) | ||
get_filename_component(_abs_dir ${_abs_file} DIRECTORY) | ||
list(FIND _protobuf_include_path ${_abs_dir} _contains_already) | ||
if(${_contains_already} EQUAL -1) | ||
list(APPEND _protobuf_include_path -I ${_abs_dir}) | ||
endif() | ||
endforeach() | ||
endif() | ||
|
||
foreach(DIR ${protobuf_generate_IMPORT_DIRS}) | ||
get_filename_component(ABS_PATH ${DIR} ABSOLUTE) | ||
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) | ||
if(${_contains_already} EQUAL -1) | ||
list(APPEND _protobuf_include_path -I ${ABS_PATH}) | ||
endif() | ||
endforeach() | ||
|
||
if(NOT _protobuf_include_path) | ||
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) | ||
endif() | ||
|
||
set(_generated_srcs_all) | ||
foreach(_proto ${protobuf_generate_PROTOS}) | ||
get_filename_component(_abs_file ${_proto} ABSOLUTE) | ||
get_filename_component(_abs_dir ${_abs_file} DIRECTORY) | ||
|
||
get_filename_component(_file_full_name ${_proto} NAME) | ||
string(FIND "${_file_full_name}" "." _file_last_ext_pos REVERSE) | ||
string(SUBSTRING "${_file_full_name}" 0 ${_file_last_ext_pos} _basename) | ||
|
||
set(_suitable_include_found FALSE) | ||
foreach(DIR ${_protobuf_include_path}) | ||
if(NOT DIR STREQUAL "-I") | ||
file(RELATIVE_PATH _rel_dir ${DIR} ${_abs_dir}) | ||
string(FIND "${_rel_dir}" "../" _is_in_parent_folder) | ||
if (NOT ${_is_in_parent_folder} EQUAL 0) | ||
set(_suitable_include_found TRUE) | ||
break() | ||
endif() | ||
endif() | ||
endforeach() | ||
|
||
if(NOT _suitable_include_found) | ||
message(SEND_ERROR "Error: protobuf_generate could not find any correct proto include directory.") | ||
return() | ||
endif() | ||
|
||
set(_generated_srcs) | ||
foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) | ||
list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") | ||
endforeach() | ||
list(APPEND _generated_srcs_all ${_generated_srcs}) | ||
|
||
set(_comment "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}") | ||
if(protobuf_generate_PROTOC_OPTIONS) | ||
set(_comment "${_comment}, protoc-options: ${protobuf_generate_PROTOC_OPTIONS}") | ||
endif() | ||
if(_plugin_options) | ||
set(_comment "${_comment}, plugin-options: ${_plugin_options}") | ||
endif() | ||
|
||
add_custom_command( | ||
OUTPUT ${_generated_srcs} | ||
COMMAND protobuf::protoc | ||
ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file} | ||
DEPENDS ${_abs_file} ${protobuf_PROTOC_EXE} ${protobuf_generate_DEPENDENCIES} | ||
COMMENT ${_comment} | ||
VERBATIM ) | ||
endforeach() | ||
|
||
set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE) | ||
if(protobuf_generate_OUT_VAR) | ||
set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE) | ||
endif() | ||
if(protobuf_generate_TARGET) | ||
target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all}) | ||
endif() | ||
|
||
endfunction() |
Oops, something went wrong.