init
This commit is contained in:
@@ -0,0 +1,361 @@
|
||||
# Adapted from https://github.com/jeffdaily/parasail/blob/600fb26151ff19899ee39a214972dcf2b9b11ed7/cmake/FindAVX2.cmake
|
||||
#[[
|
||||
Copyright (c) 2015-2024, Battelle Memorial Institute
|
||||
|
||||
|
||||
1. Battelle Memorial Institute (hereinafter Battelle) hereby grants
|
||||
permission to any person or entity lawfully obtaining a copy of this
|
||||
software and associated documentation files (hereinafter “the
|
||||
Software”) to redistribute and use the Software in source and binary
|
||||
forms, with or without modification. Such person or entity may use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and may permit others to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimers.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
- Other than as used herein, neither the name Battelle Memorial
|
||||
Institute or Battelle may be used in any form whatsoever without
|
||||
the express written consent of Battelle.
|
||||
|
||||
- Redistributions of the software in any form, and publications
|
||||
based on work performed using the software should include the
|
||||
following citation as a reference:
|
||||
|
||||
Daily, Jeff. (2016). Parasail: SIMD C library for global,
|
||||
semi-global, and local pairwise sequence alignments. *BMC
|
||||
Bioinformatics*, 17(1), 1-11. doi:10.1186/s12859-016-0930-z
|
||||
|
||||
2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BATTELLE
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
]]
|
||||
|
||||
|
||||
|
||||
# .rst:
|
||||
# FindAVX2
|
||||
# --------
|
||||
#
|
||||
# Finds AVX2 support
|
||||
#
|
||||
# This module can be used to detect AVX2 support in a C compiler. If
|
||||
# the compiler supports AVX2, the flags required to compile with
|
||||
# AVX2 support are returned in variables for the different languages.
|
||||
# The variables may be empty if the compiler does not need a special
|
||||
# flag to support AVX2.
|
||||
#
|
||||
# The following variables are set:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# AVX2_C_FLAGS - flags to add to the C compiler for AVX2 support
|
||||
# AVX2_FOUND - true if AVX2 is detected
|
||||
# =============================================================================
|
||||
|
||||
set(_AVX2_REQUIRED_VARS)
|
||||
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
|
||||
set(CMAKE_REQUIRED_QUIET ${AVX2_FIND_QUIETLY})
|
||||
|
||||
# sample AVX2 source code to test
|
||||
set(AVX2_C_TEST_SOURCE
|
||||
"
|
||||
#include <immintrin.h>
|
||||
void parasail_memset___m256i(__m256i *b, __m256i c, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
for (i=0; i<len; ++i) {
|
||||
_mm256_store_si256(&b[i], c);
|
||||
}
|
||||
}
|
||||
|
||||
int foo() {
|
||||
__m256i vOne = _mm256_set1_epi8(1);
|
||||
__m256i result = _mm256_add_epi8(vOne,vOne);
|
||||
return _mm_extract_epi16(_mm256_extracti128_si256(result,0),0);
|
||||
}
|
||||
int main(void) { return (int)foo(); }
|
||||
")
|
||||
|
||||
# if these are set then do not try to find them again,
|
||||
# by avoiding any try_compiles for the flags
|
||||
if((DEFINED AVX2_C_FLAGS) OR (DEFINED HAVE_AVX2))
|
||||
else()
|
||||
if(WIN32)
|
||||
# MSVC can compile AVX intrinsics without the arch flag, however it
|
||||
# will detect that AVX code is found and "consider using /arch:AVX".
|
||||
set(AVX2_C_FLAG_CANDIDATES
|
||||
"/arch:AVX"
|
||||
"/arch:AVX2")
|
||||
else()
|
||||
set(AVX2_C_FLAG_CANDIDATES
|
||||
#Empty, if compiler automatically accepts AVX2
|
||||
" "
|
||||
#GNU, Intel
|
||||
"-march=core-avx2"
|
||||
#clang
|
||||
"-mavx2"
|
||||
)
|
||||
endif()
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
foreach(FLAG IN LISTS AVX2_C_FLAG_CANDIDATES)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
unset(HAVE_AVX2 CACHE)
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Try AVX2 C flag = [${FLAG}]")
|
||||
endif()
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE}" HAVE_AVX2)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
if(HAVE_AVX2)
|
||||
set(AVX2_C_FLAGS_INTERNAL "${FLAG}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(AVX2_C_FLAG_CANDIDATES)
|
||||
|
||||
set(AVX2_C_FLAGS "${AVX2_C_FLAGS_INTERNAL}"
|
||||
CACHE STRING "C compiler flags for AVX2 intrinsics")
|
||||
endif()
|
||||
|
||||
list(APPEND _AVX2_REQUIRED_VARS AVX2_C_FLAGS)
|
||||
|
||||
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
|
||||
|
||||
if(_AVX2_REQUIRED_VARS)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(AVX2
|
||||
REQUIRED_VARS ${_AVX2_REQUIRED_VARS})
|
||||
|
||||
mark_as_advanced(${_AVX2_REQUIRED_VARS})
|
||||
|
||||
unset(_AVX2_REQUIRED_VARS)
|
||||
else()
|
||||
message(SEND_ERROR "FindAVX2 requires C or CXX language to be enabled")
|
||||
endif()
|
||||
|
||||
# begin tests for AVX2 specfic features
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(SAFE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(SAFE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
endif()
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_SET1_EPI64X
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
__m256i foo() {
|
||||
__m256i vOne = _mm256_set1_epi64x(1);
|
||||
return vOne;
|
||||
}
|
||||
int main(void) { foo(); return 0; }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_SET1_EPI64X}" HAVE_AVX2_MM256_SET1_EPI64X)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_SET_EPI64X
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
__m256i foo() {
|
||||
__m256i vOne = _mm256_set_epi64x(1,1,1,1);
|
||||
return vOne;
|
||||
}
|
||||
int main(void) { foo(); return 0; }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_SET_EPI64X}" HAVE_AVX2_MM256_SET_EPI64X)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_INSERT64
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
__m256i foo() {
|
||||
__m256i vOne = _mm256_set1_epi8(1);
|
||||
return _mm256_insert_epi64(vOne,INT64_MIN,0);
|
||||
}
|
||||
int main(void) { foo(); return 0; }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_INSERT64}" HAVE_AVX2_MM256_INSERT_EPI64)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_INSERT32
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
__m256i foo() {
|
||||
__m256i vOne = _mm256_set1_epi8(1);
|
||||
return _mm256_insert_epi32(vOne,INT32_MIN,0);
|
||||
}
|
||||
int main(void) { foo(); return 0; }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_INSERT32}" HAVE_AVX2_MM256_INSERT_EPI32)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_INSERT16
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
__m256i foo() {
|
||||
__m256i vOne = _mm256_set1_epi8(1);
|
||||
return _mm256_insert_epi16(vOne,INT16_MIN,0);
|
||||
}
|
||||
int main(void) { foo(); return 0; }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_INSERT16}" HAVE_AVX2_MM256_INSERT_EPI16)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_INSERT8
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
__m256i foo() {
|
||||
__m256i vOne = _mm256_set1_epi8(1);
|
||||
return _mm256_insert_epi8(vOne,INT8_MIN,0);
|
||||
}
|
||||
int main(void) { foo(); return 0; }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_INSERT8}" HAVE_AVX2_MM256_INSERT_EPI8)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_EXTRACT64
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
int64_t foo() {
|
||||
__m256i vOne = _mm256_set1_epi8(1);
|
||||
return (int64_t)_mm256_extract_epi64(vOne,0);
|
||||
}
|
||||
int main(void) { return (int)foo(); }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_EXTRACT64}" HAVE_AVX2_MM256_EXTRACT_EPI64)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_EXTRACT32
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
int32_t foo() {
|
||||
__m256i vOne = _mm256_set1_epi8(1);
|
||||
return (int32_t)_mm256_extract_epi32(vOne,0);
|
||||
}
|
||||
int main(void) { return (int)foo(); }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_EXTRACT32}" HAVE_AVX2_MM256_EXTRACT_EPI32)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_EXTRACT16
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
int16_t foo() {
|
||||
__m256i vOne = _mm256_set1_epi8(1);
|
||||
return (int16_t)_mm256_extract_epi16(vOne,0);
|
||||
}
|
||||
int main(void) { return (int)foo(); }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_EXTRACT16}" HAVE_AVX2_MM256_EXTRACT_EPI16)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(AVX2_C_TEST_SOURCE_EXTRACT8
|
||||
"
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
int8_t foo() {
|
||||
__m256i vOne = _mm256_set1_epi8(1);
|
||||
return (int8_t)_mm256_extract_epi8(vOne,0);
|
||||
}
|
||||
int main(void) { return (int)foo(); }
|
||||
")
|
||||
|
||||
if(AVX2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${AVX2_C_FLAGS}")
|
||||
check_c_source_compiles("${AVX2_C_TEST_SOURCE_EXTRACT8}" HAVE_AVX2_MM256_EXTRACT_EPI8)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_C_FLAGS "${SAFE_CMAKE_C_FLAGS}")
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS "${SAFE_CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
@@ -0,0 +1,52 @@
|
||||
#[[
|
||||
Copyright (c) 2022, Arm Limited and Contributors
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 the "License";
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
]]
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(ADB_FILE "adb.exe")
|
||||
else()
|
||||
set(ADB_FILE "adb")
|
||||
endif()
|
||||
|
||||
find_program(ADB_EXECUTABLE
|
||||
NAMES
|
||||
${ADB_FILE}
|
||||
PATH_SUFFIXES
|
||||
platform-tools
|
||||
PATHS
|
||||
$ENV{ANDROID_HOME})
|
||||
|
||||
mark_as_advanced(ADB_EXECUTABLE)
|
||||
|
||||
if(ADB_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND ${ADB_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE ADB_VERSION
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(ADB_VERSION_PREFIX "Android Debug Bridge version ")
|
||||
string(REGEX MATCH "${ADB_VERSION_PREFIX}[0-9]+.[0-9]+.[0-9]+" ADB_VERSION ${ADB_VERSION})
|
||||
string(REPLACE ${ADB_VERSION_PREFIX} "" ADB_VERSION ${ADB_VERSION})
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(Adb
|
||||
VERSION_VAR ADB_VERSION
|
||||
REQUIRED_VARS ADB_EXECUTABLE)
|
||||
@@ -0,0 +1,51 @@
|
||||
#[[
|
||||
Copyright (c) 2019, Arm Limited and Contributors
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 the "License";
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
]]
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(GRADLE_FILE "gradle.bat")
|
||||
else()
|
||||
set(GRADLE_FILE "gradle")
|
||||
endif()
|
||||
|
||||
find_program(GRADLE_EXECUTABLE
|
||||
NAMES
|
||||
${GRADLE_FILE}
|
||||
PATH_SUFFIXES
|
||||
bin
|
||||
PATHS
|
||||
$ENV{GRADLE_HOME})
|
||||
|
||||
mark_as_advanced(GRADLE_EXECUTABLE)
|
||||
|
||||
if(GRADLE_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND ${GRADLE_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE GRADLE_VERSION
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
string(REGEX MATCH "Gradle [0-9]+.[0-9]+" GRADLE_VERSION ${GRADLE_VERSION})
|
||||
string(REPLACE "Gradle " "" GRADLE_VERSION ${GRADLE_VERSION})
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(Gradle
|
||||
VERSION_VAR GRADLE_VERSION
|
||||
REQUIRED_VARS GRADLE_EXECUTABLE)
|
||||
@@ -0,0 +1,145 @@
|
||||
# Adapted from https://github.com/jeffdaily/parasail/blob/600fb26151ff19899ee39a214972dcf2b9b11ed7/cmake/FindNEON.cmake
|
||||
#[[
|
||||
Copyright (c) 2015-2024, Battelle Memorial Institute
|
||||
|
||||
|
||||
1. Battelle Memorial Institute (hereinafter Battelle) hereby grants
|
||||
permission to any person or entity lawfully obtaining a copy of this
|
||||
software and associated documentation files (hereinafter “the
|
||||
Software”) to redistribute and use the Software in source and binary
|
||||
forms, with or without modification. Such person or entity may use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and may permit others to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimers.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
- Other than as used herein, neither the name Battelle Memorial
|
||||
Institute or Battelle may be used in any form whatsoever without
|
||||
the express written consent of Battelle.
|
||||
|
||||
- Redistributions of the software in any form, and publications
|
||||
based on work performed using the software should include the
|
||||
following citation as a reference:
|
||||
|
||||
Daily, Jeff. (2016). Parasail: SIMD C library for global,
|
||||
semi-global, and local pairwise sequence alignments. *BMC
|
||||
Bioinformatics*, 17(1), 1-11. doi:10.1186/s12859-016-0930-z
|
||||
|
||||
2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BATTELLE
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
]]
|
||||
|
||||
#.rst:
|
||||
# FindNEON
|
||||
# --------
|
||||
#
|
||||
# Finds NEON support
|
||||
#
|
||||
# This module can be used to detect NEON support in a C compiler. If
|
||||
# the compiler supports NEON, the flags required to compile with
|
||||
# NEON support are returned in variables for the different languages.
|
||||
# The variables may be empty if the compiler does not need a special
|
||||
# flag to support NEON.
|
||||
#
|
||||
# The following variables are set:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# NEON_C_FLAGS - flags to add to the C compiler for NEON support
|
||||
# NEON_FOUND - true if NEON is detected
|
||||
#
|
||||
#=============================================================================
|
||||
|
||||
set(_NEON_REQUIRED_VARS)
|
||||
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
|
||||
set(CMAKE_REQUIRED_QUIET ${NEON_FIND_QUIETLY})
|
||||
|
||||
# sample NEON source code to test
|
||||
set(NEON_C_TEST_SOURCE
|
||||
"
|
||||
#include <arm_neon.h>
|
||||
uint32x4_t double_elements(uint32x4_t input)
|
||||
{
|
||||
return(vaddq_u32(input, input));
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
uint32x4_t one;
|
||||
uint32x4_t two = double_elements(one);
|
||||
return 0;
|
||||
}
|
||||
")
|
||||
|
||||
# if these are set then do not try to find them again,
|
||||
# by avoiding any try_compiles for the flags
|
||||
if((DEFINED NEON_C_FLAGS) OR (DEFINED HAVE_NEON))
|
||||
else()
|
||||
if(WIN32)
|
||||
set(NEON_C_FLAG_CANDIDATES
|
||||
#Empty, if compiler automatically accepts NEON
|
||||
" ")
|
||||
else()
|
||||
set(NEON_C_FLAG_CANDIDATES
|
||||
#Empty, if compiler automatically accepts NEON
|
||||
" "
|
||||
"-mfpu=neon"
|
||||
"-mfpu=neon -mfloat-abi=softfp"
|
||||
)
|
||||
endif()
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
foreach(FLAG IN LISTS NEON_C_FLAG_CANDIDATES)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
unset(HAVE_NEON CACHE)
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Try NEON C flag = [${FLAG}]")
|
||||
endif()
|
||||
check_c_source_compiles("${NEON_C_TEST_SOURCE}" HAVE_NEON)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
if(HAVE_NEON)
|
||||
set(NEON_C_FLAGS_INTERNAL "${FLAG}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(NEON_C_FLAG_CANDIDATES)
|
||||
|
||||
set(NEON_C_FLAGS "${NEON_C_FLAGS_INTERNAL}"
|
||||
CACHE STRING "C compiler flags for NEON intrinsics")
|
||||
endif()
|
||||
|
||||
list(APPEND _NEON_REQUIRED_VARS NEON_C_FLAGS)
|
||||
|
||||
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
|
||||
|
||||
if(_NEON_REQUIRED_VARS)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(NEON
|
||||
REQUIRED_VARS ${_NEON_REQUIRED_VARS})
|
||||
|
||||
mark_as_advanced(${_NEON_REQUIRED_VARS})
|
||||
|
||||
unset(_NEON_REQUIRED_VARS)
|
||||
else()
|
||||
message(SEND_ERROR "FindNEON requires C or CXX language to be enabled")
|
||||
endif()
|
||||
@@ -0,0 +1,194 @@
|
||||
# Adapted from https://github.com/jeffdaily/parasail/blob/600fb26151ff19899ee39a214972dcf2b9b11ed7/cmake/FindSSE2.cmake
|
||||
#[[
|
||||
Copyright (c) 2015-2024, Battelle Memorial Institute
|
||||
|
||||
|
||||
1. Battelle Memorial Institute (hereinafter Battelle) hereby grants
|
||||
permission to any person or entity lawfully obtaining a copy of this
|
||||
software and associated documentation files (hereinafter “the
|
||||
Software”) to redistribute and use the Software in source and binary
|
||||
forms, with or without modification. Such person or entity may use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and may permit others to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimers.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
- Other than as used herein, neither the name Battelle Memorial
|
||||
Institute or Battelle may be used in any form whatsoever without
|
||||
the express written consent of Battelle.
|
||||
|
||||
- Redistributions of the software in any form, and publications
|
||||
based on work performed using the software should include the
|
||||
following citation as a reference:
|
||||
|
||||
Daily, Jeff. (2016). Parasail: SIMD C library for global,
|
||||
semi-global, and local pairwise sequence alignments. *BMC
|
||||
Bioinformatics*, 17(1), 1-11. doi:10.1186/s12859-016-0930-z
|
||||
|
||||
2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BATTELLE
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
]]
|
||||
|
||||
#.rst:
|
||||
# FindSSE2
|
||||
# --------
|
||||
#
|
||||
# Finds SSE2 support
|
||||
#
|
||||
# This module can be used to detect SSE2 support in a C compiler. If
|
||||
# the compiler supports SSE2, the flags required to compile with
|
||||
# SSE2 support are returned in variables for the different languages.
|
||||
# The variables may be empty if the compiler does not need a special
|
||||
# flag to support SSE2.
|
||||
#
|
||||
# The following variables are set:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SSE2_C_FLAGS - flags to add to the C compiler for SSE2 support
|
||||
# SSE2_FOUND - true if SSE2 is detected
|
||||
#
|
||||
#=============================================================================
|
||||
|
||||
set(_SSE2_REQUIRED_VARS)
|
||||
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
|
||||
set(CMAKE_REQUIRED_QUIET ${SSE2_FIND_QUIETLY})
|
||||
|
||||
# sample SSE2 source code to test
|
||||
set(SSE2_C_TEST_SOURCE
|
||||
"
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
int foo() {
|
||||
__m128i vOne = _mm_set1_epi16(1);
|
||||
__m128i result = _mm_add_epi16(vOne,vOne);
|
||||
return _mm_extract_epi16(result, 0);
|
||||
}
|
||||
int main(void) { return foo(); }
|
||||
")
|
||||
|
||||
# if these are set then do not try to find them again,
|
||||
# by avoiding any try_compiles for the flags
|
||||
if((DEFINED SSE2_C_FLAGS) OR (DEFINED HAVE_SSE2))
|
||||
else()
|
||||
if(WIN32)
|
||||
set(SSE2_C_FLAG_CANDIDATES
|
||||
#Empty, if compiler automatically accepts SSE2
|
||||
" "
|
||||
"/arch:SSE2")
|
||||
else()
|
||||
set(SSE2_C_FLAG_CANDIDATES
|
||||
#Empty, if compiler automatically accepts SSE2
|
||||
" "
|
||||
#GNU, Intel
|
||||
"-march=core2"
|
||||
#clang
|
||||
"-msse2"
|
||||
)
|
||||
endif()
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
foreach(FLAG IN LISTS SSE2_C_FLAG_CANDIDATES)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
unset(HAVE_SSE2 CACHE)
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Try SSE2 C flag = [${FLAG}]")
|
||||
endif()
|
||||
check_c_source_compiles("${SSE2_C_TEST_SOURCE}" HAVE_SSE2)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
if(HAVE_SSE2)
|
||||
set(SSE2_C_FLAGS_INTERNAL "${FLAG}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(SSE2_C_FLAG_CANDIDATES)
|
||||
|
||||
set(SSE2_C_FLAGS "${SSE2_C_FLAGS_INTERNAL}"
|
||||
CACHE STRING "C compiler flags for SSE2 intrinsics")
|
||||
endif()
|
||||
|
||||
list(APPEND _SSE2_REQUIRED_VARS SSE2_C_FLAGS)
|
||||
|
||||
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
|
||||
|
||||
if(_SSE2_REQUIRED_VARS)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(SSE2
|
||||
REQUIRED_VARS ${_SSE2_REQUIRED_VARS})
|
||||
|
||||
mark_as_advanced(${_SSE2_REQUIRED_VARS})
|
||||
|
||||
unset(_SSE2_REQUIRED_VARS)
|
||||
else()
|
||||
message(SEND_ERROR "FindSSE2 requires C or CXX language to be enabled")
|
||||
endif()
|
||||
|
||||
set(SSE2_C_TEST_SOURCE_SET1_EPI64X
|
||||
"
|
||||
#include <stdint.h>
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
__m128i foo() {
|
||||
__m128i vOne = _mm_set1_epi64x(1);
|
||||
return vOne;
|
||||
}
|
||||
int main(void) { foo(); return 0; }
|
||||
")
|
||||
|
||||
if(SSE2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${SSE2_C_FLAGS}")
|
||||
check_c_source_compiles("${SSE2_C_TEST_SOURCE_SET1_EPI64X}" HAVE_SSE2_MM_SET1_EPI64X)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(SSE2_C_TEST_SOURCE_SET_EPI64X
|
||||
"
|
||||
#include <stdint.h>
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
__m128i foo() {
|
||||
__m128i vOne = _mm_set_epi64x(1,1);
|
||||
return vOne;
|
||||
}
|
||||
int main(void) { foo(); return 0; }
|
||||
")
|
||||
|
||||
if(SSE2_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${SSE2_C_FLAGS}")
|
||||
check_c_source_compiles("${SSE2_C_TEST_SOURCE_SET_EPI64X}" HAVE_SSE2_MM_SET_EPI64X)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
@@ -0,0 +1,198 @@
|
||||
# Adapted from https://github.com/jeffdaily/parasail/blob/600fb26151ff19899ee39a214972dcf2b9b11ed7/cmake/FindSSE41.cmake
|
||||
#[[
|
||||
Copyright (c) 2015-2024, Battelle Memorial Institute
|
||||
|
||||
|
||||
1. Battelle Memorial Institute (hereinafter Battelle) hereby grants
|
||||
permission to any person or entity lawfully obtaining a copy of this
|
||||
software and associated documentation files (hereinafter “the
|
||||
Software”) to redistribute and use the Software in source and binary
|
||||
forms, with or without modification. Such person or entity may use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and may permit others to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimers.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
- Other than as used herein, neither the name Battelle Memorial
|
||||
Institute or Battelle may be used in any form whatsoever without
|
||||
the express written consent of Battelle.
|
||||
|
||||
- Redistributions of the software in any form, and publications
|
||||
based on work performed using the software should include the
|
||||
following citation as a reference:
|
||||
|
||||
Daily, Jeff. (2016). Parasail: SIMD C library for global,
|
||||
semi-global, and local pairwise sequence alignments. *BMC
|
||||
Bioinformatics*, 17(1), 1-11. doi:10.1186/s12859-016-0930-z
|
||||
|
||||
2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BATTELLE
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
]]
|
||||
|
||||
#.rst:
|
||||
# FindSSE41
|
||||
# ---------
|
||||
#
|
||||
# Finds SSE41 support
|
||||
#
|
||||
# This module can be used to detect SSE41 support in a C compiler. If
|
||||
# the compiler supports SSE41, the flags required to compile with
|
||||
# SSE41 support are returned in variables for the different languages.
|
||||
# The variables may be empty if the compiler does not need a special
|
||||
# flag to support SSE41.
|
||||
#
|
||||
# The following variables are set:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SSE41_C_FLAGS - flags to add to the C compiler for SSE41 support
|
||||
# SSE41_FOUND - true if SSE41 is detected
|
||||
#
|
||||
#=============================================================================
|
||||
|
||||
set(_SSE41_REQUIRED_VARS)
|
||||
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
|
||||
set(CMAKE_REQUIRED_QUIET ${SSE41_FIND_QUIETLY})
|
||||
|
||||
# sample SSE41 source code to test
|
||||
set(SSE41_C_TEST_SOURCE
|
||||
"
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
int foo() {
|
||||
__m128i vOne = _mm_set1_epi8(1);
|
||||
__m128i result = _mm_max_epi8(vOne,vOne);
|
||||
return _mm_extract_epi8(result, 0);
|
||||
}
|
||||
int main(void) { return foo(); }
|
||||
")
|
||||
|
||||
# if these are set then do not try to find them again,
|
||||
# by avoiding any try_compiles for the flags
|
||||
if((DEFINED SSE41_C_FLAGS) OR (DEFINED HAVE_SSE41))
|
||||
else()
|
||||
if(WIN32)
|
||||
set(SSE41_C_FLAG_CANDIDATES
|
||||
#Empty, if compiler automatically accepts SSE41
|
||||
" "
|
||||
"/arch:SSE2")
|
||||
else()
|
||||
set(SSE41_C_FLAG_CANDIDATES
|
||||
#Empty, if compiler automatically accepts SSE41
|
||||
" "
|
||||
#GNU, Intel
|
||||
"-march=corei7"
|
||||
#clang
|
||||
"-msse4"
|
||||
#GNU 4.4.7 ?
|
||||
"-msse4.1"
|
||||
)
|
||||
endif()
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
foreach(FLAG IN LISTS SSE41_C_FLAG_CANDIDATES)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
unset(HAVE_SSE41 CACHE)
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Try SSE41 C flag = [${FLAG}]")
|
||||
endif()
|
||||
check_c_source_compiles("${SSE41_C_TEST_SOURCE}" HAVE_SSE41)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
if(HAVE_SSE41)
|
||||
set(SSE41_C_FLAGS_INTERNAL "${FLAG}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(SSE41_C_FLAG_CANDIDATES)
|
||||
|
||||
set(SSE41_C_FLAGS "${SSE41_C_FLAGS_INTERNAL}"
|
||||
CACHE STRING "C compiler flags for SSE41 intrinsics")
|
||||
endif()
|
||||
|
||||
list(APPEND _SSE41_REQUIRED_VARS SSE41_C_FLAGS)
|
||||
|
||||
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
|
||||
|
||||
if(_SSE41_REQUIRED_VARS)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(SSE41
|
||||
REQUIRED_VARS ${_SSE41_REQUIRED_VARS})
|
||||
|
||||
mark_as_advanced(${_SSE41_REQUIRED_VARS})
|
||||
|
||||
unset(_SSE41_REQUIRED_VARS)
|
||||
else()
|
||||
message(SEND_ERROR "FindSSE41 requires C or CXX language to be enabled")
|
||||
endif()
|
||||
|
||||
# begin tests for SSE4.1 specfic features
|
||||
|
||||
set(SSE41_C_TEST_SOURCE_INSERT64
|
||||
"
|
||||
#include <stdint.h>
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
__m128i foo() {
|
||||
__m128i vOne = _mm_set1_epi8(1);
|
||||
return _mm_insert_epi64(vOne,INT64_MIN,0);
|
||||
}
|
||||
int main(void) { foo(); return 0; }
|
||||
")
|
||||
|
||||
if(SSE41_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${SSE41_C_FLAGS}")
|
||||
check_c_source_compiles("${SSE41_C_TEST_SOURCE_INSERT64}" HAVE_SSE41_MM_INSERT_EPI64)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(SSE41_C_TEST_SOURCE_EXTRACT64
|
||||
"
|
||||
#include <stdint.h>
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
int64_t foo() {
|
||||
__m128i vOne = _mm_set1_epi8(1);
|
||||
return (int64_t)_mm_extract_epi64(vOne,0);
|
||||
}
|
||||
int main(void) { return (int)foo(); }
|
||||
")
|
||||
|
||||
if(SSE41_C_FLAGS)
|
||||
include(CheckCSourceCompiles)
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${SSE41_C_FLAGS}")
|
||||
check_c_source_compiles("${SSE41_C_TEST_SOURCE_EXTRACT64}" HAVE_SSE41_MM_EXTRACT_EPI64)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
endif()
|
||||
@@ -0,0 +1,962 @@
|
||||
# Updates for iOS Copyright (c) 2024, Holochip Inc.
|
||||
# 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)
|
||||
|
||||
# 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()
|
||||
|
||||
# FindVulkan only works correctly with the default CMAKE_FIND_FRAMEWORK
|
||||
# value: FIRST. If LAST it will find the macOS dylibs instead of the iOS
|
||||
# frameworks when IOS is true. If ALWAYS it will fail to find the macOS
|
||||
# dylibs. If NEVER it will fail to find the iOS frameworks. If frameworks
|
||||
# are ever included in the SDK for macOS, the search mechanism will need
|
||||
# revisiting.
|
||||
if(DEFINED CMAKE_FIND_FRAMEWORK)
|
||||
set(_Vulkan_saved_cmake_find_framework ${CMAKE_FIND_FRAMEWORK})
|
||||
set(CMAKE_FIND_FRAMEWORK FIRST)
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
get_filename_component(Vulkan_Target_SDK "$ENV{VULKAN_SDK}/.." REALPATH)
|
||||
list(APPEND CMAKE_FRAMEWORK_PATH "${Vulkan_Target_SDK}/iOS/lib")
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
|
||||
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
|
||||
"$ENV{VULKAN_SDK}/include"
|
||||
)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_Vulkan_hint_executable_search_paths
|
||||
"$ENV{VULKAN_SDK}/bin"
|
||||
)
|
||||
set(_Vulkan_hint_library_search_paths
|
||||
"$ENV{VULKAN_SDK}/lib"
|
||||
"$ENV{VULKAN_SDK}/bin"
|
||||
)
|
||||
else()
|
||||
set(_Vulkan_hint_executable_search_paths
|
||||
"$ENV{VULKAN_SDK}/bin32"
|
||||
"$ENV{VULKAN_SDK}/bin"
|
||||
)
|
||||
set(_Vulkan_hint_library_search_paths
|
||||
"$ENV{VULKAN_SDK}/lib32"
|
||||
"$ENV{VULKAN_SDK}/bin32"
|
||||
"$ENV{VULKAN_SDK}/lib"
|
||||
"$ENV{VULKAN_SDK}/bin"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set(_Vulkan_library_name vulkan)
|
||||
set(_Vulkan_hint_include_search_paths
|
||||
"$ENV{VULKAN_SDK}/include"
|
||||
)
|
||||
set(_Vulkan_hint_executable_search_paths
|
||||
"$ENV{VULKAN_SDK}/bin"
|
||||
)
|
||||
set(_Vulkan_hint_library_search_paths
|
||||
"$ENV{VULKAN_SDK}/lib"
|
||||
)
|
||||
endif()
|
||||
if(APPLE AND DEFINED Vulkan_Target_SDK)
|
||||
list(APPEND _Vulkan_hint_include_search_paths
|
||||
"${Vulkan_Target_SDK}/macOS/include"
|
||||
)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
list(APPEND _Vulkan_hint_library_search_paths
|
||||
"${Vulkan_Target_SDK}/iOS/lib"
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
|
||||
list(APPEND _Vulkan_hint_library_search_paths
|
||||
"${Vulkan_Target_SDK}/tvOS/lib"
|
||||
)
|
||||
else()
|
||||
list(APPEND _Vulkan_hint_library_search_paths
|
||||
"${Vulkan_Target_SDK}/lib"
|
||||
)
|
||||
endif()
|
||||
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}
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
#message(STATUS "vulkan_library ${Vulkan_LIBRARY} search paths ${_Vulkan_hint_library_search_paths}")
|
||||
mark_as_advanced(Vulkan_LIBRARY)
|
||||
|
||||
find_library(Vulkan_Layer_API_DUMP
|
||||
NAMES VkLayer_api_dump
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_Layer_API_DUMP)
|
||||
|
||||
find_library(Vulkan_Layer_SHADER_OBJECT
|
||||
NAMES VkLayer_khronos_shader_object
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(VkLayer_khronos_shader_object)
|
||||
|
||||
find_library(Vulkan_Layer_SYNC2
|
||||
NAMES VkLayer_khronos_synchronization2
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_Layer_SYNC2)
|
||||
|
||||
find_library(Vulkan_Layer_VALIDATION
|
||||
NAMES VkLayer_khronos_validation
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_Layer_VALIDATION)
|
||||
|
||||
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)
|
||||
# CMake has a bug in 3.28 that doesn't handle xcframeworks. Do it by hand for now.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
if(CMAKE_VERSION VERSION_LESS 3.29)
|
||||
set( _Vulkan_hint_library_search_paths ${Vulkan_Target_SDK}/ios/lib/MoltenVK.xcframework/ios-arm64)
|
||||
else ()
|
||||
set( _Vulkan_hint_library_search_paths ${Vulkan_Target_SDK}/ios/lib/)
|
||||
endif ()
|
||||
endif ()
|
||||
find_library(Vulkan_MoltenVK_LIBRARY
|
||||
NAMES MoltenVK
|
||||
NO_DEFAULT_PATH
|
||||
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(DEFINED _Vulkan_saved_cmake_find_framework)
|
||||
set(CMAKE_FIND_FRAMEWORK ${_Vulkan_saved_cmake_find_framework})
|
||||
unset(_Vulkan_saved_cmake_find_framework)
|
||||
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(FindPackageHandleStandardArgs)
|
||||
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)
|
||||
get_filename_component(_Vulkan_lib_extension ${Vulkan_LIBRARIES} LAST_EXT)
|
||||
if(_Vulkan_lib_extension STREQUAL ".framework" AND CMAKE_VERSION VERSION_LESS 3.28)
|
||||
set_target_properties(Vulkan::Vulkan PROPERTIES
|
||||
# Prior to 3.28 must reference library just inside the framework.
|
||||
IMPORTED_LOCATION "${Vulkan_LIBRARIES}/vulkan")
|
||||
else()
|
||||
set_target_properties(Vulkan::Vulkan PROPERTIES
|
||||
IMPORTED_LOCATION "${Vulkan_LIBRARIES}")
|
||||
endif()
|
||||
set_target_properties(Vulkan::Vulkan PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
unset(_Vulkan_lib_extension)
|
||||
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)
|
||||
Reference in New Issue
Block a user