Skip to content
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

【第三方库离线编译】add submodule pybind11 #54322

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

RedContritio
Copy link
Contributor

@RedContritio RedContritio commented Jun 3, 2023

PR types

Others

PR changes

Others

Description

将 pybind11 作为子模块引入,以支持离线编译。

@paddle-bot
Copy link

paddle-bot bot commented Jun 3, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Jun 3, 2023
@RedContritio RedContritio force-pushed the offline_pybind11 branch 8 times, most recently from a95d8af to dfcd011 Compare June 5, 2023 02:29
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Jun 5, 2023
@RedContritio RedContritio changed the title add submodule pybind11 【第三方库离线编译】add submodule pybind11 Jun 5, 2023
@RedContritio RedContritio force-pushed the offline_pybind11 branch 5 times, most recently from 270077c to fa08d99 Compare June 5, 2023 12:18
@RedContritio
Copy link
Contributor Author

@risemeup1 待 review

Copy link
Contributor

@risemeup1 risemeup1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +52 to +59
# I intentionally preserved an extern_pybind/include/pybind11 directory
# to site-packages, so that you could discern that you intended to
# employ not only python, but also CPP and were ready to incorporate header files.
BUILD_COMMAND
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PYBIND_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYBIND_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${SOURCE_INCLUDE_DIR}
${PYBIND_INCLUDE_DIR}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在这里保留了 ${THIRD_PARTY}/pybind/src/extern_pybind/include 目录,并且将 ${SOURCE_DIR}/include 中的内容复制过去。

Paddle/setup.py

Lines 146 to 156 in 2f0b4ad

# third_party
install_dir = re.sub(
env_dict.get("THIRD_PARTY_PATH"), 'third_party', header
)
patterns = [
'install/mkldnn/include/',
'pybind/src/extern_pybind/include/',
'third_party/xpu/src/extern_xpu/xpu/include/',
]
for pattern in patterns:
install_dir = re.sub(pattern, '', install_dir)

因为 setup.py 中需要对该目录('pybind/src/extern_pybind/include/')进行处理,并将之安装到 site-packages 中,所以在不大幅改动 setup.py 逻辑的情况下,先采用该方法。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在这里保留了 ${THIRD_PARTY}/pybind/src/extern_pybind/include 目录,并且将 ${SOURCE_DIR}/include 中的内容复制过去。

Paddle/setup.py

Lines 146 to 156 in 2f0b4ad

# third_party
install_dir = re.sub(
env_dict.get("THIRD_PARTY_PATH"), 'third_party', header
)
patterns = [
'install/mkldnn/include/',
'pybind/src/extern_pybind/include/',
'third_party/xpu/src/extern_xpu/xpu/include/',
]
for pattern in patterns:
install_dir = re.sub(pattern, '', install_dir)

因为 setup.py 中需要对该目录('pybind/src/extern_pybind/include/')进行处理,并将之安装到 site-packages 中,所以在不大幅改动 setup.py 逻辑的情况下,先采用该方法。

ok,的确。

@risemeup1 risemeup1 merged commit 3535049 into PaddlePaddle:develop Jun 7, 2023
@RedContritio RedContritio deleted the offline_pybind11 branch June 7, 2023 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants