Skip to content

Commit f47a03c

Browse files
authored
Merge pull request #166 from Taoxuan-168/main
增加对maixcam2的支持
2 parents 6e0d71f + cde9dc2 commit f47a03c

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

docs/doc/zh/source_code/add_c_module.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ title: 给 MaixCAM MaixPy 添加一个 C/C++ 模块
99

1010
## 通用函数封装
1111

12-
如果你想封装的函数实现的功能不依赖 MaixPy 的其它功能,直接使用 Python 使用 C/C++ 添加模块的通用方法,具体方法可以自行百度,比如 ffi, ctype 等
13-
> 欢迎 PR 添加方法
12+
如果你想封装的函数实现的功能不依赖 MaixPy 的其它功能,直接使用 Python 使用 C/C++ 添加模块的通用方法,具体方法可以查看:
13+
https://maixhub.com/share/114
1414

1515
## 如果你的模块还想依赖 MaixPy 的其它基础 API
1616

tools/maix_module/configs/config_platform_maixcam2.mk

Whitespace-only changes.

tools/maix_module/setup.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@
77

88
####################################################################
99
# supported platforms
10-
board_names = ["linux", "maixcam"]
10+
# 1. 新增 maixcam2 到支持的平台列表中
11+
board_names = ["linux", "maixcam", "maixcam2"] # 修改点:添加 maixcam2
1112
platform_names = {
1213
# use correspond docker to compile https://github.com/pypa/manylinux
1314
"linux": "manylinux2014_{}".format(platform.machine().replace("-", "_").replace(".", "_").lower()),
1415
"m2dock": "linux_armv7l",
1516
"maixcam": "linux_riscv64",
17+
"maixcam2": "linux_arrch64", # 修改点:添加 maixcam2 对应的平台名称
1618
}
1719
platform_toolchain_id = {
18-
"maixcam": "musl_t-hread"
20+
"maixcam": "musl_t-hread",
21+
"maixcam2": "cross-gcc-11.3" # 修改点:添加 maixcam2 对应的工具链ID
1922
}
2023
####################################################################
2124

@@ -70,11 +73,15 @@ def print_py_version_err(build_py_version):
7073
print(" conda create -n python{}.{} python={}.{}".format(build_py_version[0], build_py_version[1], build_py_version[0], build_py_version[1]))
7174
print(" conda activate python{}.{}".format(build_py_version[0], build_py_version[1]))
7275

73-
# specially check for maixcam
76+
# specially check for maixcam and maixcam2
7477
py_version = get_python_version()
7578
if board == "maixcam" and f"{py_version[0]}.{py_version[1]}" != "3.11":
7679
print_py_version_err([3, 11])
7780
sys.exit(1)
81+
# 修改点:新增 maixcam2 的 Python 版本强制检测(要求 3.13)
82+
if board == "maixcam2" and f"{py_version[0]}.{py_version[1]}" != "3.13":
83+
print_py_version_err([3, 13])
84+
sys.exit(1)
7885

7986
if board:
8087
# build CPP modules, and copy to build/lib/
@@ -273,7 +280,7 @@ def has_ext_modules(foo):
273280
# os.rename(os.path.join("dist", name), os.path.join("dist",
274281
# "MaixPy-{}-{}-{}-{}.whl".format(__version__, py_tag, py_tag, platform_names[board]))
275282
# )
276-
if name.find("linux_riscv64") != -1 or name.find("manylinux2014_") != -1:# 增加linux平台判断,使linux平台和maixcam平台执行相同的whl打包逻辑
283+
if True:# 所有平台都打包whl文件
277284
# pypi not support riscv64 yet, so we have to change to py3-none-any pkg
278285
# unzip to dist/temp, change dist-info/WHEEL file
279286
# zip back and rename

0 commit comments

Comments
 (0)