Addded depenendency load tool

Added simple python script that will load needed libraries into
the project folder structure. Most libraries are now not needed to be
present in development system.
This commit is contained in:
Piotr Krygier committed 2023-08-07 13:48:30 +02:00
1 parent 320c9293b1
commit a82550d414
18 files changed
+1992 -19594

No files matched your search

+4 -1
View File
@@ -36,4 +36,7 @@ build/*
bin/*
# VSCode configurations
.vscode/
.vscode/
# Third party libraires
third_party/
+1 -1
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.12)
project("RedScarfEngine"
VERSION 0.0.1
DESCRIPTION "Vulkan based 3D engine"
+611
View File
@@ -0,0 +1,611 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPackageHandleStandardArgs
-----------------------------
This module provides functions intended to be used in :ref:`Find Modules`
implementing :command:`find_package(<PackageName>)` calls.
.. command:: find_package_handle_standard_args
This command handles the ``REQUIRED``, ``QUIET`` and version-related
arguments of :command:`find_package`. It also sets the
``<PackageName>_FOUND`` variable. The package is considered found if all
variables listed contain valid results, e.g. valid filepaths.
There are two signatures:
.. code-block:: cmake
find_package_handle_standard_args(<PackageName>
(DEFAULT_MSG|<custom-failure-message>)
<required-var>...
)
find_package_handle_standard_args(<PackageName>
[FOUND_VAR <result-var>]
[REQUIRED_VARS <required-var>...]
[VERSION_VAR <version-var>]
[HANDLE_VERSION_RANGE]
[HANDLE_COMPONENTS]
[CONFIG_MODE]
[NAME_MISMATCHED]
[REASON_FAILURE_MESSAGE <reason-failure-message>]
[FAIL_MESSAGE <custom-failure-message>]
)
The ``<PackageName>_FOUND`` variable will be set to ``TRUE`` if all
the variables ``<required-var>...`` are valid and any optional
constraints are satisfied, and ``FALSE`` otherwise. A success or
failure message may be displayed based on the results and on
whether the ``REQUIRED`` and/or ``QUIET`` option was given to
the :command:`find_package` call.
The options are:
``(DEFAULT_MSG|<custom-failure-message>)``
In the simple signature this specifies the failure message.
Use ``DEFAULT_MSG`` to ask for a default message to be computed
(recommended). Not valid in the full signature.
``FOUND_VAR <result-var>``
.. deprecated:: 3.3
Specifies either ``<PackageName>_FOUND`` or
``<PACKAGENAME>_FOUND`` as the result variable. This exists only
for compatibility with older versions of CMake and is now ignored.
Result variables of both names are always set for compatibility.
``REQUIRED_VARS <required-var>...``
Specify the variables which are required for this package.
These may be named in the generated failure message asking the
user to set the missing variable values. Therefore these should
typically be cache entries such as ``FOO_LIBRARY`` and not output
variables like ``FOO_LIBRARIES``.
.. versionchanged:: 3.18
If ``HANDLE_COMPONENTS`` is specified, this option can be omitted.
``VERSION_VAR <version-var>``
Specify the name of a variable that holds the version of the package
that has been found. This version will be checked against the
(potentially) specified required version given to the
:command:`find_package` call, including its ``EXACT`` option.
The default messages include information about the required
version and the version which has been actually found, both
if the version is ok or not.
``HANDLE_VERSION_RANGE``
.. versionadded:: 3.19
Enable handling of a version range, if one is specified. Without this
option, a developer warning will be displayed if a version range is
specified.
``HANDLE_COMPONENTS``
Enable handling of package components. In this case, the command
will report which components have been found and which are missing,
and the ``<PackageName>_FOUND`` variable will be set to ``FALSE``
if any of the required components (i.e. not the ones listed after
the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are
missing.
``CONFIG_MODE``
Specify that the calling find module is a wrapper around a
call to ``find_package(<PackageName> NO_MODULE)``. This implies
a ``VERSION_VAR`` value of ``<PackageName>_VERSION``. The command
will automatically check whether the package configuration file
was found.
``REASON_FAILURE_MESSAGE <reason-failure-message>``
.. versionadded:: 3.16
Specify a custom message of the reason for the failure which will be
appended to the default generated message.
``FAIL_MESSAGE <custom-failure-message>``
Specify a custom failure message instead of using the default
generated message. Not recommended.
``NAME_MISMATCHED``
.. versionadded:: 3.17
Indicate that the ``<PackageName>`` does not match
``${CMAKE_FIND_PACKAGE_NAME}``. This is usually a mistake and raises a
warning, but it may be intentional for usage of the command for components
of a larger package.
Example for the simple signature:
.. code-block:: cmake
find_package_handle_standard_args(LibXml2 DEFAULT_MSG
LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
The ``LibXml2`` package is considered to be found if both
``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid.
Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found
and ``REQUIRED`` was used, it fails with a
:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was
used or not. If it is found, success will be reported, including
the content of the first ``<required-var>``. On repeated CMake runs,
the same message will not be printed again.
.. note::
If ``<PackageName>`` does not match ``CMAKE_FIND_PACKAGE_NAME`` for the
calling module, a warning that there is a mismatch is given. The
``FPHSA_NAME_MISMATCHED`` variable may be set to bypass the warning if using
the old signature and the ``NAME_MISMATCHED`` argument using the new
signature. To avoid forcing the caller to require newer versions of CMake for
usage, the variable's value will be used if defined when the
``NAME_MISMATCHED`` argument is not passed for the new signature (but using
both is an error)..
Example for the full signature:
.. code-block:: cmake
find_package_handle_standard_args(LibArchive
REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
VERSION_VAR LibArchive_VERSION)
In this case, the ``LibArchive`` package is considered to be found if
both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid.
Also the version of ``LibArchive`` will be checked by using the version
contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given,
the default messages will be printed.
Another example for the full signature:
.. code-block:: cmake
find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
find_package_handle_standard_args(Automoc4 CONFIG_MODE)
In this case, a ``FindAutmoc4.cmake`` module wraps a call to
``find_package(Automoc4 NO_MODULE)`` and adds an additional search
directory for ``automoc4``. Then the call to
``find_package_handle_standard_args`` produces a proper success/failure
message.
.. command:: find_package_check_version
.. versionadded:: 3.19
Helper function which can be used to check if a ``<version>`` is valid
against version-related arguments of :command:`find_package`.
.. code-block:: cmake
find_package_check_version(<version> <result-var>
[HANDLE_VERSION_RANGE]
[RESULT_MESSAGE_VARIABLE <message-var>]
)
The ``<result-var>`` will hold a boolean value giving the result of the check.
The options are:
``HANDLE_VERSION_RANGE``
Enable handling of a version range, if one is specified. Without this
option, a developer warning will be displayed if a version range is
specified.
``RESULT_MESSAGE_VARIABLE <message-var>``
Specify a variable to get back a message describing the result of the check.
Example for the usage:
.. code-block:: cmake
find_package_check_version(1.2.3 result HANDLE_VERSION_RANGE
RESULT_MESSAGE_VARIABLE reason)
if (result)
message (STATUS "${reason}")
else()
message (FATAL_ERROR "${reason}")
endif()
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
cmake_policy(PUSH)
# numbers and boolean constants
cmake_policy (SET CMP0012 NEW)
# IN_LIST operator
cmake_policy (SET CMP0057 NEW)
# internal helper macro
macro(_FPHSA_FAILURE_MESSAGE _msg)
set (__msg "${_msg}")
if (FPHSA_REASON_FAILURE_MESSAGE)
string(APPEND __msg "\n Reason given by package: ${FPHSA_REASON_FAILURE_MESSAGE}\n")
endif()
if (${_NAME}_FIND_REQUIRED)
message(FATAL_ERROR "${__msg}")
else ()
if (NOT ${_NAME}_FIND_QUIETLY)
message(STATUS "${__msg}")
endif ()
endif ()
endmacro()
# internal helper macro to generate the failure message when used in CONFIG_MODE:
macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
# <PackageName>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
if(${_NAME}_CONFIG)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
else()
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
# List them all in the error message:
if(${_NAME}_CONSIDERED_CONFIGS)
set(configsText "")
list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
math(EXPR configsCount "${configsCount} - 1")
foreach(currentConfigIndex RANGE ${configsCount})
list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
string(APPEND configsText "\n ${filename} (version ${version})")
endforeach()
if (${_NAME}_NOT_FOUND_MESSAGE)
if (FPHSA_REASON_FAILURE_MESSAGE)
string(PREPEND FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}\n ")
else()
set(FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}")
endif()
else()
string(APPEND configsText "\n")
endif()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:${configsText}")
else()
# Simple case: No Config-file was found at all:
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
endif()
endif()
endmacro()
function(FIND_PACKAGE_CHECK_VERSION version result)
cmake_parse_arguments (PARSE_ARGV 2 FPCV "HANDLE_VERSION_RANGE;NO_AUTHOR_WARNING_VERSION_RANGE" "RESULT_MESSAGE_VARIABLE" "")
if (FPCV_UNPARSED_ARGUMENTS)
message (FATAL_ERROR "find_package_check_version(): ${FPCV_UNPARSED_ARGUMENTS}: unexpected arguments")
endif()
if ("RESULT_MESSAGE_VARIABLE" IN_LIST FPCV_KEYWORDS_MISSING_VALUES)
message (FATAL_ERROR "find_package_check_version(): RESULT_MESSAGE_VARIABLE expects an argument")
endif()
set (${result} FALSE PARENT_SCOPE)
if (FPCV_RESULT_MESSAGE_VARIABLE)
unset (${FPCV_RESULT_MESSAGE_VARIABLE} PARENT_SCOPE)
endif()
if (_CMAKE_FPHSA_PACKAGE_NAME)
set (package "${_CMAKE_FPHSA_PACKAGE_NAME}")
elseif (CMAKE_FIND_PACKAGE_NAME)
set (package "${CMAKE_FIND_PACKAGE_NAME}")
else()
message (FATAL_ERROR "find_package_check_version(): Cannot be used outside a 'Find Module'")
endif()
if (NOT FPCV_NO_AUTHOR_WARNING_VERSION_RANGE
AND ${package}_FIND_VERSION_RANGE AND NOT FPCV_HANDLE_VERSION_RANGE)
message(AUTHOR_WARNING
"`find_package()` specify a version range but the option "
"HANDLE_VERSION_RANGE` is not passed to `find_package_check_version()`. "
"Only the lower endpoint of the range will be used.")
endif()
set (version_ok FALSE)
unset (version_msg)
if (FPCV_HANDLE_VERSION_RANGE AND ${package}_FIND_VERSION_RANGE)
if ((${package}_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE"
AND version VERSION_GREATER_EQUAL ${package}_FIND_VERSION_MIN)
AND ((${package}_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
AND version VERSION_LESS_EQUAL ${package}_FIND_VERSION_MAX)
OR (${package}_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
AND version VERSION_LESS ${package}_FIND_VERSION_MAX)))
set (version_ok TRUE)
set(version_msg "(found suitable version \"${version}\", required range is \"${${package}_FIND_VERSION_RANGE}\")")
else()
set(version_msg "Found unsuitable version \"${version}\", required range is \"${${package}_FIND_VERSION_RANGE}\"")
endif()
elseif (DEFINED ${package}_FIND_VERSION)
if(${package}_FIND_VERSION_EXACT) # exact version required
# count the dots in the version string
string(REGEX REPLACE "[^.]" "" version_dots "${version}")
# add one dot because there is one dot more than there are components
string(LENGTH "${version_dots}." version_dots)
if (version_dots GREATER ${package}_FIND_VERSION_COUNT)
# Because of the C++ implementation of find_package() ${package}_FIND_VERSION_COUNT
# is at most 4 here. Therefore a simple lookup table is used.
if (${package}_FIND_VERSION_COUNT EQUAL 1)
set(version_regex "[^.]*")
elseif (${package}_FIND_VERSION_COUNT EQUAL 2)
set(version_regex "[^.]*\\.[^.]*")
elseif (${package}_FIND_VERSION_COUNT EQUAL 3)
set(version_regex "[^.]*\\.[^.]*\\.[^.]*")
else()
set(version_regex "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
endif()
string(REGEX REPLACE "^(${version_regex})\\..*" "\\1" version_head "${version}")
if (NOT ${package}_FIND_VERSION VERSION_EQUAL version_head)
set(version_msg "Found unsuitable version \"${version}\", but required is exact version \"${${package}_FIND_VERSION}\"")
else ()
set(version_ok TRUE)
set(version_msg "(found suitable exact version \"${_FOUND_VERSION}\")")
endif ()
else ()
if (NOT ${package}_FIND_VERSION VERSION_EQUAL version)
set(version_msg "Found unsuitable version \"${version}\", but required is exact version \"${${package}_FIND_VERSION}\"")
else ()
set(version_ok TRUE)
set(version_msg "(found suitable exact version \"${version}\")")
endif ()
endif ()
else() # minimum version
if (${package}_FIND_VERSION VERSION_GREATER version)
set(version_msg "Found unsuitable version \"${version}\", but required is at least \"${${package}_FIND_VERSION}\"")
else()
set(version_ok TRUE)
set(version_msg "(found suitable version \"${version}\", minimum required is \"${${package}_FIND_VERSION}\")")
endif()
endif()
else ()
set(version_ok TRUE)
set(version_msg "(found version \"${version}\")")
endif()
set (${result} ${version_ok} PARENT_SCOPE)
if (FPCV_RESULT_MESSAGE_VARIABLE)
set (${FPCV_RESULT_MESSAGE_VARIABLE} "${version_msg}" PARENT_SCOPE)
endif()
endfunction()
function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# Set up the arguments for `cmake_parse_arguments`.
set(options CONFIG_MODE HANDLE_COMPONENTS NAME_MISMATCHED HANDLE_VERSION_RANGE)
set(oneValueArgs FAIL_MESSAGE REASON_FAILURE_MESSAGE VERSION_VAR FOUND_VAR)
set(multiValueArgs REQUIRED_VARS)
# Check whether we are in 'simple' or 'extended' mode:
set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
unset(FPHSA_NAME_MISMATCHED_override)
if (DEFINED FPHSA_NAME_MISMATCHED)
# If the variable NAME_MISMATCHED variable is set, error if it is passed as
# an argument. The former is for old signatures, the latter is for new
# signatures.
list(FIND ARGN "NAME_MISMATCHED" name_mismatched_idx)
if (NOT name_mismatched_idx EQUAL "-1")
message(FATAL_ERROR
"The `NAME_MISMATCHED` argument may only be specified by the argument or "
"the variable, not both.")
endif ()
# But use the variable if it is not an argument to avoid forcing minimum
# CMake version bumps for calling modules.
set(FPHSA_NAME_MISMATCHED_override "${FPHSA_NAME_MISMATCHED}")
endif ()
if(${INDEX} EQUAL -1)
set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
set(FPHSA_REQUIRED_VARS ${ARGN})
set(FPHSA_VERSION_VAR)
else()
cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
if(FPHSA_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
endif()
if(NOT FPHSA_FAIL_MESSAGE)
set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
endif()
# In config-mode, we rely on the variable <PackageName>_CONFIG, which is set by find_package()
# when it successfully found the config-file, including version checking:
if(FPHSA_CONFIG_MODE)
list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
set(FPHSA_VERSION_VAR ${_NAME}_VERSION)
endif()
if(NOT FPHSA_REQUIRED_VARS AND NOT FPHSA_HANDLE_COMPONENTS)
message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
endif()
endif()
if (DEFINED FPHSA_NAME_MISMATCHED_override)
set(FPHSA_NAME_MISMATCHED "${FPHSA_NAME_MISMATCHED_override}")
endif ()
if (DEFINED CMAKE_FIND_PACKAGE_NAME
AND NOT FPHSA_NAME_MISMATCHED
AND NOT _NAME STREQUAL CMAKE_FIND_PACKAGE_NAME)
message(AUTHOR_WARNING
"The package name passed to `find_package_handle_standard_args` "
"(${_NAME}) does not match the name of the calling package "
"(${CMAKE_FIND_PACKAGE_NAME}). This can lead to problems in calling "
"code that expects `find_package` result variables (e.g., `_FOUND`) "
"to follow a certain pattern.")
endif ()
if (${_NAME}_FIND_VERSION_RANGE AND NOT FPHSA_HANDLE_VERSION_RANGE)
message(AUTHOR_WARNING
"`find_package()` specify a version range but the module ${_NAME} does "
"not support this capability. Only the lower endpoint of the range "
"will be used.")
endif()
# to propagate package name to FIND_PACKAGE_CHECK_VERSION
set(_CMAKE_FPHSA_PACKAGE_NAME "${_NAME}")
# now that we collected all arguments, process them
if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
endif()
if (FPHSA_REQUIRED_VARS)
list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
endif()
string(TOUPPER ${_NAME} _NAME_UPPER)
string(TOLOWER ${_NAME} _NAME_LOWER)
if(FPHSA_FOUND_VAR)
set(_FOUND_VAR_UPPER ${_NAME_UPPER}_FOUND)
set(_FOUND_VAR_MIXED ${_NAME}_FOUND)
if(FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED OR FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER)
set(_FOUND_VAR ${FPHSA_FOUND_VAR})
else()
message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_FOUND_VAR_MIXED}\" and \"${_FOUND_VAR_UPPER}\" are valid names.")
endif()
else()
set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
endif()
# collect all variables which were not found, so they can be printed, so the
# user knows better what went wrong (#6375)
set(MISSING_VARS "")
set(DETAILS "")
# check if all passed variables are valid
set(FPHSA_FOUND_${_NAME} TRUE)
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
if(NOT ${_CURRENT_VAR})
set(FPHSA_FOUND_${_NAME} FALSE)
string(APPEND MISSING_VARS " ${_CURRENT_VAR}")
else()
string(APPEND DETAILS "[${${_CURRENT_VAR}}]")
endif()
endforeach()
if(FPHSA_FOUND_${_NAME})
set(${_NAME}_FOUND TRUE)
set(${_NAME_UPPER}_FOUND TRUE)
else()
set(${_NAME}_FOUND FALSE)
set(${_NAME_UPPER}_FOUND FALSE)
endif()
# component handling
unset(FOUND_COMPONENTS_MSG)
unset(MISSING_COMPONENTS_MSG)
if(FPHSA_HANDLE_COMPONENTS)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(${_NAME}_${comp}_FOUND)
if(NOT DEFINED FOUND_COMPONENTS_MSG)
set(FOUND_COMPONENTS_MSG "found components:")
endif()
string(APPEND FOUND_COMPONENTS_MSG " ${comp}")
else()
if(NOT DEFINED MISSING_COMPONENTS_MSG)
set(MISSING_COMPONENTS_MSG "missing components:")
endif()
string(APPEND MISSING_COMPONENTS_MSG " ${comp}")
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
string(APPEND MISSING_VARS " ${comp}")
endif()
endif()
endforeach()
set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
string(APPEND DETAILS "[c${COMPONENT_MSG}]")
endif()
# version handling:
set(VERSION_MSG "")
set(VERSION_OK TRUE)
# check that the version variable is not empty to avoid emitting a misleading
# message (i.e. `Found unsuitable version ""`)
if (DEFINED ${_NAME}_FIND_VERSION)
if(DEFINED ${FPHSA_VERSION_VAR})
if(NOT "${${FPHSA_VERSION_VAR}}" STREQUAL "")
set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}})
if (FPHSA_HANDLE_VERSION_RANGE)
set (FPCV_HANDLE_VERSION_RANGE HANDLE_VERSION_RANGE)
else()
set(FPCV_HANDLE_VERSION_RANGE NO_AUTHOR_WARNING_VERSION_RANGE)
endif()
find_package_check_version ("${_FOUND_VERSION}" VERSION_OK RESULT_MESSAGE_VARIABLE VERSION_MSG
${FPCV_HANDLE_VERSION_RANGE})
else()
set(VERSION_OK FALSE)
endif()
endif()
if("${${FPHSA_VERSION_VAR}}" STREQUAL "")
# if the package was not found, but a version was given, add that to the output:
if(${_NAME}_FIND_VERSION_EXACT)
set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
elseif (FPHSA_HANDLE_VERSION_RANGE AND ${_NAME}_FIND_VERSION_RANGE)
set(VERSION_MSG "(Required is version range \"${${_NAME}_FIND_VERSION_RANGE}\")")
else()
set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
endif()
endif()
else ()
# Check with DEFINED as the found version may be 0.
if(DEFINED ${FPHSA_VERSION_VAR})
set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")")
endif()
endif ()
if(VERSION_OK)
string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]")
else()
set(${_NAME}_FOUND FALSE)
endif()
# print the result:
if (${_NAME}_FOUND)
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
else ()
if(FPHSA_CONFIG_MODE)
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
else()
if(NOT VERSION_OK)
set(RESULT_MSG)
if (_FIRST_REQUIRED_VAR)
string (APPEND RESULT_MSG "found ${${_FIRST_REQUIRED_VAR}}")
endif()
if (COMPONENT_MSG)
if (RESULT_MSG)
string (APPEND RESULT_MSG ", ")
endif()
string (APPEND RESULT_MSG "${FOUND_COMPONENTS_MSG}")
endif()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (${RESULT_MSG})")
else()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}")
endif()
endif()
endif ()
set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
endfunction()
cmake_policy(POP)
+48
View File
@@ -0,0 +1,48 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPackageMessage
------------------
.. code-block:: cmake
find_package_message(<name> "message for user" "find result details")
This function is intended to be used in FindXXX.cmake modules files.
It will print a message once for each unique find result. This is
useful for telling the user where a package was found. The first
argument specifies the name (XXX) of the package. The second argument
specifies the message to display. The third argument lists details
about the find result so that if they change the message will be
displayed again. The macro also obeys the QUIET argument to the
find_package command.
Example:
.. code-block:: cmake
if(X11_FOUND)
find_package_message(X11 "Found X11: ${X11_X11_LIB}"
"[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
else()
...
endif()
#]=======================================================================]
function(find_package_message pkg msg details)
# Avoid printing a message repeatedly for the same find result.
if(NOT ${pkg}_FIND_QUIETLY)
string(REPLACE "\n" "" details "${details}")
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
# The message has not yet been printed.
message(STATUS "${msg}")
# Save the find details in the cache to avoid printing the same
# message again.
set("${DETAILS_VAR}" "${details}"
CACHE INTERNAL "Details about finding ${pkg}")
endif()
endif()
endfunction()
+897
View File
@@ -0,0 +1,897 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindVulkan
----------
.. versionadded:: 3.7
Find Vulkan, which is a low-overhead, cross-platform 3D graphics
and computing API.
Optional COMPONENTS
^^^^^^^^^^^^^^^^^^^
.. versionadded:: 3.24
This module respects several optional COMPONENTS.
There are corresponding imported targets for each of these.
``glslc``
The SPIR-V compiler.
``glslangValidator``
The ``glslangValidator`` tool.
``glslang``
The SPIR-V generator library.
``shaderc_combined``
The static library for Vulkan shader compilation.
``SPIRV-Tools``
Tools to process SPIR-V modules.
``MoltenVK``
On macOS, an additional component ``MoltenVK`` is available.
``dxc``
.. versionadded:: 3.25
The DirectX Shader Compiler.
The ``glslc`` and ``glslangValidator`` components are provided even
if not explicitly requested (for backward compatibility).
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` targets if Vulkan has been found:
``Vulkan::Vulkan``
The main Vulkan library.
``Vulkan::glslc``
.. versionadded:: 3.19
The GLSLC SPIR-V compiler, if it has been found.
``Vulkan::Headers``
.. versionadded:: 3.21
Provides just Vulkan headers include paths, if found. No library is
included in this target. This can be useful for applications that
load Vulkan library dynamically.
``Vulkan::glslangValidator``
.. versionadded:: 3.21
The glslangValidator tool, if found. It is used to compile GLSL and
HLSL shaders into SPIR-V.
``Vulkan::glslang``
.. versionadded:: 3.24
Defined if SDK has the Khronos-reference front-end shader parser and SPIR-V
generator library (glslang).
``Vulkan::shaderc_combined``
.. versionadded:: 3.24
Defined if SDK has the Google static library for Vulkan shader compilation
(shaderc_combined).
``Vulkan::SPIRV-Tools``
.. versionadded:: 3.24
Defined if SDK has the Khronos library to process SPIR-V modules
(SPIRV-Tools).
``Vulkan::MoltenVK``
.. versionadded:: 3.24
Defined if SDK has the Khronos library which implement a subset of Vulkan API
over Apple Metal graphics framework. (MoltenVK).
``Vulkan::volk``
.. versionadded:: 3.25
Defined if SDK has the Vulkan meta-loader (volk).
``Vulkan::dxc_lib``
.. versionadded:: 3.25
Defined if SDK has the DirectX shader compiler library.
``Vulkan::dxc_exe``
.. versionadded:: 3.25
Defined if SDK has the DirectX shader compiler CLI tool.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``Vulkan_FOUND``
set to true if Vulkan was found
``Vulkan_INCLUDE_DIRS``
include directories for Vulkan
``Vulkan_LIBRARIES``
link against this library to use Vulkan
``Vulkan_VERSION``
.. versionadded:: 3.23
value from ``vulkan/vulkan_core.h``
``Vulkan_glslc_FOUND``
.. versionadded:: 3.24
True, if the SDK has the glslc executable.
``Vulkan_glslangValidator_FOUND``
.. versionadded:: 3.24
True, if the SDK has the glslangValidator executable.
``Vulkan_glslang_FOUND``
.. versionadded:: 3.24
True, if the SDK has the glslang library.
``Vulkan_shaderc_combined_FOUND``
.. versionadded:: 3.24
True, if the SDK has the shaderc_combined library.
``Vulkan_SPIRV-Tools_FOUND``
.. versionadded:: 3.24
True, if the SDK has the SPIRV-Tools library.
``Vulkan_MoltenVK_FOUND``
.. versionadded:: 3.24
True, if the SDK has the MoltenVK library.
``Vulkan_volk_FOUND``
.. versionadded:: 3.25
True, if the SDK has the volk library.
``Vulkan_dxc_lib_FOUND``
.. versionadded:: 3.25
True, if the SDK has the DirectX shader compiler library.
``Vulkan_dxc_exe_FOUND``
.. versionadded:: 3.25
True, if the SDK has the DirectX shader compiler CLI tool.
The module will also defines these cache variables:
``Vulkan_INCLUDE_DIR``
the Vulkan include directory
``Vulkan_LIBRARY``
the path to the Vulkan library
``Vulkan_GLSLC_EXECUTABLE``
the path to the GLSL SPIR-V compiler
``Vulkan_GLSLANG_VALIDATOR_EXECUTABLE``
the path to the glslangValidator tool
``Vulkan_glslang_LIBRARY``
.. versionadded:: 3.24
Path to the glslang library.
``Vulkan_shaderc_combined_LIBRARY``
.. versionadded:: 3.24
Path to the shaderc_combined library.
``Vulkan_SPIRV-Tools_LIBRARY``
.. versionadded:: 3.24
Path to the SPIRV-Tools library.
``Vulkan_MoltenVK_LIBRARY``
.. versionadded:: 3.24
Path to the MoltenVK library.
``Vulkan_volk_LIBRARY``
.. versionadded:: 3.25
Path to the volk library.
``Vulkan_dxc_LIBRARY``
.. versionadded:: 3.25
Path to the DirectX shader compiler library.
``Vulkan_dxc_EXECUTABLE``
.. versionadded:: 3.25
Path to the DirectX shader compiler CLI tool.
Hints
^^^^^
.. versionadded:: 3.18
The ``VULKAN_SDK`` environment variable optionally specifies the
location of the Vulkan SDK root directory for the given
architecture. It is typically set by sourcing the toplevel
``setup-env.sh`` script of the Vulkan SDK directory into the shell
environment.
#]=======================================================================]
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)
set(VULKAN_SDK "${PROJECT_SOURCE_DIR}/third_party/vulkan/x86_64")
set(Vulkan_ROOT ${VULKAN_SDK})
# Provide compatibility with a common invalid component request that
# was silently ignored prior to CMake 3.24.
if("FATAL_ERROR" IN_LIST Vulkan_FIND_COMPONENTS)
message(AUTHOR_WARNING
"Ignoring unknown component 'FATAL_ERROR'.\n"
"The find_package() command documents no such argument."
)
list(REMOVE_ITEM Vulkan_FIND_COMPONENTS "FATAL_ERROR")
endif()
# For backward compatibility as `FindVulkan` in previous CMake versions allow to retrieve `glslc`
# and `glslangValidator` without requesting the corresponding component.
if(NOT glslc IN_LIST Vulkan_FIND_COMPONENTS)
list(APPEND Vulkan_FIND_COMPONENTS glslc)
endif()
if(NOT glslangValidator IN_LIST Vulkan_FIND_COMPONENTS)
list(APPEND Vulkan_FIND_COMPONENTS glslangValidator)
endif()
if(WIN32)
set(_Vulkan_library_name vulkan-1)
set(_Vulkan_hint_include_search_paths
"${VULKAN_SDK}/include"
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_Vulkan_hint_executable_search_paths
"${VULKAN_SDK}/bin"
)
set(_Vulkan_hint_library_search_paths
"${VULKAN_SDK}/lib"
"${VULKAN_SDK}/bin"
)
else()
set(_Vulkan_hint_executable_search_paths
"${VULKAN_SDK}/bin32"
"${VULKAN_SDK}/bin"
)
set(_Vulkan_hint_library_search_paths
"${VULKAN_SDK}/lib32"
"${VULKAN_SDK}/bin32"
"${VULKAN_SDK}/lib"
"${VULKAN_SDK}/bin"
)
endif()
else()
set(_Vulkan_library_name vulkan)
set(_Vulkan_hint_include_search_paths
"${VULKAN_SDK}/include"
)
set(_Vulkan_hint_executable_search_paths
"${VULKAN_SDK}/bin"
)
set(_Vulkan_hint_library_search_paths
"${VULKAN_SDK}/lib"
)
endif()
if(APPLE AND DEFINED {VULKAN_SDK})
cmake_path(SET _MoltenVK_path NORMALIZE "${VULKAN_SDK}/../MoltenVK")
if(EXISTS "${_MoltenVK_path}")
list(APPEND _Vulkan_hint_include_search_paths
"${_MoltenVK_path}/include"
)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
list(APPEND _Vulkan_hint_library_search_paths
"${_MoltenVK_path}/dylib/iOS"
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
list(APPEND _Vulkan_hint_library_search_paths
"${_MoltenVK_path}/dylib/tvOS"
)
else()
list(APPEND _Vulkan_hint_library_search_paths
"${_MoltenVK_path}/dylib/macOS"
)
endif()
endif()
unset(_MoltenVK_path)
endif()
find_path(Vulkan_INCLUDE_DIR
NAMES vulkan/vulkan.h
HINTS
${_Vulkan_hint_include_search_paths}
)
mark_as_advanced(Vulkan_INCLUDE_DIR)
find_library(Vulkan_LIBRARY
NAMES ${_Vulkan_library_name}
NO_DEFAULT_PATH
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_LIBRARY)
if(glslc IN_LIST Vulkan_FIND_COMPONENTS)
find_program(Vulkan_GLSLC_EXECUTABLE
NAMES glslc
HINTS
${_Vulkan_hint_executable_search_paths}
)
mark_as_advanced(Vulkan_GLSLC_EXECUTABLE)
endif()
if(glslangValidator IN_LIST Vulkan_FIND_COMPONENTS)
find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE
NAMES glslangValidator
HINTS
${_Vulkan_hint_executable_search_paths}
)
mark_as_advanced(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
endif()
if(glslang IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_glslang-spirv_LIBRARY
NAMES SPIRV
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-spirv_LIBRARY)
find_library(Vulkan_glslang-spirv_DEBUG_LIBRARY
NAMES SPIRVd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-spirv_DEBUG_LIBRARY)
find_library(Vulkan_glslang-oglcompiler_LIBRARY
NAMES OGLCompiler
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-oglcompiler_LIBRARY)
find_library(Vulkan_glslang-oglcompiler_DEBUG_LIBRARY
NAMES OGLCompilerd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-oglcompiler_DEBUG_LIBRARY)
find_library(Vulkan_glslang-osdependent_LIBRARY
NAMES OSDependent
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-osdependent_LIBRARY)
find_library(Vulkan_glslang-osdependent_DEBUG_LIBRARY
NAMES OSDependentd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-osdependent_DEBUG_LIBRARY)
find_library(Vulkan_glslang-machineindependent_LIBRARY
NAMES MachineIndependent
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-machineindependent_LIBRARY)
find_library(Vulkan_glslang-machineindependent_DEBUG_LIBRARY
NAMES MachineIndependentd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-machineindependent_DEBUG_LIBRARY)
find_library(Vulkan_glslang-genericcodegen_LIBRARY
NAMES GenericCodeGen
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-genericcodegen_LIBRARY)
find_library(Vulkan_glslang-genericcodegen_DEBUG_LIBRARY
NAMES GenericCodeGend
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-genericcodegen_DEBUG_LIBRARY)
find_library(Vulkan_glslang_LIBRARY
NAMES glslang
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang_LIBRARY)
find_library(Vulkan_glslang_DEBUG_LIBRARY
NAMES glslangd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang_DEBUG_LIBRARY)
endif()
if(shaderc_combined IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_shaderc_combined_LIBRARY
NAMES shaderc_combined
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_shaderc_combined_LIBRARY)
find_library(Vulkan_shaderc_combined_DEBUG_LIBRARY
NAMES shaderc_combinedd
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_shaderc_combined_DEBUG_LIBRARY)
endif()
if(SPIRV-Tools IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_SPIRV-Tools_LIBRARY
NAMES SPIRV-Tools
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_SPIRV-Tools_LIBRARY)
find_library(Vulkan_SPIRV-Tools_DEBUG_LIBRARY
NAMES SPIRV-Toolsd
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_SPIRV-Tools_DEBUG_LIBRARY)
endif()
if(MoltenVK IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_MoltenVK_LIBRARY
NAMES MoltenVK
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_MoltenVK_LIBRARY)
find_path(Vulkan_MoltenVK_INCLUDE_DIR
NAMES MoltenVK/mvk_vulkan.h
HINTS
${_Vulkan_hint_include_search_paths}
)
mark_as_advanced(Vulkan_MoltenVK_INCLUDE_DIR)
endif()
if(volk IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_volk_LIBRARY
NAMES volk
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_Volk_LIBRARY)
endif()
if (dxc IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_dxc_LIBRARY
NAMES dxcompiler
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_dxc_LIBRARY)
find_program(Vulkan_dxc_EXECUTABLE
NAMES dxc
HINTS
${_Vulkan_hint_executable_search_paths})
mark_as_advanced(Vulkan_dxc_EXECUTABLE)
endif()
if(Vulkan_GLSLC_EXECUTABLE)
set(Vulkan_glslc_FOUND TRUE)
else()
set(Vulkan_glslc_FOUND FALSE)
endif()
if(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
set(Vulkan_glslangValidator_FOUND TRUE)
else()
set(Vulkan_glslangValidator_FOUND FALSE)
endif()
if (Vulkan_dxc_EXECUTABLE)
set(Vulkan_dxc_exe_FOUND TRUE)
else()
set(Vulkan_dxc_exe_FOUND FALSE)
endif()
function(_Vulkan_set_library_component_found component)
cmake_parse_arguments(PARSE_ARGV 1 _ARG
"NO_WARNING"
""
"DEPENDENT_COMPONENTS")
set(all_dependent_component_found TRUE)
foreach(dependent_component IN LISTS _ARG_DEPENDENT_COMPONENTS)
if(NOT Vulkan_${dependent_component}_FOUND)
set(all_dependent_component_found FALSE)
break()
endif()
endforeach()
if(all_dependent_component_found AND (Vulkan_${component}_LIBRARY OR Vulkan_${component}_DEBUG_LIBRARY))
set(Vulkan_${component}_FOUND TRUE PARENT_SCOPE)
# For Windows Vulkan SDK, third party tools binaries are provided with different MSVC ABI:
# - Release binaries uses a runtime library
# - Debug binaries uses a debug runtime library
# This lead to incompatibilities in linking for some configuration types due to CMake-default or project-configured selected MSVC ABI.
if(WIN32 AND NOT _ARG_NO_WARNING)
if(NOT Vulkan_${component}_LIBRARY)
message(WARNING
"Library ${component} for Release configuration is missing, imported target Vulkan::${component} may not be able to link when targeting this build configuration due to incompatible MSVC ABI.")
endif()
if(NOT Vulkan_${component}_DEBUG_LIBRARY)
message(WARNING
"Library ${component} for Debug configuration is missing, imported target Vulkan::${component} may not be able to link when targeting this build configuration due to incompatible MSVC ABI. Consider re-installing the Vulkan SDK and request debug libraries to fix this warning.")
endif()
endif()
else()
set(Vulkan_${component}_FOUND FALSE PARENT_SCOPE)
endif()
endfunction()
_Vulkan_set_library_component_found(glslang-spirv NO_WARNING)
_Vulkan_set_library_component_found(glslang-oglcompiler NO_WARNING)
_Vulkan_set_library_component_found(glslang-osdependent NO_WARNING)
_Vulkan_set_library_component_found(glslang-machineindependent NO_WARNING)
_Vulkan_set_library_component_found(glslang-genericcodegen NO_WARNING)
_Vulkan_set_library_component_found(glslang
DEPENDENT_COMPONENTS
glslang-spirv
glslang-oglcompiler
glslang-osdependent
glslang-machineindependent
glslang-genericcodegen)
_Vulkan_set_library_component_found(shaderc_combined)
_Vulkan_set_library_component_found(SPIRV-Tools)
_Vulkan_set_library_component_found(volk)
_Vulkan_set_library_component_found(dxc)
if(Vulkan_MoltenVK_INCLUDE_DIR AND Vulkan_MoltenVK_LIBRARY)
set(Vulkan_MoltenVK_FOUND TRUE)
else()
set(Vulkan_MoltenVK_FOUND FALSE)
endif()
set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
# detect version e.g 1.2.189
set(Vulkan_VERSION "")
if(Vulkan_INCLUDE_DIR)
set(VULKAN_CORE_H ${Vulkan_INCLUDE_DIR}/vulkan/vulkan_core.h)
if(EXISTS ${VULKAN_CORE_H})
file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine REGEX "^#define VK_HEADER_VERSION ")
string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion "${VulkanHeaderVersionLine}")
file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine2 REGEX "^#define VK_HEADER_VERSION_COMPLETE ")
string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion2 "${VulkanHeaderVersionLine2}")
list(LENGTH VulkanHeaderVersion2 _len)
# versions >= 1.2.175 have an additional numbers in front of e.g. '0, 1, 2' instead of '1, 2'
if(_len EQUAL 3)
list(REMOVE_AT VulkanHeaderVersion2 0)
endif()
list(APPEND VulkanHeaderVersion2 ${VulkanHeaderVersion})
list(JOIN VulkanHeaderVersion2 "." Vulkan_VERSION)
endif()
endif()
if(Vulkan_MoltenVK_FOUND)
set(Vulkan_MoltenVK_VERSION "")
if(Vulkan_MoltenVK_INCLUDE_DIR)
set(VK_MVK_MOLTENVK_H ${Vulkan_MoltenVK_INCLUDE_DIR}/MoltenVK/vk_mvk_moltenvk.h)
if(EXISTS ${VK_MVK_MOLTENVK_H})
file(STRINGS ${VK_MVK_MOLTENVK_H} _Vulkan_MoltenVK_VERSION_MAJOR REGEX "^#define MVK_VERSION_MAJOR ")
string(REGEX MATCHALL "[0-9]+" _Vulkan_MoltenVK_VERSION_MAJOR "${_Vulkan_MoltenVK_VERSION_MAJOR}")
file(STRINGS ${VK_MVK_MOLTENVK_H} _Vulkan_MoltenVK_VERSION_MINOR REGEX "^#define MVK_VERSION_MINOR ")
string(REGEX MATCHALL "[0-9]+" _Vulkan_MoltenVK_VERSION_MINOR "${_Vulkan_MoltenVK_VERSION_MINOR}")
file(STRINGS ${VK_MVK_MOLTENVK_H} _Vulkan_MoltenVK_VERSION_PATCH REGEX "^#define MVK_VERSION_PATCH ")
string(REGEX MATCHALL "[0-9]+" _Vulkan_MoltenVK_VERSION_PATCH "${_Vulkan_MoltenVK_VERSION_PATCH}")
set(Vulkan_MoltenVK_VERSION "${_Vulkan_MoltenVK_VERSION_MAJOR}.${_Vulkan_MoltenVK_VERSION_MINOR}.${_Vulkan_MoltenVK_VERSION_PATCH}")
unset(_Vulkan_MoltenVK_VERSION_MAJOR)
unset(_Vulkan_MoltenVK_VERSION_MINOR)
unset(_Vulkan_MoltenVK_VERSION_PATCH)
endif()
endif()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Vulkan
REQUIRED_VARS
Vulkan_LIBRARY
Vulkan_INCLUDE_DIR
VERSION_VAR
Vulkan_VERSION
HANDLE_COMPONENTS
)
if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan)
add_library(Vulkan::Vulkan UNKNOWN IMPORTED)
set_target_properties(Vulkan::Vulkan PROPERTIES
IMPORTED_LOCATION "${Vulkan_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
endif()
if(Vulkan_FOUND AND NOT TARGET Vulkan::Headers)
add_library(Vulkan::Headers INTERFACE IMPORTED)
set_target_properties(Vulkan::Headers PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
endif()
if(Vulkan_FOUND AND Vulkan_GLSLC_EXECUTABLE AND NOT TARGET Vulkan::glslc)
add_executable(Vulkan::glslc IMPORTED)
set_property(TARGET Vulkan::glslc PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLC_EXECUTABLE}")
endif()
if(Vulkan_FOUND AND Vulkan_GLSLANG_VALIDATOR_EXECUTABLE AND NOT TARGET Vulkan::glslangValidator)
add_executable(Vulkan::glslangValidator IMPORTED)
set_property(TARGET Vulkan::glslangValidator PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE}")
endif()
if(Vulkan_FOUND)
if((Vulkan_glslang-spirv_LIBRARY OR Vulkan_glslang-spirv_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-spirv)
add_library(Vulkan::glslang-spirv STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-spirv
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-spirv_LIBRARY)
set_property(TARGET Vulkan::glslang-spirv APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-spirv
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-spirv_LIBRARY}")
endif()
if(Vulkan_glslang-spirv_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-spirv APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-spirv
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-spirv_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang-oglcompiler_LIBRARY OR Vulkan_glslang-oglcompiler_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-oglcompiler)
add_library(Vulkan::glslang-oglcompiler STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-oglcompiler
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-oglcompiler_LIBRARY)
set_property(TARGET Vulkan::glslang-oglcompiler APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-oglcompiler
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-oglcompiler_LIBRARY}")
endif()
if(Vulkan_glslang-oglcompiler_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-oglcompiler APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-oglcompiler
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-oglcompiler_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang-osdependent_LIBRARY OR Vulkan_glslang-osdependent_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-osdependent)
add_library(Vulkan::glslang-osdependent STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-osdependent
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-osdependent_LIBRARY)
set_property(TARGET Vulkan::glslang-osdependent APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-osdependent
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-osdependent_LIBRARY}")
endif()
if(Vulkan_glslang-osdependent_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-osdependent APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-osdependent
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-osdependent_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang-machineindependent_LIBRARY OR Vulkan_glslang-machineindependent_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-machineindependent)
add_library(Vulkan::glslang-machineindependent STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-machineindependent
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-machineindependent_LIBRARY)
set_property(TARGET Vulkan::glslang-machineindependent APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-machineindependent
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-machineindependent_LIBRARY}")
endif()
if(Vulkan_glslang-machineindependent_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-machineindependent APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-machineindependent
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-machineindependent_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang-genericcodegen_LIBRARY OR Vulkan_glslang-genericcodegen_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-genericcodegen)
add_library(Vulkan::glslang-genericcodegen STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-genericcodegen
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-genericcodegen_LIBRARY)
set_property(TARGET Vulkan::glslang-genericcodegen APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-genericcodegen
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-genericcodegen_LIBRARY}")
endif()
if(Vulkan_glslang-genericcodegen_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-genericcodegen APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-genericcodegen
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-genericcodegen_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang_LIBRARY OR Vulkan_glslang_DEBUG_LIBRARY)
AND TARGET Vulkan::glslang-spirv
AND TARGET Vulkan::glslang-oglcompiler
AND TARGET Vulkan::glslang-osdependent
AND TARGET Vulkan::glslang-machineindependent
AND TARGET Vulkan::glslang-genericcodegen
AND NOT TARGET Vulkan::glslang)
add_library(Vulkan::glslang STATIC IMPORTED)
set_property(TARGET Vulkan::glslang
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang_LIBRARY)
set_property(TARGET Vulkan::glslang APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang_LIBRARY}")
endif()
if(Vulkan_glslang_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang_DEBUG_LIBRARY}")
endif()
target_link_libraries(Vulkan::glslang
INTERFACE
Vulkan::glslang-spirv
Vulkan::glslang-oglcompiler
Vulkan::glslang-osdependent
Vulkan::glslang-machineindependent
Vulkan::glslang-genericcodegen
)
endif()
if((Vulkan_shaderc_combined_LIBRARY OR Vulkan_shaderc_combined_DEBUG_LIBRARY) AND NOT TARGET Vulkan::shaderc_combined)
add_library(Vulkan::shaderc_combined STATIC IMPORTED)
set_property(TARGET Vulkan::shaderc_combined
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_shaderc_combined_LIBRARY)
set_property(TARGET Vulkan::shaderc_combined APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::shaderc_combined
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_shaderc_combined_LIBRARY}")
endif()
if(Vulkan_shaderc_combined_DEBUG_LIBRARY)
set_property(TARGET Vulkan::shaderc_combined APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::shaderc_combined
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_shaderc_combined_DEBUG_LIBRARY}")
endif()
if(UNIX)
find_package(Threads REQUIRED)
target_link_libraries(Vulkan::shaderc_combined
INTERFACE
Threads::Threads)
endif()
endif()
if((Vulkan_SPIRV-Tools_LIBRARY OR Vulkan_SPIRV-Tools_DEBUG_LIBRARY) AND NOT TARGET Vulkan::SPIRV-Tools)
add_library(Vulkan::SPIRV-Tools STATIC IMPORTED)
set_property(TARGET Vulkan::SPIRV-Tools
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_SPIRV-Tools_LIBRARY)
set_property(TARGET Vulkan::SPIRV-Tools APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::SPIRV-Tools
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_SPIRV-Tools_LIBRARY}")
endif()
if(Vulkan_SPIRV-Tools_DEBUG_LIBRARY)
set_property(TARGET Vulkan::SPIRV-Tools APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::SPIRV-Tools
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_SPIRV-Tools_DEBUG_LIBRARY}")
endif()
endif()
if(Vulkan_volk_LIBRARY AND NOT TARGET Vulkan::volk)
add_library(Vulkan::volk STATIC IMPORTED)
set_property(TARGET Vulkan::volk
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
set_property(TARGET Vulkan::volk APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::volk APPEND
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_volk_LIBRARY}")
if (NOT WIN32)
set_property(TARGET Vulkan::volk APPEND
PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES dl)
endif()
endif()
if (Vulkan_dxc_LIBRARY AND NOT TARGET Vulkan::dxc_lib)
add_library(Vulkan::dxc_lib STATIC IMPORTED)
set_property(TARGET Vulkan::dxc_lib
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
set_property(TARGET Vulkan::dxc_lib APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::dxc_lib APPEND
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_dxc_LIBRARY}")
endif()
if(Vulkan_dxc_EXECUTABLE AND NOT TARGET Vulkan::dxc_exe)
add_executable(Vulkan::dxc_exe IMPORTED)
set_property(TARGET Vulkan::dxc_exe PROPERTY IMPORTED_LOCATION "${Vulkan_dxc_EXECUTABLE}")
endif()
endif()
if(Vulkan_MoltenVK_FOUND)
if(Vulkan_MoltenVK_LIBRARY AND NOT TARGET Vulkan::MoltenVK)
add_library(Vulkan::MoltenVK SHARED IMPORTED)
set_target_properties(Vulkan::MoltenVK
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_MoltenVK_INCLUDE_DIR}"
IMPORTED_LOCATION "${Vulkan_MoltenVK_LIBRARY}"
)
endif()
endif()
unset(_Vulkan_library_name)
unset(_Vulkan_hint_include_search_paths)
unset(_Vulkan_hint_executable_search_paths)
unset(_Vulkan_hint_library_search_paths)
cmake_policy(POP)
+10
View File
@@ -0,0 +1,10 @@
set(GLFW3_DIR "${PROJECT_SOURCE_DIR}/third_party/GLFW/")
find_library(
glfw
NAMES glfw
HINTS ${GLFW3_DIR}/build/src
)
set(glfw3_INCLUDE_DIR "${GLFW3_DIR}/include/")
+9
View File
@@ -0,0 +1,9 @@
set(GLM_DIR "${PROJECT_SOURCE_DIR}/third_party/GLM/")
find_library(
glm
NAMES glm glm_shared
HINTS ${GLM_DIR}/build/glm
)
set(glm_INCLUDE_DIR "${GLM_DIR}/include")
+10
View File
@@ -0,0 +1,10 @@
set(VMA_DIR "${PROJECT_SOURCE_DIR}/third_party/vma/")
find_file(
vma_header
NAMES vk_mem_alloc.h
HINTS ${VMA_DIR}/include
)
set(vma_INCLUDE_DIR "${VMA_DIR}/include")
+267
View File
@@ -0,0 +1,267 @@
{
"version": "1.3.250.0",
"release_date": "2023-05-30",
"release": true,
"publisher": "LunarG, Inc.",
"copyright": "Copyright (c) 2016-2023 LunarG, Inc.",
"comments" : "Building using the branch will build the most recent SDK on that branch. If you want to build a previous SDK on that branch, use the tag",
"repos": {
"Vulkan-Headers": {
"url": "https://github.com/KhronosGroup/Vulkan-Headers.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"configs": [ "Release" ]
},
"Vulkan-Loader": {
"url": "https://github.com/KhronosGroup/Vulkan-Loader.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"defines": [
"BUILD_DLL_VERSIONINFO={version_string}"
],
"configs": [ "RelWithDebInfo" ],
"dependencies": {
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR"
}
},
"Vulkan-ValidationLayers": {
"url": "https://github.com/KhronosGroup/Vulkan-ValidationLayers.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"defines": [
"BUILD_LAYER_SUPPORT_FILES=ON",
"ANNOTATED_SPEC_LINK=\"\\\"https://vulkan.lunarg.com/doc/view/_MAGIC_VERSION_ID_.0/windows/_MAGIC_ANNOTATED_SPEC_TYPE_/vkspec.html\\\"\""
],
"configs": [ "Release" ],
"dependencies": {
"SPIRV-Headers": "SPIRV_HEADERS_INSTALL_DIR",
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
"SPIRV-Tools": "SPIRV_TOOLS_INSTALL_DIR",
"robin-hood-hashing": "ROBIN_HOOD_HASHING_INSTALL_DIR"
},
"windows_dependencies": {
"mimalloc": "MIMALLOC_INSTALL_DIR"
},
"vk_layer_settings_files": [ "layers/vk_layer_settings.txt" ]
},
"Vulkan-ExtensionLayer": {
"url": "https://github.com/KhronosGroup/Vulkan-ExtensionLayer.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"configs": [ "Release" ],
"defines": ["BUILD_TESTS=OFF"],
"dependencies": {
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
"SPIRV-Headers": "SPIRV_HEADERS_INSTALL_DIR",
"SPIRV-Tools": "SPIRV_TOOLS_INSTALL_DIR",
"Glslang": "GLSLANG_INSTALL_DIR"
},
"vk_layer_settings_files": [ "layers/vk_layer_settings.txt" ]
},
"Khronos-Tools": {
"url": "https://github.com/KhronosGroup/Vulkan-Tools.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"defines": [
"VULKANINFO_BUILD_DLL_VERSIONINFO={version_string}"
],
"configs": [ "RelWithDebInfo" ],
"dependencies": {
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
"Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR"
}
},
"Glslang": {
"url": "https://github.com/KhronosGroup/glslang.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"script": [ "python update_glslang_sources.py" ],
"configs": [ "RelWithDebInfo", "Debug" ]
},
"LunarG-Tools": {
"url": "https://github.com/LunarG/VulkanTools.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"script": [ "update_external_sources.bat --all" ],
"configs": [ "RelWithDebInfo" ],
"dependencies": {
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
"Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR",
"Vulkan-ValidationLayers": "VULKAN_VALIDATIONLAYERS_INSTALL_DIR"
},
"vk_layer_settings_files": [ "layersvt/vk_layer_settings.txt" ]
},
"SPIRV-Cross": {
"url": "https://github.com/KhronosGroup/SPIRV-Cross.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"defines": [ "SPIRV_CROSS_SHARED=ON" ],
"configs": [ "Release", "Debug" ]
},
"SPIRV-Tools": {
"url": "https://github.com/KhronosGroup/SPIRV-Tools.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"configs": [ "Release", "Debug" ],
"dependencies": {
"SPIRV-Headers": "SPIRV_HEADERS_INSTALL_DIR"
},
"defines": [
"SPIRV-Headers_SOURCE_DIR={root_path_forward}/SPIRV-Headers/repo"
]
},
"shaderc": {
"url": "https://github.com/google/shaderc.git",
"commit": "8226ab8d003b3249d8da9c83159482d180f38959",
"script": [ "python update_shaderc_sources.py" ],
"defines": [
"CMAKE_DEBUG_POSTFIX=d",
"SHADERC_SKIP_TESTS=ON",
"SHADERC_ENABLE_SHARED_CRT=ON",
"SHADERC_SKIP_COPYRIGHT_CHECK=ON"
],
"subdir": "src",
"configs": [ "Release", "Debug" ],
"build_target": null
},
"DXC": {
"url": "https://github.com/microsoft/DirectXShaderCompiler.git",
"commit": "021f8f3e1267db0f0e3362276cdda95785de0529",
"platforms": ["Linux", "Darwin"],
"appveyor_account": "dnovillo",
"appveyor_project": "directxshadercompiler",
"windows_appveyor_image": "Image: Visual Studio 2022"
},
"gfxreconstruct": {
"url": "https://github.com/LunarG/gfxreconstruct.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"configs": [ "RelWithDebInfo" ],
"windows_compiler": "Visual Studio 16",
"defines": [ "D3D12_SUPPORT=OFF" ],
"vk_layer_settings_files": [ "layer/vk_layer_settings.txt" ]
},
"SPIRV-Headers": {
"url": "https://github.com/KhronosGroup/SPIRV-Headers.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"configs": [ "RelWithDebInfo" ]
},
"SPIRV-Reflect": {
"url": "https://github.com/KhronosGroup/SPIRV-Reflect.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"configs": [ "RelWithDebInfo" ],
"build_target": "spirv-reflect"
},
"MoltenVK": {
"url": "https://github.com/KhronosGroup/MoltenVK.git",
"tag": "v1.2.4",
"platforms": ["Darwin"]
},
"HardwareCaps": {
"url": "https://github.com/SaschaWillems/VulkanCapsViewer.git",
"tag": "3.30",
"configs": [ "Release" ],
"dependencies": {
"Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR",
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR"
}
},
"Volk": {
"url": "https://github.com/zeux/volk.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"configs": [ "RelWithDebInfo" ],
"defines": [
"VOLK_INSTALL=ON",
"VOLK_PULL_IN_VULKAN=ON"
],
"dependencies": {
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR"
}
},
"VMA": {
"url": "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git",
"commit": "0e89587db3ebee4d463f191bd296374c5fafc8ea",
"check_latest_release": true
},
"GLM": {
"url": "https://github.com/g-truc/glm.git",
"check_latest_release": true,
"tag": "0.9.9.8"
},
"SDL": {
"url": "https://github.com/libsdl-org/SDL.git",
"tag": "release-2.26.5",
"check_latest_release": true,
"configs": ["RelWithDebInfo"]
},
"Vulkan-Docs": {
"url": "https://github.com/KhronosGroup/Vulkan-Docs.git",
"tag": "v1.3.250"
},
"robin-hood-hashing": {
"url": "https://github.com/martinus/robin-hood-hashing.git",
"tag": "3.11.5",
"defines": [
"RH_STANDALONE_PROJECT=OFF"
],
"configs": ["Release"]
},
"Vulkan-Utility-Libraries": {
"url": "https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git",
"branch": "sdk-1.3.250",
"configs": ["RelWithDebInfo"],
"dependencies": {
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR"
}
},
"Vulkan-Profiles": {
"url": "https://github.com/KhronosGroup/Vulkan-Profiles.git",
"branch": "sdk-1.3.250",
"tag": "sdk-1.3.250.0",
"configs": ["Release"],
"dependencies": {
"Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR",
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
"Vulkan-ValidationLayers": "VULKAN_VALIDATIONLAYERS_INSTALL_DIR",
"jsoncpp": "JSONCPP_INSTALL_DIR",
"valijson": "VALIJSON_INSTALL_DIR",
"Vulkan-Utility-Libraries": "VULKAN_UTILITY_LIBRARIES_INSTALL_DIR"
},
"defines": [
"PROFILES_BUILD_TESTS=OFF"
]
},
"jsoncpp": {
"url": "https://github.com/open-source-parsers/jsoncpp.git",
"tag": "1.9.5",
"configs": ["RelWithDebInfo"],
"defines": [
"CMAKE_POSITION_INDEPENDENT_CODE=ON",
"JSONCPP_WITH_TESTS=OFF",
"JSONCPP_WITH_POST_BUILD_UNITTEST=OFF",
"JSONCPP_WITH_WARNING_AS_ERROR=OFF",
"JSONCPP_WITH_PKGCONFIG_SUPPORT=OFF"
]
},
"valijson": {
"url": "https://github.com/tristanpenman/valijson.git",
"tag": "v1.0",
"configs": ["RelWithDebInfo"]
},
"mimalloc": {
"url": "https://github.com/microsoft/mimalloc.git",
"tag": "v2.0.7",
"configs": ["RelWithDebInfo"],
"platforms": ["Windows"],
"defines": [
"MI_BUILD_STATIC=ON",
"MI_BUILD_OBJECT=OFF",
"MI_BUILD_SHARED=OFF",
"MI_BUILD_TESTS=OFF"
]
}
}
}
+17
View File
@@ -0,0 +1,17 @@
[GLM]
git_url = https://github.com/g-truc/glm.git
tag = 0.9.9.8
custom_commands = cd GLM && mkdir build && cd build && cmake .. -D BUILD_SHARED_LIBS=ON && make && cd .. && mkdir include && mv glm include
[GLFW]
git_url = https://github.com/glfw/glfw.git
tag = 3.3.8
custom_commands = cd GLFW && mkdir build && cd build && cmake .. -D BUILD_SHARED_LIBS=ON && make
[Vulkan-SDK]
dl_url = https://sdk.lunarg.com/sdk/download/1.3.250.1/linux/vulkansdk-linux-x86_64-1.3.250.1.tar.gz
custom_commands = tar -xf Vulkan-SDK && mv 1.3.250.1 vulkan && rm Vulkan-SDK
[vma]
git_url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
tag = v3.0.1
+8 -5
View File
@@ -1,9 +1,12 @@
find_package(Vulkan REQUIRED)
find_package(vma REQUIRED)
find_package(glfw3 REQUIRED)
find_package(glm REQUIRED)
find_package(Vulkan COMPONENTS glslc)
find_program(glslc_executable NAMES glslc HINTS Vulkan::glslc)
find_program(glslc_executable NAMES glslc HINTS ${Vulkan_GLSLC_EXECUTABLE}/..)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/shaders)
cmake_policy(SET CMP0116 NEW)
function(compile_shader)
@@ -36,14 +39,14 @@ add_library(rse_graphics SHARED shaders/shader.vert.num shaders/shader.frag.num)
target_include_directories(rse_graphics PRIVATE
${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}
${Vulkan_INCLUDE_DIR}
${vma_INCLUDE_DIR}
${glfw3_INCLUDE_DIR}
${glm_INCLUDE_DIR}
)
message("Vulkan_INCLUDE_DIR: ${Vulkan_INCLUDE_DIR}")
target_sources(rse_graphics PRIVATE
src/window.cpp
src/vulkan_base.cpp
@@ -58,6 +61,6 @@ target_sources(rse_graphics PRIVATE
target_link_libraries(rse_graphics PRIVATE
rse_utilities
${Vulkan_LIBRARIES}
glfw
glm
${glfw}
${glm}
)
+5 -3
View File
@@ -2,13 +2,15 @@
#define RSE_GRAPHICS_HPP
#include <cstdint>
#include "src/vulkan_commons.hpp"
namespace rse::graphics
{
namespace vulkanbase {
struct VulkanState;
};
class RseGraphics {
public:
RseGraphics();
~RseGraphics();
RseGraphics& operator=(const RseGraphics&) = delete;
RseGraphics(const RseGraphics&) = delete;
@@ -22,7 +24,7 @@ class RseGraphics {
private:
/* Hold vulkan state. It is modified by function initializing and communicating with Vulkan API */
vulkanbase::VulkanState vulkan_state;
vulkanbase::VulkanState* vulkan_state;
};
+21 -17
View File
@@ -9,23 +9,27 @@ namespace rse::graphics
RseGraphics::RseGraphics()
{
vulkan_state = {
.graphicsQueue = VK_NULL_HANDLE,
.physicalDevice = VK_NULL_HANDLE,
.currentFrame = 0U,
.queueFamilyIndices = {0U}, /* TODO: Change when more families are needed */
.uniformBuffers = {},
.pCommandBuffers = {},
.descriptorSets = {},
.swapChainImageViews = {},
.swapchainExtent = {},
.renderPass = VK_NULL_HANDLE,
.descriptorSetLayout = VK_NULL_HANDLE,
.swapchainFramebuffers = {},
.graphicsPipeline = VK_NULL_HANDLE,
.pipelineLayout = VK_NULL_HANDLE,
.swapchain = VK_NULL_HANDLE,
};
vulkan_state = new vulkanbase::VulkanState;
vulkan_state->graphicsQueue = VK_NULL_HANDLE;
vulkan_state->physicalDevice = VK_NULL_HANDLE;
vulkan_state->currentFrame = 0U;
// vulkan_state->queueFamilyIndices = {0U}; /* TODO: Change when more families are needed */
vulkan_state->uniformBuffers = {};
vulkan_state->pCommandBuffers = {};
vulkan_state->descriptorSets = {};
vulkan_state->swapChainImageViews = {};
vulkan_state->swapchainExtent = {};
vulkan_state->renderPass = VK_NULL_HANDLE;
vulkan_state->descriptorSetLayout = VK_NULL_HANDLE;
vulkan_state->swapchainFramebuffers = {};
vulkan_state->graphicsPipeline = VK_NULL_HANDLE;
vulkan_state->pipelineLayout = VK_NULL_HANDLE;
vulkan_state->swapchain = VK_NULL_HANDLE;
}
RseGraphics::~RseGraphics()
{
delete vulkan_state;
}
+1 -1
View File
@@ -24,7 +24,7 @@
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wparentheses"
#define VMA_IMPLEMENTATION
#include "third_party/vma/vk_mem_alloc.h"
#include "vk_mem_alloc.h"
#pragma GCC diagnostic pop
#include "locale_vulkan.hpp"
+1 -1
View File
@@ -5,7 +5,7 @@
#include <vector>
#include <vulkan/vulkan.hpp>
#include "third_party/vma/vk_mem_alloc.h"
#include "vk_mem_alloc.h"
#include "vulkan_commons.hpp"
+3 -1
View File
@@ -13,9 +13,11 @@
#define RSE_VULKAN_GLOBAL_HPP
#include <vulkan/vulkan.hpp>
#pragma GCC diagnostic ignored "-Wvolatile"
#include <glm/glm.hpp>
#pragma GCC diagnostic pop
#include "third_party/vma/vk_mem_alloc.h"
#include "vk_mem_alloc.h"
#define SWAP_BUFFER_COUNT 2U
+79
View File
@@ -0,0 +1,79 @@
#!/usr/bin/python
# !WARNING! When run, this script will create prepare.lock file, which will indicate that the script has been run before.
# This is used for automation with CMake, which will run this script if and only if this file does not exists.
# If you want to run this script again, remove this file manually first.
# Script used for preparing build envirionment. I cannot use submodules, because I cannot specify commit/tag
# in submodule config. What's more, preparing vulkan SDK is complicated, so a custom scrip is needed for that.
import io
import re
import git
import os
import requests
import subprocess
REPO_DIR = os.path.join(os.getcwd(), "third_party")
class Dependency:
def __init__(self, name, file: io.TextIOWrapper):
self.name = name
while 1:
line = file.readline().split("=", 1)
if len(line) > 1:
match line[0].strip():
case "git_url":
self.git_url = line[1].strip()
case "dl_url":
self.dl_url = line[1].strip()
case "tag":
self.tag = line[1].strip()
case "custom_commands":
self.custom_commands = line[1].strip()
else:
break
def download(self):
# Git repository
if hasattr(self, "git_url") and self.git_url:
repo = git.Repo.clone_from(self.git_url, os.path.join(REPO_DIR, self.name))
repo.git.checkout(self.tag)
elif hasattr(self, "dl_url") and self.dl_url:
response = requests.get(self.dl_url)
if response.status_code == 200: # everything went fine
open(os.path.join(REPO_DIR, self.name), "wb").write(response.content)
if hasattr(self, "custom_commands") and self.custom_commands:
p = subprocess.Popen(self.custom_commands, shell=True)
def main():
if not os.path.isdir(REPO_DIR):
os.mkdir(REPO_DIR)
f = open("dependencies.dep", "r")
os.chdir(REPO_DIR)
while True:
line = f.readline()
if not line:
break
stripped = line.strip()
# Remove comments
if stripped.startswith("#"):
return
uncommented = stripped.split("#", 1)[0]
if len(uncommented) == 0:
return
if uncommented.startswith("["):
dep_name = re.search('\[(.*)\]', uncommented).group(1)
dep = Dependency(dep_name, f)
dep.download()
f.close()
if __name__ == "__main__":
main()
-19564
View File
File diff suppressed because it is too large. Load diff