Skip to content

Commit ae4f575

Browse files
committed
Fix some details for macOS
Signed-off-by: falkTX <falktx@falktx.com>
1 parent 066a029 commit ae4f575

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

.github/workflows/build.yml

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ env:
1414
PAWPAW_VERSION: 70160711d2efec286d417b63a073a8f2012346f6
1515

1616
jobs:
17-
# macOS native universal build
1817
macos_universal:
1918
runs-on: macos-11
2019
steps:

CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ if(APPLE)
113113
add_custom_command(TARGET Chibi POST_BUILD
114114
COMMAND cp "${QtPluginsDir}/styles/libqmacstyle.dylib" "$<TARGET_BUNDLE_DIR:Chibi>/Contents/PlugIns/styles/"
115115
)
116+
add_custom_command(TARGET Chibi POST_BUILD
117+
COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/carla/lib/carla-bridge-native"
118+
"${CMAKE_CURRENT_BINARY_DIR}/carla/lib/carla-discovery-native"
119+
"$<TARGET_BUNDLE_DIR:Chibi>/Contents/MacOS/"
120+
)
116121
add_custom_command(TARGET Chibi POST_BUILD
117122
COMMAND macdeployqt $<TARGET_BUNDLE_DIR:Chibi> -dmg
118123
)

main.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,29 @@
2020
#include <QtWidgets/QApplication>
2121
#include <QtWidgets/QMessageBox>
2222

23+
#ifdef CARLA_OS_MAC
24+
# include <dlfcn.h>
25+
// override for custom location
26+
const char* carla_get_library_folder()
27+
{
28+
struct _ {
29+
static std::string getExecutableDir()
30+
{
31+
Dl_info dlinfo = {};
32+
dladdr(reinterpret_cast<const void*>(::carla_get_library_folder), &dlinfo);
33+
34+
if (const char* const lastsep = std::strrchr(dlinfo.dli_fname, '/'))
35+
return std::string(dlinfo.dli_fname, lastsep - dlinfo.dli_fname);
36+
37+
return {};
38+
}
39+
};
40+
41+
static std::string path(_::getExecutableDir());
42+
return path.c_str();
43+
}
44+
#endif
45+
2346
CARLA_BACKEND_USE_NAMESPACE;
2447

2548
int main(int argc, char *argv[])

0 commit comments

Comments
 (0)