-
Notifications
You must be signed in to change notification settings - Fork 70
CMake Herc6x
Wiki ▸ CMake Build Logic ▸ CMake Scripts ▸ Herc6x.cmake
These scripts comprise the final steps of configuring build tool scripts to compile Hercules and any needed external packages.
- Herc60_CreateTargets.cmake - Create targets to build Hercules executables, libraries, and loadable modules.
- Herc61_SlibSource.cmake - Create source file and header lists for Hercules targets.
- Herc65_ExtPackageWinCopy.cmake - (Windows only) Copy package libraries to binary directory.
This script defines what gets built when compiling Hercules and the order used to build Hercules components. It does the following:
- Sets up Herc01_GitVer.cmake to be run to update git status in
commitinfo.h
each time Hercules is recompiled. - Runs script Herc61_SlibSource.cmake to build variables containing source files for each target.
- Builds decNumber
- Creates targets for the five Hercules shared libraries. Regina Rexx and/or Open Object Rexx are included in
herc
if they were selected or defaulted. - Adds any external packages to be built by Hercules as dependencies of
herc
so they are built beforeherc
. - Creates targets for the 19 loadable modules, 14 for device emulation and five for optional functions.
- If building on Windows or macOS, creates a dependency for each of the 19 loadable modules on the
herc
shared library. Windows and macOS require a dependent shared library to exist at link time; UNIX-like systems do not. - Creates targets for the 22 utility executables and, if building on Windows, a target for
conspawn
, which allows thesh
command to be used in Windows. - Creates the target for the main executable
hercules
. - If supported on the target system, creates a target for
hercifc
, a utility that configures tun/tap network interface(s) for CTC operation. Script Herc20_TargetEnv.cmake determines whetherhercifc
should be built. - Clones the html repository from the Hercules-390 github project. Some testing is needed here to ensure that updates to the html repository are propagated to the build directory automatically.
- Adds the
tests
subdirectory to the build. The CMakeLists.txt in that directory will create the test cases. - Creates an uninstall script and a
check
target, a synonym for thetest
target that CMake automatically creates.
Create source file variables for Hercules targets; the variables are used by Herc60_CreateTargets.cmake to create targets.
"Target" is the CMake term for a executable, shared library, or dynamically loaded module. Each variable is a list of the source files needed to be compiled to create whatever the target represents. Headers, c sources, and Windows resource files are listed. (CMake ignores resource files when compiling for other than Windows systems.)
One variable, headers_sources
, lists all headers including those not associated with a specific compilation unit (e.g., hstruct.h
). A custom target is created from this variable so that an Integrated Development Environment can be used to edit any header, not just those specific to a given compilation unit.
At the end of this script, the list variables are altered to add files required for a Windows build and remove files not needed when building for Windows.
This script is run only when the target system is Windows.
This script adds CMake commands to copy shared libraries generated from external packages from their respective build directories to the Hercules build directory. The Windows search order for shared libraries is fixed; the simplest way to enable Hercules' use of external package libraries is to copy them into the Hercules build directory.
The added commands, one Add_Custom_Command to run script Herc03_CopySharedLib.cmake for each external package, are run each time Hercules is built.
This script and the commands are not needed on UNIX-like and macOS builds because the shared libraries are located using the RPATH set in the calling executable or shared library. CMake sets RPATH to include the build directories of all external packages not retrieved from system libraries.
This Wiki page Copyright © 2018 by Stephen R. Orso. This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.