-
-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provide cmake python3_add_library #1896
Comments
这个跟 swig 的py模块命名一样? _xxx.so? win 上 _xxx.pyd 能给个完整 linux/macos/win 下模块命名规范么 |
➜ ~ python -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))" 为啥 python2 和 python3 结果还不一样? |
是因为这个 soabi 只有 python3 支持? |
我加上了 add_rules("mode.release", "mode.debug")
add_requires("pybind11")
target("example")
add_rules("python.library")
add_files("src/*.cpp")
add_packages("pybind11")
set_languages("c++11") With soabi add_rules("mode.release", "mode.debug")
add_requires("pybind11")
target("example")
add_rules("python.library", {soabi = true})
add_files("src/*.cpp")
add_packages("pybind11")
set_languages("c++11") Swig with soabi add_rules("mode.release", "mode.debug")
add_requires("python 3.x")
target("example")
add_rules("swig.c", {moduletype = "python", soabi = true})
add_files("src/example.i", {scriptdir = "share"})
add_files("src/example.c")
add_packages("python") |
cmake对soabi的探测是有几种不同方法的,原话是
可能以前soabi是存在distutils里面?我这没有python2环境,没办法确认,windows上python3我实测只有sysconfig.get_config_var('EXT_SUFFIX')有效,其他都不行 |
python2 下 distutils 没 sysconfig 这个对象 |
sysconfig.get_config_var('SOABI')也不行的话应该就是python2不支持了 |
返回也是 None |
我看 cmake 也只有 FindPython3 提到了 soabi ,,FindPython 文档里面也没提到 |
估计就 py3 支持,那目前这样差不多了,你试试呢 dev 上,没问题的话,我就 close 了 |
你在什么场景下需要该功能?
https://cmake.org/cmake/help/latest/module/FindPython3.html#commands
提供cmake的python3_add_library功能
使用python特征的后缀名:不带soabi的so/pyd,带soabi的从distutils或者sysconfig获取
类型为动态链接库
描述可能的解决方案
用一个rule
python_library
来模拟:之前的swig.python没考虑soabi的事情,这里也可以加上
The text was updated successfully, but these errors were encountered: