-
Notifications
You must be signed in to change notification settings - Fork 10
Compiling Q‐Zandronum on Mac
Q-Zandronum needs certain tools and development files in order to compile:
- Xcode
- CMake
- Mac OS SDK
- SDL2 with SDL 1.2 Compatibility
- GLEW
- FMOD Ex 4.44.64
- Open AL Soft (Preferred)
- Python3 (It's already on the Mac)
- Openssl (for Zandronum 1.3 or later)
- SQLite (for Zandronum 1.3 or later)
- Fluidsynth (For Midi Device)
- libmpg123 (Music)
- libsndfile (Sound)
- zlib (Zandronum has a copy of it and will be statically compiled in if not found)
- libbzip2 (possibly static)
- libjpeg (possibly static)
- HomeBrew or Macports (Not recommended for building using M1 or M2 (ARM64) CPU)
- Rosetta 2 (for building x86_64 binaries using M1 or M2 (ARM64) CPU)
There are 3 ways to install Xcode:
Open Terminal.app and paste this command:
xcode-select --install
This'll pop up:
Install it. (Caution: it's big so make sure you got enough space)
[https://apps.apple.com/au/app/xcode/id497799835?mt=12 Xcode] (Click the link, it'll go straight to the App Store)
https://developer.apple.com/download/all/ (Sign in is required. It includes Command line Tools as well)
If you are using M1 or M2 (ARM64), then this is required:
softwareupdate --install-rosetta
brew install jpeg-turbo fluid-synth openssl sdl2 sdl12-compat libmpg123 libsndfile
sudo port install libjpeg-turbo fluidsynth openssl sdl2 sdl12-compat libmpg123 libsndfile
Download CMake.
Open up the DMG and copy them into Applications (or drag them).
Open Terminal.app and paste this command:
mkdir -pv ~/qzandronum_build
If you already have this installed using HomeBrew or Macports. Please skip this section. Create a directory like this:
cd ~/qzandronum_build && mkdir -pv sdl_pack
Download SDL2 and SDL 1.2 Compatibility and extract them into it.
Or
Clone it:
git clone https://github.com/libsdl-org/sdl12-compat.git && git clone https://github.com/libsdl-org/SDL.git
Click on the CMake app that you added into Applications, it'll give you a warning that you downloaded a third party app on Mac, just hit OK.
Click Browse Source, choose where you put SDL12-Compat, then click Open.
It's better if you build it inside the source, so do the same in Browse Build. Add a new folder into SDL12-Compat called Build.
When you click Configure it'll popup a window, choose "Unix Makefiles" (It's faster than using Xcode type) and click Done.
Make sure you disable SDL12TESTS as we don't need it and make the default architecture x86_64 because we are not using ARM64 until further releases.
Then check Advanced to display the SDL2 Section.
Configure only SDL_INCLUDE_DIR.
Click Generate and then compile, it'll give you 2 files.
cd ~/zandronum_build/sdl_pack/sdl12-compat/build/ && make
Clone it:
cd ~/qzandronum_build/
git clone https://github.com/IgeNiaI/Q-Zandronum.git
Open the CMake app again.
This is a lot because you must compile most of the dependencies before you can do this next part, so read the readme on each source codes. Homebrew and MacPorts are fine.
So firstly Browse Source and Build like you did with SDL12-Compat.
Click Browse Source, choose where you put Q-Zandronum, then click Open.
It's better if you build it inside the source, so do the same in Browse Build. Add a new folder into Q-Zandronum called Build
.
When you click Configure it'll popup a window, choose "Unix Makefiles" (It's faster than using Xcode type) and click Done. If it shows an error that means they couldn't find the rest. So you need to go through each dependency to find the directories and files then hit Generate.
If you only see SDL_INCLUDE_DIR
, click Add Entry and type in SDL_LIBRARY
then browse for the Dylib.
also in cmake_cxx_flags
add this:
-std=c++14 -stdlib=libc++
and in cmake_exe_linker_flags
add this:
-framework CoreFoundation -framework Carbon -framework Cocoa -framework IOKit -framework AudioToolbox -framework AudioUnit
Once you've done everything, compile.
cd ~/qzandronum_build/q-zandronum/build/ && make -j8
Once the compile is finished, all that's left to do is to add the dylibs and frameworks into the Frameworks you need to create an appbundles and use install name tool yourrself.
There you have it, just drag the bundle into the applications, and it should be good to go.