-
Notifications
You must be signed in to change notification settings - Fork 124
/
conanfile.py
93 lines (80 loc) · 3.5 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, collect_libs
import os.path
required_conan_version = ">=1.59.0"
class openfx(ConanFile):
name = "openfx"
version = "1.4.0"
license = "BSD-3-Clause"
url = "https://github.com/AcademySoftwareFoundation/openfx"
description = "OpenFX image processing plug-in standard"
exports_sources = (
"cmake/*",
"Examples/*",
"HostSupport/*",
"include/*",
"scripts/*",
"Support/*",
"CMakeLists.txt",
"LICENSE",
"README.md",
"INSTALL.md"
)
settings = "os", "arch", "compiler", "build_type"
options = {"use_opencl": [True, False]}
default_options = {
"expat/*:shared": True,
"use_opencl": False,
"spdlog/*:header_only": True,
"fmt/*:header_only": True
}
def requirements(self):
if self.options.use_opencl: # for OpenCL examples
self.requires("opencl-icd-loader/2023.12.14")
self.requires("opencl-headers/2023.12.14")
self.requires("opengl/system") # for OpenGL examples
self.requires("expat/2.4.8") # for HostSupport
self.requires("cimg/3.3.2") # to draw text into images
self.requires("spdlog/1.13.0") # for logging
def layout(self):
cmake_layout(self)
def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
if self.settings.os == "Windows":
tc.preprocessor_definitions["WINDOWS"] = 1
tc.preprocessor_definitions["NOMINMAX"] = 1
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, "cmake/*", src=self.source_folder, dst=self.package_folder)
copy(self, "LICENSE, README.md, INSTALL.md", src=self.source_folder, dst=self.package_folder)
copy(self, "include/*.h", src=self.source_folder, dst=self.package_folder)
copy(self,"HostSupport/include/*.h", src=self.source_folder, dst=self.package_folder)
copy(self,"Support/*.h", src=self.source_folder, dst=self.package_folder)
copy(self,"Support/Plugins/include/*.h", src=self.source_folder, dst=self.package_folder)
copy(self,"*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False)
copy(self,"*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False)
copy(self,"*.ofx", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False)
copy(self,"*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False)
copy(self,"*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False)
def package_info(self):
libs = collect_libs(self)
self.cpp_info.set_property("cmake_build_modules", [os.path.join("cmake", "OpenFX.cmake")])
self.cpp_info.components["Api"].includedirs = ["include"]
self.cpp_info.components["HostSupport"].libs = [i for i in libs if "OfxHost" in i]
self.cpp_info.components["HostSupport"].includedirs = ["HostSupport/include"]
self.cpp_info.components["HostSupport"].requires = ["expat::expat"]
self.cpp_info.components["Support"].libs = [i for i in libs if "OfxSupport" in i]
self.cpp_info.components["Support"].includedirs = ["Support/include"]
self.cpp_info.components["Support"].requires = ["opengl::opengl"]
if self.settings.os == "Windows":
win_defines = ["WINDOWS", "NOMINMAX"]
self.cpp_info.components["Api"].defines = win_defines
self.cpp_info.components["HostSupport"].defines = win_defines
self.cpp_info.components["Support"].defines = win_defines