Skip to content

Commit 44cbd40

Browse files
committed
add compat dirs to includes for ci
1 parent b0a182d commit 44cbd40

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

python/paddle/utils/cpp_extension/extension_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ def find_paddle_includes(use_cuda=False):
835835
)
836836
compat_dir_api_include = os.path.join(
837837
paddle_include_dir,
838-
'paddle/phi/api/include/compat/torch/csrc/api/include/',
838+
'paddle/phi/api/include/compat/torch/csrc/api/include',
839839
)
840840
include_dirs.extend([compat_dir_root, compat_dir_api_include])
841841

test/cpp_extension/utils.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
1615
import sys
16+
from pathlib import Path
1717
from site import getsitepackages
1818

1919
import numpy as np
@@ -28,12 +28,19 @@
2828
# PaddlePaddle whl. So here we specific `include_dirs` to avoid errors in CI.
2929
paddle_includes = []
3030
for site_packages_path in getsitepackages():
31-
paddle_includes.append(
32-
os.path.join(site_packages_path, 'paddle', 'include')
33-
)
34-
paddle_includes.append(
35-
os.path.join(site_packages_path, 'paddle', 'include', 'third_party')
36-
)
31+
paddle_include_dir = Path(site_packages_path) / "paddle/include"
32+
paddle_includes.append(str(paddle_include_dir))
33+
paddle_includes.append(str(paddle_include_dir / 'third_party'))
34+
if not IS_WINDOWS:
35+
paddle_includes.append(
36+
str(paddle_include_dir / 'paddle/phi/api/include/compat')
37+
)
38+
paddle_includes.append(
39+
str(
40+
paddle_include_dir
41+
/ 'paddle/phi/api/include/compat/torch/csrc/api/include'
42+
)
43+
)
3744

3845
# Test for extra compile args
3946
extra_cc_args = ['-w', '-g'] if not IS_WINDOWS else ['/w']

0 commit comments

Comments
 (0)