@@ -102,6 +102,7 @@ \section{License}
102102
103103\section {Building LibTomMath }
104104
105+
105106LibTomMath is meant to be very `` GCC friendly'' as it comes with a makefile well suited for GCC.
106107However, the library will also build in MSVC, Borland C out of the box. For any other ISO C
107108compiler a makefile will have to be made by the end
@@ -270,6 +271,53 @@ \subsection{Testing}
270271test was invoked. If an error is detected the program will exit with a dump of the relevant
271272numbers it was working with.
272273
274+ \subsection {CMake }
275+ Some of the options above are also available with CMake.
276+
277+ \subsubsection {Shared Library }
278+ The default is a static library. To produce a shared library use the CMake option
279+ \begin {alltt }
280+ -DBUILD_SHARED_LIBS=ON
281+ \end {alltt }
282+
283+ \subsubsection {Testing }
284+ To run the testsuite use option
285+ \begin {alltt }
286+ -DBUILD_TESTING=ON
287+ \end {alltt }
288+
289+ \subsubsection {Tuning }
290+ To run the tuning itself use option
291+ \begin {alltt }
292+ -DBUILD_TUNING=ON
293+ \end {alltt }
294+
295+ To run a benchmark with the tuned library and print plots of the benchmark tables use option
296+ \begin {alltt }
297+ -DBUILD_GRAPHS=ON
298+ \end {alltt }
299+
300+ To compile with LTO (Link Time Optimization) use option
301+ \begin {alltt }
302+ -DCOMPILE_LTO=ON
303+ \end {alltt }
304+
305+ There are several build types available:
306+ \begin {description }
307+ \item [Debug] Build a library with debugging symbols (\texttt {-g3 }) and no extra optimization
308+ \item [Release] Build the normal release version (\texttt {-O3 -funroll-loops -fomit-frame-pointer }) (default)
309+ \item [RelWithDebInfo] Build a library with debugging symbols (\texttt {-g3 -O2 }) and a bit of optimization
310+ \item [MinSizeRel] Build a small sized library (\texttt {-Os })
311+ \end {description }
312+ The build types are case-sensitive!
313+
314+ Choose one with:
315+ \begin {alltt }
316+ -DCMAKE_BUILD_TYPE=buildtype
317+ \end {alltt }
318+
319+
320+
273321\section {Build Configuration }
274322LibTomMath can configured at build time in two phases we shall call `` depends'' and
275323`` trims'' . Each phase changes how the library is built and they are applied one after another
@@ -1600,13 +1648,35 @@ \section{Tuning Polynomial Basis Routines}
16001648make tune
16011649\end {alltt }
16021650
1603- This will run a benchmark, computes the medians, rewrites \texttt {bncore.c }, and recompiles
1604- \texttt {bncore.c } and relinks the library.
1651+ With CMake
1652+ \begin {alltt }
1653+ cmake --build /path/to/build/dir -DBUILD_TUNING=ON
1654+ \end {alltt }
1655+
1656+
1657+ This will run a benchmark, computes the medians, rewrites \texttt {tommath\_ cutoffs.h }, recompiles
1658+ \texttt {cutoffs.c }, and relinks the library.
16051659
16061660The benchmark itself can be fine--tuned in the file \texttt {etc/tune\_ it.sh }.
16071661
16081662The program \texttt {etc/tune } is also able to print a list of values for printing curves with e.g.:
1609- \texttt {gnuplot }. type \texttt {./etc/tune -h } to get a list of all available options.
1663+ \texttt {gnuplot }. Type \texttt {./etc/tune -h } to get a list of all the available options. There
1664+ are a lot.
1665+
1666+ To get some nice plots in \texttt {etc } try
1667+
1668+ \begin {alltt }
1669+ make graphs
1670+ \end {alltt }
1671+
1672+ With CMake
1673+ \begin {alltt }
1674+ cmake --build /path/to/build/dir -DBUILD_GRAPHS=ON
1675+ \end {alltt }
1676+
1677+ This will run a benchmark, computes the medians, rewrites \texttt {tommath\_ cutoffs.h }, recompiles
1678+ \texttt {cutoffs.c }, relinks the library and runs gnuplot to print plots in the PNG format. The size
1679+ of the images is fixed in the file \texttt {etc/plot\_ graphs.gp } and has to be changed manually.
16101680
16111681\chapter {Modular Reduction }
16121682
0 commit comments