-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
166 lines (136 loc) · 5.65 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# SPDX-FileCopyrightText: 2024 Howetuft
#
# SPDX-License-Identifier: Apache-2.0
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.system.package_manager import Brew, Yum
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import get, copy, rmdir, rename, rm, save
import os
import io
import shutil
from pathlib import Path
_boost_version = os.environ["BOOST_VERSION"]
_ocio_version = os.environ["OCIO_VERSION"]
_oiio_version = os.environ["OIIO_VERSION"]
_oidn_version = os.environ["OIDN_VERSION"]
_openexr_version = os.environ["OPENEXR_VERSION"]
_blender_version = os.environ["BLENDER_VERSION"]
_openvdb_version = os.environ["OPENVDB_VERSION"]
_tbb_version = os.environ["TBB_VERSION"]
_spdlog_version = os.environ["SPDLOG_VERSION"]
_embree3_version = os.environ["EMBREE3_VERSION"]
_fmt_version = os.environ["FMT_VERSION"]
class LuxCore(ConanFile):
name = "luxcorewheels"
version = "2.9alpha1"
user = "luxcorewheels"
channel = "luxcorewheels"
requires = [
f"opencolorio/{_ocio_version}",
"minizip-ng/4.0.3",
"libpng/1.6.42",
f"spdlog/{_spdlog_version}",
f"openimageio/{_oiio_version}@luxcorewheels/luxcorewheels",
"c-blosc/1.21.5",
f"boost/{_boost_version}",
f"boost-python/{_boost_version}@luxcorewheels/luxcorewheels",
f"openvdb/{_openvdb_version}",
"eigen/3.4.0",
f"embree3/{_embree3_version}",
"tsl-robin-map/1.2.1",
f"blender-types/{_blender_version}@luxcorewheels/luxcorewheels",
f"oidn/{_oidn_version}@luxcorewheels/luxcorewheels",
]
default_options = {
"fmt/*:header_only": True,
"spdlog/*:header_only": True,
"openimageio/*:with_ffmpeg": False,
"openimageio/*:with_libheif": False,
"embree3/*:neon": True,
}
settings = "os", "compiler", "build_type", "arch"
# Note: LuxCoreRender is sourced by Github action (see Checkout LuxCoreRender)
def requirements(self):
self.requires(
f"onetbb/{_tbb_version}",
override=True,
libs=True,
transitive_libs=True,
) # For oidn
self.requires(
f"libdeflate/1.22",
force=True,
libs=True,
transitive_libs=True,
)
self.requires("imath/3.1.9", override=True)
self.requires(f"fmt/{_fmt_version}", override=True)
if self.settings.os == "Macos":
self.requires("llvm-openmp/18.1.8")
if self.settings.os == "Windows":
self.tool_requires("winflexbison/2.5.25")
def build_requirements(self):
self.tool_requires("cmake/*")
self.tool_requires("meson/*")
self.tool_requires("ninja/*")
self.tool_requires("pkgconf/*")
self.tool_requires("yasm/*")
def generate(self):
tc = CMakeToolchain(self)
tc.absolute_paths = True
tc.preprocessor_definitions["OIIO_STATIC_DEFINE"] = True
tc.preprocessor_definitions["SPDLOG_FMT_EXTERNAL"] = True
tc.variables["CMAKE_COMPILE_WARNING_AS_ERROR"] = False
# OIDN denoiser executable
oidn_info = self.dependencies["oidn"].cpp_info
oidn_bindir = Path(oidn_info.bindirs[0])
if self.settings.os == "Windows":
denoise_path = oidn_bindir / "oidnDenoise.exe"
else:
denoise_path = oidn_bindir / "oidnDenoise"
tc.variables["LUX_OIDN_DENOISE_PATH"] = denoise_path.as_posix()
# OIDN denoiser cpu (for Linux)
oidn_libdir = Path(oidn_info.libdirs[0])
tc.variables["LUX_OIDN_DENOISE_LIBS"] = oidn_libdir.as_posix()
tc.variables["LUX_OIDN_DENOISE_BINS"] = oidn_bindir.as_posix()
tc.variables["LUX_OIDN_VERSION"] = _oidn_version
if self.settings.os == "Linux":
denoise_cpu = oidn_libdir / f"libOpenImageDenoise_device_cpu.so.{_oidn_version}"
elif self.settings.os == "Windows":
denoise_cpu = oidn_bindir / "OpenImageDenoise_device_cpu.dll"
elif self.settings.os == "Macos":
denoise_cpu = oidn_libdir / f"OpenImageDenoise_device_cpu.{_oidn_version}.pylib"
tc.variables["LUX_OIDN_DENOISE_CPU"] = denoise_cpu.as_posix()
if self.settings.os == "Macos" and self.settings.arch == "armv8":
tc.cache_variables["CMAKE_OSX_ARCHITECTURES"] = "arm64"
if self.settings.os == "Macos":
buildenv = VirtualBuildEnv(self)
bisonbrewpath = io.StringIO()
self.run("brew --prefix bison", stdout=bisonbrewpath)
bison_root = os.path.join(bisonbrewpath.getvalue().rstrip(),"bin")
buildenv.environment().define("BISON_ROOT", bison_root)
flexbrewpath = io.StringIO()
self.run("brew --prefix flex", stdout=flexbrewpath)
flex_root = os.path.join(flexbrewpath.getvalue().rstrip(),"bin")
buildenv.environment().define("FLEX_ROOT", flex_root)
buildenv.generate()
tc.presets_build_environment = buildenv.environment()
tc.generate()
cd = CMakeDeps(self)
# Alternative filenames
cd.set_property("c-blosc", "cmake_file_name", "Blosc")
cd.generate()
def package(self):
# Just to ensure package is not empty
save(self, os.path.join(self.package_folder, "dummy.txt"), "Hello World")
def layout(self):
cmake_layout(self)
def package_info(self):
if self.settings.os == "Linux":
self.cpp_info.libs = ["pyluxcore"]
elif self.settings.os == "Windows":
self.cpp_info.libs = [
"pyluxcore.pyd",
"tbb12.dll",
]