Commit 818292a7 authored by David Thompson's avatar David Thompson

Expunge sparsehash from SMTK.

We never built with it and it has different semantics for invaliding
iterators which could cause issues if anyone ever decided to use it.
parent 50be9983
......@@ -38,9 +38,6 @@
// Was SMTK built with Remus? If true, smtkRemoteSession library will exist.
#cmakedefine SMTK_ENABLE_REMUS_SUPPORT
// Should sparse_hash_map be used (instead of std::map) for primary storage?
#cmakedefine SMTK_HASH_STORAGE
#define SMTK_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
#endif // __smtk_Options_h
......@@ -127,9 +127,6 @@ if (SMTK_ENABLE_MULTISCALE_SESSION)
endif()
option(SMTK_USE_SYSTEM_MOAB "Use the system-installed moab?" OFF)
option(SMTK_USE_SYSTEM_SPARSEHASH "Use the system-installed sparsehash?" OFF)
option(SMTK_HASH_STORAGE "Use sparsehash library for primary storage?" OFF)
mark_as_advanced(SMTK_USE_SYSTEM_SPARSEHASH SMTK_HASH_STORAGE)
option(SMTK_ENABLE_DOCUMENTATION
"Include targets for Doxygen- and Sphinx-generated documentation" OFF)
......@@ -318,21 +315,6 @@ if (SMTK_ENABLE_REMUS_SUPPORT)
find_package(Remus REQUIRED)
endif()
################################################################################
# Sparsehash Related Settings
################################################################################
if (SMTK_USE_SYSTEM_SPARSEHASH)
# A system sparsehash implementation must be detected with pkgconfig:
set(SYSTEM_SPARSEHASH_REQUIRED "REQUIRED")
include(FindPkgConfig)
pkg_check_modules(SPARSEHASH ${SYSTEM_SPARSEHASH_REQUIRED} libsparsehash)
else()
set(SPARSEHASH_INCLUDE_DIRS
"${SMTK_SOURCE_DIR}/thirdparty"
"${SMTK_BINARY_DIR}/thirdparty")
endif()
################################################################################
# Build third party libraries
################################################################################
......@@ -608,7 +590,8 @@ include_directories(
)
include_directories(
SYSTEM
"${SPARSEHASH_INCLUDE_DIRS}"
"${CMAKE_CURRENT_SOURCE_DIR}/thirdparty"
"${CMAKE_CURRENT_BINARY_DIR}/thirdparty"
"${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cJSON"
"${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml"
"${Boost_INCLUDE_DIRS}"
......
......@@ -34,7 +34,6 @@ licenses.
- - - - - - - - - - - - - - - - - - - - - - - -
Thirdparty/pugixml
Thirdparty/cJSON
Thirdparty/sparsehash
Thirdparty/PyYaml
Thidpary/rtvl
CMake/FindDocutils.cmake
......@@ -5,7 +5,7 @@
# If we have doxygen, create reference API documentation for SMTK.
#
# This also generates documentation for third-party libraries
# cJSON and sparsehash which is referenced by SMTK's documentation.
# (e.g., cJSON) which are referenced by SMTK's documentation.
#
if(DOXYGEN_FOUND)
file(MAKE_DIRECTORY "${SMTK_BINARY_DIR}/doc/reference")
......@@ -14,11 +14,6 @@ if(DOXYGEN_FOUND)
${CMAKE_CURRENT_BINARY_DIR}/cjson.doxyfile
@ONLY
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/sparsehash.doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/sparsehash.doxyfile
@ONLY
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/smtk.doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/smtk.doxyfile
......@@ -35,15 +30,6 @@ if(DOXYGEN_FOUND)
COMMENT "Generating cJSON API documentation with Doxygen" VERBATIM
)
add_custom_command(
OUTPUT ${SMTK_BINARY_DIR}/doc/reference/sparsehash.tags
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/sparsehash.doxyfile
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/sparsehash.doxyfile
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/reference"
COMMENT "Generating sparsehash API documentation with Doxygen" VERBATIM
)
add_custom_command(
OUTPUT ${SMTK_BINARY_DIR}/doc/reference/smtk.tags
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/smtk.doxyfile
......@@ -51,7 +37,6 @@ if(DOXYGEN_FOUND)
DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/smtk.doxyfile"
"${SMTK_BINARY_DIR}/doc/reference/cjson.tags"
"${SMTK_BINARY_DIR}/doc/reference/sparsehash.tags"
COMMENT "Generating SMTK API documentation with Doxygen" VERBATIM
)
add_custom_target(doc
......
......@@ -87,8 +87,6 @@ if readTheDocs or localReadTheDocs:
'@SMTK_VERSION@': '1.1.0'})
# Run doxygen ourselves on ReadTheDocs.org so that doxylinks will work.
if not localSkipDoxygen:
runDoxygen(sourcedir, builddir, 'sparsehash.doxyfile.in',
'sparsehash.doxyfile')
runDoxygen(sourcedir, builddir, 'cjson.doxyfile.in', 'cjson.doxyfile')
runDoxygen(sourcedir, builddir, 'smtk.doxyfile.in', 'smtk.doxyfile')
......@@ -240,10 +238,7 @@ doxylink = {
os.path.join(refbase, 'smtk', 'html')),
'cjson': (
os.path.join(tagbase, 'cjson.tags'),
os.path.join(refbase, 'cjson', 'html')),
'sparsehash': (
os.path.join(tagbase, 'sparsehash.tags'),
os.path.join(refbase, 'sparsehash', 'html'))
os.path.join(refbase, 'cjson', 'html'))
}
# A boolean that decides whether parentheses are appended to
......
......@@ -1609,9 +1609,7 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH = \
"@SMTK_SOURCE_DIR@/thirdparty/cJSON" \
"@SMTK_SOURCE_DIR@/thirdparty/sparsehash" \
"@SMTK_BINARY_DIR@/thirdparty/cJSON" \
"@SMTK_BINARY_DIR@/thirdparty/sparsehash"
"@SMTK_BINARY_DIR@/thirdparty/cJSON"
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
......@@ -1739,9 +1737,6 @@ SKIP_FUNCTION_MACROS = YES
TAGFILES = \
"@SMTK_BINARY_DIR@/doc/reference/cjson.tags = @SMTK_BINARY_DIR@/doc/reference/cjson/html"
# This causes segfaults in doxygen 1.8.8:
# "@SMTK_BINARY_DIR@/doc/reference/sparsehash.tags = @SMTK_BINARY_DIR@/doc/reference/sparsehash/html"
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
......
This diff is collapsed.
......@@ -50,7 +50,6 @@ With that in mind:
* cJSON — used to serialize geometric model information
* pugiXML — used to serialize attribute collections
* sparsehash — an alternative to using :cxx:`std::map` to store maps from UUIDs to entity and property records in SMTK models.
* utilities — scripts to aid in the development of SMTK
......
......@@ -19,18 +19,7 @@
#include "smtk/bridge/cgm/Exports.h"
#include "smtk/common/UUIDGenerator.h"
#ifdef SMTK_HASH_STORAGE
#if defined(_MSC_VER) // Visual studio
#pragma warning(push)
#pragma warning(disable : 4996) // Overeager "unsafe" parameter check
#endif
#include "sparsehash/sparse_hash_map"
#if defined(_MSC_VER) // Visual studio
#pragma warning(pop)
#endif
#else
#include <map>
#endif // SMTK_HASH_STORAGE
namespace smtk
{
......@@ -39,13 +28,8 @@ namespace bridge
namespace cgm
{
#ifdef SMTK_HASH_STORAGE
/// Map UUIDs to CGM entity pointers
typedef google::sparse_hash_map<smtk::common::UUID, ToolDataUser*> UUIDToCGMRef;
#else
/// Map UUIDs to CGM entity pointers
typedef std::map<smtk::common::UUID, ToolDataUser*> UUIDToCGMRef;
#endif // SMTK_HASH_STORAGE
class SMTKCGMSESSION_EXPORT TDUUID : public ToolData
{
......
......@@ -22,21 +22,12 @@ namespace smtk
namespace mesh
{
#ifdef SMTK_HASH_STORAGE
typedef google::sparse_hash_map<smtk::mesh::MeshSet, smtk::model::FloatData> MeshFloatData;
typedef google::sparse_hash_map<smtk::common::UUID, MeshFloatData> CollectionToMeshFloatData;
typedef google::sparse_hash_map<smtk::mesh::MeshSet, smtk::model::StringData> MeshStringData;
typedef google::sparse_hash_map<smtk::common::UUID, MeshStringData> CollectionToMeshStringData;
typedef google::sparse_hash_map<smtk::mesh::MeshSet, smtk::model::IntegerData> MeshIntegerData;
typedef google::sparse_hash_map<smtk::common::UUID, MeshIntegerData> CollectionToMeshIntegerData;
#else // SMTK_HASH_STORAGE
typedef std::map<smtk::mesh::MeshSet, smtk::model::FloatData> MeshFloatData;
typedef std::map<smtk::common::UUID, MeshFloatData> CollectionToMeshFloatData;
typedef std::map<smtk::mesh::MeshSet, smtk::model::StringData> MeshStringData;
typedef std::map<smtk::common::UUID, MeshStringData> CollectionToMeshStringData;
typedef std::map<smtk::mesh::MeshSet, smtk::model::IntegerData> MeshIntegerData;
typedef std::map<smtk::common::UUID, MeshIntegerData> CollectionToMeshIntegerData;
#endif // SMTK_HASH_STORAGE
} // namespace mesh
} // namespace smtk
......
......@@ -17,17 +17,6 @@
#include "smtk/model/ArrangementKind.h"
#include "smtk/model/Entity.h"
#ifdef SMTK_HASH_STORAGE
#if defined(_MSC_VER) // Visual studio
#pragma warning(push)
#pragma warning(disable : 4996) // Overeager "unsafe" parameter check
#endif
#include "sparsehash/sparse_hash_map"
#if defined(_MSC_VER) // Visual studio
#pragma warning(pop)
#endif
#endif // SMTK_HASH_STORAGE
#include <map>
#include <vector>
......@@ -286,18 +275,10 @@ public:
typedef std::vector<Arrangement> Arrangements;
/// A map holding Arrangements of different ArrangementKinds.
typedef std::map<ArrangementKind, Arrangements> KindsToArrangements;
#ifdef SMTK_HASH_STORAGE
/// Each Manager entity's UUID is mapped to a vector of Arrangment instances.
typedef google::sparse_hash_map<smtk::common::UUID, KindsToArrangements> UUIDsToArrangements;
/// An iterator referencing a (UUID,KindsToArrangements)-tuple.
typedef google::sparse_hash_map<smtk::common::UUID, KindsToArrangements>::iterator
UUIDWithArrangementDictionary;
#else
/// Each Manager entity's UUID is mapped to a vector of Arrangment instances.
typedef std::map<smtk::common::UUID, KindsToArrangements> UUIDsToArrangements;
/// An iterator referencing a (UUID,KindsToArrangements)-tuple.
typedef std::map<smtk::common::UUID, KindsToArrangements>::iterator UUIDWithArrangementDictionary;
#endif // SMTK_HASH_STORAGE
/// An iterator referencing an (ArrangementKind,Arrangements)-tuple.
typedef std::map<ArrangementKind, Arrangements>::iterator ArrangementKindWithArrangements;
/// An array of ArrangementReference objects used, for instance, to enumerate inverse relations.
......
......@@ -10,23 +10,11 @@
#ifndef __smtk_model_AttributeAssignments_h
#define __smtk_model_AttributeAssignments_h
#include "smtk/Options.h" // for SMTK_HASH_STORAGE
#include "smtk/PublicPointerDefs.h"
#include "smtk/common/UUID.h"
#ifdef SMTK_HASH_STORAGE
#if defined(_MSC_VER) // Visual studio
#pragma warning(push)
#pragma warning(disable : 4996) // Overeager "unsafe" parameter check
#endif
#include "sparsehash/sparse_hash_map"
#if defined(_MSC_VER) // Visual studio
#pragma warning(pop)
#endif
#else
#include <map>
#endif
#include <set>
namespace smtk
......@@ -51,19 +39,10 @@ protected:
smtk::common::UUIDs m_attributes; // IDs of attributes assigned to an entity.
};
#ifdef SMTK_HASH_STORAGE
/// Each Manager entity's UUID is mapped to a set of assigned attribute IDs.
typedef google::sparse_hash_map<smtk::common::UUID, AttributeAssignments>
UUIDsToAttributeAssignments;
/// An iterator referencing a (UUID,AttributeAssignments)-tuple.
typedef google::sparse_hash_map<smtk::common::UUID, AttributeAssignments>::iterator
UUIDWithAttributeAssignments;
#else
/// Each Manager entity's UUID is mapped to a set of assigned attribute IDs.
typedef std::map<smtk::common::UUID, AttributeAssignments> UUIDsToAttributeAssignments;
/// An iterator referencing a (UUID,AttributeAssignments)-tuple.
typedef std::map<smtk::common::UUID, AttributeAssignments>::iterator UUIDWithAttributeAssignments;
#endif
} // model namespace
} // smtk namespace
......
......@@ -14,19 +14,7 @@
#include "smtk/common/UUID.h"
#ifdef SMTK_HASH_STORAGE
#if defined(_MSC_VER) // Visual studio
#pragma warning(push)
#pragma warning(disable : 4996) // Overeager "unsafe" parameter check
#endif
#include "sparsehash/sparse_hash_map"
#if defined(_MSC_VER) // Visual studio
#pragma warning(pop)
#endif
#else // SMTK_HASH_STORAGE
#include <map>
#endif // SMTK_HASH_STORAGE
#include <string>
#include <vector>
......@@ -37,14 +25,8 @@ namespace model
typedef double Float;
typedef std::vector<Float> FloatList;
#ifdef SMTK_HASH_STORAGE
typedef google::sparse_hash_map<std::string, FloatList> FloatData;
typedef google::sparse_hash_map<smtk::common::UUID, FloatData> UUIDsToFloatData;
#else // SMTK_HASH_STORAGE
typedef std::map<std::string, FloatList> FloatData;
typedef std::map<smtk::common::UUID, FloatData> UUIDsToFloatData;
#endif // SMTK_HASH_STORAGE
typedef UUIDsToFloatData::iterator UUIDWithFloatProperties;
typedef FloatData::iterator PropertyNameWithFloats;
typedef FloatData::const_iterator PropertyNameWithConstFloats;
......
......@@ -14,19 +14,7 @@
#include "smtk/common/UUID.h"
#ifdef SMTK_HASH_STORAGE
#if defined(_MSC_VER) // Visual studio
#pragma warning(push)
#pragma warning(disable : 4996) // Overeager "unsafe" parameter check
#endif
#include "sparsehash/sparse_hash_map"
#if defined(_MSC_VER) // Visual studio
#pragma warning(pop)
#endif
#else // SMTK_HASH_STORAGE
#include <map>
#endif // SMTK_HASH_STORAGE
#include <string>
#include <vector>
......@@ -37,14 +25,8 @@ namespace model
typedef long Integer;
typedef std::vector<long> IntegerList;
#ifdef SMTK_HASH_STORAGE
typedef google::sparse_hash_map<std::string, IntegerList> IntegerData;
typedef google::sparse_hash_map<smtk::common::UUID, IntegerData> UUIDsToIntegerData;
#else // SMTK_HASH_STORAGE
typedef std::map<std::string, IntegerList> IntegerData;
typedef std::map<smtk::common::UUID, IntegerData> UUIDsToIntegerData;
#endif // SMTK_HASH_STORAGE
typedef UUIDsToIntegerData::iterator UUIDWithIntegerProperties;
typedef IntegerData::iterator PropertyNameWithIntegers;
typedef IntegerData::const_iterator PropertyNameWithConstIntegers;
......
......@@ -2775,8 +2775,7 @@ UUID Manager::createIncludedShell(const UUID& useOrShell)
UUIDWithEntityPtr shell = this->insertEntityOfTypeAndDimension(SHELL_ENTITY | shellDim, -1);
this->arrangeEntity(
useOrShell, INCLUDES, Arrangement::UseOrShellIncludesShellWithIndex(indexOfNewShell));
// We must re-find the entity record since insertEntityOfTypeAndDimension
// invalidates entity when SMTK_HASH_STORAGE is true:
// We must re-find the entity record since insertEntityOfTypeAndDimension:
this->findEntity(useOrShell)->appendRelation(shell->first);
this->arrangeEntity(
shell->first, EMBEDDED_IN, Arrangement::ShellEmbeddedInUseOrShellWithIndex(
......@@ -3055,15 +3054,11 @@ bool Manager::disassociateAttribute(
}
if ((didRemove = ref->second.disassociateAttribute(attribId)))
{
// If the AttributeAssignments instance is now empty, remove it.
// (Only do this for std::map storage, as it triggers assertion
// failures in sparsehash for no discernable reason.)
#ifndef SMTK_HASH_STORAGE
// If the AttributeAssignments instance is now empty, remove it.
if (ref->second.attributes().empty())
{
this->m_attributeAssignments->erase(ref);
}
#endif
// Notify the Attribute of the removal
if (reverse && sys)
{
......
......@@ -17,19 +17,7 @@
#include "smtk/common/UUID.h"
#ifdef SMTK_HASH_STORAGE
#if defined(_MSC_VER) // Visual studio
#pragma warning(push)
#pragma warning(disable : 4996) // Overeager "unsafe" parameter check
#endif
#include "sparsehash/sparse_hash_map"
#if defined(_MSC_VER) // Visual studio
#pragma warning(pop)
#endif
#else // SMTK_HASH_STORAGE
#include <map>
#endif // SMTK_HASH_STORAGE
#include <string>
#include <vector>
......@@ -42,18 +30,10 @@ namespace model
typedef std::string String;
/// Use vectors of String objects for holding string properties on model entities.
typedef std::vector<String> StringList;
#ifdef SMTK_HASH_STORAGE
/// A dictionary of property names mapped to their values (string vectors)
typedef google::sparse_hash_map<std::string, StringList> StringData;
/// A dictionary of model entities mapped to all the string properties defined on them.
typedef google::sparse_hash_map<smtk::common::UUID, StringData> UUIDsToStringData;
#else // SMTK_HASH_STORAGE
/// A dictionary of property names mapped to their values (string vectors)
typedef std::map<std::string, StringList> StringData;
/// A dictionary of model entities mapped to all the string properties defined on them.
typedef std::map<smtk::common::UUID, StringData> UUIDsToStringData;
#endif // SMTK_HASH_STORAGE
/// A convenient typedef that describes how an iterator to model-entity string properties is used.
typedef UUIDsToStringData::iterator UUIDWithStringProperties;
/// A convenient typedef that describes how the iterator to one string property is used.
......
......@@ -12,19 +12,7 @@
#include "smtk/common/UUID.h"
#ifdef SMTK_HASH_STORAGE
#if defined(_MSC_VER) // Visual studio
#pragma warning(push)
#pragma warning(disable : 4996) // Overeager "unsafe" parameter check
#endif
#include "sparsehash/sparse_hash_map"
#if defined(_MSC_VER) // Visual studio
#pragma warning(pop)
#endif
#else // SMTK_HASH_STORAGE
#include <map>
#endif // SMTK_HASH_STORAGE
#include <vector>
namespace smtk
......@@ -171,13 +159,8 @@ protected:
std::vector<int> m_conn;
};
#ifdef SMTK_HASH_STORAGE
typedef google::sparse_hash_map<smtk::common::UUID, Tessellation> UUIDsToTessellations;
typedef google::sparse_hash_map<smtk::common::UUID, Tessellation>::iterator UUIDWithTessellation;
#else // SMTK_HASH_STORAGE
typedef std::map<smtk::common::UUID, Tessellation> UUIDsToTessellations;
typedef std::map<smtk::common::UUID, Tessellation>::iterator UUIDWithTessellation;
#endif // SMTK_HASH_STORAGE
} // model namespace
} // smtk namespace
......
......@@ -150,10 +150,6 @@ if (NOT SMTK_USE_SYSTEM_MOAB)
verdict_DIR
)
endif()
# Only use the local sparsehash when the system version is not requested.
if (NOT SMTK_USE_SYSTEM_SPARSEHASH)
add_subdirectory(sparsehash)
endif()
#if(SMTK_ENABLE_OPENCV)
# set(Delaunay_USE_OPENCV ON)
......
google-sparsehash@googlegroups.com
project(sparsehash)
cmake_minimum_required(VERSION 2.8)
if (POLICY CMP0054)
cmake_policy(SET CMP0054 OLD)
endif()
set(CMAKE_MODULE_PATH
"${CMAKE_MODULE_PATH}"
"${sparsehash_SOURCE_DIR}/cmake"
)
include(CheckCXXSymbolExists)
include(CheckIncludeFileCXX)
include(CheckTypeSize)
include(CheckHashFunCXX)
include(CheckHashMapCXX)
# Define a configure-time option for changing the namespace
# where the sparsehash classes are located.
set(SPARSEHASH_NAMESPACE "google" CACHE STRING "Choose a namespace you want sparsehash classes to inhabit.")
# Find size-specific type definition header files:
check_include_file_cxx("sys/types.h" SPARSEHASH_HAVE_SYS_TYPES_H)
check_include_file_cxx("stdint.h" SPARSEHASH_HAVE_STDINT_H)
check_include_file_cxx("inttypes" SPARSEHASH_HAVE_INTTYPES_H)
check_include_file_cxx("memcpy.h" SPARSEHASH_HAVE_MEMCPY_H)
check_include_file_cxx("string.h" SPARSEHASH_HAVE_STRING_H)
if (SPARSEHASH_HAVE_SYS_TYPES_H)
set(_sparsehash_INCLUDES "${_sparsehash_INCLUDES};sys/types.h")
endif()
if (SPARSEHASH_HAVE_STDINT_H)
set(_sparsehash_INCLUDES "${_sparsehash_INCLUDES};stdint.h")
endif()
if (SPARSEHASH_HAVE_INTTYPES_H)
set(_sparsehash_INCLUDES "${_sparsehash_INCLUDES};inttypes")
endif()
if (SPARSEHASH_HAVE_MEMCPY_H)
set(_sparsehash_INCLUDES "${_sparsehash_INCLUDES};memcpy.h")
endif()
if (SPARSEHASH_HAVE_STRING_H)
set(_sparsehash_INCLUDES "${_sparsehash_INCLUDES};string.h")
endif()
# Now see if we have some common integer types:
set(CMAKE_EXTRA_INCLUDE_FILES ${_sparsehash_INCLUDES})
check_type_size("uint16_t" SIZEOF_UINT16_T)
check_type_size("u_int16_t" SIZEOF_U_INT16_T)
check_type_size("__uint16_t" SIZEOF___UINT16)
check_type_size("long long" SIZEOF_LONG_LONG)
check_cxx_symbol_exists("memcpy" "${_sparsehash_INCLUDES}" SPARSEHASH_HAVE_MEMCPY)
if (SIZEOF_UINT16_T)
set(SPARSEHASH_HAVE_UINT16_T 1)
endif()
if (SIZEOF_U_INT16_T)
set(SPARSEHASH_HAVE_U_INT16_T 1)
endif()
if (SIZEOF___UINT16)
set(SPARSEHASH_HAVE___UINT16 1)
endif()
if (SIZEOF_LONG_LONG)
set(SPARSEHASH_HAVE_LONG_LONG 1)
endif()
# Locate headers with hash functions, hash sets, and hash maps:
check_hash_fun(HASH_FUN_H HASH_FUN_NAMESPACE)
check_hash_map(HASH_MAP_H HASH_MAP_NAMESPACE)
set(HASH_SET_H ${HASH_MAP_H})
set(HASH_SET_NAMESPACE ${HASH_MAP_NAMESPACE})
set(START_SPARSEHASH_NAMESPACE "namespace ${SPARSEHASH_NAMESPACE} {")
set(END_SPARSEHASH_NAMESPACE "} // namespace ${SPARSEHASH_NAMESPACE}")
mark_as_advanced(
SPARSEHASH_NAMESPACE
HASH_FUN_H
HASH_FUN_NAMESPACE
HASH_MAP_H
HASH_MAP_NAMESPACE
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/internal/sparseconfig.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/internal/sparseconfig.h
)
install(
FILES
AUTHORS
COPYING
doc/dense_hash_map.html
doc/dense_hash_set.html
doc/designstyle.css
doc/implementation.html
doc/index.html
doc/performance.html
doc/sparse_hash_map.html
doc/sparsetable.html
doc/sparse_hash_set.html
DESTINATION
share/doc/sparsehash
)
install(
FILES
dense_hash_map
dense_hash_set
sparse_hash_map
sparse_hash_set
sparsetable
template_util.h
type_traits.h
DESTINATION
include/smtk/${SMTK_VERSION}/sparsehash
)
install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/internal/densehashtable.h
${CMAKE_CURRENT_SOURCE_DIR}/internal/libc_allocator_with_realloc.h
${CMAKE_CURRENT_SOURCE_DIR}/internal/sparsehashtable.h
${CMAKE_CURRENT_SOURCE_DIR}/internal/hashtable-common.h
${CMAKE_CURRENT_BINARY_DIR}/internal/sparseconfig.h
DESTINATION
include/smtk/${SMTK_VERSION}/sparsehash/internal
)
Copyright (c) 2005, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# CheckHashFunCXX.cmake
#
# Search for a header file that contains the hash<X> template.
# The template may reside in several namespaces, so this macro
# returns two values:
# HASH_FUN_H - The name of the header file containing the hash<X> template.
# HASH_FUN_NAMESPACE - The namespace (not including "::") in which the template resides.
#
macro(check_hash_fun HASH_FUN_H HASH_FUN_NAMESPACE)
include(FindSymbolInHeaderNamespace)
find_symbol_in_header_namespace(
${HASH_FUN_H}
${HASH_FUN_NAMESPACE}
CODE
"int h = NAMESPACE ::hash<int>()(42);"
HEADERS
"functional"
"tr1/functional"
"ext/hash_fun.h"
"ext/stl_hash_fun.h"
"hash_fun.h"
"stl_hash_fun.h"
"stl/_hash_fun.h"
NAMESPACES
""
"std"
"std::tr1"
"stdext"
"__gnu_cxx"
SUMMARY
"hash"
)
endmacro()
# CheckHashMapCXX.cmake
#
# Search for a header file that contains the hash<X> template.
# The template may reside in several namespaces, so this macro
# returns two values:
# HASH_MAP_H - The name of the header file containing the hash<X> template.
# HASH_MAP_NAMESPACE - The namespace (not including "::") in which the template resides.
#
macro(check_hash_map HASH_MAP_H HASH_MAP_NAMESPACE)
include(FindSymbolInHeaderNamespace)
# Prefer unordered_map<X,Y>
find_symbol_in_header_namespace(
${HASH_MAP_H}
${HASH_MAP_NAMESPACE}
CODE
"NAMESPACE ::unordered_map<int,int> foo;"
HEADERS
"unordered_map"
"tr1/unordered_map"
NAMESPACES
"std"
"std::tr1"
SUMMARY
"unordered_map"
)
# If we don't have unordered_map, see about hash_map
if ("${${HASH_MAP_H}}" STREQUAL "")
find_symbol_in_header_namespace(
${HASH_MAP_H}
${HASH_MAP_NAMESPACE}
CODE
"NAMESPACE ::hash_map<int,int> foo;"
HEADERS
"hash_map"
"ext/hash_map"
NAMESPACES
"__gnu_cxx"
""
"std"
"stdext"
SUMMARY
"hash_map"
)
endif()
endmacro()
# find_symbol_in_header_namespace(
# HEADER_OUT NAMESPACE_OUT
# "CODE" SNIPPET_IN
# "HEADERS" HEADERS_IN
# "NAMESPACES" NAMESPACES_IN
# "SUMMARY" SUMMARY_IN)
#
# Search for a header file that will allow ${SNIPPET_IN} to compile.
# Each header in the HEADERS_IN list is considered. If found, then
# attempts will be made to compile SNIPPET_IN after including that header.
# The first successful compilation terminates the search.
#