Skip to content

Commit

Permalink
Replaced conanfile.txt with conanfile.py to address Linux-only settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanoLusardi committed Aug 6, 2024
1 parent 8f9c147 commit 5c9c805
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:

- task: Cache@2
inputs:
key: 'conan $(Agent.JobName) | inference_client/conanfile.txt | inference_client/examples/conanfile.txt | inference_client/tests/conanfile.txt'
key: 'conan $(Agent.JobName) | inference_client/conanfile.py | inference_client/examples/conanfile.txt | inference_client/tests/conanfile.txt'
path: '$(Build.SourcesDirectory)/.conan'
displayName: 'Cache Conan'

Expand Down
39 changes: 36 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
#!/usr/bin/env python
# Copyright 2024 TeiaCare
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from conans import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain
import re

def get_project_version():
with open('VERSION') as version_file:
# TODO: validate Regex format
return version_file.read().strip()
with open('VERSION', encoding='utf8') as version_file:
version_regex = r'^\d+\.\d+\.\d+$'
version = version_file.read().strip()
if re.match(version_regex, version):
return version
else:
raise ValueError(f"Invalid version detected into file VERSION: {version}")

class TeiaCareInferenceClient(ConanFile):
name = "teiacare_inference_client"
Expand All @@ -30,6 +49,20 @@ def configure(self):
if self.options.shared:
del self.options.fPIC

self.options["grpc"].codegen=True
self.options["grpc"].csharp_ext=False
self.options["grpc"].cpp_plugin=True
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["grpc"].secure=False

if self.settings.os == "Linux":
self.options["grpc"].with_libsystemd=False

def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
Expand Down

0 comments on commit 5c9c805

Please sign in to comment.