"docs-source/usersguide/vscode:/vscode.git/clone" did not exist on "87a70daf1753105594cc8996aabdc66daddfcd6f"
phi_header.cmake 2.24 KB
Newer Older
yuguo960516yuguo's avatar
yuguo960516yuguo committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set(PADDLE_INFERENCE_INSTALL_DIR
    "${CMAKE_BINARY_DIR}/paddle_inference_install_dir")

function(phi_header_path_compat TARGET_PATH)
  message(STATUS "phi header path compat processing: ${TARGET_PATH}")
“yuguo”'s avatar
2.5  
“yuguo” committed
20
21
22
23
24
25
26
27
28
29
  file(GLOB HEADERS "${TARGET_PATH}/*" "*.h")
  foreach(header ${HEADERS})
    if(${header} MATCHES ".*.h$")
      file(READ ${header} HEADER_CONTENT)
      string(REPLACE "paddle/fluid/platform/" "paddle/phi/" HEADER_CONTENT
                     "${HEADER_CONTENT}")
      file(WRITE ${header} "${HEADER_CONTENT}")
      message(STATUS "phi header path compat processing complete: ${header}")
    endif()
  endforeach()
yuguo960516yuguo's avatar
yuguo960516yuguo committed
30
31
endfunction()

“yuguo”'s avatar
2.5  
“yuguo” committed
32
phi_header_path_compat(${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle)
yuguo960516yuguo's avatar
yuguo960516yuguo committed
33
phi_header_path_compat(
“yuguo”'s avatar
2.5  
“yuguo” committed
34
  ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi)
yuguo960516yuguo's avatar
yuguo960516yuguo committed
35
phi_header_path_compat(
“yuguo”'s avatar
2.5  
“yuguo” committed
36
  ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api)
yuguo960516yuguo's avatar
yuguo960516yuguo committed
37
phi_header_path_compat(
“yuguo”'s avatar
2.5  
“yuguo” committed
38
  ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api/ext)
yuguo960516yuguo's avatar
yuguo960516yuguo committed
39
phi_header_path_compat(
“yuguo”'s avatar
2.5  
“yuguo” committed
40
  ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api/include)
yuguo960516yuguo's avatar
yuguo960516yuguo committed
41
phi_header_path_compat(
“yuguo”'s avatar
2.5  
“yuguo” committed
42
  ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/common)
yuguo960516yuguo's avatar
yuguo960516yuguo committed
43
phi_header_path_compat(
“yuguo”'s avatar
2.5  
“yuguo” committed
44
  ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/core)
yuguo960516yuguo's avatar
yuguo960516yuguo committed
45

“yuguo”'s avatar
2.5  
“yuguo” committed
46
47
48
49
50
51
52
# NOTE(liuyuanle): In inference lib, no need include paddle/utils/pybind.h, so we delete this.
file(READ ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/extension.h
     HEADER_CONTENT)
string(REGEX REPLACE "#if !defined\\(PADDLE_ON_INFERENCE\\).*#endif" ""
                     HEADER_CONTENT "${HEADER_CONTENT}")
file(WRITE ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/extension.h
     "${HEADER_CONTENT}")