Skip to content

Commit

Permalink
Use Conan v2
Browse files Browse the repository at this point in the history
Contribute to CURA-11622
  • Loading branch information
jellespijker committed Feb 12, 2024
1 parent bb9515f commit b80345f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 18 deletions.
41 changes: 34 additions & 7 deletions .github/workflows/conan-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,68 @@ on:
- 'CMakelists.txt'
- '.github/workflows/conan-package.yml'
- '.github/workflows/requirements*.txt'
branches:
- main
- 'CURA-*'
- 'PP-*'
- 'NP-*'
- '[0-9].[0-9]*'
- '[0-9].[0-9][0-9]*'

jobs:
# FIXME: Use main once merged
conan-recipe-version:
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@CURA-11622_conan_v2
with:
project_name: curaengine_grpc_definitions

# FIXME: Use main once merged
conan-package-export:
needs: [ conan-recipe-version ]
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-export.yml@main
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-export.yml@CURA-11622_conan_v2
with:
recipe_id_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_version: ${{ needs.conan-recipe-version.outputs.recipe_semver_full }}
recipe_id_user: ${{ needs.conan-recipe-version.outputs.user }}
recipe_id_channel: ${{ needs.conan-recipe-version.outputs.channel }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }}
secrets: inherit

# FIXME: Use main once merged
conan-package-create-macos:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-macos.yml@main
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-macos.yml@CURA-11622_conan_v2
with:
recipe_id_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_version: ${{ needs.conan-recipe-version.outputs.recipe_semver_full }}
recipe_id_user: ${{ needs.conan-recipe-version.outputs.user }}
recipe_id_channel: ${{ needs.conan-recipe-version.outputs.channel }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit

# FIXME: Use main once merged
conan-package-create-windows:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-windows.yml@main
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-windows.yml@CURA-11622_conan_v2
with:
recipe_id_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_version: ${{ needs.conan-recipe-version.outputs.recipe_semver_full }}
recipe_id_user: ${{ needs.conan-recipe-version.outputs.user }}
recipe_id_channel: ${{ needs.conan-recipe-version.outputs.channel }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit

# FIXME: Use main once merged
conan-package-create-linux:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-linux.yml@main
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-linux.yml@CURA-11622_conan_v2
with:
recipe_id_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_version: ${{ needs.conan-recipe-version.outputs.recipe_semver_full }}
recipe_id_user: ${{ needs.conan-recipe-version.outputs.user }}
recipe_id_channel: ${{ needs.conan-recipe-version.outputs.channel }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit
secrets: inherit
23 changes: 12 additions & 11 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) 2023 UltiMaker
# Copyright (c) 2024 UltiMaker
# curaengine_grpc_definitions is released under the terms of the MIT

import os
from pathlib import Path

Expand All @@ -10,9 +11,9 @@
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import copy, update_conandata
from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc
from conan.tools.scm import Version
from conan.tools.scm import Version, Git

required_conan_version = ">=1.58.0 <2.0.0"
required_conan_version = ">=1.58.0"


class CuraEngine_gRPC_DefinitionsConan(ConanFile):
Expand All @@ -39,6 +40,10 @@ def set_version(self):
if not self.version:
self.version = self.conan_data["version"]

def export(self):
git = Git(self)
update_conandata(self, {"version": self.version, "commit": git.get_commit()})

@property
def _min_cppstd(self):
return 20
Expand All @@ -53,9 +58,6 @@ def _compilers_minimum_version(self):
"visual_studio": "17",
}

def export(self):
update_conandata(self, {"version": self.version})

def export_sources(self):
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
copy(self, "*.proto", self.recipe_folder, self.export_sources_folder)
Expand Down Expand Up @@ -96,10 +98,10 @@ def layout(self):

def requirements(self):
self.requires("protobuf/3.21.12", transitive_headers = True)
self.requires("boost/1.82.0")
self.requires("asio-grpc/2.6.0")
self.requires("grpc/1.50.1", transitive_headers = True)
self.requires("openssl/3.2.0")
self.requires("boost/1.83.0")
self.requires("asio-grpc/2.9.2")
self.requires("grpc/1.54.3", transitive_headers = True)
self.requires("openssl/3.2.1")

def validate(self):
# validate the minimum cpp standard supported. For C++ projects only
Expand All @@ -119,7 +121,6 @@ def build_requirements(self):
self.tool_requires("protobuf/3.21.9")

def generate(self):
# BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE are automatically parsed when self.options.shared or self.options.fPIC exist
tc = CMakeToolchain(self)
if is_msvc(self):
tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self)
Expand Down

0 comments on commit b80345f

Please sign in to comment.