|
7 | 7 |
|
8 | 8 | #include "../../lib/Interpreter/Paths.h"
|
9 | 9 |
|
| 10 | +#define XCPP_INTEROP_STRINGIFY(x) #x |
| 11 | +#define CPP_INTEROP_STRINGIFY(x) XCPP_INTEROP_STRINGIFY(x) |
| 12 | + |
10 | 13 | // This function isn't referenced outside its translation unit, but it
|
11 | 14 | // can't use the "static" keyword because its address is used for
|
12 | 15 | // GetMainExecutable (since some platforms don't support taking the
|
@@ -59,15 +62,23 @@ TEST(DynamicLibraryManagerTest, Sanity) {
|
59 | 62 |
|
60 | 63 | TEST(UtilsPlatform, DLTest) {
|
61 | 64 | std::string err = "";
|
| 65 | + // CPPINTEROP_LIB_TestSharedLib_DIR_PREFIX specified by cmake though target |
| 66 | + // definitions |
62 | 67 | #if defined(__APPLE__)
|
63 | 68 | auto dlopen_handle = Cpp::utils::platform::DLOpen(
|
64 |
| - "./libTestSharedLib.dylib", err); |
| 69 | + CPP_INTEROP_STRINGIFY( |
| 70 | + CPPINTEROP_LIB_TestSharedLib_DIR_PREFIX) "./libTestSharedLib.dylib", |
| 71 | + err); |
65 | 72 | #elif defined(_WIN32)
|
66 | 73 | auto dlopen_handle = Cpp::utils::platform::DLOpen(
|
67 |
| - "./libTestSharedLib.dll", err); |
| 74 | + CPP_INTEROP_STRINGIFY( |
| 75 | + CPPINTEROP_LIB_TestSharedLib_DIR_PREFIX) "./libTestSharedLib.dll", |
| 76 | + err); |
68 | 77 | #else
|
69 |
| - auto dlopen_handle = |
70 |
| - Cpp::utils::platform::DLOpen("../bin/libTestSharedLib.so", err); |
| 78 | + auto dlopen_handle = Cpp::utils::platform::DLOpen( |
| 79 | + CPP_INTEROP_STRINGIFY( |
| 80 | + CPPINTEROP_LIB_TestSharedLib_DIR_PREFIX) "./libTestSharedLib.so", |
| 81 | + err); |
71 | 82 | #endif
|
72 | 83 | EXPECT_TRUE(dlopen_handle);
|
73 | 84 | EXPECT_TRUE(err.empty());
|
|
0 commit comments