The recommended way to compile the games is MinGW on Windows. The following platforms also have various levels of support:
Platform | Toolchain | Status | Notes |
---|---|---|---|
Windows | MinGW | Primary | CI: Appveyor |
Windows | MSVC | Secondary | CI: Appveyor |
Linux | GCC | Secondary | CI: Appveyor |
Windows | Clang | Tertiary | No app icons |
Linux | Clang | Tertiary | |
Android | NDK | Tertiary | Incomplete/buggy |
Browser | Emscripten | Tertiary | Incomplete |
First-time setup:
- Install MSYS2, an environment for compiling C++ code.
- Visit https://www.msys2.org/ and download and run the latest "msys2-x86_64" installer.
- Choose a relatively short path with no spaces (say,
C:\msys64
orD:\tools\msys2
). - After installation finishes, run
pacman -Syu
in the console that opens. - When asked to do so, close the console and reopen it from the Start Menu (MSYS2 64bit > MSYS2 MinGW 32-bit).
- Run
pacman -Syu
again.
- Use
cd
to select the directory where HamSandwich will go.- For example, if you want the code to go in
C:\projects\HamSandwich
, runcd C:\projects
.
- For example, if you want the code to go in
- Run
pacman -S git
to install git, a tool used for source code collaboration. - Run
git clone https://github.com/SpaceManiac/HamSandwich
to download the code. - Run
cd HamSandwich
to enter the directory.
Compiling and running:
- Run
./run
to see a list of games in the project, and use./run <project>
to compile and play.- For example, to run Supreme with Cheese, write
./run supreme
. - To compile without running, write
make
ormake <projectname>
. - The first time you try to run a game, you will be prompted to download its installer from https://hamumu.itch.io/; follow the instructions shown.
- For example, to run Supreme with Cheese, write
- Run
git pull
to fetch changes which have been published here.
- Download dependencies:
- Run
powershell tools/build/msvc-install-deps.ps1
. - Or, download and extract them manually:
build/premake5.exe
: premake-5.0.0-alpha14-windows.zip from https://github.com/premake/premake-core/releases/tag/v5.0.0-alpha14.build/SDL2-msvc/
: SDL2-devel-2.0.9-VC.zip from https://www.libsdl.org/download-2.0.php.build/SDL2_mixer-msvc/
: SDL2_mixer-devel-2.0.4-VC.zip from https://www.libsdl.org/projects/SDL_mixer/.build/SDL2_image-msvc/
: SDL2_image-devel-2.0.4-VC.zip from https://www.libsdl.org/projects/SDL_image/.
- Run
- Run
build/premake5.exe vs2017
(or appropriate VS version) to generate solution. - Open and compile
build/HamSandwich.sln
in Visual Studio.- For command-line builds, run
msbuild build/HamSandwich.sln /p:Configuration=debug /p:Platform=Win32
.
- For command-line builds, run
- Use installers from https://hamumu.itch.io/ to extract game assets to
build/game/<gamename>
. - Debug from within Visual Studio to launch a game.
- Install dependencies (handled automatically on Ubuntu, Arch):
- premake-5.0.0-alpha14-linux.tar.gz from https://github.com/premake/premake-core/releases/tag/v5.0.0-alpha14.
- 32-bit G++ (or Clang) toolchain.
- 32-bit SDL2, SDL2_mixer, and SDL2_image development packages.
- 7-Zip and Innoextract to extract game assets.
- Use
make
and./run
as described above to build and run the games.
- Install Gradle and the Android SDK and NDK and set
ANDROID_HOME
. - Run
./tools/build/sdl2-source.sh
. - Run
premake5 android-studio
. - Change directory to
build/android
. - Run
gradle packageDebug
to compile APKs. - Run
gradle installDebug
to install to a connected Android device.
- Install the Emscripten SDK and activate the upstream-LLVM backend:
cd
to a convenient directory.git clone https://github.com/emscripten-core/emsdk.git
.cd emsdk
../emsdk install latest-upstream
../emsdk activate latest-upstream
.source ./emsdk_env.sh
- Return to the HamSandwich directory.
- Run
./run <gamename> --web
to run the build and open the result in your browser.
Publishing:
- Consider tidying the
build/game/<gamename>
folder so that your saves are not included in the download. - Run
make toolset=emcc config=release <gamename>
to prepare a release build. - Upload the
.data
,.html
,.js,
and.wasm
files frombuild/emcc-release/<gamename>
.