转码工具页面功能
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(uf2touft3_binding VERSION 1.0.0 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# 查找 Python
|
||||
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
||||
|
||||
# 尝试查找 pybind11
|
||||
# 方法 1: 通过 pip 安装的 pybind11
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -m pybind11 --cmakedir
|
||||
OUTPUT_VARIABLE PYBIND11_CMAKE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
if(PYBIND11_CMAKE_DIR)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${PYBIND11_CMAKE_DIR})
|
||||
endif()
|
||||
|
||||
find_package(pybind11 REQUIRED)
|
||||
|
||||
# 创建 Python 模块
|
||||
pybind11_add_module(uf2touft3_binding uf2touft3_binding.cpp)
|
||||
|
||||
# Windows 特定设置
|
||||
if(WIN32)
|
||||
set_target_properties(uf2touft3_binding PROPERTIES
|
||||
SUFFIX ".pyd"
|
||||
)
|
||||
endif()
|
||||
|
||||
# 安装目标
|
||||
install(TARGETS uf2touft3_binding
|
||||
LIBRARY DESTINATION .
|
||||
RUNTIME DESTINATION .
|
||||
)
|
||||
|
||||
message(STATUS "Python3 executable: ${Python3_EXECUTABLE}")
|
||||
message(STATUS "Python3 include dirs: ${Python3_INCLUDE_DIRS}")
|
||||
message(STATUS "Python3 libraries: ${Python3_LIBRARIES}")
|
||||
message(STATUS "pybind11 found: ${pybind11_FOUND}")
|
||||
Reference in New Issue
Block a user