Skip to content

Install with KallistiOS

Markdown

SH4ZAM is an official part of kos-ports, so it is integrated with the KallistiOS ecosystem and is set up as part of the regular KOS installation process.

If you're following the standard community guide for Setting up KallistiOS, SH4ZAM will be installed as part of the Building KOS Ports step. Nothing else to do.

If you're using DreamSDK to manage your KallistiOS development environment, SH4ZAM may be installed from the KallistiOS Ports tab.

To get started within a preexisting KallistiOS environment, use git pull from within the folder containing the kos-ports git repository, which is typically installed to /opt/toolchains/dc/kos-ports. Then cd into the sh4zam folder and run make install to build and install the latest version of SH4ZAM as a statically linked library:

cd /opt/toolchains/dc/kos-ports
git pull
cd sh4zam
make install

Source your environ.sh first; the Makefile refuses to run without KOS_BASE set. make install symlinks libsh4zam.a into $(KOS_PORTS)/lib and the sh4zam header folder into $(KOS_PORTS)/include.

Once this succeeds, your KOS application can begin leveraging SH4ZAM to make big performance gainz.

The upstream Makefile wraps kos-cmake. Run these from a SH4ZAM checkout:

TargetWhat it does
libBuilds the static library only.
testsBuilds the unit test binary.
allBuilds library and unit test binary.
runRuns the unit tests using KOS's default loader ($(KOS_LOADER)).
rerunCleans, rebuilds and reruns the unit tests.
flycastRuns the unit tests with the flycast emulator.
installInstalls the static library as a KOS port.
uninstallRemoves the library and headers from KOS ports.
reinstalluninstall then install.
cleanDeletes all build artifacts.
rebuildCleans, then rebuilds the static library.
check-swRebuilds and runs the software back-end unit tests on the host (needs Ninja).
docsRegenerates the Doxygen documentation.
updateChecks out master and pulls the latest.

Two variables can be overridden on the command line: SHZ_BACKEND (default SH4) and SHZ_SAVE_TEMPS (default off). For example, make clean lib SHZ_BACKEND=SW builds the portable software back-end with the Dreamcast toolchain. The variables only take effect when build/ is configured, so run make clean before switching.

For KOS users building with CMake, use kos-cmake instead of your system cmake command. It sets up the Dreamcast toolchain so PLATFORM_DREAMCAST is defined and the SH4 back-end is selected. The options are listed in Install with CMake.

The examples are installed to kos-ports/examples/sh4zam. You should be able to type make to build any example. See Examples.