Add support for compiling on macOS#472
Conversation
- Updated build scripts and configurations to support macOS - Resolved compatibility issues specific to macOS - Verified successful compilation on macOS X environment
|
Looks good, other than the formatting. I will wait on pulling the trigger until I can pull it and test locally. But if that goes well, this looks good to merge. |
|
the unnecessary formatting changes make it hard to review. could you please get rid of them? |
CMakeLists.txt
Outdated
| if(ENABLE_TFE) | ||
| add_executable(tfe) | ||
| set_target_properties(tfe PROPERTIES OUTPUT_NAME "theforceengine") | ||
| set_target_properties(tfe PROPERTIES OUTPUT_NAME "theforceengine_target") # rename the binary to "theforceengine_target" to avoid conflicts with the directory name on mac os x |
There was a problem hiding this comment.
I don't know how @luciusDXL feels about this, maybe use "theforceengine_osx" and "theforceengine_linux" but _target sounds just wrong to me.
There was a problem hiding this comment.
Yes, I agree. It was just a quick stopgap solution to avoid the name conflict. What do you think about autoappending CMAKE's platform name:
set(FINAL_OUTPUT_NAME "theforceengine_${CMAKE_SYSTEM_NAME}")
set_target_properties(tfe PROPERTIES OUTPUT_NAME "${FINAL_OUTPUT_NAME}")
In these cases I take the full patch file and edit out all the unwanted hunks by hand, apply the edited diff to the tree and fix up the remaining issues. Most of the relevant changes are to fileutil-posix.cpp, renderBackend.cpp, OpenGL_caps.cpp so they should be fairly easy to isolate. |
|
@apancik: I've cleaned up your patch, against head, attached. Works for me, Please test? EDIT2: updated the diff to _v4.patch (forgot the crashhandler) |
|
Your patch By the way, I tried to do the whitespace mess cleanup in dff0f42 042215b 7558920 4c8d835 – the diff for this PR in Github looks much saner – please have a look. I also removed some uneccesary changes that were just leftovers from my tinkering that ended up in your patch. Maybe this can salvage this PR 😄 |
|
@mlauss2 I could wrap the entire definition and its calls in #ifdef blocks to make it explicitly clear that this is platform-specific. Do you think that approach would be better? |
|
@apancik : here's a v5, it builds and runs fine on linux; could you please test on osx? Please fix it up and create a new PR. I would like to keep the executable name "theforceengine" on linux, but you could decide for an osx name and special case that for apple (i.e. something like below on top of your work:) index cbb9727a..80398f03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,7 +57,13 @@ option(ENABLE_ADJUSTABLEHUD_MOD "Install the build‑in “AdjustableHud mod”
if(ENABLE_TFE)
add_executable(tfe)
- set_target_properties(tfe PROPERTIES OUTPUT_NAME "theforceengine_target") # rename the binary to "theforceengine_target" to avoid conflicts with the directory name on mac os x
+
+ if(APPLE)
+ # cant have executable have the same name as the cmake working dir
+ set_target_properties(tfe PROPERTIES OUTPUT_NAME "theforceengine_osx")
+ else()
+ set_target_properties(tfe PROPERTIES OUTPUT_NAME "theforceengine")
+ endif()
if(UNIX)
find_package(PkgConfig REQUIRED)
|
This pull request introduces changes to enable compiling The Force Engine on macOS.
Hardware: Intel Mac / macOS Sequoia 15.1 / XCode 16.1
SDL2: version 2.30.9, SDL2_image: version 2.8.2, RtMidi: version 6.0.0