-
Notifications
You must be signed in to change notification settings - Fork 0
fork Build on macOS
Be sure to check Build for generic instructions.
EmptyEpsilon supports building on both Intel (x86_64) and M-series ARM (M1, M2, etc.) architectures.
If you're building and running EmptyEpsilon locally for development purposes, follow the instructions in the "Basic app target" section.
If you intend to build a DMG for distribution to players that includes all necessary dependencies, follow the instructions in the "DMG packaging" section.
The result of these steps builds a standard macOS .app, but might require external dependencies.
-
Install XCode:
xcode-select --install
-
Install the Homebrew package manager to install some dependencies before compiling EmptyEpsilon.
-
Install
cmaketo compile your code, and thesdl2dependency that EmptyEpsilon needs. You can also installgitand theninjabuild tool viabrewif necessary.Note: Some users have reported build issues with cmake version 4.x. If that happens to you, try downgrading to cmake 3.31.4.
brew install cmake sdl2 git ninja
You can also compile or install pre-compiled SDL2 libraries yourself. Refer to the official documentation.
-
Create a new directory named
emptyepsilonwhere the game sources will be fetched, and download SeriousProton (game engine) and EmptyEpsilon (the actual game).mkdir -p emptyepsilon && cd emptyepsilon git clone https://github.com/oznogon/SeriousProton.git git clone https://github.com/oznogon/EmptyEpsilon.git
If you're building a specific release of EmptyEpsilon, remember to checkout the correct tag in both repositories as mentioned in the generic Build instructions!
-
Configure cmake.
cmake -S EmptyEpsilon -B EmptyEpsilon/_build -G Ninja -DCMAKE_INSTALL_PREFIX=.
The
-DCMAKE_INSTALL_PREFIX=.option is necessary to install assets in the app bundle instead of/usr/local. -
Build EmptyEpsilon.
cmake --build EmptyEpsilon/_build --target install
--target installcopies the repository'sscripts,resources, andpacksdirectories into the app bundle, which are required to run EmptyEpsilon. If you're rebuilding for C++ code changes without changing those directories, you can omit the--target installoption to rebuild only the EmptyEpsilon binary.
Once the app bundle built, you can launch the game:
-
From Finder, by double-clicking the
EmptyEpsilonapp bundle inEmptyEpsilon/_build -
From the terminal, by opening the app bundle:
open EmptyEpsilon/_build/EmptyEpsilon.app
To launch with Preferences file options set on the command line, pass them after the
--argsflag. For example, to launch the app bundle as a server into the Basic scenario by using theserver_scenariooption, run:open EmptyEpsilon/_build/EmptyEpsilon.app --args server_scenario=scenario_00_basic.lua
-
From the terminal, by directly launching the binary from the app bundle's
Contentsdirectory:cd EmptyEpsilon/_build/EmptyEpsilon.app/Contents MacOS/EmptyEpsilonThis also outputs EmptyEpsilon's log in the terminal for easier troubleshooting.
Game assets, including models, scripts, images, sound effects, and music, are stored within the bundle at EmptyEpsilon.app/Contents/Resources/. The Preferences file (options.ini), keybindings file (keybindings.json), and script storage (scriptstorage.json) are saved to ~/.emptyepsilon/.
NOTE: The compiled app bundle still requires SDL2 libraries, such as the Homebrew
sdl2package, to be installed locally where installed. To add SDL2 to the app bundle, see DMG packaging.
If using the VSCode IDE, intellisense can be achieved for most files using the following .vscode/settings.json file:
{
"editor.formatOnSave": false,
"C_Cpp.default.includePath": [
"${workspaceFolder}/src",
"${workspaceFolder}/src/**",
"${workspaceFolder}/../SeriousProton/src",
"${workspaceFolder}/../SeriousProton/src/**",
"${workspaceFolder}/_build/_deps/glm-src"
],
}To aid compatibility with specific older versions of OS X/macOS, use the MACOSX_DEPLOYMENT_TARGET environment variable to set a minimum Mac OS X/macOS target version. Setting this lower than 10.15 (EE's default since may 2021) might cause problems when compiling with newer versions of XCode, and SDL2 does not support targeting OS X 10.5 and older.
You can also set this in EmptyEpsilon's CMakeLists.txt, around the top:
set(ENV{MACOSX_DEPLOYMENT_TARGET} "11.0")Since May 2021, EE supports packaging a DMG directly through CMake that contains all necessary dependencies for distribution to players.
-
Install the Homebrew package manager to install some dependencies before compiling EmptyEpsilon.
-
Install
cmakeandninjato be installed, which you can do via homebrew:brew install cmake ninja
-
Create a folder to put all of your EmptyEpsilon files. For example,
~/Documents/emptyepsilon-compile -
Download SDL2.
NOTE: To generate a DMG package, you cannot use the sdl2 package from homebrew!. Relocatable packages require Frameworks, which homebrew does not install.
Frameworks and homebrew-installed libraries for SDL2 should not be installed simultaneously. However, brew's
sdl2package might be installed as a dependency of other homebrew packages, particularlyffmpeg. If you have issues building EmptyEpsilon, you might need to remove all such homebrew package dependencies so you can remove thesdl2package.- Create a folder to put your SDL2
.dmgfile. For example,~/Documents/emptyepsilon-compile/SDL2-dmg -
Download the official SDL2 DMG release and save it in
~/Documents/emptyepsilon-compile/SDL2-dmg.
- Create a folder to put your SDL2
-
Open a terminal and change directories to
~/Documents/emptyepsilon-compile/SDL2-dmg. -
Run the following:
# Update the following version number to the version you downloaded cd ~/Documents/emptyepsilon-compile/SDL2-dmg export SDL2_VERSION=2.32.10 hdiutil attach SDL2-${SDL2_VERSION}.dmg
-
Clone a copy of the EmptyEpsilon and SeriousProton source code in
~/Documents/emptyepsilon-compile.cd ~/Documents/emptyepsilon-compile git clone https://github.com/daid/SeriousProton git clone https://github.com/daid/EmptyEpsilon
-
Decide which version of EmptyEpsilon you'd like to compile. Check out the appropriate git tag:
cd ~/Documents/emptyepsilon-compile/SeriousProton git checkout EE-2024.12.08 cd ~/Documents/emptyepsilon-compile/EmptyEpsilon git checkout EE-2024.12.08
-
Create a
sdl2-config.cmakefile which targets the framework. Save it as~/Documents/emptyepsilon-compile/sdl2-config.cmake.# sdl2-config.cmake # By default, hdiutil will attach to /Volumes/SDL2 set(_SDL2_mountpoint /Volumes/SDL2) find_library(SDL2_LIBRARIES SDL2 PATHS "${_SDL2_mountpoint}") find_path(SDL2_INCLUDE_DIRS SDL.h PATHS "${SDL2_LIBRARIES}" PATH_SUFFIXES Headers) set(SDL2_FRAMEWORK_PATH "${_SDL2_mountpoint}/SDL2.framework") set(SDL2_INCLUDE_DIR "${SDL2_FRAMEWORK_PATH}/Headers") set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR};${SDL2_FRAMEWORK_PATH}")
-
Change directories to your EmptyEpsilon source code directory:
cd ~/Documents/emptyepsilon-compile/EmptyEpsilon
-
Run the following commands:
-
# Run this from your EmptyEpsilon source code directory: ~/Documents/emptyepsilon-compile/EmptyEpsilon SDL2_CONFIG_DIR=.. -
# Run this from your EmptyEpsilon source code directory: ~/Documents/emptyepsilon-compile/EmptyEpsilon # Be sure to update `DCPACK_PACKAGE_VERSION_MAJOR`, `DCPACK_PACKAGE_VERSION_MINOR`, # and `DCPACK_PACKAGE_VERSION_PATCH` to match the version number you've selected to compile cmake -G Ninja \ -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ -DCPACK_GENERATOR:STRING=DragNDrop \ -DSDL2_DIR:PATH=$SDL2_CONFIG_DIR \ -DSERIOUS_PROTON_DIR=../SeriousProton \ -DCPACK_PACKAGE_VERSION_MAJOR=2024 \ -DCPACK_PACKAGE_VERSION_MINOR=08 \ -DCPACK_PACKAGE_VERSION_PATCH=09 \ -B _build
-
# Run this from your EmptyEpsilon source code directory: ~/Documents/emptyepsilon-compile/EmptyEpsilon cmake --build _build --target package --parallel
-
-
If compilation finishes successfully, you should have an EmptyEpsilon
.dmgin your~/Documents/emptyepsilon-compile/EmptyEpsilon/_build/directory, that can be used to install the game or be shared with others.
If the build fails with an error about the freetype framework being missing:
CMake Error at /usr/local/Cellar/cmake/3.22.1/share/cmake/Modules/BundleUtilities.cmake:458 (message):
otool -l failed: 1
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't
open file: @rpath/../Frameworks/freetype.framework/Versions/A/freetype (No
such file or directory)
You might need to install it using homebrew, and also manually link it to a path being searched during the build:
brew install freetype
ln -s /usr/local/lib/freetype.framework /Library/Frameworks/If this still doesn't work, you may need to specify the homebrew path as a CMAKE_PREFIX_PATH when running the cmake --build command:
CMAKE_PREFIX_PATH=/usr/local/lib/freetype.framework cmake --build _build --target package --parallelThis might build the DMG, but the resulting app might still fail with a missing freetype library error, in which case ?? please help
SDL2 has known issues with macOS codesigning, and sometimes requires app bundles to be signed multiple times to work. If you built EmptyEpsilon from source and it won't launch, especially after rebuilding binaries in an existing app bundle, manually self-sign the bundle:
codesign --force --deep --sign - EmptyEpsilon/_build/EmptyEpsilon.appIf a build without C++ code changes produces a no LC_RPATH load command with path error, such as:
error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: no LC_RPATH load command with path: /opt/homebrew/Cellar/sdl2/2.32.10/lib found ...
Run cmake to configure with the -DCMAKE_SKIP_INSTALL_RPATH=TRUE flag:
cmake -S EmptyEpsilon -B EmptyEpsilon/_build -G Ninja \
-DCMAKE_INSTALL_PREFIX=. \
-DCMAKE_SKIP_INSTALL_RPATH=TRUEThis prevents CMake from adding install_name_tool -delete_rpath calls that succeed on the first --target install run, but then fail on re-runs because the build rpath was already removed from the installed binary.
If rebuilding an EmptyEpsilon app bundle from source on newer version of macOS, EmptyEpsilon's icon on the dock might revert to a white square. If so, update the last-modified timestamp on the app bundle to force a cache refresh.
touch EmptyEpsilon/_build/EmptyEpsilon.appThe content below is old, kept for posterity. Dive in at your own risk!
-
Before October 2021, the project used SFML. Be sure to check the previous instructions if building for an older version.
-
In macOS/OS X 10.14 (Mojave) and earlier, Windows binaries also perform well on macOS as both clients and server, including station transparency effects, when run with Wine 4+ (
brew cask install wine-stableif Homebrew is installed).As of macOS 10.15 (Catalina), 32-bit applications are no longer supported.
winedoes not run on Catalina andwine64will not run Windows builds of EmptyEpsilon.
By using the above process, end users who try to run your app bundle builds must also install sfml in order to play. To avoid this, you can bundle the required dependencies using dylibbundler, which copies the libraries into the app bundle and updates the EmptyEpsilon executable within the bundle to link them.
You'll need to build dylibbundler from source to get the --search-path feature, which as of Feb. 2020 is not yet in a released version.
If you've followed the steps to build EmptyEpsilon, you already have everything you need to build dylibbundler:
git clone https://github.com/auriamg/macdylibbundler.git
cd macdylibbundler
make && make installOnce dylibbundler is built and installed, go to the EmptyEpsilon build directory containing your newly built EmptyEpsilon.app bundle and run:
dylibbundler \
--overwrite-dir \
--bundle-deps \
--search-path "/usr/local/lib" \
--fix-file "EmptyEpsilon.app/Contents/MacOS/EmptyEpsilon" \
--dest-dir "EmptyEpsilon.app/Contents/libs"This will output many warnings that you can disregard. The changes this makes to EmptyEpsilon.app will increase the bundle's size slightly but should allow you to run the app bundle on Macs that do not have SFML libraries installed.
To compress the EmptyEpsilon.app bundle and other useful files (such as script_reference.html), you can build a disk image (DMG).
Copy EmptyEpsilon.app and any other files you want on the image into a staging directory. For example, from the directory where you built EmptyEpsilon, you can run:
mkdir _staging
cp -r EmptyEpsilon.app script_reference.html _stagingThen use hdiutil to create a temporary image using that directory as the source:
hdiutil \
create "/tmp/tmp.dmg" \
-ov \
-volname "EmptyEpsilon" \
-fs HFS+ \
-srcfolder "_staging"Finally, convert the image to a read-only distributable image:
hdiutil \
convert "/tmp/tmp.dmg" \
-format UDZO \
-o "EmptyEpsilon.dmg"- Home
- Building and installing the game
- Configuring the game
- Playing the game
- Officer roles and screens
- Captain
- Main screen
- Ship window
- Crews of 5-6 players
- Crews of 3-4 players
- Single-player crew
- Game Master (GM) screens
- Extra screens
- Minigames
- Weapon types
- Officer roles and screens
- Extending the game
- Troubleshooting
- Fork content