Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ cmake --build . --config RelWithDebInfo

## Building on Mac

If you install conan via brew you must ensure you get the correct version; however, the cmake-conan script will not detect it from the default install location. You must therefore also alias it elsewhere:
If you install conan via brew the cmake-conan script will not detect it from the default install location. You must therefore also alias it elsewhere:

```bash
brew install conan@1
sudo ln -s /usr/local/opt/conan@1/bin/conan /usr/local/bin/conan
brew install conan
sudo ln -s /usr/local/opt/conan/bin/conan /usr/local/bin/conan
cd open.mp
mkdir build
cd build
Expand Down
16 changes: 16 additions & 0 deletions Server/Source/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ static LARGE_INTEGER yo;
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif
#define SET_TICKER_RESOLUTION(ms)
#define LIBRARY_OPEN(path) dlopen(path, RTLD_LAZY | RTLD_LOCAL)
#define LIBRARY_OPEN_GLOBAL(path) dlopen(path, RTLD_LAZY | RTLD_GLOBAL)
Expand Down Expand Up @@ -153,6 +156,19 @@ ghc::filesystem::path GetExecutablePath()
{
return ghc::filesystem::path();
}
#elif defined(__APPLE__)
char path[4096] = { 0 };
uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == 0)
{
std::error_code ec;
auto canonicalPath = ghc::filesystem::canonical(path, ec);
return ec ? ghc::filesystem::path(path) : canonicalPath;
}
else
{
return ghc::filesystem::path();
}
#else
return ghc::filesystem::canonical("/proc/self/exe");
#endif
Expand Down
Loading