# CMakeLists.txt -- Build system for the pybind11 test suite
#
# Copyright (c) 2015 Wenzel Jakob <wenzel@inf.ethz.ch>
#
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
cmake_minimum_required(VERSION 3.4)
# The `cmake_minimum_required(VERSION 3.4...3.18)` syntax does not work with
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
# the behavior using the following workaround:
if(${CMAKE_VERSION} VERSION_LESS 3.21)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.21)
endif()
# Only needed for CMake < 3.5 support
include(CMakeParseArguments)
# Filter out items; print an optional message if any items filtered
#
# Usage:
# pybind11_filter_tests(LISTNAME file1.cpp file2.cpp ... MESSAGE "")
#
macro(pybind11_filter_tests LISTNAME)
cmake_parse_arguments(ARG "" "MESSAGE" "" ${ARGN})
set(PYBIND11_FILTER_TESTS_FOUND OFF)
foreach(filename IN LISTS ARG_UNPARSED_ARGUMENTS)
list(FIND ${LISTNAME} ${filename} _FILE_FOUND)
if(_FILE_FOUND GREATER -1)
list(REMOVE_AT ${LISTNAME} ${_FILE_FOUND})
set(PYBIND11_FILTER_TESTS_FOUND ON)
endif()
endforeach()
if(PYBIND11_FILTER_TESTS_FOUND AND ARG_MESSAGE)
message(STATUS "${ARG_MESSAGE}")
endif()
endmacro()
macro(possibly_uninitialized)
foreach(VARNAME ${ARGN})
if(NOT DEFINED "${VARNAME}")
set("${VARNAME}" "")
endif()
endforeach()
endmacro()
# New Python support
if(DEFINED Python_EXECUTABLE)
set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
set(PYTHON_VERSION "${Python_VERSION}")
endif()
# There's no harm in including a project in a project
project(pybind11_tests CXX)
# Access FindCatch and more
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../tools")
option(PYBIND11_WERROR "Report all warnings as errors" OFF)
option(DOWNLOAD_EIGEN "Download EIGEN (requires CMake 3.11+)" OFF)
option(PYBIND11_CUDA_TESTS "Enable building CUDA tests (requires CMake 3.12+)" OFF)
set(PYBIND11_TEST_OVERRIDE
""
CACHE STRING "Tests from ;-separated list of *.cpp files will be built instead of all tests")
set(PYBIND11_TEST_FILTER
""
CACHE STRING "Tests from ;-separated list of *.cpp files will be removed from all tests")
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# We're being loaded directly, i.e. not via add_subdirectory, so make this
# work as its own project and load the pybind11Config to get the tools we need
find_package(pybind11 REQUIRED CONFIG)
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting tests build type to MinSizeRel as none was specified")
set(CMAKE_BUILD_TYPE
MinSizeRel
CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel"
"RelWithDebInfo")
endif()
if(PYBIND11_CUDA_TESTS)
enable_language(CUDA)
if(DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
endif()
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()
# Full set of test files (you can override these; see below)
set(PYBIND11_TEST_FILES
test_async.cpp
test_buffers.cpp
test_builtin_casters.cpp
test_call_policies.cpp
test_callbacks.cpp
test_chrono.cpp
test_class.cpp
test_constants_and_functions.cpp
test_copy_move.cpp
test_custom_type_casters.cpp
test_custom_type_setup.cpp
test_docstring_options.cpp
test_eigen.cpp
test_enum.cpp
test_eval.cpp
test_exceptions.cpp
test_factory_constructors.cpp
test_gil_scoped.cpp
test_iostream.cpp
test_kwargs_and_defaults.cpp
test_local_bindings.cpp
test_methods_and_attributes.cpp
test_modules.cpp
test_multiple_inheritance.cpp
test_numpy_array.cpp
test_numpy_dtypes.cpp
test_numpy_vectorize.cpp
test_opaque_types.cpp
test_operator_overloading.cpp
test_pickling.cpp
test_pytypes.cpp
test_sequences_and_iterators.cpp
test_smart_ptr.cpp
test_stl.cpp
test_stl_binders.cpp
test_tagbased_polymorphic.cpp
test_thread.cpp
test_union.cpp
test_virtual_functions.cpp)
# Invoking cmake with something like:
# cmake -DPYBIND11_TEST_OVERRIDE="test_callbacks.cpp;test_pickling.cpp" ..
# lets you override the tests that get compiled and run. You can restore to all tests with:
# cmake -DPYBIND11_TEST_OVERRIDE= ..
if(PYBIND11_TEST_OVERRIDE)
set(PYBIND11_TEST_FILES ${PYBIND11_TEST_OVERRIDE})
endif()
# You can also filter tests:
if(PYBIND11_TEST_FILTER)
pybind11_filter_tests(PYBIND11_TEST_FILES ${PYBIND11_TEST_FILTER})
endif()
if(PYTHON_VERSION VERSION_LESS 3.5)
pybind11_filter_tests(PYBIND11_TEST_FILES test_async.cpp MESSAGE
"Skipping test_async on Python 2")
endif()
# Skip tests for CUDA check:
# /pybind11/tests/test_constants_and_functions.cpp(125):
# error: incompatible exception specifications
if(PYBIND11_CUDA_TESTS)
pybind11_filter_tests(
PYBIND11_TEST_FILES test_constants_and_functions.cpp MESSAGE
"Skipping test_constants_and_functions due to incompatible exception specifications")
endif()
string(REPLACE ".cpp" ".py" PYBIND11_PYTEST_FILES "${PYBIND11_TEST_FILES}")
# Contains the set of test files that require pybind11_cross_module_tests to be
# built; if none of these are built (i.e. because TEST_OVERRIDE is used and
# doesn't include them) the second module doesn't get built.
set(PYBIND11_CROSS_MODULE_TESTS test_exceptions.py test_local_bindings.py test_stl.py
test_stl_binders.py)
set(PYBIND11_CROSS_MODULE_GIL_TESTS test_gil_scoped.py)
set(PYBIND11_EIGEN_REPO
"https://gitlab.com/libeigen/eigen.git"
CACHE STRING "Eigen repository to use for tests")
# Always use a hash for reconfigure speed and security reasons
# Include the version number for pretty printing (keep in sync)
set(PYBIND11_EIGEN_VERSION_AND_HASH
"3.4.0;929bc0e191d0927b1735b9a1ddc0e8b77e3a25ec"
CACHE STRING "Eigen version to use for tests, format: VERSION;HASH")
list(GET PYBIND11_EIGEN_VERSION_AND_HASH 0 PYBIND11_EIGEN_VERSION_STRING)
list(GET PYBIND11_EIGEN_VERSION_AND_HASH 1 PYBIND11_EIGEN_VERSION_HASH)
# Check if Eigen is available; if not, remove from PYBIND11_TEST_FILES (but
# keep it in PYBIND11_PYTEST_FILES, so that we get the "eigen is not installed"
# skip message).
list(FIND PYBIND11_TEST_FILES test_eigen.cpp PYBIND11_TEST_FILES_EIGEN_I)
if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
# Try loading via newer Eigen's Eigen3Config first (bypassing tools/FindEigen3.cmake).
# Eigen 3.3.1+ exports a cmake 3.0+ target for handling dependency requirements, but also
# produces a fatal error if loaded from a pre-3.0 cmake.
if(DOWNLOAD_EIGEN)
if(CMAKE_VERSION VERSION_LESS 3.11)
message(FATAL_ERROR "CMake 3.11+ required when using DOWNLOAD_EIGEN")
endif()
include(FetchContent)
FetchContent_Declare(
eigen
GIT_REPOSITORY "${PYBIND11_EIGEN_REPO}"
GIT_TAG "${PYBIND11_EIGEN_VERSION_HASH}")
FetchContent_GetProperties(eigen)
if(NOT eigen_POPULATED)
message(
STATUS
"Downloading Eigen ${PYBIND11_EIGEN_VERSION_STRING} (${PYBIND11_EIGEN_VERSION_HASH}) from ${PYBIND11_EIGEN_REPO}"
)
FetchContent_Populate(eigen)
endif()
set(EIGEN3_INCLUDE_DIR ${eigen_SOURCE_DIR})
set(EIGEN3_FOUND TRUE)
# When getting locally, the version is not visible from a superprojet,
# so just force it.
set(EIGEN3_VERSION "${PYBIND11_EIGEN_VERSION_STRING}")
else()
find_package(Eigen3 3.2.7 QUIET CONFIG)
if(NOT EIGEN3_FOUND)
# Couldn't load via target, so fall back t
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
使用pybind11导出open62541接口 (238个子文件)
setup.cfg 2KB
.clang-format 472B
.clang-tidy 2KB
pybind11Common.cmake 15KB
FindPythonLibsNew.cmake 10KB
pybind11NewTools.cmake 10KB
pybind11Tools.cmake 7KB
FindEigen3.cmake 3KB
FindCatch.cmake 2KB
open62541.cpp 2.85MB
test_class.cpp 22KB
test_virtual_functions.cpp 21KB
test_methods_and_attributes.cpp 21KB
test_stl.cpp 21KB
test_pytypes.cpp 20KB
test_sequences_and_iterators.cpp 19KB
test_numpy_array.cpp 19KB
test_numpy_dtypes.cpp 19KB
test_smart_ptr.cpp 19KB
test_eigen.cpp 17KB
test_factory_constructors.cpp 17KB
test_builtin_casters.cpp 15KB
test_interpreter.cpp 14KB
test_copy_move.cpp 10KB
test_exceptions.cpp 10KB
test_multiple_inheritance.cpp 9KB
test_callbacks.cpp 9KB
test_operator_overloading.cpp 9KB
test_kwargs_and_defaults.cpp 8KB
test_buffers.cpp 8KB
test_pickling.cpp 7KB
opcua.cpp 6KB
pybind11_cross_module_tests.cpp 6KB
test_constants_and_functions.cpp 6KB
test_custom_type_casters.cpp 6KB
test_enum.cpp 6KB
test_tagbased_polymorphic.cpp 5KB
test_stl_binders.cpp 4KB
test_numpy_vectorize.cpp 4KB
test_local_bindings.cpp 4KB
test_iostream.cpp 4KB
test_call_policies.cpp 4KB
test_modules.cpp 4KB
pybind11_tests.cpp 4KB
test_chrono.cpp 3KB
test_eval.cpp 3KB
test_opaque_types.cpp 3KB
test_docstring_options.cpp 3KB
test_thread.cpp 2KB
cross_module_gil_utils.cpp 2KB
test_gil_scoped.cpp 2KB
opcAPI.cpp 1KB
test_custom_type_setup.cpp 1KB
main.cpp 1KB
test_async.cpp 890B
base.cpp 747B
embed.cpp 677B
catch.cpp 659B
test_union.cpp 625B
external_module.cpp 586B
main.cpp 158B
theme_overrides.css 265B
Doxyfile 675B
.gitignore 532B
open62541.h 1.62MB
pybind11.h 118KB
pytypes.h 76KB
numpy.h 72KB
cast.h 60KB
common.h 48KB
type_caster_base.h 42KB
eigen.h 30KB
class.h 28KB
stl_bind.h 27KB
attr.h 24KB
internals.h 22KB
init.h 17KB
stl.h 14KB
embed.h 12KB
constructor_stats.h 11KB
iostream.h 9KB
operators.h 9KB
chrono.h 9KB
gil.h 7KB
buffer_info.h 6KB
object.h 6KB
eval.h 6KB
descr.h 5KB
functional.h 5KB
filesystem.h 4KB
pybind11_tests.h 3KB
local_bindings.h 3KB
options.h 2KB
complex.h 2KB
typeid.h 1KB
opcua.h 1KB
atom.h 1KB
cthread.h 1002B
base.h 492B
cnode.h 442B
共 238 条
- 1
- 2
- 3
资源评论
Aaron.Ma
- 粉丝: 45
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2406011243520696.mp4
- sql语句及应用场景.zip
- 疯狂吃月饼游戏小程序前端源码
- 硬件工程师+电子类工程师岗位简历模板
- 知识领域: 人工智能 技术关键词: TensorFlow、Keras、深度学习、神经网络
- 知识领域: 自动化测试 技术关键词: pytest、unittest、自动化测试、测试框架
- 知识领域: 数据库管理 技术关键词: SQLAlchemy、数据库、ORM、SQL 内容关键词: 数据库连接、数据查询、数据操作
- 知识领域: 网络编程 技术关键词: socket、网络编程、异步IO、TCP/IP 内容关键词: 客户端、服务器、网络协议
- 知识领域: 自然语言处理 技术关键词: NLTK、spaCy、文本处理、语言模型
- ubuntu20.04安装教程.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功