============ Installation ============ .. only:: html .. |br| raw:: html
.. only:: latex .. |nl| raw:: latex \newline You will need `CMake `_ v3.14 or later to build the package and, optionally, recent versions of `Doxygen `_, `Sphinx `_ and `Breathe `_ to compile the documentation. Also make sure you have `LaTeX `_ with PDF support installed on your system if you want to generate the documentation in PDF format. The emulator requires some types and macros included in `Zeta `_, a dependency-free, `header-only `_ library used to retain compatibility with most C compilers. Install Zeta or extract its official source code package to the directory of the Z80 project or its parent directory. Zeta is the sole dependency; the emulator is a freestanding implementation and as such does not depend on the `C standard library `_. Once all requirements are met, create a directory and run ``cmake`` from there to prepare the build system: .. code-block:: sh mkdir build cd build cmake [options] The resulting build files can be configured by passing options to ``cmake``. To show a complete list of those available along with their current settings, type the following: .. code-block:: sh cmake -LAH If in doubt, read the `CMake documentation `_ for more information on configuration options. The following are some of the most relevant standard options of CMake: .. option:: -DBUILD_SHARED_LIBS=(YES|NO) Build the project as a shared library rather than a static one. |br| |nl| The default is ``NO``. .. option:: -DCMAKE_BUILD_TYPE=(Debug|Release|RelWithDebInfo|MinSizeRel) Choose the type of build (configuration) to generate. |br| |nl| The default is ``Release``. .. option:: -DCMAKE_INSTALL_PREFIX="" Specify the installation prefix on `UNIX `_ and `UNIX-like `_ operating systems. |br| |nl| The default is ``"/usr/local"``. Package-specific options are prefixed with ``Z80_`` and can be divided into two groups. The first one controls aspects not related to the source code of the library: .. option:: -DZ80_DOWNLOAD_TEST_FILES=(YES|NO) Download the firmware and software used by the testing tool. |br| |nl| The default is ``NO``. .. option:: -DZ80_INSTALL_CMAKEDIR="" Specify the directory in which to install the CMake `config-file package `_. |br| |nl| The default is ``"${CMAKE_INSTALL_LIBDIR}/cmake/Z80"``. .. option:: -DZ80_INSTALL_PKGCONFIGDIR="" Specify the directory in which to install the `pkg-config `_ `file `_. |br| |nl| The default is ``"${CMAKE_INSTALL_LIBDIR}/pkgconfig"``. .. option:: -DZ80_NOSTDLIB_FLAGS=(Auto|[[;...]]) Specify the linker flags used to avoid linking against system libraries. |br| |nl| The default is ``Auto`` (autoconfigure flags). If you get linker errors, set this option to ``""``. .. option:: -DZ80_SHARED_LIBS=(YES|NO) Build the project as a shared library rather than a static one. |br| |nl| This option takes precedence over ``BUILD_SHARED_LIBS``. |br| |nl| Not defined by default. .. option:: -DZ80_SPHINX_HTML_THEME="[]" Specify the Sphinx theme for the documentation in HTML format. |br| |nl| The default is ``""`` (use the default theme). .. option:: -DZ80_WITH_CMAKE_SUPPORT=(YES|NO) Generate and install the CMake `config-file package `_. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_HTML_DOCUMENTATION=(YES|NO) Build and install the documentation in HTML format. |br| |nl| It requires Doxygen, Sphinx and Breathe. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_PDF_DOCUMENTATION=(YES|NO) Build and install the documentation in PDF format. |br| |nl| It requires Doxygen, Sphinx, Breathe and LaTeX with PDF support. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_PKGCONFIG_SUPPORT=(YES|NO) Generate and install the `pkg-config `_ `file `_. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_STANDARD_DOCUMENTS=(YES|NO) Install the standard text documents distributed with the package: ``AUTHORS``, ``COPYING``, ``COPYING.LESSER``, ``HISTORY``, ``README`` and ``THANKS``. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_TESTS=(YES|NO) Build the testing tool. |br| |nl| The default is ``NO``. The second group of package-specific options configures the source code of the library by predefining macros that enable optional implementations: .. option:: -DZ80_WITH_EXECUTE=(YES|NO) Build the implementation of the ``z80_execute`` function. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_FULL_IM0=(YES|NO) Build the full implementation of the interrupt mode 0 rather than the reduced one. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_Q=(YES|NO) Build the implementation of the `Q "register" `_. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_SPECIAL_RESET=(YES|NO) Build the implementation of the `special RESET `_. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_UNOFFICIAL_RETI=(YES|NO) Configure the ``ED5Dh``, ``ED6Dh`` and ``ED7Dh`` undocumented instructions as ``reti`` instead of ``retn``. |br| |nl| The default is ``NO``. .. option:: -DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=(YES|NO) Build the implementation of the bug affecting the Zilog Z80 NMOS, which causes the P/V flag to be reset when a maskable interrupt is accepted during the execution of the ``ld a,{i|r}`` instructions. |br| |nl| The default is ``NO``. Package maintainers should use at least the following options for the shared library: .. code-block:: sh -DZ80_WITH_EXECUTE=YES -DZ80_WITH_FULL_IM0=YES -DZ80_WITH_Q=YES -DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=YES Finally, once the build system is configured according to your needs, build and install the package: .. code-block:: sh make make install/strip