Skip to content

Commit d0088a0

Browse files
committed
merge develop
2 parents 1190e38 + 3d966b0 commit d0088a0

File tree

6 files changed

+74
-52
lines changed

6 files changed

+74
-52
lines changed

.github/workflows/code_testing.yml

+32-32
Original file line numberDiff line numberDiff line change
@@ -7,69 +7,69 @@ concurrency:
77
cancel-in-progress: true
88

99
jobs:
10-
build_and_run_tests_and_examples:
10+
build-and-run-tests-and-examples:
1111
strategy:
1212
fail-fast: false
1313
matrix:
1414
config:
1515
- os: ubuntu-22.04
16-
compiler: clang-17
16+
compiler: clang-15
17+
- os: ubuntu-22.04
18+
compiler: clang-16
19+
20+
- os: ubuntu-22.04
21+
compiler: gcc-12
1722
- os: ubuntu-22.04
1823
compiler: gcc-13
1924
runs-on: ${{ matrix.config.os }}
20-
name: ${{ matrix.config.os }} (${{ matrix.config.compiler }})
2125
steps:
22-
- name: Add repo for gcc-13 and clang-17
26+
- name: Add repos for for gcc-13 and clang-16
2327
run: |
2428
# gcc-13
2529
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
26-
27-
# clang-17
30+
31+
# clang-16
2832
source /etc/os-release
29-
echo "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-17 main" | sudo tee /etc/apt/sources.list.d/llvm-17.list
30-
curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/llvm.gpg > /dev/null
33+
echo "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-16 main" | sudo tee /etc/apt/sources.list.d/llvm-16.list
34+
curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/llvm-16.gpg > /dev/null
3135
32-
- name: Install libstdc++-13
33-
run: |
34-
sudo apt-get install libstdc++-13-dev -y
36+
sudo apt-get update -y
3537
36-
- name: Get minimum cmake version
37-
uses: lukka/get-cmake@latest
38+
- name: Install CMake
39+
uses: lukka/get-cmake@v3.24.3
3840
with:
39-
cmakeVersion: 3.22.5
41+
cmakeVersion: 3.16.9
4042

4143
- name: Install compiler
4244
id: install_cc
4345
uses: rlalik/[email protected]
4446
with:
4547
compiler: ${{ matrix.config.compiler }}
4648

47-
- name: install conan packages
48-
run: |
49-
sudo apt-get update
50-
sudo apt-get install -y python3-pip
51-
52-
pip3 install "conan==1.62.0"
53-
conan profile new --detect default
54-
conan profile update settings.compiler.libcxx=libstdc++11 default
49+
- name: Install linker
50+
uses: rui314/setup-mold@v1
5551

5652
- uses: actions/checkout@v3
5753

58-
- name: build tests and examples
59-
run: |
60-
mkdir build
61-
cd build
62-
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DWITH_SODIUM=ON -DCMAKE_CXX_FLAGS="-march=native" .. && make -j
54+
- name: Configure CMake
55+
run: cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=On -DBUILD_EXAMPLES=On -G Ninja -B build .
6356
env:
6457
CC: ${{ steps.install_cc.outputs.cc }}
6558
CXX: ${{ steps.install_cc.outputs.cxx }}
59+
CXXFLAGS: -fsanitize=undefined -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls
6660

67-
- name: run tests
61+
- name: Build tests and examples
6862
working-directory: build
69-
run: ctest --verbose --parallel 2 --exclude-regex "benchmark_*"
63+
run: cmake --build . -j2
7064

71-
- name: run examples
65+
- name: Run tests
66+
working-directory: build
67+
run: ctest --verbose -j2
68+
69+
- name: Run examples
70+
working-directory: build
7271
run: |
73-
for example in build/examples/example_*; do
74-
./$example
72+
for example in $(find ./examples -maxdepth 1 -type f -executable); do
73+
echo "running ${example}"
74+
./${example}
7575
done

.github/workflows/publish-conan-branch-package.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
with:
1313
public_artifactory: true
1414
os: ubuntu-22.04
15-
compiler: clang-17
15+
compiler: clang-15
1616
cmake-version: 3.22.6
1717
conan-version: 2.0.13
1818
secrets:

CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
cmake_minimum_required(VERSION 3.16)
1+
cmake_minimum_required(VERSION 3.22)
22

33
project(
44
dice-hash
5-
VERSION 0.4.3
5+
VERSION 0.4.4
66
DESCRIPTION "dice-hash provides a framework to generate stable hashes. It provides state-of-the-art hash functions, supports STL containers out of the box and helps you to defines stable hashes for your own structs and classes."
77
HOMEPAGE_URL "https://dice-group.github.io/dice-hash/")
88

@@ -82,13 +82,13 @@ endif ()
8282
include(cmake/install_library.cmake)
8383
install_cpp_library(${PROJECT_NAME} "src")
8484

