Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
liss-h authored Jul 29, 2024
2 parents 6908a14 + 6bf7509 commit 987c579
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/detect-pobr-diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Detect POBR diff

on: [ pull_request ]

concurrency:
group: detect-pobr-diff-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
detect-pobr-diff:
uses: dice-group/cpp-conan-release-reusable-workflow/.github/workflows/abi-diff.yml@main
with:
os: ubuntu-22.04
compiler: clang-16
cmake-version: 3.24.0
conan-version: 2.3.1
base-branch: ${{ github.base_ref }}
search-path: >
include/dice/sparse-map/sparse_growth_policy.hpp
include/dice/sparse-map/sparse_hash.hpp
include/dice/sparse-map/sparse_map.hpp
include/dice/sparse-map/sparse_set.hpp
abi-version-header: include/dice/sparse-map/version.hpp
abi-version-const: dice::sparse_map::pobr_version
secrets:
CONAN_USER: ""
CONAN_PW: ""
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,4 @@ test_package/build/
test_package/CMakeUserPresets.json
conan_provider.cmake
CMakeUserPresets.json
include/dice/sparse-map/version.hpp
28 changes: 20 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
cmake_minimum_required(VERSION 3.24)
project(dice-sparse-map
VERSION 0.2.6
VERSION 0.2.7
DESCRIPTION "C++ implementation of a memory efficient hash map and hash set based on [tsl::sparse_map](https://github.com/Tessil/sparse-map). We added support for fancy pointers.")
set(POBR_VERSION 1) # Persisted Object Binary Representation Version

include(cmake/boilerplate_init.cmake)
boilerplate_init()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/dice/sparse-map/version.hpp)

option(BUILD_TESTING "Build tests" OFF)

if (PROJECT_IS_TOP_LEVEL)
if (BUILD_TESTING)
set(CONAN_INSTALL_ARGS "${CONAN_INSTALL_ARGS};-o=&:with_test_deps=True")
endif ()
endif ()

add_library(${PROJECT_NAME} INTERFACE)
# Use dice::sparse_map as target, more consistent with other libraries conventions (Boost, Qt, ...)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
Expand All @@ -24,14 +32,18 @@ if(MSVC)
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_DATAROOTDIR}/tsl-sparse-map.natvis>")
endif()

if (PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
message("Tests are configured to be build.")
include(CTest)
enable_testing()
add_subdirectory(tests)
endif ()

if (PROJECT_IS_TOP_LEVEL)
if (BUILD_TESTING)
message("Tests are configured to be build.")
include(CTest)
enable_testing()
add_subdirectory(tests)
else ()
# in top-level builds without tests we only need boost headers but not libraries
# so avoid building the unecessesarily
set(CONAN_INSTALL_ARGS "${CONAN_INSTALL_ARGS};-o=boost/*:header_only=True")
endif ()

include(cmake/install_interface_library.cmake)
install_interface_library("${PROJECT_NAME}" "${PROJECT_NAME}" "${PROJECT_NAME}" "include")
endif ()
13 changes: 13 additions & 0 deletions cmake/version.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef DICE_SPARSEMAP_VERSION_HPP
#define DICE_SPARSEMAP_VERSION_HPP

#include <array>

namespace dice::sparse_map {
inline constexpr char name[] = "@PROJECT_NAME@";
inline constexpr char version[] = "@PROJECT_VERSION@";
inline constexpr std::array<int, 3> version_tuple = {@PROJECT_VERSION_MAJOR@, @PROJECT_VERSION_MINOR@, @PROJECT_VERSION_PATCH@};
inline constexpr int pobr_version = @POBR_VERSION@; ///< persisted object binary representation version
} // namespace dice::sparse_map

#endif // DICE_SPARSEMAP_VERSION_HPP
9 changes: 8 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ class Recipe(ConanFile):
package_type = "header-library"
generators = "CMakeDeps", "CMakeToolchain"
no_copy_source = True
options = {
"with_test_deps": [True, False],
}
default_options = {
"with_test_deps": False,
}

def requirements(self):
self.test_requires("boost/1.83.0")
if self.options.with_test_deps:
self.test_requires("boost/1.83.0")

def set_name(self):
if not hasattr(self, 'name') or self.version is None:
Expand Down

0 comments on commit 987c579

Please sign in to comment.