CMakeLists.txt 1.5 KB
Newer Older
1 2
# phi auto cmake utils
include(phi)
3

4 5 6
# paddle experimental common components
add_subdirectory(common)

7 8
# phi (low level) api headers: include
# phi (high level) api
9
add_subdirectory(api)
10
# phi core components
11
add_subdirectory(core)
12
# phi components of specific backends
C
Chen Weihang 已提交
13
add_subdirectory(backends)
14
# phi kernels for diff device
15
add_subdirectory(kernels)
16
# phi infermeta
C
Chen Weihang 已提交
17
add_subdirectory(infermeta)
18
# phi tools
19
add_subdirectory(tools)
20 21 22 23
# phi capi
if(WITH_CUSTOM_DEVICE)
  add_subdirectory(capi)
endif()
24 25

# make an unity target for compile deps
26 27 28
set(PHI_DEPS
    convert_utils
    dense_tensor
29
    phi_backends
30 31 32 33 34 35 36 37 38
    kernel_factory
    kernel_context
    arg_map_context
    infermeta
    lod_utils
    sparse_csr_tensor
    sparse_coo_tensor
    string_tensor
    api_scalar
39 40
    api_int_array
    extended_tensor)
41

42 43
get_property(phi_kernels GLOBAL PROPERTY PHI_KERNELS)
set(PHI_DEPS ${PHI_DEPS} ${phi_kernels})
44

L
Leo Chen 已提交
45
cc_library(phi DEPS ${PHI_DEPS})
46

47 48 49 50 51 52 53
set(phi_extension_header_file
    ${CMAKE_CURRENT_SOURCE_DIR}/extension.h
    CACHE INTERNAL "phi/extension.h file")
file(
  WRITE ${phi_extension_header_file}
  "// Header file generated by paddle/phi/CMakeLists.txt for external users,\n// DO NOT edit or include it within paddle.\n\n#pragma once\n\n"
)
54 55

# generate inner headers include dir for users
56
generate_unify_header(backends EXCLUDES context_pool_utils.h)
57
generate_unify_header(core EXCLUDES cuda_stream.h)
58 59
generate_unify_header(infermeta)
generate_unify_header(kernels SKIP_SUFFIX grad_kernel)