85-
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
85+
if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
8686
include(CTest)
8787
enable_testing()
8888
add_subdirectory(tests)
8989
endif()
9090

9191
option(BUILD_EXAMPLES "Build example programs" OFF)
92-
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_EXAMPLES)
92+
if(PROJECT_IS_TOP_LEVEL AND BUILD_EXAMPLES)
9393
add_subdirectory(examples)
9494
endif()

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ add
3030
FetchContent_Declare(
3131
dice-hash
3232
GIT_REPOSITORY https://github.com/dice-group/dice-hash.git
33-
GIT_TAG 0.4.3
33+
GIT_TAG 0.4.4
3434
GIT_SHALLOW TRUE)
3535
3636
FetchContent_MakeAvailable(dice-hash)
@@ -51,7 +51,7 @@ To use it with [conan](https://conan.io/) you need to add the repository:
5151
conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris
5252
```
5353

54-
To use it add `dice-hash/0.4.3` to the `[requires]` section of your conan file.
54+
To use it add `dice-hash/0.4.4` to the `[requires]` section of your conan file.
5555

5656
## build and run tests
5757

conanfile.py

+27-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import re, os
1+
import re
2+
import os
23

34
from conan import ConanFile
45
from conan.tools.cmake import CMake, cmake_layout
@@ -54,27 +55,43 @@ def build(self):
5455
self._configure_cmake().build()
5556

5657
def package(self):
58+
cmake = CMake(self)
59+
cmake.configure()
60+
cmake.install()
61+
62+
for dir in ("lib", "res", "share"):
63+
rmdir(self, os.path.join(self.package_folder, dir))
64+
5765
self._configure_cmake().install()
5866
rmdir(self, os.path.join(self.package_folder, "cmake"))
5967
rmdir(self, os.path.join(self.package_folder, "share"))
6068
copy(self, pattern="LICENSE*", dst="licenses", src=self.folders.source_folder)
6169

6270
def package_info(self):
63-
self.cpp_info.components["global"].set_property("cmake_target_name", f"{self.name}::{self.name}")
64-
self.cpp_info.components["global"].names["cmake_find_package_multi"] = f"{self.name}"
65-
self.cpp_info.components["global"].names["cmake_find_package"] = f"{self.name}"
66-
self.cpp_info.components["global"].includedirs = ["src"]
67-
self.cpp_info.components["global"].libs = [f"{self.name}"]
68-
self.cpp_info.components["global"].libdirs = ["lib"]
71+
self.cpp_info.bindirs = []
72+
self.cpp_info.libdirs = []
73+
74+
self.cpp_info.set_property("cmake_find_mode", "both")
75+
self.cpp_info.set_property("cmake_target_name", "dice-hash::dice-hash")
76+
self.cpp_info.set_property("cmake_file_name", "dice-hash")
77+
78+
def package_info(self):
79+
self.cpp_info.set_property("cmake_find_mode", "both")
80+
self.cpp_info.set_property("cmake_target_name", "dice-hash::dice-hash")
81+
self.cpp_info.set_property("cmake_file_name", "dice-hash")
82+
83+
self.cpp_info.includedirs = ["src"]
84+
self.cpp_info.libs = [f"{self.name}"]
85+
self.cpp_info.libdirs = ["lib"]
6986

70-
self.cpp_info.components["global"].requires = []
87+
self.cpp_info.requires = []
7188

7289
if self.options.with_sodium:
73-
self.cpp_info.components["global"].requires += [
90+
self.cpp_info.requires += [
7491
"libsodium::libsodium"
7592
]
7693

7794
if self.options.with_test_deps:
78-
self.cpp_info.components["global"].requires += [
95+
self.cpp_info.requires += [
7996
"Metall::Metall"
8097
]

test_package/conanfile.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from conan import ConanFile
3-
from conan.tools.cmake import CMake
4-
from conan.tools.layout import cmake_layout
3+
from conan.tools.build import can_run
4+
from conan.tools.cmake import CMake, cmake_layout
55

66
required_conan_version = ">=1.59"
77

@@ -11,6 +11,9 @@ class TestPackageConan(ConanFile):
1111
generators = "CMakeDeps", "CMakeToolchain"
1212
default_options = {"dice-hash:with_sodium": True}
1313

14+
def requirements(self):
15+
self.requires(self.tested_reference_str)
16+
1417
def layout(self):
1518
cmake_layout(self)
1619

@@ -20,4 +23,6 @@ def build(self):
2023
cmake.build()
2124

2225
def test(self):
23-
self.run(os.path.join(self.cpp.build.bindirs[0], "example"), run_environment=True)
26+
if can_run(self):
27+
cmd = os.path.join(self.cpp.build.bindir, "example")
28+
self.run(cmd, env="conanrun")

0 commit comments

Comments
 (0)