fix(macosx): make packaged games find the bundled lib/ (RPATH + bootstrap)

The SDK eve carries INSTALL_RPATH @loader_path/../lib for the bin/+lib/
SDK layout, but 'eve package' places the copied lib/ tree at <out>/lib
next to the eve binary, so dyld failed with '@rpath/libz.1.dylib' not
loaded. Add @loader_path/lib to the RPATH and make bootstrapBundledVulkan
check exeDir/lib (package layout) in addition to ../lib (SDK) and
../Frameworks (.app bundle).
This commit is contained in:
西风逍遥游 committed 2026-08-23 11:54:05 +08:00
1 parent 060a828808
commit 63cc3de03f
2 files changed
+7 -3

No files matched your search

+4 -1
View File
@@ -67,7 +67,10 @@ if(BUILD_PLATFORM STREQUAL "macosx")
")
install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/macosx_bundle_vulkan.cmake")
set_target_properties(${EVENGINE_NATIVE_TARGET} PROPERTIES
INSTALL_RPATH "@loader_path/../lib;@loader_path"
# SDK layout is bin/eve + lib/ (-> ../lib). `eve package` copies the
# lib/ tree next to eve as <out>/lib (-> @loader_path/lib). Keep both
# so the same binary runs from the SDK and from a packaged game.
INSTALL_RPATH "@loader_path/../lib;@loader_path/lib;@loader_path"
)
endif()
+3 -2
View File
@@ -72,10 +72,11 @@ std::string bootstrapBundledVulkan() {
const std::string exeDir = exe.substr(0, slash);
// Packaged EVEngine distributions ship the loader + MoltenVK next to the
// executable: ../lib in the flat SDK layout (dist/eve-sdk/macosx), or
// executable: ../lib in the flat SDK layout (dist/eve-sdk/macosx), lib in
// a packaged game (eve package copies the SDK lib/ tree to <out>/lib), or
// ../Frameworks inside an .app bundle.
const std::string dir = [&]() -> std::string {
for (const char *rel : {"../lib", "../Frameworks"}) {
for (const char *rel : {"../lib", "lib", "../Frameworks"}) {
const std::string candidate = exeDir + "/" + rel;
if (::access((candidate + "/libvulkan.1.dylib").c_str(), R_OK) == 0)
return candidate;