Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
liss-h authored Jun 4, 2024
2 parents f9aa10b + e3a7eea commit 58e112a
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 49 deletions.
38 changes: 24 additions & 14 deletions .github/workflows/code_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,12 @@ jobs:
runs-on: ${{ matrix.config.os }}
steps:
- name: Add repos for for gcc-13 and clang-16
run: |
# gcc-13
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
# clang-16
source /etc/os-release
echo "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-16 main" | sudo tee /etc/apt/sources.list.d/llvm-16.list
curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/llvm-16.gpg > /dev/null
sudo apt-get update -y
uses: dice-group/cpp-conan-release-reusable-workflow/.github/actions/setup_apt@main

- name: Install CMake
uses: lukka/get-cmake@v3.24.3
uses: lukka/get-cmake@v3.29.3
with:
cmakeVersion: 3.16.9
cmakeVersion: 3.24

- name: Install compiler
id: install_cc
Expand All @@ -49,10 +40,29 @@ jobs:
- name: Install linker
uses: rui314/setup-mold@v1

- uses: actions/checkout@v3
- name: Configure conan
uses: dice-group/cpp-conan-release-reusable-workflow/.github/actions/configure_conan@main
with:
conan-version: 2.3.1

- name: add conan user
run: |
conan remote add -f dice-group https://conan.dice-research.org/artifactory/api/conan/tentris
- name: Cache conan data
id: cache-conan
uses: actions/cache@v4.0.2
with:
path: ~/.conan2/p
key: ${{ matrix.config.os }}-${{ matrix.config.compiler }}

- uses: actions/checkout@v4.1.6

- name: Get dependency provider
uses: dice-group/cpp-conan-release-reusable-workflow/.github/actions/add_conan_provider@main

- name: Configure CMake
run: cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=On -DBUILD_EXAMPLES=On -G Ninja -B build .
run: cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=On -DBUILD_EXAMPLES=On -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G Ninja -B build .
env:
CC: ${{ steps.install_cc.outputs.cc }}
CXX: ${{ steps.install_cc.outputs.cxx }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
- uses: actions/checkout@v3
# https://github.com/marketplace/actions/doxygen-action
- name: generate docu
uses: mattnotmitt/doxygen-action@v1
uses: mattnotmitt/doxygen-action@v1.9.8
with:
working-directory: '.'
doxyfile-path: 'Doxyfile'

- name: upload to github page branch
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docu
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-conan-branch-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
public_artifactory: true
os: ubuntu-22.04
compiler: clang-15
cmake-version: 3.22.6
conan-version: 2.0.13
cmake-version: 3.24.0
conan-version: 2.3.0
secrets:
CONAN_USER: ${{ secrets.CONAN_USER }}
CONAN_PW: ${{ secrets.CONAN_PW }}
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
public_artifactory: true
os: ubuntu-22.04
compiler: clang-14
cmake-version: 3.22.6
cmake-version: 3.24.0
conan-version: 2.0.13
secrets:
CONAN_USER: ${{ secrets.CONAN_USER }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,4 @@ modules.xml
/docu/

test_package/build
conan_provider.cmake
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.24)

project(
dice-hash
VERSION 0.4.4
VERSION 0.4.5
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."
HOMEPAGE_URL "https://dice-group.github.io/dice-hash/")

Expand Down
28 changes: 9 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,13 @@ A C++20 compatible compiler. Code was only tested on x86_64.

### CMake

add
```cmake
FetchContent_Declare(
dice-hash
GIT_REPOSITORY https://github.com/dice-group/dice-hash.git
GIT_TAG 0.4.4
GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(dice-hash)
### conan
To use it with [conan](https://conan.io/) you need to add the repository:
```shell
conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris
```

to your CMakeLists.txt
To use it add `dice-hash/0.4.5` to the `[requires]` section of your conan file.

You can now add it to your target with:
```cmake
Expand All @@ -43,27 +38,22 @@ target_link_libraries(your_target
)
```

### conan
To use it with [conan](https://conan.io/) you need to add the repository:
```shell
conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris
```

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

## build and run tests

```shell
#get it
git clone https://github.com/dice-group/dice-hash.git
cd dice-hash
#build it
wget https://github.com/conan-io/cmake-conan/raw/develop2/conan_provider.cmake -O conan_provider.cmake
mkdir build
cd build
cmake -DBUILD_TESTING -DCMAKE_BUILD_TYPE=Release ..
cmake -DBUILD_TESTING -DCMAKE_BUILD_TYPE=Release .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake
make -j tests_dice_hash
./test/tests_dice_hash
```
Note: This example uses conan as dependency provider, other providers are possible.
See https://cmake.org/cmake/help/latest/guide/using-dependencies/index.html#dependency-providers

## usage
You need to include a single header:
Expand Down
16 changes: 15 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,23 @@ def set_version(self):
cmake_file = load(self, os.path.join(self.recipe_folder, "CMakeLists.txt"))
self.description = re.search(r"project\([^)]*DESCRIPTION\s+\"([^\"]+)\"[^)]*\)", cmake_file).group(1)

def requirements(self):
self.test_requires("catch2/2.13.9")

def layout(self):
cmake_layout(self)

def build(self):
if not self.conf.get("tools.build:skip_test", default=False):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package_id(self):
self.info.clear()

def package(self):
cmake = CMake(self)
cmake.configure()
cmake.install()

for dir in ("lib", "res", "share"):
Expand Down
9 changes: 1 addition & 8 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS OFF)

include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.9
GIT_SHALLOW TRUE)

FetchContent_MakeAvailable(Catch2)
find_package(Catch2 REQUIRED)

add_executable(tests_dice_hash TestDiceHash.cpp)
target_link_libraries(tests_dice_hash PRIVATE
Expand Down

0 comments on commit 58e112a

Please sign in to comment.