Skip to content

Commit f7fb482

Browse files
committed
Documentation: Installation from sources and integration.
1 parent 443d246 commit f7fb482

File tree

4 files changed

+51
-21
lines changed

4 files changed

+51
-21
lines changed

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,15 @@ Pre-built binaries for Windows are available on the [download](https://zxe.io/so
358358

359359
## Installation from sources
360360

361+
### Prerequisites
362+
361363
You will need [CMake](https://cmake.org) v3.14 or later to build the package and, optionally, recent versions of [Doxygen](https://www.doxygen.nl), [Sphinx](https://www.sphinx-doc.org) and [Breathe](https://www.breathe-doc.org) to compile the documentation. Also, make sure that you have [LaTeX](https://www.latex-project.org) with PDF support installed on your system if you want to generate the documentation in PDF format.
362364

363-
The emulator requires some types and macros included in [Zeta](https://zeta.st), a dependency-free, [header-only](https://en.wikipedia.org/wiki/Header-only) library used to retain compatibility with most C compilers. Install Zeta or extract its [source code tarball](https://zeta.st/download) to the root 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](https://en.wikipedia.org/wiki/C_standard_library).
365+
The Z80 library requires some types and macros included in [Zeta](https://zxe.io/software/Zeta), a [header-only](https://en.wikipedia.org/wiki/Header-only), dependency-free library used for portability reasons. Install Zeta or extract its [source code tarball](https://zxe.io/software/Zeta/download) to the root directory of the Z80 project or its parent directory. Zeta is the sole dependency; the emulator does not depend on the [C standard library](https://en.wikipedia.org/wiki/C_standard_library).
366+
367+
Lastly, the package includes two testing tools. The first one runs various Z80-specific tests for [CP/M](https://en.wikipedia.org/wiki/CP/M) and [ZX Spectrum](https://en.wikipedia.org/wiki/ZX_Spectrum) and will use [libzip](https://libzip.org) and [zlib](https://zlib.net) if they are available on your system. The second tool is for [unit tests in JSON format](https://github.com/SingleStepTests/z80) and requires the [cJSON](https://github.com/DaveGamble/cJSON) and [Z80InsnClock](https://zxe.io/software/Z80InsnClock) libraries. Building these tools is optional.
368+
369+
### Configure
364370

365371
Once the prerequisites are met, create a directory and run `cmake` from there to prepare the build system:
366372

@@ -452,6 +458,11 @@ If in doubt, read the [CMake documentation](https://cmake.org/documentation/) fo
452458
Install the standard text documents distributed with the package: [`AUTHORS`](AUTHORS), [`COPYING`](COPYING), [`COPYING.LESSER`](COPYING.LESSER), [`HISTORY`](HISTORY), [`README`](README) and [`THANKS`](THANKS).
453459
The default is `NO`.
454460

461+
* <span id="cmake_option_z80_with_step_testing_tool">**`-DZ80_WITH_STEP_TESTING_TOOL=(YES|NO)`**</span>
462+
Build `step-test-Z80`, a tool for [unit tests in JSON format](https://github.com/SingleStepTests/z80).
463+
It requires cJSON and Z80InsnClock.
464+
The default is `NO`.
465+
455466
* <span id="cmake_option_z80_with_testing_tool">**`-DZ80_WITH_TESTING_TOOL=(YES|NO)`**</span>
456467
Build `test-Z80`, a tool that runs various Z80-specific tests for [CP/M](https://en.wikipedia.org/wiki/CP/M) and [ZX Spectrum](https://en.wikipedia.org/wiki/ZX_Spectrum).
457468
The default is `NO`.
@@ -504,6 +515,8 @@ Package maintainers are encouraged to use at least the following options for the
504515
-DZ80_WITH_ZILOG_NMOS_LD_A_IR_BUG=YES
505516
```
506517

518+
### Build and install
519+
507520
Finally, once the build system is configured according to your needs, build and install the package:
508521

509522
```shell
@@ -620,9 +633,9 @@ When not specified as a component, the linking method is selected according to [
620633

621634
### As a CMake subproject
622635

623-
To embed the Z80 library as a CMake subproject, extract the source code tarballs of [Zeta](https://zeta.st/download) and [Z80](https://zxe.io/software/Z80/download) (or clone their respective repositories) into a subdirectory of another project. Then use [`add_subdirectory`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html) in the parent project to add the Z80 source code tree to the build process (N.B., the Z80 subproject will automatically find Zeta and import it as an [interface library](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#interface-libraries)).
636+
To embed the Z80 library as a CMake subproject, extract the source code tarballs of [Zeta](https://zxe.io/software/Zeta/download) and [Z80](https://zxe.io/software/Z80/download) (or clone their respective repositories) into a subdirectory of another project. Then use [`add_subdirectory`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html) in the parent project to add the Z80 source code tree to the build process (N.B., the Z80 subproject will automatically find Zeta and import it as an [interface library](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#interface-libraries)).
624637

625-
It is advisable to configure the Z80 library in the `CMakeLists.txt` of the parent project. This will prevent the user from having to specify [configuration options for the Z80 subproject](#cmake_package_options) through the command line when building the main project.
638+
It is advisable to configure the Z80 library in the `CMakeLists.txt` of the parent project. This will eliminate the need for the user to specify [configuration options for the Z80 subproject](#cmake_package_options) through the command line when building the main project.
626639

627640
Example:
628641

@@ -643,16 +656,16 @@ The source code of the emulator can be configured at compile time by predefining
643656

644657
* <span id="macro_z80_external_header">**`#define Z80_EXTERNAL_HEADER "header-name.h"`**</span>
645658
Specifies the only external header to `#include`, replacing all others.
646-
Predefine this macro to provide a header file that defines the external types and macros used by the emulator, thus preventing your project from depending on [Zeta](https://zeta.st). You can use this when compiling `Z80.c` as a part of your project or (if your types do not break the binary compatibility) when including `<Z80.h>` and linking against a pre-built Z80 library.
659+
Predefine this macro to provide a header file that defines the external types and macros used by the emulator, thus preventing your project from depending on [Zeta](https://zxe.io/software/Zeta). You can use this when compiling `Z80.c` within your project or (if your types do not break the binary compatibility) when including `<Z80.h>` and linking against a pre-built Z80 library.
647660

648661
* <span id="macro_z80_static">**`#define Z80_STATIC`**</span>
649-
Restricts the visibility of public symbols.
650-
This macro is required if you are building `Z80.c` as a static library, compiling it directly as a part of your project, or linking your program against the static version of the Z80 library. In either of these cases, make sure this macro is defined before including `"Z80.h"` or `<Z80.h>`.
662+
Indicates that the emulator is a static library.
663+
This macro must be predefined when building `Z80.c` as a static library. Additionally, if you compile `Z80.c` directly within your project or link your program against the static version of the Z80 library, ensure that this macro is defined before including `"Z80.h"` or `<Z80.h>`.
651664

652665
* <span id="macro_z80_with_local_header">**`#define Z80_WITH_LOCAL_HEADER`**</span>
653666
Tells `Z80.c` to <code>#include&nbsp;"Z80.h"</code> instead of `<Z80.h>`.
654667

655-
The optional features of the emulator mentioned in "[Installation from sources](#installation-from-sources)" are disabled by default. If you compile `Z80.c` as a part of your project, enable those features you need by predefining their respective activation macros. They have the same name as their [CMake equivalents](#cmake_package_source_code_options):
668+
The optional features of the emulator mentioned in the "[Configure](#configure)" section of "[Installation from sources](#installation-from-sources)" are disabled by default. If you compile `Z80.c` within your project, enable those features you need by predefining their respective activation macros. They have the same name as their [CMake equivalents](#cmake_package_source_code_options):
656669

657670
* **<code>#define [Z80_WITH_EXECUTE](#cmake_option_z80_with_execute)</code>**
658671
* **<code>#define [Z80_WITH_FULL_IM0](#cmake_option_z80_with_full_im0)</code>**

documentation/installation-from-sources.rst

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,30 @@ Installation from sources
1414

1515
\newline
1616

17-
.. |cmake_option_build_config| replace:: ``--config``
18-
.. _cmake_option_build_config: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-build-config
19-
2017
.. |cmake_option_install_component| replace:: ``--component``
2118
.. _cmake_option_install_component: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-install-component
2219

20+
.. |cmake_option_build_config| replace:: ``--config``
21+
.. _cmake_option_build_config: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-build-config
22+
2323
.. |cmake_option_install_strip| replace:: ``--strip``
2424
.. _cmake_option_install_strip: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-install-strip
2525

2626
.. _config-file package: https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages
2727
.. _CP/M: https://en.wikipedia.org/wiki/CP/M
2828
.. _file: https://people.freedesktop.org/~dbn/pkg-config-guide.html
2929
.. _pkg-config: https://www.freedesktop.org/wiki/Software/pkg-config
30+
.. _unit tests in JSON format: https://github.com/SingleStepTests/z80
3031
.. _ZX Spectrum: https://en.wikipedia.org/wiki/ZX_Spectrum
3132

3233
Prerequisites
3334
=============
3435

3536
You will need `CMake <https://cmake.org>`_ v3.14 or later to build the package and, optionally, recent versions of `Doxygen <https://www.doxygen.nl>`_, `Sphinx <https://www.sphinx-doc.org>`_ and `Breathe <https://www.breathe-doc.org>`_ to compile the documentation. Also, make sure that you have `LaTeX <https://www.latex-project.org>`_ with PDF support installed on your system if you want to generate the documentation in PDF format.
3637

37-
The emulator requires some types and macros included in `Zeta <https://zeta.st>`_, a dependency-free, `header-only <https://en.wikipedia.org/wiki/Header-only>`_ library used to retain compatibility with most C compilers. Install Zeta or extract its `source code tarball <https://zeta.st/download>`_ to the root 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 <https://en.wikipedia.org/wiki/C_standard_library>`_.
38+
The Z80 library requires some types and macros included in `Zeta <https://zxe.io/software/Zeta>`_, a `header-only <https://en.wikipedia.org/wiki/Header-only>`_, dependency-free library used for portability reasons. Install Zeta or extract its `source code tarball <https://zxe.io/software/Zeta/download>`_ to the root directory of the Z80 project or its parent directory. Zeta is the sole dependency; the emulator does not depend on the `C standard library <https://en.wikipedia.org/wiki/C_standard_library>`_.
39+
40+
Lastly, the package includes two testing tools. The first one runs various Z80-specific tests for `CP/M`_ and `ZX Spectrum`_ and will use `libzip <https://libzip.org>`_ and `zlib <https://zlib.net>`_ if they are available on your system. The second tool is for `unit tests in JSON format`_ and requires the `cJSON <https://github.com/DaveGamble/cJSON>`_ and `Z80InsnClock <https://zxe.io/software/Z80InsnClock>`_ libraries. Building these tools is optional.
3841

3942
Configure
4043
=========
@@ -148,14 +151,20 @@ Package-specific options are prefixed with ``Z80_`` and can be divided into two
148151
Install the standard text documents distributed with the package: :file:`AUTHORS`, :file:`COPYING`, :file:`COPYING.LESSER`, :file:`HISTORY`, :file:`README` and :file:`THANKS`. |br| |nl|
149152
The default is ``NO``.
150153

154+
.. option:: -DZ80_WITH_STEP_TESTING_TOOL=(YES|NO)
155+
156+
Build :file:`step-test-Z80`, a tool for `unit tests in JSON format`_. |br| |nl|
157+
It requires cJSON and Z80InsnClock. |br| |nl|
158+
The default is ``NO``.
159+
151160
.. option:: -DZ80_WITH_TESTING_TOOL=(YES|NO)
152161

153162
Build :file:`test-Z80`, a tool that runs various Z80-specific tests for `CP/M`_ and `ZX Spectrum`_. |br| |nl|
154163
The default is ``NO``.
155164

156165
.. _cmake_package_source_code_options:
157166

158-
The second group of package-specific options configures the source code of the library by predefining macros that enable :ref:`optional features <Introduction:Optional features>`:
167+
The second group of package-specific options configures the source code of the library by predefining macros that enable :ref:`optional features <introduction:Optional features>`:
159168

160169
.. option:: -DZ80_WITH_EXECUTE=(YES|NO)
161170

@@ -222,7 +231,9 @@ Finally, once the build system is configured according to your needs, build and
222231
cmake --build . [--config (Debug|Release|RelWithDebInfo|MinSizeRel)]
223232
cmake --install . [--config <configuration>] [--strip] [--component <component>]
224233
225-
The |cmake_option_build_config|_ option is only necessary for those `CMake generators <https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html>`_ that ignore :option:`CMAKE_BUILD_TYPE<-DCMAKE_BUILD_TYPE>` (e.g., Xcode and Visual Studio). Use |cmake_option_install_strip|_ to remove debugging information and non-public symbols when installing non-debug builds of the shared library. To install only a specific component of the package, use the |cmake_option_install_component|_ option. The project defines the following components:
234+
The |cmake_option_build_config|_ option is only necessary for those `CMake generators <https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html>`_ that ignore :option:`CMAKE_BUILD_TYPE<-DCMAKE_BUILD_TYPE>` (e.g., Xcode and Visual Studio). Use |cmake_option_install_strip|_ to remove debugging information and non-public symbols when installing non-debug builds of the shared library. To install only a specific component of the package, use the |cmake_option_install_component|_ option.
235+
236+
The project defines the following components:
226237

227238
.. option:: Z80_Runtime
228239

@@ -242,3 +253,9 @@ The |cmake_option_build_config|_ option is only necessary for those `CMake gener
242253

243254
* Documentation in HTML format.
244255
* Documentation in PDF format.
256+
257+
.. option:: Z80_Testing
258+
259+
* Testing tools.
260+
261+
By default, the build system will install ``Z80_Runtime``, ``Z80_Development`` and ``Z80_Documentation``. The ``Z80_Testing`` component can only be installed explicitly.

documentation/integration.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ When not specified as a component, the linking method is selected according to :
2828
As a CMake subproject
2929
=====================
3030

31-
To embed the Z80 library as a CMake subproject, extract the source code tarballs of `Zeta <https://zeta.st/download>`__ and `Z80 <https://zxe.io/software/Z80/download>`_ (or clone their respective repositories) into a subdirectory of another project. Then use |add_subdirectory|_ in the parent project to add the Z80 source code tree to the build process (N.B., the Z80 subproject will automatically find Zeta and import it as an `interface library <https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#interface-libraries>`_).
31+
To embed the Z80 library as a CMake subproject, extract the source code tarballs of `Zeta <https://zxe.io/software/Zeta/download>`__ and `Z80 <https://zxe.io/software/Z80/download>`_ (or clone their respective repositories) into a subdirectory of another project. Then use |add_subdirectory|_ in the parent project to add the Z80 source code tree to the build process (N.B., the Z80 subproject will automatically find Zeta and import it as an `interface library <https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#interface-libraries>`_).
3232

33-
It is advisable to configure the Z80 library in the :file:`CMakeLists.txt` of the parent project. This will prevent the user from having to specify :ref:`configuration options for the Z80 subproject <cmake_package_options>` through the command line when building the main project.
33+
It is advisable to configure the Z80 library in the :file:`CMakeLists.txt` of the parent project. This will eliminate the need for the user to specify :ref:`configuration options for the Z80 subproject <cmake_package_options>` through the command line when building the main project.
3434

3535
Example:
3636

@@ -54,25 +54,25 @@ The source code of the emulator can be configured at compile time by predefining
5454
5555
Specifies the only external header to ``#include``, replacing all others.
5656

57-
Predefine this macro to provide a header file that defines the external types and macros used by the emulator, thus preventing your project from depending on `Zeta <https://zeta.st>`__:
57+
Predefine this macro to provide a header file that defines the external types and macros used by the emulator, thus preventing your project from depending on `Zeta <https://zxe.io/software/Zeta>`__:
5858

5959
* Macros: ``Z_ALWAYS_INLINE``, ``Z_API_EXPORT``, ``Z_API_IMPORT``, ``Z_CAST``, ``Z_EMPTY``, ``Z_EXTERN_C_BEGIN``, ``Z_EXTERN_C_END``, ``Z_MEMBER_OFFSET``, ``Z_NULL``, ``Z_UINT8_ROTATE_LEFT``, ``Z_UINT8_ROTATE_RIGHT``, ``Z_UINT16``, ``Z_UINT16_BIG_ENDIAN``, ``Z_UINT32``, ``Z_UINT32_BIG_ENDIAN``, ``Z_UNUSED``, ``Z_USIZE`` and ``Z_USIZE_MAXIMUM``.
6060

6161
* Types: ``zbool``, ``zchar``, ``zsint``, ``zsint8``, ``zuint``, ``zuint8``, ``zuint16``, ``zuint32``, ``zusize``, ``ZInt16`` and ``ZInt32``.
6262

63-
You can use this macro when compiling :file:`Z80.c` as a part of your project or (if your types do not break the binary compatibility) when including ``<Z80.h>`` and linking against a pre-built Z80 library.
63+
You can use this macro when compiling :file:`Z80.c` within your project or (if your types do not break the binary compatibility) when including ``<Z80.h>`` and linking against a pre-built Z80 library.
6464

6565
.. c:macro:: Z80_STATIC
6666
67-
Restricts the visibility of public symbols.
67+
Indicates that the emulator is a static library.
6868

69-
This macro is required if you are building :file:`Z80.c` as a static library, compiling it directly as a part of your project, or linking your program against the static version of the Z80 library. In either of these cases, make sure this macro is defined before including ``"Z80.h"`` or ``<Z80.h>``.
69+
This macro must be predefined when building :file:`Z80.c` as a static library. Additionally, if you compile :file:`Z80.c` directly within your project or link your program against the static version of the Z80 library, ensure that this macro is defined before including ``"Z80.h"`` or ``<Z80.h>``.
7070

7171
.. c:macro:: Z80_WITH_LOCAL_HEADER
7272
7373
Tells :file:`Z80.c` to ``#include "Z80.h"`` instead of ``<Z80.h>``.
7474

75-
The :ref:`optional features <Introduction:Optional features>` of the emulator mentioned in the ":doc:`installation-from-sources`" section are disabled by default. If you compile :file:`Z80.c` as a part of your project, enable those features you need by predefining their respective activation macros. They have the same name as their :ref:`CMake equivalents <cmake_package_source_code_options>`:
75+
The :ref:`optional features <introduction:Optional features>` of the emulator mentioned in the ":ref:`Configure <installation-from-sources:Configure>`" section of ":doc:`installation-from-sources`" are disabled by default. If you compile :file:`Z80.c` within your project, enable those features you need by predefining their respective activation macros. They have the same name as their :ref:`CMake equivalents <cmake_package_source_code_options>`:
7676

7777
.. c:macro:: Z80_WITH_EXECUTE
7878

documentation/version-history.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This is an important update that addresses a number of issues and also includes
1515
2. Moved the public header from ``<emulation/CPU/Z80.h>`` to ``<Z80.h>``.
1616
3. Removed the Xcode project.
1717
4. Switched the build system from Premake to `CMake <https://cmake.org>`_.
18-
5. Switched to `Zeta <https://zeta.st>`_ v0.1.
18+
5. Switched to `Zeta <https://zxe.io/software/Zeta>`_ v0.1.
1919
6. Added `pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config>`_ support.
2020
7. Added the following files to the project: :file:`.vimrc`, :file:`CITATION.cff` and :file:`THANKS`.
2121
8. Added detailed documentation.

0 commit comments

Comments
 (0)