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 |
|---|---|
|
original debug info for ZebFront programs |
-f <file> |
give an alternative configuration file (by default
the file named |
|
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.
|
Makefile lines which will be added to the top of the |
|
Indicates that all libraries to be generated, and those to
be used, will be shared libraries ( |
|
These are command options which are added on each source file
compilation line. One could also use the |
|
These are command options passed on at the link stage of the compilation. |
|
This command takes only one argument, the name of a
directory containing header files ( |
|
Description of the dependencies for a directory with C++ source files.
The directory name must be given, followed by the include directories with
|
|
Fortran files directory. |
|
Takes a list of the directories or file names to be compiled in debug
when Zmake is run using the |
|
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. |
|
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#
Here is a library_files file used for a small user project:
!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 (%).
|
defines the base directory ( |
|
indicates that the build will produce a DLL named user_lib. |
|
directory where Z-set DLLs will be installed. |
|
indicates the directory where the user project files are located. |
|
flag to prevent automatic installation after the build. |
|
specifies the version of Visual C++ being used. |
|
indicates that the build is for a 64-bit platform. |
|
optimization options for the compiler in release mode. |
|
debug options for the compiler in debug mode. |
|
additional preprocessor definitions and options for the compiler. |
|
linking options. |
|
specify the group of source files. |
|
indicates dependencies or modules to be used in the build. |
Example
ProjectRoot/
│── src/
│ ├── source_file.c
│ ├── source_file.h
│ ├── source_file.z
│ ├── ...
│── user_proj.zpr
Here is an example of a Windows project file user_proj.zpr:
!Z7DIR C:\MyPath\Z9.1
!O_DEST_DIR C:\MyPath\Z9.1\win64
!PROJDIR C:\ProjectRoot
!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
A space or a newline should be inserted after
!!RETURN.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:
Visual Studio 19 and later
Execute the project file with
%Z7PATH%\win64\win_proj.exe\(\longrightarrow\) generates user_lib.dspfile.Open user_lib
.dspfile with Visual studio.Retarget solution to the latest Microsoft toolset.
Build the solution (user_lib
.dll).
Visual Studio 10 and earlier
Execute the project file with
%Z7PATH%\win64\win_proj.exe\(\longrightarrow\) generates user_lib.dspfile.Open user_lib
.dspfile with Visual studio. When opening the project in Visual Studio (version 6 or later), you’ll be prompted to convert it to the current format. Proceed with the conversion for compatibility with the newer version.Build the solution (user_lib
.dll).
Build using command line#
Visual Studio 19
Open a Visual Studio Developer Command Prompt, and navigate to your project folder
>> cd \path\to\ProjectRootand run the following command:
generate a .dsp project file (used in Microsoft Visual Studio 6.0 and earlier).
>> %z7path%\win64\win_proj.exe user_proj.zpr
Migrate .dsp to .vcxproj (a format supported by Visual Studio 2010 and later)
>> devenv /upgrade user_lib.dspRetarget solution to the latest Microsoft toolset
>> devenv /upgrade user_lib.vcxprojBuild the solution
>> msbuild user_lib.vcxproj /p:Configuration=Release /p:Platform=x64
Visual Studio 10
Open a Visual Studio Developer Command Prompt, and navigate to your project folder
>> cd \path\to\ProjectRootand run the following command:
generate a .dsp project file:
>> %z7path%\win64\win_proj.exe user_proj.zpr
Upgrade project files
>> vcupgrade user_lib.dspBuild the solution
>> msbuild user_lib.vcxproj /p:Configuration=Release /p:Platform=x64
Note
As outlined in the installation procedure, the
Z7PATHenvironment variable should be defined, and%Z7PATH%\win64should be appended to thePATH.