[WIP] Add descriptors and pipeline builder
This commit is contained in:
1 parent
173a82b9d1
commit
f8eb98ddf4
36 files changed
+613
-458
No files matched your search
@@ -1,17 +0,0 @@
|
||||
set(CMOCK_DIR "${PROJECT_SOURCE_DIR}/third_party/cmock/")
|
||||
|
||||
|
||||
find_library(
|
||||
cmock
|
||||
NAMES cmock
|
||||
HINTS ${CMOCK_DIR}/build/src/
|
||||
)
|
||||
|
||||
find_library(
|
||||
unity
|
||||
NAMES unity
|
||||
HINTS ${CMOCK_DIR}/build/vendor/unity/src/
|
||||
)
|
||||
|
||||
set(cmock_INCLUDE_DIR "${CMOCK_DIR}/src/")
|
||||
set(unity_INCLUDE_DIR "${CMOCK_DIR}/vendor/unity/src/")
|
||||
@@ -1,10 +0,0 @@
|
||||
set(CRITERION_DIR "${PROJECT_SOURCE_DIR}/third_party/Criterion/")
|
||||
|
||||
find_library(
|
||||
criterion
|
||||
NAMES criterion
|
||||
HINTS ${CRITERION_DIR}/build/src
|
||||
)
|
||||
|
||||
|
||||
set(criterion_INCLUDE_DIR "${CRITERION_DIR}/include/")
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
set(FREE_TYPE_DIR "${PROJECT_SOURCE_DIR}/third_party/freetype/")
|
||||
set(FREE_TYPE_DIR "/usr/")
|
||||
|
||||
find_library(
|
||||
freetype
|
||||
NAMES freetype
|
||||
HINTS ${FREE_TYPE_DIR}/build/
|
||||
HINTS ${FREE_TYPE_DIR}/lib/x86_64-linux-gnu
|
||||
)
|
||||
|
||||
|
||||
set(FreeType_INCLUDE_DIR "${FREE_TYPE_DIR}/include/")
|
||||
set(FreeType_INCLUDE_DIR "${FREE_TYPE_DIR}/include/freetype2/")
|
||||
@@ -1,611 +0,0 @@
|
||||
# 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)
|
||||
@@ -1,48 +0,0 @@
|
||||
# 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()
|
||||
@@ -1,897 +0,0 @@
|
||||
# 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)
|
||||
@@ -1,10 +0,0 @@
|
||||
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/")
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
set(STB_DIR "${PROJECT_SOURCE_DIR}/third_party/stb/")
|
||||
set(STB_DIR "/usr/include")
|
||||
|
||||
set(stb_INCLUDE_DIR "${STB_DIR}/")
|
||||
@@ -1,10 +0,0 @@
|
||||
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")
|
||||
Reference in new issue
Block a user