Conversation
Updated the CMakeLists.txt to treat APPLE as a supported platform alongside UNIX for dependency linking. This ensures proper library linking on macOS systems.
Introduces a workflow to build the project on macOS using CMake and vcpkg. The workflow installs dependencies, configures and builds the project for arm64 architecture, and uploads the resulting artifact.
Added .DS_Store, vcpkg_installed, and platform-specific build directories to .gitignore to prevent accidental commits of system and build artifacts.
Extended platform checks to include __APPLE__ for macOS support in multiple files. Added macOS-specific logic for game path detection, legitimacy check, and error handling where game launching is not supported. Updated includes and platform-specific code paths to ensure compatibility with both Linux and macOS.
Removed platform-specific preprocessor checks for the 'clear' system command in ReLaunch(). Now, 'system("clear")' is called unconditionally for all platforms.
Adds steps to configure the SDKROOT and MACOSX_DEPLOYMENT_TARGET environment variables in the cmake-macos GitHub Actions workflow to ensure consistent build environment targeting macOS 11.0.
| } | ||
| #elif defined(__APPLE__) | ||
| std::filesystem::path GetGamePath() { | ||
| // Right now only steam is supported |
There was a problem hiding this comment.
Could you elaborate on this comment?
| struct passwd* pw = getpwuid(getuid()); | ||
| std::string homeDir = pw->pw_dir; | ||
|
|
||
| std::string Path = homeDir + "/Library/Application Support/BeamNG/BeamNG.drive/"; |
There was a problem hiding this comment.
Will the user data folder always be in this location?
src/GameStart.cpp
Outdated
| // macOS does not support game launching - StartGame is never called | ||
| void StartGame(std::string Dir) { | ||
| // This function should never be called on macOS | ||
| error("Game launching is not supported on macOS"); | ||
| } | ||
| #endif | ||
|
|
||
| void InitGame(const beammp_fs_string& Dir) { | ||
| #if defined(__APPLE__) | ||
| // macOS does not support game launching | ||
| return; |
There was a problem hiding this comment.
If it is not support and should never be called why define the function or call it in the first place?
| info("Please enter the path to your BeamNG.drive installation directory:"); | ||
| info("Example: /Users/YourName/Library/Application Support/Steam/steamapps/common/BeamNG.drive"); | ||
| std::cout << "Game directory path: "; | ||
|
|
||
| std::string userPath; | ||
| std::getline(std::cin, userPath); |
There was a problem hiding this comment.
Could command line arguments be used instead of this interface?
| // Remove trailing slash if present | ||
| if (!userPath.empty() && (userPath.back() == '/' || userPath.back() == '\\')) { | ||
| userPath.pop_back(); | ||
| } |
There was a problem hiding this comment.
could std::filesystem::path be used for this instead?
| return; | ||
| } | ||
|
|
||
| GameDir = gamePath.string() + "/"; |
There was a problem hiding this comment.
Could std::filesystem::path be used here as well?
| #elif defined(__linux__) | ||
| // Linux version of the game cant handle mods with uppercase names | ||
| #elif defined(__linux__) || defined(__APPLE__) | ||
| // Linux and macOS versions of the game cant handle mods with uppercase names |
There was a problem hiding this comment.
Isn't the mac version the windows version of the game running with a translations layer, making it able to handle uppercase names?
Refactors InitGame to exclude its definition on macOS and updates main.cpp to only call InitGame when not on macOS. This prevents attempts to launch the game on macOS, where it is not supported.
Deleted the macOS-specific StartGame function, as game launching is not supported and the function is never called on that platform.
Replaces incorrect use of 'defined' with preprocessor directive '#if !defined(__APPLE__)' to ensure InitGame is only called on non-Apple platforms.
|
@enzofrnt please can you response to the comments above? |
This PR introduces initial macOS support.
This implementation is not finished yet and may require further improvements.
Adding macOS support does not require major changes to the launcher because of the existing Linux support. The main difficulty is handling the game path.
On macOS, BeamNG.drive is usually run through CrossOver, which adds multiple layers (Wine, bottles, custom directories). Because of this complexity, the game installation path cannot be reliably detected automatically.
The launcher still requires this path to function correctly, so it must currently be provided manually by the user.
A possible improvement would be to store the last known game path (for example in the Resources directory) to avoid asking for it again on future launches.
Maintenance
A new CI is setup to build the MacOS version of the launcher for us. If it fails, mention me and I’ll come to help fix the issue. Considering the limited number of macOS users for BeamMP, it can be fixed later if not done in time.
Documentation
If necessary, I can create some documentation on how to run BeamMP on macOS. Anyone needing help can then contact me.
By creating this pull request, I understand that code that is AI generated or otherwise automatically generated may be rejected without further discussion.
I declare that I fully understand all code I pushed into this PR, and wrote all this code myself and own the rights to this code.