cmake: Cleanup vlk_get_header_version
This commit is contained in:
parent
1a8e782743
commit
bc6beaa960
@ -16,8 +16,6 @@
|
|||||||
# ~~~
|
# ~~~
|
||||||
cmake_minimum_required(VERSION 3.10.2)
|
cmake_minimum_required(VERSION 3.10.2)
|
||||||
|
|
||||||
# Written as a function to minimize variable scope
|
|
||||||
# Only VK_VERSION_STRING will be returned to the PARENT_SCOPE
|
|
||||||
function(vlk_get_header_version)
|
function(vlk_get_header_version)
|
||||||
set(vulkan_core_header_file "${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan/vulkan_core.h")
|
set(vulkan_core_header_file "${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan/vulkan_core.h")
|
||||||
if (NOT EXISTS ${vulkan_core_header_file})
|
if (NOT EXISTS ${vulkan_core_header_file})
|
||||||
@ -26,7 +24,6 @@ function(vlk_get_header_version)
|
|||||||
|
|
||||||
file(READ ${vulkan_core_header_file} ver)
|
file(READ ${vulkan_core_header_file} ver)
|
||||||
|
|
||||||
# Get the major/minor version
|
|
||||||
if (ver MATCHES "#define[ ]+VK_HEADER_VERSION_COMPLETE[ ]+VK_MAKE_API_VERSION\\([ ]*[0-9]+,[ ]*([0-9]+),[ ]*([0-9]+),[ ]*VK_HEADER_VERSION[ ]*\\)")
|
if (ver MATCHES "#define[ ]+VK_HEADER_VERSION_COMPLETE[ ]+VK_MAKE_API_VERSION\\([ ]*[0-9]+,[ ]*([0-9]+),[ ]*([0-9]+),[ ]*VK_HEADER_VERSION[ ]*\\)")
|
||||||
set(VK_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
set(VK_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||||
set(VK_VERSION_MINOR "${CMAKE_MATCH_2}")
|
set(VK_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||||
@ -34,14 +31,13 @@ function(vlk_get_header_version)
|
|||||||
message(FATAL_ERROR "Couldn't get major/minor version")
|
message(FATAL_ERROR "Couldn't get major/minor version")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Get the patch version
|
|
||||||
if (ver MATCHES "#define[ ]+VK_HEADER_VERSION[ ]+([0-9]+)")
|
if (ver MATCHES "#define[ ]+VK_HEADER_VERSION[ ]+([0-9]+)")
|
||||||
set(VK_HEADER_VERSION "${CMAKE_MATCH_1}")
|
set(VK_PATCH_VERSION "${CMAKE_MATCH_1}")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Couldn't get the patch version")
|
message(FATAL_ERROR "Couldn't get the patch version")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(VK_VERSION_STRING "${VK_VERSION_MAJOR}.${VK_VERSION_MINOR}.${VK_HEADER_VERSION}" PARENT_SCOPE)
|
set(VK_VERSION_STRING "${VK_VERSION_MAJOR}.${VK_VERSION_MINOR}.${VK_PATCH_VERSION}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
vlk_get_header_version()
|
vlk_get_header_version()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user