Skip to content

Commit

Permalink
Use Conan Transitive Dependencies (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
fpelliccioni committed Apr 5, 2023
1 parent 9113676 commit 0fc7c86
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 83 deletions.
138 changes: 76 additions & 62 deletions .github/workflows/knuth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
# - main # tagged latest
# - master # tagged latest
- master # tagged latest
# - dev # tagged test
- init
tags:
Expand All @@ -19,8 +19,20 @@ env:
CONAN_REMOTE_URL: https://packages.kth.cash/api/

jobs:
master:
name: Master and Dev
if: github.event_name != 'pull_request' &&
(github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/dev')
runs-on: ubuntu-20.04
steps:
- name: Master Build
shell: bash
run: |
echo "Stable packages are published in Release branches"
check:
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
outputs:
permitted: ${{ steps.check.outputs.permitted }}
Expand All @@ -32,6 +44,7 @@ jobs:
permission: write

setup:
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
outputs:
build-version: ${{ steps.version.outputs.build-version }}
Expand Down Expand Up @@ -76,6 +89,7 @@ jobs:
# run: docker push ${{ env.name }}:${{ steps.version.outputs.version }}

generate-matrix:
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
name: Generate Job Matrix
runs-on: ubuntu-20.04
outputs:
Expand All @@ -91,67 +105,67 @@ jobs:
echo "${MATRIX}"
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
calc-deps-with-container:
needs: [setup, generate-matrix]
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
name: ${{ matrix.config.name }}
uses: k-nuth/ci-utils/.github/workflows/calc-deps-with-container.yml@master
with:
if: ${{ matrix.config.compiler == 'GCC' }}
os: ${{ matrix.config.os }}
image: "kthnode/gcc${{ matrix.config.version }}${{ matrix.config.docker_suffix }}"
conan-remote: "kth"
build-version: ${{ needs.setup.outputs.build-version }}
secrets:
conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
conan-password: ${{ secrets.CONAN_3_PASSWORD }}

calc-deps-without-container:
needs: [setup, generate-matrix]
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
name: ${{ matrix.config.name }}
uses: k-nuth/ci-utils/.github/workflows/calc-deps-without-container.yml@master
with:
if: ${{ matrix.config.compiler != 'GCC' }}
os: ${{ matrix.config.os }}
conan-remote: "kth"
build-version: ${{ needs.setup.outputs.build-version }}
secrets:
conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
conan-password: ${{ secrets.CONAN_3_PASSWORD }}

build-deps-with-container:
needs: [calc-deps-with-container]
strategy:
matrix: ${{ fromJson(needs.calc-deps-with-container.outputs.matrix) }}
name: ${{ matrix.config.name }}
uses: k-nuth/ci-utils/.github/workflows/build-deps-with-container.yml@master
with:
if: ${{ matrix.config.compiler == 'GCC' }}
os: ${{ matrix.config.os }}
image: "kthnode/gcc${{ matrix.config.version }}${{ matrix.config.docker_suffix }}"
reference: ${{ matrix.config.reference }}
conan-remote: "kth"
secrets:
conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
conan-password: ${{ secrets.CONAN_3_PASSWORD }}

build-deps-without-container:
needs: [calc-deps-without-container]
strategy:
matrix: ${{ fromJson(needs.calc-deps-without-container.outputs.matrix) }}
name: ${{ matrix.config.name }}
uses: k-nuth/ci-utils/.github/workflows/build-deps-without-container.yml@master
with:
if: ${{ matrix.config.compiler != 'GCC' }}
os: ${{ matrix.config.os }}
reference: ${{ matrix.config.reference }}
conan-remote: "kth"
secrets:
conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
conan-password: ${{ secrets.CONAN_3_PASSWORD }}
# calc-deps-with-container:
# needs: [setup, generate-matrix]
# strategy:
# matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
# name: ${{ matrix.config.name }}
# uses: k-nuth/ci-utils/.github/workflows/calc-deps-with-container.yml@master
# with:
# if: ${{ matrix.config.compiler == 'GCC' }}
# os: ${{ matrix.config.os }}
# image: "kthnode/gcc${{ matrix.config.version }}${{ matrix.config.docker_suffix }}"
# conan-remote: "kth"
# build-version: ${{ needs.setup.outputs.build-version }}
# secrets:
# conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
# conan-password: ${{ secrets.CONAN_3_PASSWORD }}

# calc-deps-without-container:
# needs: [setup, generate-matrix]
# strategy:
# matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
# name: ${{ matrix.config.name }}
# uses: k-nuth/ci-utils/.github/workflows/calc-deps-without-container.yml@master
# with:
# if: ${{ matrix.config.compiler != 'GCC' }}
# os: ${{ matrix.config.os }}
# conan-remote: "kth"
# build-version: ${{ needs.setup.outputs.build-version }}
# secrets:
# conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
# conan-password: ${{ secrets.CONAN_3_PASSWORD }}

# build-deps-with-container:
# needs: [calc-deps-with-container]
# strategy:
# matrix: ${{ fromJson(needs.calc-deps-with-container.outputs.matrix) }}
# name: ${{ matrix.config.name }}
# uses: k-nuth/ci-utils/.github/workflows/build-deps-with-container.yml@master
# with:
# if: ${{ matrix.config.compiler == 'GCC' }}
# os: ${{ matrix.config.os }}
# image: "kthnode/gcc${{ matrix.config.version }}${{ matrix.config.docker_suffix }}"
# reference: ${{ matrix.config.reference }}
# conan-remote: "kth"
# secrets:
# conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
# conan-password: ${{ secrets.CONAN_3_PASSWORD }}

# build-deps-without-container:
# needs: [calc-deps-without-container]
# strategy:
# matrix: ${{ fromJson(needs.calc-deps-without-container.outputs.matrix) }}
# name: ${{ matrix.config.name }}
# uses: k-nuth/ci-utils/.github/workflows/build-deps-without-container.yml@master
# with:
# if: ${{ matrix.config.compiler != 'GCC' }}
# os: ${{ matrix.config.os }}
# reference: ${{ matrix.config.reference }}
# conan-remote: "kth"
# secrets:
# conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
# conan-password: ${{ secrets.CONAN_3_PASSWORD }}

build-with-container:
needs: [setup, generate-matrix]
Expand Down
13 changes: 0 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,8 @@ endif()

message(STATUS "Knuth: Cryptocurrency: ${CURRENCY}")


find_package(infrastructure REQUIRED)
find_package(domain REQUIRED)

find_package(fmt 9.1.0 REQUIRED)
find_package(spdlog 1.10.0 REQUIRED)
find_package(lmdb 0.9.29 REQUIRED)
find_package(Boost 1.81.0 COMPONENTS boost REQUIRED)

include(CheckCXXCompilerFlag)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/ci_utils/cmake)
Expand Down Expand Up @@ -370,15 +364,8 @@ if (NOT ENABLE_SHARED)
target_compile_definitions(${PROJECT_NAME} PUBLIC -DKD_STATIC -DBC_STATIC)
endif()

target_link_libraries(${PROJECT_NAME} PUBLIC infrastructure::infrastructure)
target_link_libraries(${PROJECT_NAME} PUBLIC domain::domain)

target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt)
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog)
target_link_libraries(${PROJECT_NAME} PUBLIC lmdb::lmdb)
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::boost)



if (MINGW)
target_link_libraries(${PROJECT_NAME} PUBLIC ws2_32 wsock32)
Expand Down
11 changes: 3 additions & 8 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,14 @@ def build_requirements(self):
self.test_requires("catch2/3.3.1")

def requirements(self):
self.requires("infrastructure/0.23.0")
self.requires("domain/0.25.0")

self.requires("boost/1.81.0")
self.requires("fmt/9.1.0")
self.requires("spdlog/1.11.0")
self.requires("domain/0.25.0", transitive_headers=True, transitive_libs=True)

if not self._is_legacy_db():
if self.options.use_libmdbx:
self.requires("libmdbx/0.7.0@kth/stable")
self.requires("libmdbx/0.7.0@kth/stable", transitive_headers=True, transitive_libs=True)
self.output.info("Using libmdbx for DB management")
else:
self.requires("lmdb/0.9.29")
self.requires("lmdb/0.9.29", transitive_headers=True, transitive_libs=True)
self.output.info("Using lmdb for DB management")
else:
self.output.info("Using legacy DB")
Expand Down

0 comments on commit 0fc7c86

Please sign in to comment.