Read CppInterOp location from CPPINTEROP_BIN_DIR env var#211
Read CppInterOp location from CPPINTEROP_BIN_DIR env var#211conrade-ctc wants to merge 1 commit into
Conversation
| #elif defined(_WIN32) | ||
| return dir + "/lib/libclangCppInterOp.dll"; | ||
| #elif defined(__APPLE__) | ||
| return dir + "/lib/libclangCppInterOp.dylib"; | ||
| #else | ||
| return dir + "/lib/libclangCppInterOp.so"; |
There was a problem hiding this comment.
Do we need these branches? Seems unlikely that this variable isn't set, do you have an example where this was the case?
There was a problem hiding this comment.
We're not using cmake in our env, so setting it feels artificial... however, since cmake will set the suffix, the WIN32 and APPLE special cases seem unnecessary, and maybe we just go with the main CMAKE_SHARED_LIBRARY_SUFFIX branch with ".so" as the default if not defined. I'll update, let me know if that doesn't seem reasonable.
The CppInterOp install prefix was baked into a CPPINTEROP_DIR macro at build time, so a relocated backend could not find libclangCppInterOp. Add cppinterop_dir()/cppinterop_lib_path() helpers that prefer the CPPINTEROP_BIN_DIR environment variable, fall back to the compile-time default, and report a clear error (instead of relying on the macro always being defined) when the location is unknown. Rename the macro to CPPINTEROP_BIN_DIR to match. Co-developed-with-the-help-of: Claude Code (Claude Opus 4.8)
198aceb to
98c296c
Compare
|
Gentle ping @aaronj0 — the WIN32/APPLE branches have been replaced with a |
aaronj0
left a comment
There was a problem hiding this comment.
LGTM! I guess we need to wait for the CppInterOp side PR to land for this
Summary
CPPINTEROP_DIRmacro at build time, so a relocated backend could not findlibclangCppInterOp.cppinterop_dir()/cppinterop_lib_path()helpers that prefer theCPPINTEROP_BIN_DIRenvironment variable, fall back to the compile-time default, and report a clear error (instead of relying on the macro always being defined) when the location is unknown.CPPINTEROP_BIN_DIRto match.Test plan
test_cppyy: 501 passed, 69 skipped, 19 xfailed, 2 xpassed.import cppyywith a bogusCPPINTEROP_BIN_DIRprints a clear diagnostic instead of crashing.🤖 Done with the help of Claude Code (Claude Opus 4.8)