Zsetup#

Description#

This program generates a Makefile.dat from a configuration file named library_files. The program is efficient for setting up dependencies, adding new files, managing source directories, and configuring libraries to create. It is provided as a utility for generating appropriate Makefiles for user plugins.

Syntax#

In order to configure a source project, define the project structure in library_files and run Zsetup:

% Zsetup [options]\(\hookleftarrow\)

Options

DESCRIPTION

-od

original debug info for ZebFront programs

-f <file>

give an alternative configuration file (by default the file named library_files is considered)

-h

display help information for this command

The -od switch can be used to debug ZebFront program compilations. By default ZebFront re-assigns line numbers to the corresponding number in the .z file, and the .c C++ source is removed after successful compilation. Because many lines are added to the resulting C++ file, there is a possibility that syntax errors are first referenced in the generated code. This method of compiling will leave the .c file, and error messages from the compiler will refer to that file.

The syntax of the library_files is partially summarized below. All commands start with an exclamation point (!) and are followed by free format lists of parameters. In most cases the parameters are read until the next command appears (not so for !MAKE). The parameters may be split with comments. The comment character is the pound sign (#). The file reading will end with the !!RETURN command, which must exist in the file.

!MAKE

Makefile lines which will be added to the top of the Makefile.dat which is generated. Only the remaining part of the line will be taken. Target command lines must have a tab in them, so these lines should have a tab immediately following the !MAKE command.

!DYNAMIC

Indicates that all libraries to be generated, and those to be used, will be shared libraries (.so or .sl format) and not object archives .a.

!CFLAGS

These are command options which are added on each source file compilation line. One could also use the MACHINE_TYPES compiler description file.

!BFLAGS

These are command options passed on at the link stage of the compilation.

!INC

This command takes only one argument, the name of a directory containing header files (.h).

!SRC

Description of the dependencies for a directory with C++ source files. The directory name must be given, followed by the include directories with .h files used in those sources.

!FSRC

Fortran files directory.

!DEBUG

Takes a list of the directories or file names to be compiled in debug when Zmake is run using the -g switch.

!LIB

Defines a library to be created. The first parameter is the name of the library, followed by the source directories which are contained in it.

!TARGET

Defines a target executable. The first parameter is the prefix name of the executable, followed by the source directories which are contained in it.

Important

  • Source files are included only if they begin with a capital letter and must have unique names.

  • A user-shared library intended for use with Z-mat should contain “Zmat” in its name.

Example#

The library_files file used for the small user project is as follows:

!MESSAGE User Z7 project
!DYNAMIC
!CFLAGS -I${Z7PATH}/include
!BFLAGS -L${Z7PATH}/PUBLIC/lib-${Z7MACHINE}
!INC   source
!SRC   source source
!DEBUG source
!LIB ZeBaBa_User source
!TARGET NONE source
!!RETURN

Note

An example of a user project is provided in $Z7PATH/User-project, with library_files (for Linux) and *.zpr (for Windows) files.

Setup user projects in Windows#

Setting up and building a user project on Windows differs from the process on Linux. In the following, we outline how to configure and compile a user project using Microsoft Visual Studio. The configuration file *.zpr allows to easily generate a visual studio project *.dsp

The syntax of the configuration file (.zpr) is partially summarized below. The comment character is the percent sign (%).

!Z7DIR <z7dir>

defines the base directory (%Z7PATH%) of the used version of Z-set.

!DLL <user_dll>

indicates that the build will produce a DLL named user_dll.

!O_DEST_DIR

directory where Z-set DLLs will be installed.

!PROJDIR

indicates the directory where the user project files are located.

!DONT_INSTALL

flag to prevent automatic installation after the build.

!VCPP

specifies the version of Visual C++ being used.

!64BITS

indicates that the build is for a 64-bit platform.

!O_OPT

optimization options for the compiler in release mode.

!D_OPT

debug options for the compiler in debug mode.

!OPT

additional preprocessor definitions and options for the compiler.

!OPT LINK32

linking options.

!GROUPS

specify the group of source files.

!USE

indicates dependencies or modules to be used in the build.

Here is an example of a Windows project file:

!Z7DIR       C:\MyPath\Z9.1
!O_DEST_DIR  C:\MyPath\Z9.1\win64
!PROJDIR     D:\USER_PROJ
!DONT_INSTALL

!VCPP    6.00
!64BITS

!O_OPT CPP /Ox /D "NDEBUG" /FR /GX /MD /G5 /Tp /Gm-
!D_OPT CPP /D "ZCHECK" /Od /D "NDEBUG" /Zi /GX /MD /G5 /Tp /Gm-

!OPT LINK32
kernel32.lib
msvcrt.lib
/INCREMENTAL:NO /debug
/libpath:"..\win64"
!OPT CPP /D "ZEXCEPTIONS" /Tp /D "DLL3" /D "_WIN32"
!DLL zmat_user
!GROUPS
src
!USE
zmat_base
!!RETURN

Important

  • The name of a user dynamic link library intended for use with Z-mat should start with “zmat” (Case-insensitive).

To build a Z-set user project, follow these steps:

  1. Execute the project file with %Z7PATH%\win64\win_proj.exe \(\longrightarrow\) generates user_dll.dsp file.

  2. Open user_dll.dsp file with Visual studio.

  3. Retarget solution to the latest Microsoft toolset.

  4. Build the solution (user_dll.dll).