After the source code for PLplot has been obtained the generic steps to configure, build, and install PLplot are as follows:
Optionally set environment variables to force
CMake's find commands to locate any of PLplot's software dependencies
that are installed in non-standard locations. See the CMake
documentation for the find_file
and find_library
commands for the list of such variables which includes
CMAKE_INCLUDE_PATH
,
CMAKE_LIBRARY_PATH
, and PATH
.
In addition, the PKG_CONFIG_PATH
environment
variable forces CMake to find certain software packages which specify
their (non-standard) install locations using pkg-config
.
Optionally set environment variables that force CMake
to use specific compilers to override the (normally good) default
choice of compilers that CMake uses. The environment variables that
CMake recognizes for this purpose are ADA
to
specify the Ada compiler, CC
to specify the C
compiler, CXX
to specify the C++ compiler,
DC
to specify the D compiler, and
FC
to specify the Fortran compiler.
Optionally set environment variables that force CMake
to use specific compiler flags. The environment variables that CMake recognizes for this
purpose are ADAFLAGS
to specify the Ada compiler flags,
CCFLAGS
to specify the C compiler flags,
CXXFLAGS
to specify the C++ compiler flags,
DFLAGS
to specify the D compiler flags, and
FFLAGS
to specify the Fortran compiler flags.
Prepare for running the cmake
command
by removing the stale PLplot install tree (if it exists) that corresponds to
the -DCMAKE_INSTALL_PREFIX
option for the
cmake
command (see below), creating an empty build directory, and
changing directories to that build directory (which will become the top-level directory
of the build tree).
Configure the PLplot build and install by running
cmake <cmake options> <top-level directory of the source tree>
on the command line. Many cmake
options are possible. Two common ones that are
often sufficient for most purposes are
-DCMAKE_INSTALL_PREFIX=<installation prefix>
(to specify the
top-level directory of the soon-to-be created install tree) and -G <generator identification string>
(to identify the cmake
backend generator to use such as "Unix Makefiles"). However, there are also
many other cmake
options that are
specific to the PLplot build system that
are documented in the CMakeCache.txt
file that
is created by the cmake
command.
Build PLplot by building the "all" target. For example, that would be done for the "Unix Makefiles" generator case by
make all
Install PLplot by building the "install" target. For example, that would be done for the "Unix Makefiles" generator case by
make install
Determine the list of additional targets that are available for the PLplot build by building the "help" target. For example, that would be done for the "Unix Makefiles" generator case by
make help
For additional platform-specific details beyond the above generic steps, please consult our wiki.
After PLplot has been configured, built, and installed, you can
write code in C or any of the languages that have PLplot bindings to
make the desired PLplot calls. Standard example programs in all
supported languages are included with the PLplot software package.
The installation of those examples includes both a CMake-based build
system (see <installation
prefix>/share/plplot5.15.0/examples/CMakelists.txt
)
and a more traditional (Makefile + pkg-config) build system (see
<installation
prefix>/share/plplot5.15.0/examples/Makefile
)
for building and linking the examples. Either of these two build
systems can be adapted by users to build and link their own
PLplot-related code for compiled languages or to test PLplot related
code that is compiled or which is written in a scripting language
where PLplot capability is dynamically loaded. However, note the
CMake-based build system for the installed examples should work on all
platforms where PLplot can be built while the traditional build system
for the installed examples will only work on platforms (e.g., Linux)
which have make
(only with GNU extensions),
pkg-config
, and bash
(required
for testing targets) installed. Plots generated from these example
programs as well as the source code for those examples in all our
supported languages are available from links given here.