forked from saimusdev-conan/tensorflow-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
65 lines (54 loc) · 2.27 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import sys
from os import getcwd
from multiprocessing import cpu_count
from conans import ConanFile, tools, AutoToolsBuildEnvironment
class TFLiteConan(ConanFile):
# Basic info
name = "tensorflow-lite"
version = "2.0.0"
repo_url = "https://github.com/tensorflow/tensorflow.git"
# Other package details
description = "https://www.tensorflow.org/"
url = "https://github.com/saimusdev/tflite-conan"
homepage = "The core open source library to help you develop and train ML models"
author = "saimusdev"
license = "Apache-2.0"
# Conan build process settings
exports = [ "LICENSE.md", "revision"]
settings = "os", "arch", "compiler", "build_type"
options = { "shared": [True, False], "fPIC": [True, False] }
default_options = { "shared": True, "fPIC": True }
source_subfolder = "tensorflow"
build_subfolder = "tensorflow/lite/tools/make" # relative path
generators = "make"
def build_requirements(self):
pass
def configure(self):
self.repo_revision = tools.load("revision")
def config_options(self):
if self.settings.os == 'Windows':
del self.options.fPIC
def source(self):
git = tools.Git(folder=self.source_subfolder)
git.clone(self.repo_url)
with tools.chdir(self.source_subfolder):
self.run("git checkout %s" % (self.repo_revision))
def build(self):
with tools.chdir(self.source_subfolder):
#with tools.chdir(self.build_subfolder):
#self.run("./download_dependencies.sh")
env_build = AutoToolsBuildEnvironment(self)
env_build.fpic = True
#env_build.libs.append("pthread")
env_build.defines.append("BUILD_WITH_NNAPI=false")
env_build.defines.append("BUILD_WITH_MMAP=false")
build_target = "all" # "micro"?
env_build.make(target="%s -f %s/Makefile -C %s" % (
build_target,
self.build_subfolder,
getcwd()))
def package(self):
self.copy(pattern="LICENSE", dst="licenses", src=self.source_subfolder)
self.copy(pattern="*.so*", dst="lib", src=self.source_subfolder, keep_path=False, symlinks=True)
def package_info(self):
self.cpp_info.libs = ["tensorflow"]