diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index fa2db39..4aecbe5 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -9,41 +9,15 @@ 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: - conan-recipe-version: - uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main - with: - project_name: curaengine_grpc_definitions - - conan-package-export: - needs: [ conan-recipe-version ] - uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-export.yml@main - with: - recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} - recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }} - secrets: inherit - - 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 - with: - recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} - secrets: inherit - - 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 - with: - recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} - secrets: inherit - - 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 - with: - recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} + conan-package: + uses: ultimaker/cura-workflows/.github/workflows/conan-package.yml@main secrets: inherit diff --git a/.github/workflows/requirements-runner.txt b/.github/workflows/requirements-runner.txt deleted file mode 100644 index e69de29..0000000 diff --git a/conanfile.py b/conanfile.py index 3edb87b..c843a7c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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 @@ -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 = ">=2.7.0" class CuraEngine_gRPC_DefinitionsConan(ConanFile): @@ -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 @@ -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) @@ -65,17 +67,8 @@ def config_options(self): del self.options.fPIC def configure(self): - self.options["boost"].header_only = True - if self.options.shared: self.options.rm_safe("fPIC") - self.options["grpc"].csharp_plugin = False - self.options["grpc"].node_plugin = False - self.options["grpc"].objective_c_plugin = False - self.options["grpc"].php_plugin = False - self.options["grpc"].python_plugin = False - self.options["grpc"].ruby_plugin = False - self.options["asio-grpc"].local_allocator = "recycling_allocator" def layout(self): cmake_layout(self) @@ -96,10 +89,7 @@ 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("asio-grpc/2.9.2") def validate(self): # validate the minimum cpp standard supported. For C++ projects only @@ -119,12 +109,11 @@ 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) tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" - tc.variables["GRPC_PROTOS"] = ";".join([str(p).replace("\\", "/") for p in Path(self.source_path).rglob("*.proto")]) + tc.variables["GRPC_PROTOS"] = ";".join([str(p).replace("\\", "/") for p in Path(self.source_folder).rglob("*.proto")]) tc.generate() tc = CMakeDeps(self)