cs16-client icon indicating copy to clipboard operation
cs16-client copied to clipboard

build: macos arm build POC

Open kenyerman opened this issue 7 months ago • 3 comments

🧪 Proof of Concept: macOS ARM (Apple Silicon) Build Support

This PR introduces a proof of concept for building and running the CS16 client on macOS ARM (Apple Silicon), in response to Issue #162. While this is an experimental implementation, it demonstrates that supporting macOS on Apple Silicon is technically feasible.

The goal here is to kickstart discussion and iteration on proper macOS support. Feedback, improvements, and corrections are warmly welcome!


🔧 Building Instructions

This process involves building the CS16 client and the Xash3D-FWGS engine, and then setting up game files using SteamCMD. Everything is bundled manually into a playable setup.

1. Set Up Project Workspace

mkdir -p ~/cs16-macos

2. Build the CS16 Client

a) Install dependencies

brew install cmake pkg-config clang

b) Clone the client repo (with build/macos-arm branch)

cd ~/cs16-macos
git clone --single-branch --branch build/macos-arm https://github.com/kenyerman/cs16-client-macos-arm --recursive

c) Build the client

cd cs16-client-macos-arm
cmake -S . -B build
cmake --build build --config Release
cmake --install ./build --prefix ./release

Output will be available in: ~/cs16-macos/cs16-client-macos-arm/release


3. Build the Engine (Xash3D-FWGS)

a) Clone the engine repo

cd ~/cs16-macos
git clone --recursive https://github.com/FWGS/xash3d-fwgs

b) Download SDL2

Download the latest SDL2 v2.x release from: https://github.com/libsdl-org/SDL/releases

Mount the .dmg, then copy SDL2.framework to: ~/cs16-macos/SDL2.Framework

c) Build the engine

cd xash3d-fwgs
./waf configure --sdl2=~/cs16-macos/SDL2.Framework
./waf build
mkdir -p ~/cs16-macos/xash3d-install
./waf install --destdir=../xash3d-install

Engine files will be located at: ~/cs16-macos/xash3d-install


4. Get the Game Files (via SteamCMD)

a) Install SteamCMD

brew install steamcmd

b) Create a directory for the game

mkdir -p ~/cs16-macos/hl

c) Download Half-Life via SteamCMD

steamcmd

force_install_dir ./hl
login <YOUR_USERNAME>
@sSteamCmdForcePlatformType windows
app_update 10
quit

You should now have the base game files in ~/cs16-macos/hl. (If it fails, use apps_installed in SteamCMD to check the location and copy manually.)


5. Merge Everything

cd ~/cs16-macos
cp -r ./xash3d-install/* ./hl
cp -r ./cs16-client-macos-arm/release/* ./hl

6. Run the Mod 🎮

Heads up: The first launch on macOS may trigger security prompts. Start in windowed mode to avoid being stuck behind fullscreen SDL2 windows.

cd ~/cs16-macos/hl
./xash3d -windowed -game cstrike 

🙏 Acknowledgements

Thanks to the maintainers and contributors of this amazing project. This is a first step toward expanding support for more platforms—Apple Silicon is here to stay, and it's exciting to see CS16 inching closer to native support!

My experience with C++ build systems is a bit rusty, so please let me know if anything can be improved or if I’ve accidentally broken something. I’m happy to iterate.

Cheers! — @kenyerman

kenyerman avatar May 27 '25 20:05 kenyerman

When I built the client:

cmake -S . -B build

I got this error:

kimhung@G1-HungNguyen1 cs16-client-macos-arm % cmake -S . -B build

CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- Library postfix: _arm64
CMake Deprecation Warning at cl_dll/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


CMake Error at CMakeLists.txt:50 (add_subdirectory):
  The source directory

    /Users/kimhung/Desktop/cs16-macos/cs16-client-macos-arm/3rdparty/yapb

  does not contain a CMakeLists.txt file.


CMake Error at cmake/LibraryNaming.cmake:205 (set_target_properties):
  set_target_properties Can not find target to add properties to: yapb
Call Stack (most recent call first):
  CMakeLists.txt:51 (set_target_postfix)


CMake Error at CMakeLists.txt:54 (add_subdirectory):
  The source directory

    /Users/kimhung/Desktop/cs16-macos/cs16-client-macos-arm/3rdparty/ReGameDLL_CS

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:60 (add_subdirectory):
  The source directory

    /Users/kimhung/Desktop/cs16-macos/cs16-client-macos-arm/3rdparty/mainui_cpp

  does not contain a CMakeLists.txt file.


-- Configuring incomplete, errors occurred!

Please check

kimhung222 avatar May 28 '25 05:05 kimhung222

Ahhh the submodules cannot be cloned because my changes aren't pushed in them. I'll have to fork them, push the changes, and point the main repo to the forks. I'll get back to you when i'm done with this.

kenyerman avatar May 28 '25 11:05 kenyerman

AI generated 🤮🤮

a1batross avatar May 28 '25 12:05 a1batross

After some investigation i realized that ReGameDLL had a runtime error so the server creation feature did not work (and i couldn't get it to work properly 😔) However the client does work, you can join servers and play!

Getting more familiar with the project and after some experiments i concluded that the we can also skip the building of mainui lib (although i've already opened a PR at https://github.com/Velaron/mainui_cpp/pull/6 ). This means that the PR works without changing anything in the submodules. (Currently on macos the building of the server components and mainui is disabled.)

I force pushed the branch, reverted the submodule changes, and added disabling the build of the server and mainui components.

The build&install&run should be same as the above. @kimhung222 please report back if it worked for you.

kenyerman avatar Jun 12 '25 23:06 kenyerman