|
3 | 3 | # and installed. |
4 | 4 | # |
5 | 5 | # LIBDYND_FOUND - was LibDyND found |
| 6 | +# LIBDYND_LIBRARIES - full paths for the LibDyND libraries |
| 7 | +# LIBDYND_LIBRARY_DIR - the directory containing the libdynd libraries |
| 8 | +# LIBDYND_LIBRARY_NAMES - the names of the libdynd libraries |
| 9 | +# LIBDYND_INCLUDE_DIR - path to the LibDyND include files |
| 10 | +# LIBDYND_ROOT_DIR - directory containing LIBDYND_LIBRARY_DIR and LIBDYND_INCLUDE_DIR |
6 | 11 | # LIBDYND_VERSION - the version of LibDyND found as a string |
7 | | -# LIBDYND_LIBRARIES - path to the LibDyND library |
8 | | -# LIBDYND_INCLUDE_DIRS - path to the LibDyND include files |
9 | | -# LIBDYND_CUDA - if LibDyND was built with cuda support |
10 | 12 |
|
11 | 13 | #============================================================================ |
12 | 14 | # Copyright 2013 Continuum Analytics, Inc. |
@@ -48,50 +50,74 @@ else() |
48 | 50 | find_program(_LIBDYND_CONFIG "libdynd-config") |
49 | 51 | endif() |
50 | 52 | if("${_LIBDYND_CONFIG}" STREQUAL "") |
| 53 | + |
51 | 54 | if(LibDyND_FIND_REQUIRED) |
52 | | - message(FATAL_ERROR |
53 | | - "Failed to find libdynd-config program") |
| 55 | + message(FATAL_ERROR "Failed to find libdynd-config program") |
54 | 56 | endif() |
55 | | - set(LIBDYND_FOUND FALSE) |
| 57 | + set(LIBDYND_FOUND False) |
56 | 58 | return() |
57 | | -endif() |
58 | 59 |
|
| 60 | +else() |
59 | 61 |
|
60 | | -# Get the version |
61 | | -execute_process(COMMAND "${_LIBDYND_CONFIG}" "-version" |
62 | | - RESULT_VARIABLE _DYND_SEARCH_SUCCESS |
63 | | - OUTPUT_VARIABLE LIBDYND_VERSION |
64 | | - ERROR_VARIABLE _DYND_ERROR_VALUE |
65 | | - OUTPUT_STRIP_TRAILING_WHITESPACE) |
66 | | -if(NOT _DYND_SEARCH_SUCCESS MATCHES 0) |
67 | | - message(FATAL_ERROR |
68 | | - "Error getting additional properties of libdynd:\n${_DYND_ERROR_VALUE}") |
69 | | -endif() |
| 62 | + # Get the libraries to link against. |
| 63 | + execute_process(COMMAND "${_LIBDYND_CONFIG}" "-libnames" |
| 64 | + RESULT_VARIABLE _DYND_SEARCH_SUCCESS |
| 65 | + OUTPUT_VARIABLE LIBDYND_LIBRARY_NAMES |
| 66 | + ERROR_VARIABLE _DYND_ERROR_VALUE |
| 67 | + OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 68 | + if(NOT _DYND_SEARCH_SUCCESS MATCHES 0) |
| 69 | + message(FATAL_ERROR "Error getting dynd library names:\n${_DYND_ERROR_VALUE}") |
| 70 | + endif() |
70 | 71 |
|
71 | | -# Get the library to link against |
72 | | -execute_process(COMMAND "${_LIBDYND_CONFIG}" "-libpath" |
73 | | - RESULT_VARIABLE _DYND_SEARCH_SUCCESS |
74 | | - OUTPUT_VARIABLE LIBDYND_LIBRARIES |
75 | | - ERROR_VARIABLE _DYND_ERROR_VALUE |
76 | | - OUTPUT_STRIP_TRAILING_WHITESPACE) |
77 | | -if(NOT _DYND_SEARCH_SUCCESS MATCHES 0) |
78 | | - message(FATAL_ERROR |
79 | | - "Error getting additional properties of libdynd:\n${_DYND_ERROR_VALUE}") |
80 | | -endif() |
| 72 | + execute_process(COMMAND "${_LIBDYND_CONFIG}" "-libdir" |
| 73 | + RESULT_VARIABLE _DYND_SEARCH_SUCCESS |
| 74 | + OUTPUT_VARIABLE LIBDYND_LIBRARY_DIR |
| 75 | + ERROR_VARIABLE _DYND_ERROR_VALUE |
| 76 | + OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 77 | + if(NOT _DYND_SEARCH_SUCCESS MATCHES 0) |
| 78 | + message(FATAL_ERROR "Error getting dynd library directory:\n${_DYND_ERROR_VALUE}") |
| 79 | + endif() |
81 | 80 |
|
82 | | -# Get the include directory |
83 | | -execute_process(COMMAND "${_LIBDYND_CONFIG}" "-includedir" |
84 | | - RESULT_VARIABLE _DYND_SEARCH_SUCCESS |
85 | | - OUTPUT_VARIABLE LIBDYND_INCLUDE_DIRS |
86 | | - ERROR_VARIABLE _DYND_ERROR_VALUE |
87 | | - OUTPUT_STRIP_TRAILING_WHITESPACE) |
88 | | -if(NOT _DYND_SEARCH_SUCCESS MATCHES 0) |
89 | | - message(FATAL_ERROR |
90 | | - "Error getting additional properties of libdynd:\n${_DYND_ERROR_VALUE}") |
91 | | -endif() |
| 81 | + # Construct DYND_LIBRARIES from the names and directory given. |
| 82 | + if(WIN32) |
| 83 | + string(REPLACE "\\" "/" LIBDYND_LIBRARY_DIR ${LIBDYND_LIBRARY_DIR}) |
| 84 | + endif() |
| 85 | + set(LIBDYND_LIBRARIES "") |
| 86 | + foreach(_lib ${LIBDYND_LIBRARY_NAMES}) |
| 87 | + LIST(APPEND LIBDYND_LIBRARIES "${LIBDYND_LIBRARY_DIR}/${_lib}") |
| 88 | + endforeach() |
| 89 | + |
| 90 | + # Get the include directory |
| 91 | + execute_process(COMMAND "${_LIBDYND_CONFIG}" "-includedir" |
| 92 | + RESULT_VARIABLE _DYND_SEARCH_SUCCESS |
| 93 | + OUTPUT_VARIABLE LIBDYND_INCLUDE_DIR |
| 94 | + ERROR_VARIABLE _DYND_ERROR_VALUE |
| 95 | + OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 96 | + if(NOT _DYND_SEARCH_SUCCESS MATCHES 0) |
| 97 | + message(FATAL_ERROR "Error getting dynd include directory:\n${_DYND_ERROR_VALUE}") |
| 98 | + endif() |
| 99 | + |
| 100 | + # Get the root directory |
| 101 | + execute_process(COMMAND "${_LIBDYND_CONFIG}" "-rootdir" |
| 102 | + RESULT_VARIABLE _DYND_SEARCH_SUCCESS |
| 103 | + OUTPUT_VARIABLE LIBDYND_ROOT_DIR |
| 104 | + ERROR_VARIABLE _DYND_ERROR_VALUE |
| 105 | + OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 106 | + if(NOT _DYND_SEARCH_SUCCESS MATCHES 0) |
| 107 | + message(FATAL_ERROR "Error getting dynd root directory:\n${_DYND_ERROR_VALUE}") |
| 108 | + endif() |
| 109 | + |
| 110 | + # Get the version |
| 111 | + execute_process(COMMAND "${_LIBDYND_CONFIG}" "-version" |
| 112 | + RESULT_VARIABLE _DYND_SEARCH_SUCCESS |
| 113 | + OUTPUT_VARIABLE LIBDYND_VERSION |
| 114 | + ERROR_VARIABLE _DYND_ERROR_VALUE |
| 115 | + OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 116 | + if(NOT _DYND_SEARCH_SUCCESS MATCHES 0) |
| 117 | + message(FATAL_ERROR "Error getting dynd version:\n${_DYND_ERROR_VALUE}") |
| 118 | + endif() |
92 | 119 |
|
93 | | -find_package_message(LIBDYND |
94 | | - "Found LibDyND: version \"${LIBDYND_VERSION}\", ${LIBDYND_LIBRARIES}" |
95 | | - "${LIBDYND_INCLUDE_DIRS}${LIBDYND_LIBRARIES}${LIBDYND_VERSION}") |
| 120 | + find_package_message(LIBDYND "Found LibDyND: version \"${LIBDYND_VERSION}\"" "${LIBDYND_ROOT_DIR}.") |
96 | 121 |
|
97 | | -set(NUMPY_FOUND TRUE) |
| 122 | + set(LIBDYND_FOUND True) |
| 123 | +endif() |
0 commit comments