CMakeLists.txt 1.6 KB
Newer Older
1 2
configure_file(config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)

3 4
# phi auto cmake utils
include(phi)
5

6 7 8
# paddle experimental common components
add_subdirectory(common)

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

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

46 47
get_property(phi_kernels GLOBAL PROPERTY PHI_KERNELS)
set(PHI_DEPS ${PHI_DEPS} ${phi_kernels})
48

L
Leo Chen 已提交
49
cc_library(phi DEPS ${PHI_DEPS})
50

51 52 53 54 55 56 57
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"
)
58

59
file(APPEND ${phi_extension_header_file} "#include \"paddle/phi/config.h\"\n\n")
60
# generate inner headers include dir for users
61
generate_unify_header(backends EXCLUDES context_pool_utils.h)
62
generate_unify_header(core EXCLUDES cuda_stream.h)
63 64
generate_unify_header(infermeta)
generate_unify_header(kernels SKIP_SUFFIX grad_kernel)