build: optional MIR2X_CLIENT_ONLY and Apple Clang flags#59
Open
iamcheyan wants to merge 1 commit into
Open
Conversation
Lets the project configure and build on macOS without manual CMake
hacking. Linux GCC builds are unchanged.
CMakeLists.txt (top level):
- New MIR2X_CLIENT_ONLY option. When ON, server/ and tools/ are
skipped -- handy on macOS, where the server still needs brew
LLVM (Apple Clang 17 hits an internal compiler bug on
server/src/player.cpp's nested-lambda pattern) and the tools
need additional FLTK 1.4 / Cairo wiring.
- Apple Clang: don't pass -fcoroutines (a GCC-only flag; Clang
has coroutines on by default at C++20) and don't promote
warnings to errors with -Werror (avoids Clang's stricter
warnings tripping the build on otherwise-fine code).
client/src/CMakeLists.txt:
- On APPLE, append -L/opt/homebrew/lib so the linker finds
SDL2_ttf / SDL2_gfx / SDL2_image / SDL2_mixer installed via
Homebrew on Apple Silicon.
common/src/CMakeLists.txt:
- Link stdc++fs only for GCC. libc++ (Apple Clang, brew LLVM)
has std::filesystem in the main runtime; linking stdc++fs
fails or is unnecessary.
- Explicitly include SDL2 / FLTK header dirs for the common
target so subtargets that pull in common headers don't need
to re-resolve them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets the project be configured and built on macOS without manual
CMake hacking. Linux GCC builds are unchanged.
Top-level
CMakeLists.txtMIR2X_CLIENT_ONLYoption (default OFF — preservescurrent behaviour). When ON,
server/andtools/are skipped.This is useful on macOS, where the server still needs brew LLVM
to build (Apple Clang 17 hits an internal compiler crash on
server/src/player.cpp's nested-lambda pattern inclang::Expr::EvaluateAsInitializer— reproducible; happy tofile upstream at LLVM if useful) and the tools need extra
FLTK 1.4 / Cairo wiring beyond the scope of this PR.
-fcoroutines(GCC-only flag;Clang has C++20 coroutines on by default) and don't promote
warnings to errors with
-Werror(Clang's stricter warningstrip on otherwise-fine code; once everything's clean we can
switch it back on).
client/src/CMakeLists.txtAPPLE, append-L/opt/homebrew/libso the linker findsSDL2_ttf/SDL2_gfx/SDL2_image/SDL2_mixerinstalledvia Homebrew on Apple Silicon.
common/src/CMakeLists.txtstdc++fsonly for GCC. libc++ (Apple Clang, brew LLVM)has
std::filesystemin the main runtime; linkingstdc++fsthere fails or is a no-op.
commontarget'sinclude paths so subtargets that pull in common headers don't
need to re-resolve them.
Tested
APPLE/Clang/MIR2X_CLIENT_ONLYso the existing GCCpath is untouched. Happy to verify on a Linux box if you'd
like before merging.
cmake -DMIR2X_CLIENT_ONLY=ON ..configures and builds the client cleanly.
MIR2X_CLIENT_ONLY=OFFworks (alongside compat: sol::nil -> sol::lua_nil for sol2 v3 #57 + fix: add explicit STL headers and tighten two non-portable usages #58).