| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| <meta http-equiv="X-UA-Compatible" content="IE=11"/> |
| <meta name="generator" content="Doxygen 1.9.8"/> |
| <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| <title>datasketches-cpp: Apache DataSketches Core C++ Library Component</title> |
| <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript" src="jquery.js"></script> |
| <script type="text/javascript" src="dynsections.js"></script> |
| <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript" src="search/searchdata.js"></script> |
| <script type="text/javascript" src="search/search.js"></script> |
| <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| </head> |
| <body> |
| <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| <div id="titlearea"> |
| <table cellspacing="0" cellpadding="0"> |
| <tbody> |
| <tr id="projectrow"> |
| <td id="projectalign"> |
| <div id="projectname">datasketches-cpp |
| </div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <!-- end header part --> |
| <!-- Generated by Doxygen 1.9.8 --> |
| <script type="text/javascript"> |
| /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ |
| var searchBox = new SearchBox("searchBox", "search/",'.html'); |
| /* @license-end */ |
| </script> |
| <script type="text/javascript" src="menudata.js"></script> |
| <script type="text/javascript" src="menu.js"></script> |
| <script type="text/javascript"> |
| /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ |
| $(function() { |
| initMenu('',true,false,'search.php','Search'); |
| $(document).ready(function() { init_search(); }); |
| }); |
| /* @license-end */ |
| </script> |
| <div id="main-nav"></div> |
| </div><!-- top --> |
| <!-- window showing the filter options --> |
| <div id="MSearchSelectWindow" |
| onmouseover="return searchBox.OnSearchSelectShow()" |
| onmouseout="return searchBox.OnSearchSelectHide()" |
| onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| </div> |
| |
| <!-- iframe showing the search results (closed by default) --> |
| <div id="MSearchResultsWindow"> |
| <div id="MSearchResults"> |
| <div class="SRPage"> |
| <div id="SRIndex"> |
| <div id="SRResults"></div> |
| <div class="SRStatus" id="Loading">Loading...</div> |
| <div class="SRStatus" id="Searching">Searching...</div> |
| <div class="SRStatus" id="NoMatches">No Matches</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| <div><div class="header"> |
| <div class="headertitle"><div class="title">Apache DataSketches Core C++ Library Component </div></div> |
| </div><!--header--> |
| <div class="contents"> |
| <div class="textblock"><p><a class="anchor" id="md_README"></a>This is the core C++ component of the Apache DataSketches library. It contains all of the key sketching algorithms that are in the Java component and can be accessed directly from user applications.</p> |
| <p>This component is also a dependency of other components of the library that create adaptors for target systems, such as PostgreSQL.</p> |
| <p>Note that we have a parallel core component for [Java]((<a href="https://github.com/apache/datasketches-java">https://github.com/apache/datasketches-java</a>) and [Python]((<a href="https://github.com/apache/datasketches-python">https://github.com/apache/datasketches-python</a>) implementations of the same sketch algorithms.</p> |
| <p>Please visit the main <a href="https://datasketches.apache.org">Apache DataSketches website</a> for more information.</p> |
| <p>If you are interested in making contributions to this site please see our <a href="https://datasketches.apache.org/docs/Community/">Community</a> page for how to contact us.</p> |
| <hr /> |
| <p>This code requires C++11.</p> |
| <p>This library is header-only. The build process provided is only for building unit tests.</p> |
| <p>Building the unit tests requires cmake 3.12.0 or higher.</p> |
| <p>Installing the latest cmake on OSX: brew install cmake</p> |
| <p>Building and running unit tests using cmake for OSX and Linux:</p> |
| <div class="fragment"><div class="line">$ cmake -S . -B build/Release -DCMAKE_BUILD_TYPE=Release</div> |
| <div class="line">$ cmake --build build/Release -t all test</div> |
| </div><!-- fragment --><p>Building and running unit tests using cmake for Windows from the command line:</p> |
| <div class="fragment"><div class="line">$ cd build</div> |
| <div class="line">$ cmake ..</div> |
| <div class="line">$ cd ..</div> |
| <div class="line">$ cmake --build build --config Release</div> |
| <div class="line">$ cmake --build build --config Release --target RUN_TESTS</div> |
| </div><!-- fragment --><p>To install a local distribution (OSX and Linux), use the following command. The CMAKE_INSTALL_PREFIX variable controls the destination. If not specified, it defaults to installing in /usr (/usr/include, /usr/lib, etc). In the command below, the installation will be in /tmp/install/DataSketches (/tmp/install/DataSketches/include, /tmp/install/DataSketches/lib, etc)</p> |
| <div class="fragment"><div class="line">$ cmake -S . -B build/Release -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/install/DataSketches</div> |
| <div class="line">$ cmake --build build/Release -t install</div> |
| </div><!-- fragment --><p>To generate an installable package using cmake's built in cpack packaging tool, use the following command. The type of packaging is controlled by the CPACK_GENERATOR variable (semi-colon separated list). Cmake usually supports packaging types such as RPM, DEB, STGZ, TGZ, TZ, ZIP, etc.</p> |
| <div class="fragment"><div class="line">$ cmake3 -S . -B build/Release -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR="RPM;STGZ;TGZ" </div> |
| <div class="line">$ cmake3 --build build/Release -t package</div> |
| </div><!-- fragment --><p>The DataSketches project can be included in other projects' CMakeLists.txt files in one of two ways. If DataSketches has been installed on the host (using an RPM, DEB, "make install" into /usr/local, or some way, then CMake's <code>find_package</code> command can be used like this:</p> |
| <div class="fragment"><div class="line">find_package(DataSketches 3.2 REQUIRED)</div> |
| <div class="line">target_link_library(my_dependent_target PUBLIC ${DATASKETCHES_LIB})</div> |
| </div><!-- fragment --><p>When used with find_package, DataSketches exports several variables, including</p> |
| <ul> |
| <li><code>DATASKETCHES_VERSION</code>: The version number of the datasketches package that was imported.</li> |
| <li><code>DATASKETCHES_INCLUDE_DIR</code>: The directory that should be added to access DataSketches include files. Because cmake automatically includes the interface directories for included target libraries when using <code>target_link_library</code>, under normal circumstances there will be no need to include this directly.</li> |
| <li><code>DATASKETCHES_LIB</code>: The name of the DataSketches target to include as a dependency. Projects pulling in DataSketches should reference this with <code>target_link_library</code> in order to set up all the correct dependencies and include paths.</li> |
| </ul> |
| <p>If you don't have DataSketches installed locally, dependent projects can pull it directly from GitHub using CMake's <code>ExternalProject</code> module. The code would look something like this:</p> |
| <div class="fragment"><div class="line">cmake_policy(SET CMP0097 NEW)</div> |
| <div class="line">include(ExternalProject)</div> |
| <div class="line">ExternalProject_Add(datasketches</div> |
| <div class="line"> GIT_REPOSITORY https://github.com/apache/datasketches-cpp.git</div> |
| <div class="line"> GIT_TAG 3.2.0</div> |
| <div class="line"> GIT_SHALLOW true</div> |
| <div class="line"> GIT_SUBMODULES ""</div> |
| <div class="line"> INSTALL_DIR /tmp/datasketches-prefix</div> |
| <div class="line"> CMAKE_ARGS -DBUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/datasketches-prefix</div> |
| <div class="line"> </div> |
| <div class="line"> # Override the install command to add DESTDIR</div> |
| <div class="line"> # This is necessary to work around an oddity in the RPM (but not other) package</div> |
| <div class="line"> # generation, as CMake otherwise picks up the Datasketch files when building</div> |
| <div class="line"> # an RPM for a dependent package. (RPM scans the directory for files in addition to installing</div> |
| <div class="line"> # those files referenced in an "install" rule in the cmake file)</div> |
| <div class="line"> INSTALL_COMMAND env DESTDIR= ${CMAKE_COMMAND} --build . --target install</div> |
| <div class="line">)</div> |
| <div class="line">ExternalProject_Get_property(datasketches INSTALL_DIR)</div> |
| <div class="line">set(datasketches_INSTALL_DIR ${INSTALL_DIR})</div> |
| <div class="line">message("Source dir of datasketches = ${datasketches_INSTALL_DIR}")</div> |
| <div class="line">target_include_directories(my_dependent_target </div> |
| <div class="line"> PRIVATE ${datasketches_INSTALL_DIR}/include/DataSketches)</div> |
| <div class="line">add_dependencies(my_dependent_target datasketches)</div> |
| </div><!-- fragment --> </div></div><!-- PageDoc --> |
| </div><!-- contents --> |
| <!-- start footer part --> |
| <hr class="footer"/><address class="footer"><small> |
| Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 |
| </small></address> |
| </body> |
| </html> |