|
| 1 | +############################################################################### |
| 2 | +# - Find DeePMD |
| 3 | +# Find the native DeePMD headers and libraries. |
| 4 | +# |
| 5 | +# DeePMD_FOUND - True if lib is found. |
| 6 | +# DeePMD_LIBRARIES - List of libraries |
| 7 | +# DeePMD_INCLUDE_DIR - Where to find DeePMD headers. |
| 8 | +# |
| 9 | + |
| 10 | +find_path(DeePMD_INCLUDE_DIR |
| 11 | + deepmd/DeepPot.h |
| 12 | + HINTS ${DeePMD_DIR} |
| 13 | + PATH_SUFFIXES "include" |
| 14 | + ) |
| 15 | +find_library(deepmd_cc |
| 16 | + NAMES deepmd_cc |
| 17 | + HINTS ${DeePMD_DIR} |
| 18 | + PATH_SUFFIXES "lib" |
| 19 | + ) |
| 20 | +find_library(deepmd_op |
| 21 | + NAMES deepmd_op |
| 22 | + HINTS ${DeePMD_DIR} |
| 23 | + PATH_SUFFIXES "lib" |
| 24 | + ) |
| 25 | +find_library(deepmd_op_cuda |
| 26 | + NAMES deepmd_op_cuda |
| 27 | + HINTS ${DeePMD_DIR} |
| 28 | + PATH_SUFFIXES "lib" |
| 29 | + ) |
| 30 | +find_library(tensorflow_cc |
| 31 | + NAMES tensorflow_cc |
| 32 | + HINTS ${DeePMD_DIR} |
| 33 | + PATH_SUFFIXES "lib" |
| 34 | + ) |
| 35 | + |
| 36 | +# Handle the QUIET and REQUIRED arguments and |
| 37 | +# set DeePMD_FOUND to TRUE if all variables are non-zero. |
| 38 | +include(FindPackageHandleStandardArgs) |
| 39 | +find_package_handle_standard_args(DeePMD DEFAULT_MSG deepmd_cc deepmd_op deepmd_op_cuda tensorflow_cc DeePMD_INCLUDE_DIR) |
| 40 | + |
| 41 | +# Copy the results to the output variables and target. |
| 42 | +if(DeePMD_FOUND) |
| 43 | + #set(DeePMD_LIBRARIES ${DeePMD_LIBRARY}) |
| 44 | + set(DeePMD_INCLUDE_DIR ${DeePMD_INCLUDE_DIR}) |
| 45 | + |
| 46 | + if(NOT TARGET DeePMD::deepmd_cc) |
| 47 | + add_library(DeePMD::deepmd_cc UNKNOWN IMPORTED) |
| 48 | + set_target_properties(DeePMD::deepmd_cc PROPERTIES |
| 49 | + IMPORTED_LINK_INTERFACE_LANGUAGES "C" |
| 50 | + IMPORTED_LOCATION "${deepmd_cc}" |
| 51 | + INTERFACE_INCLUDE_DIRECTORIES "${DeePMD_INCLUDE_DIR}") |
| 52 | + endif() |
| 53 | + if(NOT TARGET DeePMD::deepmd_op) |
| 54 | + add_library(DeePMD::deepmd_op UNKNOWN IMPORTED) |
| 55 | + set_target_properties(DeePMD::deepmd_op PROPERTIES |
| 56 | + IMPORTED_LINK_INTERFACE_LANGUAGES "C" |
| 57 | + IMPORTED_LOCATION "${deepmd_op}" |
| 58 | + INTERFACE_INCLUDE_DIRECTORIES "${DeePMD_INCLUDE_DIR}") |
| 59 | + endif() |
| 60 | + if(NOT TARGET DeePMD::deepmd_op_cuda) |
| 61 | + add_library(DeePMD::deepmd_op_cuda UNKNOWN IMPORTED) |
| 62 | + set_target_properties(DeePMD::deepmd_op_cuda PROPERTIES |
| 63 | + IMPORTED_LINK_INTERFACE_LANGUAGES "C" |
| 64 | + IMPORTED_LOCATION "${deepmd_op_cuda}" |
| 65 | + INTERFACE_INCLUDE_DIRECTORIES "${DeePMD_INCLUDE_DIR}") |
| 66 | + endif() |
| 67 | + if(NOT TARGET DeePMD::tensorflow_cc) |
| 68 | + add_library(DeePMD::tensorflow_cc UNKNOWN IMPORTED) |
| 69 | + set_target_properties(DeePMD::tensorflow_cc PROPERTIES |
| 70 | + IMPORTED_LINK_INTERFACE_LANGUAGES "C" |
| 71 | + IMPORTED_LOCATION "${tensorflow_cc}" |
| 72 | + INTERFACE_INCLUDE_DIRECTORIES "${DeePMD_INCLUDE_DIR}") |
| 73 | + endif() |
| 74 | +endif() |
| 75 | + |
| 76 | +set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${DeePMD_INCLUDE_DIR}) |
| 77 | + |
| 78 | +mark_as_advanced(DeePMD_INCLUDE_DIR deepmd_cc deepmd_op deepmd_op_cuda tensorflow_cc) |
0 commit comments