diff --git a/CMake/FindZ80.cmake b/CMake/FindZ80.cmake deleted file mode 100644 index 6f46b50..0000000 --- a/CMake/FindZ80.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# Z80 - FindZ80.cmake -# ______ ______ ______ -# /\___ \/\ __ \\ __ \ -# \/__/ /\_\ __ \\ \/\ \ -# /\_____\\_____\\_____\ -# Zilog \/_____//_____//_____/ CPU Emulator -# Copyright (C) 1999-2022 Manuel Sainz de Baranda y Goñi. -# Released under the terms of the GNU Lesser General Public License v3. -# This "find module" is DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. - -include(FindPackageHandleStandardArgs) - -find_path(Z80_INCLUDE_DIR "Z80.h") - -if(Z80_INCLUDE_DIR AND EXISTS "${Z80_INCLUDE_DIR}/Z80.h") - file(READ "${Z80_INCLUDE_DIR}/Z80.h" _) - - if(_ MATCHES ".*Z80_LIBRARY_VERSION_STRING \"([^\n]*)\".*") - set(Z80_VERSION ${CMAKE_MATCH_1}) - endif() - - unset(_) -endif() - -find_library(Z80_LIBRARY Z80) - -find_package_handle_standard_args( - Z80 - FOUND_VAR Z80_FOUND - REQUIRED_VARS Z80_INCLUDE_DIR Z80_VERSION Z80_LIBRARY - VERSION_VAR Z80_VERSION) - -if(Z80_FOUND AND NOT TARGET Z80) - find_package(Zeta QUIET) - - add_library(Z80 SHARED IMPORTED) - - set_target_properties( - Z80 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${Z80_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "Zeta" - IMPORTED_LOCATION "${Z80_LIBRARY}") -endif() - -mark_as_advanced(Z80_INCLUDE_DIR Z80_LIBRARY) - -# FindZ80.cmake EOF diff --git a/README b/README index cb2e1c4..e657678 100644 --- a/README +++ b/README @@ -65,8 +65,8 @@ Test Suite" and Peter Helcmanovsky's "Z80 Block Flags Test", to name a few. 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 in case you want -to generate the documentation in PDF format. +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 (https://zeta.st), a dependency-free, header-only library used to retain compatibility with most C @@ -195,8 +195,8 @@ library by predefining macros that enable optional implementations: during the execution of the "ld a,{i|r}" instructions. The default is NO. -Package maintainers should use at least the following options for both shared and -static library targets: +Package maintainers should use at least the following options for the shared +library: -DZ80_WITH_EXECUTE=YES -DZ80_WITH_FULL_IM0=YES @@ -216,23 +216,23 @@ install the package: 4.1. As an external dependency in CMake-based projects -The Z80 library includes find-modules and a config-file package for integration -into CMake-based projects. It is recommended to always copy the FindZ80.cmake -and FindZeta.cmake files into the CMake modules directory of projects that use -the library as an external dependency. This will allow CMake to find the library -if the necessary config-file packages are not installed on the system. - -Both the config-file package and the find-module support dual installations of -the shared and static versions of the Z80 library. You can specify the linking -method by using the component mechanism of "find_package". +The Z80 library includes a config-file package for integration into CMake-based +projects, which should be installed on development environments. As usual, just +call "find_package" to find the library. This creates the imported "Z80" target +carrying the necessary transitive link dependencies. The linking method can +optionally be selected by specifying the "Shared" or "Static" component of the +Z80 package. Example: find_package(Z80 REQUIRED [Shared|Static]) target_link_libraries(your-target Z80) -Omitting the linking method will select the "Shared" version of the library or, -if not installed, the "Static" version instead. +When not specified as a component, the linking method is selected according to +"Z80_SHARED_LIBS". If this option is not defined, the config-file package uses +the type of library that is installed on the system and, if it finds both the +shared and the static versions, "BUILD_SHARED_LIBS" determines which one to link +against. 4.2. As a CMake subproject diff --git a/README.md b/README.md index 8d45384..93e1487 100644 --- a/README.md +++ b/README.md @@ -244,7 +244,7 @@ emerge z80 # Installation from sources -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://github.com/michaeljones/breathe) to compile the documentation. Also make sure you have [LaTeX](https://www.latex-project.org) with PDF support installed on your system in case you want to generate the documentation in PDF format. +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://github.com/michaeljones/breathe) to compile the documentation. Also make sure 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. The emulator requires some types and macros included in [Zeta](https://github.com/redcode/Zeta), 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 official source code package to the same directory of this `README.md` 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). @@ -359,7 +359,7 @@ Package-specific options are prefixed with `Z80_` and can be divided into two gr 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. The default is `NO`. -Package maintainers should use at least the following options for both shared and static library targets: +Package maintainers should use at least the following options for the shared library: ```shell -DZ80_WITH_EXECUTE=YES @@ -400,18 +400,16 @@ The CRC errors in the latter two are normal and match the values obtained on rea ### As an external dependency in CMake-based projects -The Z80 library includes find-modules and a config-file package for integration into CMake-based projects. It is recommended to always copy the `FindZ80.cmake` and `FindZeta.cmake` files into the CMake modules directory of projects that use the library as an external dependency. This will allow CMake to find the library if the necessary config-file packages are not installed on the system. - -Both the config-file package and the find-module support dual installations of the shared and static versions of the Z80 library. You can specify the linking method by using the component mechanism of `find_package`. +The Z80 library [includes](#option_z80_with_cmake_support) a [config-file package](https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages) for integration into CMake-based projects, which should be installed on development environments. As usual, just call [`find_package`](https://cmake.org/cmake/help/latest/command/find_package.html) to find the library. This creates the imported `Z80` target carrying the necessary transitive link dependencies. The linking method can optionally be selected by specifying the `Shared` or `Static` component of the `Z80` package. Example: ```cmake -find_package(Z80 REQUIRED [Shared|Static]) -target_link_libraries(your-target Z80) + find_package(Z80 REQUIRED [Shared|Static]) + target_link_libraries(your-target Z80) ``` -Omitting the linking method will select the `Shared` version of the library or, if not installed, the `Static` version instead. +When not specified as a component, the linking method is selected according to [`Z80_SHARED_LIBS`](#option_z80_shared_libs). If this option is not defined, the config-file package uses the type of library that is installed on the system and, if it finds both the shared and the static versions, [`BUILD_SHARED_LIBS`](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html) determines which one to link against. ### As a CMake subproject diff --git a/documentation/Installation.rst b/documentation/Installation.rst index b0c4258..ac3d0f1 100644 --- a/documentation/Installation.rst +++ b/documentation/Installation.rst @@ -14,7 +14,7 @@ Installation \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 in case you want to generate the documentation in PDF format. +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 `_. @@ -152,7 +152,7 @@ The second group of package-specific options configures the source code of the l 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 both shared and static library targets: +Package maintainers should use at least the following options for the shared library: .. code-block:: sh diff --git a/documentation/Integration.rst b/documentation/Integration.rst index 6ed5d07..6527456 100644 --- a/documentation/Integration.rst +++ b/documentation/Integration.rst @@ -17,9 +17,7 @@ Integration As an external dependency in CMake-based projects ------------------------------------------------- -The Z80 library includes find-modules and a config-file package for integration into CMake-based projects. It is recommended to always copy the ``FindZ80.cmake`` and ``FindZeta.cmake`` files into the CMake modules directory of projects that use the library as an external dependency. This will allow CMake to find the library if the necessary config-file packages are not installed on the system. - -Both the config-file package and the find-module support dual installations of the shared and static versions of the Z80 library. You can specify the linking method by using the component mechanism of ``find_package``. +The Z80 library includes a `config-file package `_ for integration into CMake-based projects, which should be installed on development environments. As usual, just call ``find_package`` to find the library. This creates the imported ``Z80`` target carrying the necessary transitive link dependencies. The linking method can optionally be selected by specifying the ``Shared`` or ``Static`` component of the ``Z80`` package. Example: @@ -28,7 +26,7 @@ Example: find_package(Z80 REQUIRED [Shared|Static]) target_link_libraries(your-target Z80) -Omitting the linking method will select the ``Shared`` version of the library or, if not installed, the ``Static`` version instead. +When not specified as a component, the linking method is selected according to ``Z80_SHARED_LIBS``. If this option is not defined, the config-file package uses the type of library that is installed on the system and, if it finds both the shared and the static versions, ``BUILD_SHARED_LIBS`` determines which one to link against. As a CMake subproject --------------------- diff --git a/documentation/TODO.txt b/documentation/TODO.txt deleted file mode 100644 index bd3b82a..0000000 --- a/documentation/TODO.txt +++ /dev/null @@ -1,2 +0,0 @@ -ST CMOS Z80 no se comporta igual en los flags de las instrucciones de bloque? -https://stardot.org.uk/forums/viewtopic.php?p=212100#p212100