| 91 | } |
| 92 | |
| 93 | os::String |
| 94 | findWrapper(const char *wrapperFilename, bool verbose) |
| 95 | { |
| 96 | os::String wrapperPath; |
| 97 | |
| 98 | os::String processDir = os::getProcessName(); |
| 99 | processDir.trimFilename(); |
| 100 | |
| 101 | // Try relative build directory |
| 102 | // XXX: Just make build and install directory layout match |
| 103 | wrapperPath = processDir; |
| 104 | #if defined(CMAKE_INTDIR) |
| 105 | // Go from `Debug\apitrace.exe` to `wrappers\Debug\foo.dll` on MSVC builds. |
| 106 | wrapperPath.join(".."); |
| 107 | wrapperPath.join("wrappers"); |
| 108 | wrapperPath.join(CMAKE_INTDIR); |
| 109 | #else |
| 110 | wrapperPath.join("wrappers"); |
| 111 | #endif |
| 112 | wrapperPath.join(wrapperFilename); |
| 113 | if (tryPath(wrapperPath, verbose)) { |
| 114 | return wrapperPath; |
| 115 | } |
| 116 | |
| 117 | #ifdef __GLIBC__ |
| 118 | // We want to take advantage of $LIB dynamic string token expansion in |
| 119 | // glibc dynamic linker to handle multilib layout for us |
| 120 | wrapperPath = processDir; |
| 121 | wrapperPath.join("../$LIB/apitrace/wrappers"); |
| 122 | wrapperPath.join(wrapperFilename); |
| 123 | if (tryLib(wrapperPath, verbose)) { |
| 124 | return wrapperPath; |
| 125 | } |
| 126 | #endif |
| 127 | |
| 128 | // Try relative install directory |
| 129 | wrapperPath = processDir; |
| 130 | #if defined(_WIN32) |
| 131 | wrapperPath.join("..\\lib\\wrappers"); |
| 132 | #elif defined(__APPLE__) |
| 133 | wrapperPath.join("../lib/wrappers"); |
| 134 | #else |
| 135 | wrapperPath.join("../lib/apitrace/wrappers"); |
| 136 | #endif |
| 137 | wrapperPath.join(wrapperFilename); |
| 138 | if (tryPath(wrapperPath, verbose)) { |
| 139 | return wrapperPath; |
| 140 | } |
| 141 | |
| 142 | #ifndef _WIN32 |
| 143 | // Try absolute install directory |
| 144 | wrapperPath = APITRACE_WRAPPERS_INSTALL_DIR; |
| 145 | wrapperPath.join(wrapperFilename); |
| 146 | if (tryPath(wrapperPath, verbose)) { |
| 147 | return wrapperPath; |
| 148 | } |
| 149 | #endif |
| 150 |
no test coverage detected