1
1

Compare commits

...

223 Commits

Author SHA1 Message Date
362d5b42c8 USD: error importing texture from empty path.
Added check for empty path before attempting to import
textures.
2022-12-07 19:59:52 -05:00
48eef11eb0 Merge branch 'universal-scene-description' into tmp-dynamic-usd 2022-12-07 14:36:08 -05:00
f6bc13b21b Merge branch 'tmp-vfx-platform-2023' of git.blender.org:blender into tmp-dynamic-usd 2022-12-07 12:48:26 -05:00
32b8a598dc USD: new URI import/export options.
Added USD URI string IO options, to allow specifying
the filepath as a URI.
2022-12-06 22:34:52 -05:00
c7f725c1f8 deps: support for dynamic ocio + python bindings 2022-12-06 17:46:13 -07:00
011f3dde48 deps builder: dynamic ocio and py bindings on windows 2022-12-06 17:43:16 -07:00
a79cfe6435 Fix missing OpenImageIO python bindings harvest on Linux/macOS 2022-12-06 21:14:45 +01:00
a44a6cf4c4 OpenImageIO: update to 2.4.6.0 2022-12-06 20:37:23 +01:00
513b639df9 OSL: set to 1.12.7.1 instead of specific hash
It's no longer required after fixes, just use latest official now.
2022-12-06 14:57:52 +01:00
e59baa8de9 macOS: don't stop hiding usdBlender symbols before libraries land 2022-12-05 23:34:33 +01:00
9b9f8053ce Cleanup: whitespace 2022-12-05 23:33:59 +01:00
7d1be8f6bb Build: fully disable MaterialX, auto clear OpenColorIO variables also 2022-12-05 22:10:16 +01:00
6fec2c4ff4 Merge branch 'master' into tmp-vfx-platform-2023 2022-12-05 22:06:08 +01:00
3ae85e0559 Build: don't enable MaterialX yet, only after libraries land for all platforms 2022-12-05 22:05:10 +01:00
05560d3425 Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-12-05 12:49:55 -07:00
9f662b383b Build: make OpenColorIO dynamic library and enable Python bindings
And fix some missing python/pybind11 dependencies.

Needs more work for Windows.
2022-12-05 19:12:55 +01:00
a2ee7e820b Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-12-05 08:24:33 -07:00
98670cfe82 USD import: Defined Primitives Only option.
New option to load defined primitives only. This may be
turned off to allow loading overrides with the Path Mask.
2022-11-29 14:18:06 -05:00
396a8b8ad8 USD import: import textures for UMM.
Added logic to support importing textures when invoking
UMM shader conversion.
2022-11-28 19:14:45 -05:00
35c7e74af9 Merge branch 'tmp-vfx-platform-2023' into tmp-dynamic-usd 2022-11-28 18:32:32 -05:00
da01237d36 Fix libsndlib picking up system libopus
Build against our own instead.
2022-11-28 17:32:27 +01:00
3b08062b34 MaterialX: various changes
* Install datafiles in shared library folder
* Various fixes to make it work on macOS/Linux
* Disqble MaterialXRender modules
* Use sitecustomize instead of usercustomize mechanism, as the latter
  seems to be disabled by default and site seems more correct anyway.
2022-11-28 17:32:23 +01:00
8c8abae971 Fix collada patch apply issue on macOS 2022-11-28 16:24:48 +01:00
91ba17da8b USD import textures option.
Added USD import option to copy textures which are
not on the local file system (e.g., textures in USDZ
archives or those specified by custom URIs) to a
designated directory using the USD ArResolver.
2022-11-28 09:56:15 -05:00
e176dba6de USD: export in-memory textures through resolver.
Also, added allow_overwrite paramter to export_textures().
2022-11-25 16:03:07 -05:00
90f1d1f4b6 USD Import: Support multiple prim path masks.
Extended the Prim Path option to support multiple path
entries, delimited by commas, spaces or semicolons.
2022-11-23 14:13:17 -05:00
04f697887e deps: Add oiio python bindings
This adds the python bindings for OIIO tested
on windows only at this point. New build time
dep pybind11 which is header only.
2022-11-22 10:29:17 -07:00
a7875fdac6 Deps: Add 2 missing files for MaterialX 2022-11-22 10:26:28 -07:00
2f385b0df1 Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-11-21 14:02:13 -07:00
1c33d1813d deps/win: support building against older lib folder
We try to support both 3.4 and 3.5 lib folders to make
bisecting a little easier. Disable materialX if it is
not found in the windows library folder. Linux already
does this.
2022-11-21 12:58:26 -07:00
Georgiy Markelov
4c48a1f7c7 deps_builder: Add materialX 1.38.6
This adds materialX to the deps builder, short term only the python
bindings are expected to be used, but libraries are included for
future use by blender as well. Some further work may need to be done
in having MaterialX find its library.

Reviewed by: brecht lazydodo
Differential Revision: https://developer.blender.org/D15989
2022-11-21 11:07:55 -07:00
3a5256307d deps: cleanup python windows build
Move linking the openssl and zlib folders to the patch step
so you can run several builds in a row without having to
remove the folder

also fix typo in the patch
2022-11-19 10:40:19 -07:00
155d0df5a5 Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-11-18 09:44:55 -07:00
c8fee4ce2d deps: use meson from the builder rather than system
The only deps that were updated were the ones that did
not work with the stand-alone meson. best to use the
same meson version uniformly across all deps.
2022-11-18 09:44:30 -07:00
bb8433f76a USD export: copy UDIM textures with resolver. 2022-11-15 19:42:08 -05:00
b8e6440430 USD export: copy textures with asset resolver.
Refactored the texture export code to copy the texture
by invoking the asset resolver.
2022-11-15 15:44:49 -05:00
19a7c7f4e1 USD export: added get_textures_dir() utility. 2022-11-14 20:55:20 -05:00
922e3ef4c2 USD IO: USD_path_abs() logic update.
For Blender relative paths that start with "//",
now also invoking the USD resolver on the absolute
path resolved by Blender.
2022-11-14 12:07:10 -05:00
b157d0b97e Merge branch 'universal-scene-description' of git.blender.org:blender into tmp-dynamic-usd 2022-11-11 14:37:36 -05:00
4d9b898e0e USD IO: invoke resolver to write USDZ.
Added new copy_usd_asset() function to invoke the USD
asset resolver to copy a file.  Updated the USDZ export
logic to use this function when copying the temporary
USDZ file to its final destination.
2022-11-11 14:35:03 -05:00
72cbb44e02 Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-11-11 10:01:21 -07:00
fa1b64eaed deps: fix USD build on linux 2022-11-10 17:22:20 -07:00
f8011249b4 deps: fix harfbuzz build on linux 2022-11-10 17:21:47 -07:00
140a83e202 Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-11-10 12:03:13 -07:00
4ab6ee68ab USD IO: function to resolve USD paths.
Added USD_path_abs() funcion, which is similar to BLI_path_abs(),
but which also invokes the USD asset resolver to determine the
absolute path. This is necessary for resolving paths with URIs
that BLI_path_abs() would otherwise alter when attempting to
normalize the path. Now calling USD_path_abs() where needed
to resolve USD paths for import.
2022-11-10 13:41:56 -05:00
24bd098dba Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-11-09 15:23:52 -07:00
32aebe8c55 Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-11-09 11:29:21 -07:00
0660f6e7dc OSL: enable OptiX support and use hash instead of official release
There is an issue with the latest OSL that we need to get fixed so we can
avoid using the older hash. Hoping to get this fixed before the new 3.5
libs go to master.

Ref D15902
2022-11-09 18:40:09 +01:00
5d772ac1fb deps_builder: add missing oiio dep to USD 2022-11-08 11:12:11 -07:00
f3e0685222 Fix missing Python dependency in shaderc 2022-11-08 13:57:35 +01:00
eef1900d51 Fix failing tests on macOS due wrong library path for idiff 2022-11-08 12:10:59 +01:00
4d8c634820 USD export: access deform verts as custom data.
Due to a recent Blender API change, MDeformVert entries
must be read as custom data.
2022-11-07 22:34:26 -05:00
a400935d29 Merge branch 'tmp-vfx-platform-2023' into tmp-dynamic-usd 2022-11-07 19:37:51 -05:00
c80f3f0d17 Fix USD/OpenColorIO build issues on macOS 2022-11-07 23:29:41 +01:00
71b635fb5a Fix missing minizipng dependency on zlib, build error on macOS 2022-11-07 22:47:33 +01:00
036e10e546 Merge branch 'universal-scene-description' into tmp-dynamic-usd 2022-11-07 12:31:34 -05:00
d8dab1ba97 deps: add missing dependency
mesa depends on zlib, dependency was missing but it
was using the libs anyhow. Hasn't caused a problem since
zlib tends to build first anyhow.
2022-11-07 08:24:54 -07:00
531fadfe4b deps: restore openpgl harvest
likely got lost in a troublesome master merge
2022-11-07 08:19:12 -07:00
35ee8fa95a Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-11-05 10:30:17 -06:00
de15fc7d4f deps: prevent _d_d for usd python extentions on windows 2022-11-04 18:09:21 -06:00
d2fa7813d1 cmake/win: fix failing tests on windows
idiff/abcls rely on the release mode dlls not available in the
blender.shared folder.
2022-11-04 13:35:15 -06:00
30c14dd783 deps: Remove unneeded OSL patch
OSL has proper lifetime management these
days.
2022-11-04 11:51:37 -06:00
e306f1fffc Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-11-03 09:51:29 -06:00
33f8c515d1 deps: USD 21.11
also small patch to OpenVDB due to USD (C++14) and OpenVDB(C++17)
running into trouble together.
2022-11-03 09:41:58 -06:00
48214e2357 deps: openvdb 10.0.0 2022-11-02 15:13:01 -06:00
0f7433a4c8 USD export: fix curve widths calculation.
Now multiplying the curve radius values by the bevel radius
when calculating curve widths.  Change authored by
Charles Wardlaw.
2022-11-02 16:27:57 -04:00
47a5eba7f5 deps_builder: opensubdiv 3.5.0 2022-11-02 13:11:03 -06:00
f428fe774b USD import: replace deprecated shape import code.
The static functions GetMeshPoints() and GetTopology()
have been removed from the adapter classes in USD 22.11.
In anticipation of this change, the code was updated to
call the corresponding virtual functions instead.
Change authored by Charles Wardlaw.
2022-11-02 14:30:00 -04:00
9e579fb2fd cmake: support ocio 2.2.0 on windows
small changes in libnames and an extra new
dependency.
2022-11-01 22:24:18 -06:00
f25c259345 deps_builder: OpenColorIO 2.2.0
Also required updates for yamlcpp from 0.6.3 to 0.7.0
and a new mandatory dependency minizip-ng 3.0.7
2022-11-01 22:22:59 -06:00
e20c9990d8 Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-11-01 23:12:07 -06:00
09a02e8714 deps_builder: shaderc v2022.3 / Vulkan v1.2.198
viewport module specifically requested an older vulkan version
this may still change before the 3.5 libs finalize.
2022-10-31 10:05:37 -06:00
e697442f09 deps_builder/win: use our openssl version for python
Python will take care of the build, we only need to unpack openssl
in the right place and python's prepare_ssl will patch and build
openssl for us.
2022-10-30 13:07:16 -06:00
ce3a045009 CMake: Copy USD 21.11 datafiles to the right location.
We used the presence of USD dll as an indicator we were
using dynamic libs where the datafiles sit next to the
DLL. 22.11 changed the dll name, so it wrongly assumed
we were using static libs and copied the USD datafiles
into the blender datafiles folder instead.
2022-10-29 10:02:33 -06:00
0355f1c09b cmake: support building against USD 22.11 2022-10-28 11:36:17 -06:00
7e0fb88a68 USD export: export textures for Cycles materials. 2022-10-27 15:25:47 -04:00
7e60d38e6c deps_builder: disable maintainer mode for opus
this requires autotools, which isn't available
on our mingw setup. Unsure why it suddenly became
a problem.
2022-10-27 12:47:27 -06:00
f4ecc02e48 deps_builder: remove 3.4 OSL patches
Got added during the last master merge. The boost one is no longer
needed and the PNG one is already there.
2022-10-27 09:07:25 -07:00
a070960b5d Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-10-27 01:17:45 -07:00
4fa478c724 USD Export: handle meshes in edit mode.
Small change to ensure Edit mode meshes are committed during the
export process.  Without this change, meshes may be empty in the
USD.  This update was authored by Charles Wardlaw.
2022-10-26 19:58:28 -04:00
a0a3e271a5 Merge branch 'tmp-vfx-platform-2023' into tmp-dynamic-usd 2022-10-25 14:54:58 -04:00
1fbec423f2 cmake: fix missing crlf's
went missing during the last master merge
2022-10-25 11:48:18 -06:00
74156ae0ea Windows: Fix broken OSL shader build
some changes in platform/platform_win32.cmake got lost during
one of the master merges.
2022-10-25 10:40:07 -06:00
269a903c15 Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-10-25 10:10:14 -06:00
784ea87375 Merge branch 'master' into universal-scene-description 2022-10-24 15:28:20 -04:00
75064c7024 USD import: crash reading shapes.
Updated the mesh reading code when reading shapes,
to fix a crash due to the updated mesh API introduced
in the last merge from master.
2022-10-24 11:17:57 -04:00
ae342e00ca USD Import: hide instance prototype collections.
Now hiding the instance prototype parent collection in
both the viewport and render.  This change was also
necessary because the previous code for hiding
prototype layer collections stopped working with the
latest merge from master.
2022-10-20 16:37:11 -04:00
471636ffcd USD Import: fix error messages loading instances.
Added logic to avoid attempting to bind the pxr::UsdSkelBindingAPI
to instance proxies and prototypes, as this was generating errors.
2022-10-19 15:15:47 -04:00
cf8cf884d1 Merge branch 'master' into universal-scene-description 2022-10-18 14:16:53 -04:00
f8e871168a Fix linux/mac build warnings and errors. 2022-10-17 16:33:09 -04:00
50a3004328 USD Import: support reading USD shapes.
Added readers for importing USD shapes (capsule, cylinder,
cone, cube and sphere) as meshes.  Implemented by Charles
Wardlaw.
2022-10-17 15:11:42 -04:00
9c1dec0d18 deps_builder: limit llvm/dpcpp to c++14
We build all deps with the -DCMAKE_CXX_STANDARD=17
flag. llvm however will not switch over to C++17
until llvm 16.0, and building older versions with
this flag is leading to some crashes inside ispc
when building with MSVC

So for both llvm and dpcpp remove the -DCMAKE_CXX_STANDARD=17
flag, this is done for all platforms since we should
not be overriding llvm's preferences here.
2022-10-13 21:08:18 -07:00
13a492dd9f deps_builder: fix harbuzz build on windows
harfbuzz will only ever like freetype.lib
and will not be convinced by any other names
so just give it what it wants, there's no
fighting it without sinking in more time
than it is worth.
2022-10-12 17:55:35 -07:00
f66185fffd deps_builder: Silence CMP0135 warnings
CMake 3.24+ has the option to set the time
stamp of extracted file to the time of
extraction rather than the time in the
archive. Which is nice, it also however
added a multi line warning when you do
not explicitly set this option. So that
got a little noisy.

This change explicitly picks the new
policy and thus silences the warning.
2022-10-12 15:06:04 -07:00
fa115a317e build_deps.cmd: fix windows runtime paths
shared libs for oiio/openexr/imath were not
found breaking the osl build
2022-10-12 06:48:17 -07:00
824e18adb1 Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-10-11 13:30:30 -07:00
a067e59004 USD Import: validate meshes option.
Added feature flag "Validate Meshes" to strip invalid geometry
from meshes on import.
2022-10-10 12:48:43 -04:00
e4919873bc cmake: fix stray endif in platform_apple.cmake
Likely the result of a merge I did yesterday that had
some conflicts.
2022-10-06 12:37:35 -06:00
2d603ab463 Fix: merge mistake in previous commit
blender_include_dirs has been renamed
to absolute_include_dirs.
2022-10-05 11:19:46 -06:00
42736e0b3f Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023 2022-10-05 09:46:18 -06:00
42ce93a2cb Add temporary svn library branch names for buildbot testing
This way branches for USD/Hydra development branches can be based on
tmp-vfx-platform-2023 until these libraries are in master.
2022-09-30 18:12:53 +02:00
61a9ee88a3 USD import: handle context-dependent UDIM paths.
This change helps address the issue where contex-dependent
UDIM texture paths (e.g., '0/foo.<UDIM>.png') were not getting
resolved by the call to SdfLayer::::ComputeAbsolutePath().
To work around this limitation, I updated the code to compute
the absolute path on just the parent directory portion of
the UDIM file path. This makes the simplifying assumption that
context-dependent asset paths are essentially relative paths,
which might not always be correct.  It's not clear how
else to efficiently address this without performing a
potentially expensive search.
2022-09-29 20:16:07 -04:00
69251411bc USD Export: Added triangulate options 2022-09-28 14:36:41 -04:00
fb1f756bd1 USD export to USDZ.
USDZ export code developed by Sonny Campbell in
patch D15623, which is currently under review.

Charles added USDZ Texture downsample export functionality
and a switch for creating ARKit assets during USDZ export.
2022-09-26 18:19:42 -04:00
90e1c892b7 USD Export: Save Blender file path to metadata.
Write source Blender file path to stage customData.
2022-09-19 16:03:11 -04:00
19fa05d37c USD skel export fixes.
Fixed error in USDSkinnedMeshWriter which was causing
the mesh to be written more than once when exporting
blendshapes is disabled.  Also removed unnecessary
warnings when the mesh has deform groups that don't
match any bones.

Updated USDBlendShapeMeshWriter to skip creating a
blendshape neutral mesh if exporting blendshapes is
disabled.

Added more descriptive error message when the shape key
offset count doesn't match the mesh vertex count.  Now
exporting the default mesh when this size mismatch is
detected.
2022-09-02 18:51:55 -04:00
95185f6e7e USD IO: fixed includes.
Fixed include order to fix build error.
Also removed unneeded includes.
2022-08-30 19:41:37 -04:00
219a71a427 USD import: fix mac build warnings and error. 2022-08-30 19:03:16 -04:00
5156e12a0a Merge branch 'master' into universal-scene-description 2022-08-30 18:13:18 -04:00
5e54c0cbf1 USD export: fix skel root by default.
Now enabling fixing the skel root hierarchy on export
by default.  Also removed 'Experimental' from the
'Armatures' export option label.
2022-08-30 17:06:21 -04:00
095f016fc0 USD import: read skeletons.
Added new option to import USD skeletons as Blender
armatures.  Added new USDSkeletonReader class and
updated the mesh import code to optionally create
armature modifiers for meshes bound to skeletons.
Added logic to the mesh reader to allow overriding
the mesh transform to ensure the mesh is aligned
with the authored geom bind transform.
2022-08-30 15:15:42 -04:00
0160c2aab0 deps/win: Fix USD debug build linker error 2022-08-26 15:07:36 -06:00
1027f4c186 deps: fix idiff failing in debug builds.
We only ship the release idiff on windows
which needs the release dll's not available
in the blender.shared folder when doing
a debug build.
2022-08-26 09:07:31 -06:00
d368567b70 Merge remote-tracking branch 'origin/master' into tmp_libupdate_34 2022-08-26 07:16:47 -06:00
a66757f130 Merge remote-tracking branch 'origin/master' into tmp_libupdate_34 2022-08-25 23:02:26 -06:00
252b3ec381 Clarify comment and code for enabling USD OpenGL support. 2022-08-25 15:20:05 +02:00
8121fedbf5 Move usercustomize.py to less conspicuous location 2022-08-25 14:44:28 +02:00
57e0b2e5fd fix: usd not importing on windows 2022-08-24 18:17:17 -06:00
ecc61b4f02 deps/windows: add backport USD 20.08 patch for openvdb
code that uses OpenVDB needs _USE_MATH_DEFINES defined
or it will have build errors on windows.

Based on 33fd2b0511
2022-08-24 15:02:23 -06:00
d729906393 Enable OpenGL, Metal and OpenImageIO in USD library
Not tested on Windows.
2022-08-24 20:21:59 +02:00
fbfcc5a544 Make OpenImageIO and OpenEXR dynamic libraries work on Linux / macOS
I tried to make the mechanism for setting the right environment for oslc and
idiff a bit more generic, hopefully did not break Windows.
2022-08-24 20:21:59 +02:00
659bcb3b10 Set rpaths for all libraries in harvest step
Each library has different logic here. Instead of trying to patch code or
find the right build options for each, set rpath ourselves.
2022-08-24 16:12:33 +02:00
045816e66d deps: Dynamic OIIO+OpenEXR
Tested on windows only
2022-08-23 15:25:40 -06:00
0cd8aaef60 Merge branch 'master' into tmp_libupdate_34 2022-08-23 16:19:02 +02:00
a58f13fcc4 deps: Refix T88813
Change got lost when I salvaged parts of D6399
2022-08-22 12:02:19 -06:00
7eb3008d99 USD: Fix failing tests with 3.3 libs 2022-08-22 10:11:12 -06:00
490d236499 Deps/Windows: Remove bzip 1.0.8 patch
not needed since 3.4 is already on python 3.10.6 which
ships with bzip 1.0.8 out of the box.
2022-08-22 09:27:17 -06:00
0546815230 Merge remote-tracking branch 'origin/master' into tmp_libupdate_34 2022-08-22 09:25:44 -06:00
f08bf4bd6b Fix: Startup issues for some tests on windows
Wrong path was set to the shared libs.
2022-08-22 09:24:36 -06:00
f058e870af fix build issue on bots
- Manifest should only be generated on windows
- Boost dll's should only be installed when they exist
2022-08-21 01:59:04 -06:00
af626a6868 deps/windows: fix usd import with standalone python
- move all shared libraries to the blender.shared folder
- install a usercustomize.py to tell python where this folder is
- move USD json folder to a location relative to the shared lib
- Disable USD plugin location hinting for windows
- Fix all tests that broke due to the above.
2022-08-21 01:43:14 -06:00
f523ec99d8 Fix: build mantaflow build issue on windows
boost 1.80 does not like it when snprintf gets
redefined
2022-08-19 17:37:42 -06:00
497f90e2a1 deps: boost/python/numpy/cython updates
boost 1.80.0
python 3.10.6
numpy 1.23.2
cython 0.29.30
2022-08-19 17:36:47 -06:00
f7cc90105a deps: fix opencollada build on windows
opencollada was not compatible with vs 2019 as
build system, tr1 headers are no longer available
as they are just regular headers now.
2022-08-19 17:35:27 -06:00
271cfbc146 deps: fix USD windows debug build 2022-08-19 17:34:12 -06:00
c031007220 Merge branch 'tmp_libupdate_34' of git.blender.org:blender into tmp_libupdate_34 2022-08-17 17:55:24 -06:00
5b9926521a cleanup: remove superfluous plugin setup calls
ensure_usd_plugin_path_registered is called at
blender startup now, the test code does it's
own thing, so the individual functions no longer
have to worry about this.
2022-08-17 17:54:59 -06:00
9f8ae96ccc Fix macOS build issues 2022-08-17 23:04:11 +02:00
a0b154ff70 Merge branch 'tmp_libupdate_34' of git.blender.org:blender into tmp_libupdate_34 2022-08-17 14:14:33 -06:00
fb758b097c attempt to fix ffmpeg test on windows
I can't seem to reproduce the failing test on
my local system, i'm moving the ffmpeg test into
the blender_test executable rather than it's own
binary, hopefully that'll do the trick as all
other tests seem to pass in that one.
2022-08-17 14:14:11 -06:00
7a64650ccc Keep Blender building with 3.3 libraries on Linux/macOS 2022-08-17 19:46:13 +02:00
8af30fd7e0 Merge remote-tracking branch 'origin/master' into tmp_libupdate_34 2022-08-17 19:40:09 +02:00
f420ef6e61 Fix Python module build for Linux/macOS
However this puts a lib/ folder directly in site-packages which is not great.
There is already a 3.4 folder there which really is wrong as well. A proper
solution would be to move everything into a bpy/ folder instead of having a
bpy.so at the top level.
2022-08-17 16:51:05 +02:00
4bc212c115 Cleanup: revert earlier changes which are no longer needed 2022-08-17 16:28:27 +02:00
bf21a78103 More rpath changes for Linux
* Change rpath of Python modules instead of Python executable, to solve issues
  with indirect dependency loading on Linux.
* Simplify build step rpath on Linux, only need absolute path to lib install dir.
2022-08-17 15:36:11 +02:00
4c1cedbbcd fix building with 3.3 lib folder on windows 2022-08-16 18:36:37 -06:00
12f8f1bfd1 Fix failing blender_test on Linux 2022-08-16 21:50:19 +02:00
c8ce653229 Fix install error on non-Windows 2022-08-16 21:42:26 +02:00
ead394996e Stop statically linking libstdc++ on Linux
With the addition of shared libraries this doesn't work anymore. The shared
libraries use dynamical linking, and having each library with their own static
copy seems problematic.

The use of this predates our switch to CentOS 7. I hope that there is just
no need for this anymore, but it's not entirely clear.
2022-08-16 20:46:29 +02:00
01d764f27a Add automatic upgrade of cmake cache on Linux/macOS 2022-08-16 20:46:29 +02:00
a44f59a961 Blender build system changes for new shared libraries and modules on Linux/macOS
PLATFORM_BUNDLED_LIBRARY_DIRS is added to the rpath for the build steps so
no libraries have to be copied.

PLATFORM_BUNDLED_LIBRARIES are copied to the lib folder in the install step.
The Blender gets its rpath point to this lib older as part of the install
step. The Python executable already contains an rpath to the lib folder.

For site packages installation on Linux, just copy over the entire library
directory as we do for macOS to simplify things.
2022-08-16 20:46:29 +02:00
fd73e63dd2 Remove blosc as direct dependency, it's inside the openvdb shared library
Don't harvest and don't link blender to it.
2022-08-16 20:46:29 +02:00
26ecc04a7c Fix build error missing usd.h 2022-08-16 20:46:29 +02:00
4d8301dcb2 Cleanup: formatting and simplification 2022-08-16 20:46:29 +02:00
8c5f0d85f6 Download sse2neon package instead of git checkout
Solves issue where it always re-installs.
2022-08-16 20:46:29 +02:00
d05c358bf1 USD build options changes
* Enable OpenVDB
* Remove custom usdBlender namespace
2022-08-16 20:46:29 +02:00
d4d9943b6c Various deps builder fixes for Linux/macOS
* Enable C++17. Silences warning in OpenVDB, and doing this right may be more
  important now that USD becomes a public C++ API.
* Various fixes for OpenVDB
* Ensure libraries have relative @origin or $ORIGIN rpath without absolute
  paths. Default assumption in most libs seems to be a fixed install location.
* Don't link static Python lib with interpreter symbols into USD library.
* Harvest fribidi and harfbuzz
* Harvest OpenVDB and USD python modules into python site-packages
* Don't harvest meson in site-packages
2022-08-16 20:46:29 +02:00
69d09bd3f5 deps: cleanup boost install
cmake folder still got copied
2022-08-16 10:34:38 -06:00
8e5d51cfb3 deps: restore more of creators CMakeLists.txt
Last merge made kind of a mess, and i restored the wrong
version previously, should be ok again now.

Add working directory for python tests so the cycles
test will now pass, which failed previously since idiff
could not find its required boost dlls
2022-08-16 09:48:20 -06:00
fdc7aaa8df fix: bad merge in previous commit
source/creator/CMakeLists.txt got truncated somehow.
2022-08-15 13:38:55 -06:00
1dfe4938cd Merge branch 'master' into universal-scene-description 2022-08-14 17:16:40 -04:00
3f3910966a USD import: invalid UsdUVTexture input crash.
Fixed crash when accessing invalud texture file
inputs.
2022-08-14 15:58:02 -04:00
a61fdcd349 USD blendshape import errors for instances.
No longer attempting to create a skel binding on
instance proxies and proxies, as doing so generates
USD errors.
2022-08-14 14:24:09 -04:00
8692840127 deps: fribidi and harfbuzz build support on linux
still todo: harvest
2022-08-13 18:13:54 -06:00
bd460290bc deps: add fribidi 1.0.12 and harfbuzz 5.1.0
Also adds buildtime dep meson

tested on windows only at this point
2022-08-13 15:41:32 -06:00
62829486a3 Deps: OIIO 2.3.18.0 2022-08-13 14:16:58 -06:00
9a2680a626 USD import: fixed typo in debug message.
This was also causing mac and linux compile errors.
2022-08-11 20:06:28 -04:00
a37e7e682f USD import: fix errors loading pixar example.
Fixed errors loading Pixar UsdSkel sample
HumanFemaleKeepAlive.usd: now reading the inherited
skeleton and animation and no longer creating curves
for blendshapes that weren't imported as shapekeys
for a given shape.
2022-08-11 19:12:19 -04:00
0430f74b0a Merge remote-tracking branch 'origin/master' into tmp_libupdate_34 2022-08-11 10:51:50 -06:00
69d3054b51 deps builder: updates for 3.4
- Enable python bindings for openvdb
- Move some more deps to ninja on windows
- Bump openvdb to 9.1.0 since it had AX support for windows, but due to size concerns disabled
- Fix dependencies for a few deps to sort out build order issues
- Limit build_deps.cmd to a single core, so it won't oversubscribe the CPU
2022-08-11 10:40:23 -06:00
833df7ebc1 USD import blendshapes.
Importing USD blendshapes as shapekeys and creating
animation curves for animated blendshape weights.
2022-08-10 23:19:57 -04:00
fadc135c50 deps/fmt: disable doc target
requires python, and we don't really need the doc target
so disable it.
2022-08-10 07:53:21 -06:00
b665ae266d USD export armatures with shapekeys WIP.
Extended USDSkinnedMeshWriter to support exporting
blendshapes.
2022-08-07 14:07:07 -04:00
a2d6093317 deps: fix windows usd python install
The debug/release python folders need to be
separated since there is not easy way to keep
creators installer from grabbing the wrong pyd's
during install.
2022-08-05 15:04:37 -06:00
82a04687a7 Updates for debug builds on windows 2022-08-05 13:09:40 -06:00
9a43a2fcd7 Initial work of D15604 2022-08-05 13:00:09 -06:00
1770d462cc USD export: fix armature export.
Fixed a bug that was preventing armature writers
from being created, due to a missing break statement,
introduced after the latest merge from master.
2022-07-27 12:23:21 -04:00
1417bf6525 Added missing include to fix linux/mac build. 2022-07-26 22:19:35 -04:00
df1edf2934 Added missing include.
To fix linux/mac build errors.
2022-07-26 21:48:58 -04:00
fa2de72f86 USD export: convert shapekeys to blendshapes.
Added option to export shapekeys as UdsSkel blendshapes.
Implemented a new USDBlendShapeMeshWriter class to export
meshes that have shapekeys defined.  Currently, only relative
shapekeys are converted to blendshapes.  Absolute shapekeys
are exported as deformed meshes.  The current implementation
doesn't handle shapekeys on meshes bound to armatures that are
expored as skinned meshes.
2022-07-26 21:08:59 -04:00
9374a3dbf0 Merge branch 'master' into universal-scene-description 2022-07-17 12:23:26 -04:00
0869c6b46d Revert "USD import: temp fix for broken UDIMS."
This reverts commit 7aa4b6f9.

An alternate fix was applied in the latest master branch.
2022-07-16 20:46:31 -04:00
1d5d49775c USD import: fix light intensity scaling.
Updated light intensity calculations on import
to preserve values on round trip Blender ->
USD -> Blender.
2022-06-14 23:56:43 -04:00
9d39948871 USD export: ensure packed texture file extension.
Updated in-memory texture path generation logic to
ensure the path has a valid extension for the image
format.  Also moved duplicate code for identifying
in-memory textures into a common function.
2022-06-06 12:26:02 -04:00
06022f7891 USD export: Convert uv to st by default.
Enabling the "Convert uv to st" export option by default.
2022-05-14 18:54:53 -04:00
7aa4b6f93f USD import: temp fix for broken UDIMS.
Applying patch authored by Jesse Yurkovich to support
single file UDIMs, while this code is still under review,
to temporarily prevent a regression for those testing USD
features.  If the patch is rejected or rewritten, it might
be necessary to back out this commit or merge it with the
latest changes.
2022-05-14 18:12:10 -04:00
69c2c9de0f USD import: preview surface fallback.
Added logic to fall back on importing USD Preview Surface
shaders, if possible, if importing MDL is specified but
an MDL couldn't be imported.
2022-05-14 16:05:32 -04:00
900ddd763a USD import: read all color primvars.
Now converting all color primvars to custom mesh data,
if the Color Attributes import option is enabled.  Also,
now enabling the Color Attributes option by default.
2022-05-11 21:37:42 -04:00
00aa4252c5 Updates to build with USD 21.11. 2022-05-02 20:22:01 -04:00
8f17cb2052 Merge branch 'master' into universal-scene-description 2022-05-02 20:17:10 -04:00
82964294a5 USD Import: Incorrect merge of untyped prims.
Fixed bug where prims with undefined types were incorrectly merged
with parent xforms on import.  In some cases, this was causing
root xforms to be lost and prevented unit scale from being applied.

As an example, a scene with a single untyped prim parented to the
top level World xform would result in the World and untyped prim
being merged into a single Blender object representing only the
untyped prim.  Moreover, the UsdXformReader logic for identifying
root transform objects would fail in this case and no scene scale
would be applied to the imported hierarchy.
2022-04-25 14:18:43 -04:00
d742007c8e USD export: convert active UV map to st.
Updated the logic of the convert_uv_to_st option to rename the
active UV set to 'st', to allow specifying the default UV set
when there are multiple UVs.  Previously, this option assumed
a single UV set.
2022-04-12 18:17:13 -04:00
2b3f5cb965 USD export: handle USD Preview Surface emission.
Now setting the USD Preview Surface emissiveColor input
on export.
2022-04-11 21:12:10 -04:00
18320355ea USD Preview Surface import improvements.
Now using the new API for querying UDIM tiles.  Also
refactored based on ongoing patch review.

Updated UsdPreviewSurface color and normal input types to be
Color3f and Normal3f, respectively, to conform to the
specification.
2022-03-27 22:27:06 -04:00
a9c8425de8 Merge master into universal-scene-description.
Merge commit '923b28aab85768e2b4aff89494c321028252cf1e'.
2022-03-25 13:13:23 -04:00
2b6306c1ea USD IO: texture wrap and vertex color fixes.
Added logic to convert between tex image node extension enum
and UsdUVTexture wrapS and wrapT inputs on import and export.

Fixed bug where loop color data was incorrectly cast to MCol
rather than MLoopCol, causing the wrong vertex colors to be
exported.

The 'displayColor' primvar was being incorrectly imported as
'displayColors' (plural), causing this attribute to be
incorrectly named when exporting back to USD in round trips.
2022-03-20 16:33:20 -04:00
1e13fc105a USD IO: register plugins in USD_create_handle().
Added call to ensure that the USD plugins are registered
when opening a USD cache archive.  This is to avoid USD
load errors due to missing USD file format plugins when
opening blender files that contain USD transform cache
constraints and mesh sequence modifilers.
2022-01-03 13:24:20 -05:00
803f19b413 USD material writer code cleanup.
Removed unneeded includes, fixed include order,
replaced includes in header file with forward
declarations.  Replaced include guards with
Removed trailing underscore from local variable
names.  Moved const before type name in parameter
declaration, for consistency with usage elsewhere
in the code.
2022-01-03 11:30:27 -05:00
d9ca13066f USD import: fixed crash getting shader value.
Getting a value from an invalid shader input was causing
a crash in the UMM conversion invocation.  I added validty
checks for the input attribute in several places to
avoid this.  Also, minor formatting fix.
2021-12-08 15:38:09 -05:00
8ca67ef025 USD export: Skel Root validation.
Added function for verifying that skinned prims
and skeletons are properly grouped under a common
SkelRoot.  Also added a Fix Skel Root export
option to attempt to fix the hierarchy if the Skel
Root is invalid.
2021-12-07 12:42:42 -05:00
8ef0925c83 USD export: avoid creating redundant root prim.
If a root prim path is set in the params, now checking
if a root object matching the root path name already
exists in the Blender scene.  Clearing the root prim
path in the params and printing a warning if it does.
This is to avoid prepending the root prim path redundantly.
2021-12-07 12:25:07 -05:00
27c6f3fca5 USD IO: material conversion improvements.
Updated the USD Preview Surface texture node
import code to handle UDIM tiles that don't
start a 1001.  Performed miscellaneous cleanup
to make code more robust.

Fixed logic for the MDL material fallback behavior
to import the USD Preview Surface shaders only if
the material has no MDL shaders.  I.e., it will not
load preview surface as a fallback if an MDL exists
but failed to load for some reason.  This is much
more useful for debugging failures and also gives
the user an opportunity to fix a partially successful
MDL import.  This refactor also fixes a significant
bug where the fallback would be used even if the MDL
import succeeds.  Refactored the report_notification()
utility function in the UMM conversion code to return
more meaningful results.

Added logic to generate file names for packed texture
assets when exporting USD Preview Surface shaders.
Previously, such asset paths were left empty and were
omitted from the export.

Updated the UsdUVTexture shader conversion code to
handle the case where the file input has a connected
source, which may happen if this input is overridden
by an input on the parent material.

Made the logic for determining the color
space for texture assets when collecting UMM
source data more robust by handling the case
where a connected source input has no color
space specified. The fix is to also query
the shader's input attribute for this data.
2021-12-06 12:55:30 -05:00
7345fe7c8c Merge branch 'master' into universal-scene-description 2021-11-22 10:12:37 -05:00
f796b72cf5 USD import options description edit.
Shortened excessively long option descriptions
by removing information that should be included
in the documentation instead.
2021-11-17 17:49:29 -05:00
da766dd71c USD IO format fixes. 2021-11-09 18:42:05 -05:00
f71ad78dc1 USD Preview Surface import as a fallback.
Added logic to fall back on importing existing
USD Preview Surface shaders if importing MDL
is selected as an option but the material has
no MDL shaders.
2021-11-09 13:02:22 -05:00
85172cb5e1 USD Export: Armature export improvements.
Now including the root prim in the skinned mesh
skeleton relationship path.  Also, added logic to
avoid nesting SkelRoot prims in the USD, as such
nesting causes skeleton binding to fail as well
as crashes in Create.

Now iterating over the deform groups of the
evaluated mesh when setting joint weights
and indices, to ensure the vertex group
data is valid.
2021-11-08 16:38:11 -05:00
e2a783f8eb USD export: fixed linux an mac compile error. 2021-10-25 20:52:20 -04:00
265df7b3a6 USD IO: attribute conversion improvements.
Initial implementation of logic to import USD
attibutes as Blender custom properites, with options
to import all custom attributes or only those
attibutes in the 'userProperties' namespace.

New export option to add custom properties to the
'userProperties' USD attribute namespace. This
option is enabled by default.

Removed hidden functionality where custom properties named
with the prefix 'USD_' were being saved to properties on the
USD prim that have the same name, without the prefix.  This
code was not type safe and could lead to unexpected behavior
in case of accidental property name collisions.

Added support for converting between USD int, float and
double vectors and Blender array type custom properties.
2021-10-25 20:12:34 -04:00
f1828d3430 USD IO: enable presets.
Enable Operator Presets drop down menu
for the USD import/export operators.
2021-10-25 16:56:59 -04:00
1496105327 USD IO: handle UMM Python module load error.
Clearing the Python import module error if loading
the UMM module failed.  If we don't do this, the
Python unit test for USD will fail if the UMM
addon isn't installed. Also printing the Python
error in this case, if printing warnings is enabled.
2021-10-24 13:51:20 -04:00
3f2a1fa87c USD export: fix build errors with latest master. 2021-10-22 12:17:59 -04:00
63dfc81631 Merge branch 'master' of git.blender.org:blender into universal-scene-description 2021-10-20 22:08:45 -04:00
5724b0dd41 USD IO improved feedback.
Now parsing the Python notification dictionary object
returned by UMM to output warnings and error to the
Blender log.

Removing unneeded log message when setting the
default prim, as it can obscure more important
warnings and errors in the status bar.
2021-09-24 13:46:40 -04:00
f42ca488d2 USD IO options improvements
Added default values for the Default Prim Path,
Root Prim Path and Material Prim Path export
options. Now validating that these options are
set to well formed USD paths and raising an
error if these paths are invalid. This helps avoid
potential crashes when attempting to define
USD prims with invalid paths. Also updated import
shaders option menu tooltip.
2021-09-23 17:25:46 -04:00
eb747dbc66 USD Import: minor format fix 2021-09-14 21:35:06 -04:00
8513cc6e44 Merge remote-tracking branch 'blender_org/master' into temp-usd-latest-master 2021-09-13 21:47:21 -04:00
ffa078a079 Merge remote-tracking branch 'blender_org/master' into temp-usd-latest-master 2021-09-09 22:24:54 -04:00
0562c8b250 USD export: redundant call to set stage units
Setting the stage meters per unit metadata was being called
in two places unnecessarily. Removed redundant call.
2021-09-09 16:02:08 -04:00
182443da4b USD import: 'preview' purpose material fallback
Added logic to explicitly query bound materials
with purpose 'preview', if querying 'allPurpse' bound
materials returns no result.
2021-08-31 15:49:11 -04:00
2e32a0871f USD IO: material import improvements
UDIM texture support on UsdPreviewSurface import.
New Material Name Collision option for sepcifying behavior when
an imported material name conflicts with the name of an
existing material. Also includes format fixes.
2021-08-30 14:09:17 -04:00
baeeb1488e USD IO: fix compiler warnings and errors
Fixed warnings and errors for linux and darwin
builds.  Also fixed copyright date in
usd_light_convert.cc.
2021-08-08 23:07:26 -04:00
d143e8ff75 USD IO: initial commit of extended features
Instancing import:  Import USD scene instances as Blender collection instances.

Instancing export:  Extend the existing instancing option to support exporting arbitrary object hierarchies as USD scene instances.  Additional support for exporting Blender particle systems as USD point instancers.

Environment map IO:  Logic to convert between USD dome lights and Blender world materials, including environment textures.

Unit conversion scene scale:  Automatically scale the scene for unit conversion on import and export (e.g., scale the imported objects based on the USD’s meters per unit value).

Curve export.

Armature export:  Export armatures and skinned meshes to USD skeletons and skeletal animations.

Light unit conversion:  Experimental code to convert between light intensity units in Nits and Blender’s light energy units, on import and export.

Transform operator options:  Option to save transforms to USD as the combination of scale, rotate and translate operators, where the rotation can be expressed as Euler angles or a quaternion.

Export to USD shader nodes:  Convert Blender shader nodes to UsdPreviewSurface nodes, MDL material nodes or a custom USD representation of Cycles shaders. (MDL export requires UMM addon to be installed.)

Import MDL materials:  Convert MDL materials to Blender shader networks. (Requires UMM addon to be installed.)

Texture export:  An option to save textures to a directory relative to the USD being exported, using either absolute or relative asset paths.  This feature works with UDIM tiles as well as packed and in-memory “baked” textures.

Option to specify a default primitive on export.

Option to add a root primitive on export. This option adds a single prim as the parent of all exported prims.
2021-08-07 21:38:02 -04:00
153 changed files with 13997 additions and 1801 deletions

View File

@@ -330,6 +330,9 @@ option(WITH_ALEMBIC "Enable Alembic Support" ON)
# Universal Scene Description support
option(WITH_USD "Enable Universal Scene Description (USD) Support" ON)
# MaterialX
option(WITH_MATERIALX "Enable MaterialX Support" OFF)
# 3D format support
# Disable opencollada when we don't have precompiled libs
option(WITH_OPENCOLLADA "Enable OpenCollada Support (http://www.opencollada.org)" ON)
@@ -1920,6 +1923,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_QUADRIFLOW)
info_cfg_option(WITH_TBB)
info_cfg_option(WITH_USD)
info_cfg_option(WITH_MATERIALX)
info_cfg_option(WITH_XR_OPENXR)
info_cfg_text("Compiler Options:")

View File

@@ -26,7 +26,9 @@
project("BlenderDependencies")
cmake_minimum_required(VERSION 3.5)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW) # CMake 3.24+ Set the date/time for extracted files to time of extraction
endif()
include(ExternalProject)
include(cmake/check_software.cmake)
include(cmake/options.cmake)
@@ -42,7 +44,7 @@ if(ENABLE_MINGW64)
else()
set(mingw_LIBDIR ${LIBDIR})
endif()
include(cmake/ssl.cmake)
include(cmake/zlib.cmake)
include(cmake/zstd.cmake)
include(cmake/openal.cmake)
@@ -66,18 +68,16 @@ endif()
if(UNIX)
include(cmake/nasm.cmake)
endif()
include(cmake/openimageio.cmake)
include(cmake/tiff.cmake)
if(WIN32)
include(cmake/flexbison.cmake)
elseif(UNIX AND NOT APPLE)
include(cmake/flex.cmake)
endif()
include(cmake/osl.cmake)
include(cmake/tbb.cmake)
include(cmake/openvdb.cmake)
include(cmake/python.cmake)
include(cmake/llvm.cmake)
include(cmake/osl.cmake)
option(USE_PIP_NUMPY "Install NumPy using pip wheel instead of building from source" OFF)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
set(USE_PIP_NUMPY ON)
@@ -86,7 +86,10 @@ else()
endif()
include(cmake/python_site_packages.cmake)
include(cmake/package_python.cmake)
include(cmake/openimageio.cmake)
include(cmake/usd.cmake)
include(cmake/materialx.cmake)
include(cmake/openvdb.cmake)
include(cmake/potrace.cmake)
include(cmake/haru.cmake)
# Boost needs to be included after `python.cmake` due to the PYTHON_BINARY variable being needed.
@@ -100,6 +103,8 @@ include(cmake/fmt.cmake)
include(cmake/robinmap.cmake)
include(cmake/xml2.cmake)
include(cmake/fribidi.cmake)
include(cmake/harfbuzz.cmake)
if(NOT APPLE)
include(cmake/xr_openxr.cmake)
if(NOT WIN32 OR BUILD_MODE STREQUAL Release)
@@ -117,6 +122,7 @@ endif()
include(cmake/expat.cmake)
include(cmake/pystring.cmake)
include(cmake/yamlcpp.cmake)
include(cmake/minizipng.cmake)
include(cmake/opencolorio.cmake)
if(BLENDER_PLATFORM_ARM)
@@ -164,7 +170,6 @@ if(UNIX)
include(cmake/bzip2.cmake)
include(cmake/ffi.cmake)
include(cmake/lzma.cmake)
include(cmake/ssl.cmake)
include(cmake/sqlite.cmake)
endif()
@@ -176,6 +181,9 @@ if(UNIX AND NOT APPLE)
include(cmake/wayland.cmake)
include(cmake/wayland_libdecor.cmake)
endif()
include(cmake/shaderc_deps.cmake)
include(cmake/shaderc.cmake)
include(cmake/vulkan.cmake)
include(cmake/pybind11.cmake)
include(cmake/harvest.cmake)
include(cmake/cve_check.cmake)

View File

@@ -17,6 +17,7 @@ ExternalProject_Add(external_alembic
URL file://${PACKAGE_DIR}/${ALEMBIC_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${ALEMBIC_HASH_TYPE}=${ALEMBIC_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/alembic
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/alembic -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${ALEMBIC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/alembic
@@ -41,6 +42,5 @@ endif()
add_dependencies(
external_alembic
external_openexr
external_imath
)

View File

@@ -38,19 +38,3 @@ if(WIN32)
external_pthreads
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_blosc after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/blosc/lib/libblosc.lib ${HARVEST_TARGET}/blosc/lib/libblosc.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/blosc/include/ ${HARVEST_TARGET}/blosc/include/
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_blosc after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/blosc/lib/libblosc_d.lib ${HARVEST_TARGET}/blosc/lib/libblosc_d.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -3,8 +3,18 @@
if(WIN32)
set(BOOST_CONFIGURE_COMMAND bootstrap.bat)
set(BOOST_BUILD_COMMAND b2)
set(BOOST_BUILD_OPTIONS runtime-link=shared )
set(BOOST_HARVEST_CMD ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/lib/ ${HARVEST_TARGET}/boost/lib/ )
set(BOOST_BUILD_OPTIONS runtime-link=shared)
if(BUILD_MODE STREQUAL Debug)
list(APPEND BOOST_BUILD_OPTIONS python-debugging=on variant=debug)
if(WITH_OPTIMIZED_DEBUG)
list(APPEND BOOST_BUILD_OPTIONS debug-symbols=off)
else()
list(APPEND BOOST_BUILD_OPTIONS debug-symbols=on)
endif()
else()
list(APPEND BOOST_BUILD_OPTIONS variant=release)
endif()
set(BOOST_HARVEST_CMD ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/lib/ ${HARVEST_TARGET}/boost/lib/)
if(BUILD_MODE STREQUAL Release)
set(BOOST_HARVEST_CMD ${BOOST_HARVEST_CMD} && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/include/boost-${BOOST_VERSION_NODOTS_SHORT}/ ${HARVEST_TARGET}/boost/include/)
endif()
@@ -22,19 +32,17 @@ else()
set(BOOST_PATCH_COMMAND echo .)
endif()
if(WITH_BOOST_PYTHON)
set(JAM_FILE ${BUILD_DIR}/boost.user-config.jam)
configure_file(${PATCH_DIR}/boost.user.jam.in ${JAM_FILE})
set(JAM_FILE ${BUILD_DIR}/boost.user-config.jam)
configure_file(${PATCH_DIR}/boost.user.jam.in ${JAM_FILE})
set(BOOST_PYTHON_OPTIONS
--with-python
--user-config=${JAM_FILE}
)
if(WIN32 AND BUILD_MODE STREQUAL Debug)
set(BOOST_PYTHON_OPTIONS
--with-python
--user-config=${JAM_FILE}
${BOOST_PYTHON_OPTIONS}
define=BOOST_DEBUG_PYTHON
)
if(WIN32 AND BUILD_MODE STREQUAL Debug)
set(BOOST_PYTHON_OPTIONS
${BOOST_PYTHON_OPTIONS}
define=BOOST_DEBUG_PYTHON
)
endif()
endif()
set(BOOST_OPTIONS
@@ -66,15 +74,13 @@ ExternalProject_Add(external_boost
UPDATE_COMMAND ""
PATCH_COMMAND ${BOOST_PATCH_COMMAND}
CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND}
BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=${BOOST_ARCHITECTURE} address-model=${BOOST_ADDRESS_MODEL} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install
BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=${BOOST_ARCHITECTURE} address-model=${BOOST_ADDRESS_MODEL} link=shared threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install
BUILD_IN_SOURCE 1
INSTALL_COMMAND "${BOOST_HARVEST_CMD}"
)
if(WITH_BOOST_PYTHON)
add_dependencies(
external_boost
external_python
external_numpy
)
endif()
add_dependencies(
external_boost
external_python
external_numpy
)

View File

@@ -20,11 +20,12 @@ endif()
set(DEFAULT_BOOST_FLAGS
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_LIBS=OFF
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DBoost_ADDITIONAL_VERSIONS=${BOOST_VERSION_SHORT}
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_USE_DEBUG_PYTHON=On
)

View File

@@ -19,6 +19,12 @@ if(UNIX)
yasm
)
if(APPLE)
list(APPEND _required_software dos2unix)
else()
list(APPEND _required_software patchelf)
endif()
foreach(_software ${_required_software})
find_program(_software_find NAMES ${_software})
if(NOT _software_find)
@@ -46,10 +52,10 @@ if(UNIX)
" ${_software_missing}\n"
"\n"
"On Debian and Ubuntu:\n"
" apt install autoconf automake bison libtool yasm tcl ninja-build meson python3-mako\n"
" apt install autoconf automake bison libtool yasm tcl ninja-build meson python3-mako patchelf\n"
"\n"
"On macOS (with homebrew):\n"
" brew install autoconf automake bison flex libtool meson ninja pkg-config yasm\n"
" brew install autoconf automake bison dos2unix flex libtool meson ninja pkg-config yasm\n"
"\n"
"Other platforms:\n"
" Install equivalent packages.\n")

View File

@@ -87,6 +87,7 @@ download_source(OPENSUBDIV)
download_source(SDL)
download_source(OPENCOLLADA)
download_source(OPENCOLORIO)
download_source(MINIZIPNG)
download_source(LLVM)
download_source(OPENMP)
download_source(OPENIMAGEIO)
@@ -125,6 +126,7 @@ download_source(SSL)
download_source(SQLITE)
download_source(EMBREE)
download_source(USD)
download_source(MATERIALX)
download_source(OIDN)
download_source(LIBGLU)
download_source(MESA)
@@ -163,3 +165,12 @@ download_source(IGC_SPIRV_TRANSLATOR)
download_source(GMMLIB)
download_source(OCLOC)
download_source(AOM)
download_source(FRIBIDI)
download_source(HARFBUZZ)
download_source(SHADERC)
download_source(SHADERC_SPIRV_TOOLS)
download_source(SHADERC_SPIRV_HEADERS)
download_source(SHADERC_GLSLANG)
download_source(VULKAN_HEADERS)
download_source(VULKAN_LOADER)
download_source(PYBIND11)

View File

@@ -1,5 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# LLVM does not switch over to cpp17 until llvm 16 and building ealier versions with
# MSVC is leading to some crashes in ISPC. Switch back to their default on all platforms
# for now.
string(REPLACE "-DCMAKE_CXX_STANDARD=17" " " DPCPP_CMAKE_FLAGS "${DEFAULT_CMAKE_FLAGS}")
if(WIN32)
set(LLVM_GENERATOR "Ninja")
@@ -79,7 +83,7 @@ ExternalProject_Add(external_dpcpp
CMAKE_GENERATOR ${LLVM_GENERATOR}
SOURCE_SUBDIR llvm
LIST_SEPARATOR ^^
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/dpcpp ${DEFAULT_CMAKE_FLAGS} ${DPCPP_EXTRA_ARGS}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/dpcpp ${DPCPP_CMAKE_FLAGS} ${DPCPP_EXTRA_ARGS}
# CONFIGURE_COMMAND
# ${PYTHON_BINARY}
# ${BUILD_DIR}/dpcpp/src/external_dpcpp/buildbot/configure.py ${DPCPP_CONFIGURE_ARGS}

View File

@@ -10,7 +10,7 @@ ExternalProject_Add(external_epoxy
URL_HASH ${EPOXY_HASH_TYPE}=${EPOXY_HASH}
PREFIX ${BUILD_DIR}/epoxy
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/epoxy/src/external_epoxy/ < ${PATCH_DIR}/epoxy.diff
CONFIGURE_COMMAND ${CONFIGURE_ENV} && meson setup --prefix ${LIBDIR}/epoxy --default-library ${EPOXY_LIB_TYPE} --libdir lib ${BUILD_DIR}/epoxy/src/external_epoxy-build ${BUILD_DIR}/epoxy/src/external_epoxy -Dtests=false
CONFIGURE_COMMAND ${CONFIGURE_ENV} && ${MESON} setup --prefix ${LIBDIR}/epoxy --default-library ${EPOXY_LIB_TYPE} --libdir lib ${BUILD_DIR}/epoxy/src/external_epoxy-build ${BUILD_DIR}/epoxy/src/external_epoxy -Dtests=false
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)
@@ -23,3 +23,8 @@ if(BUILD_MODE STREQUAL Release AND WIN32)
DEPENDEES install
)
endif()
add_dependencies(
external_epoxy
external_python_site_packages
)

View File

@@ -1,7 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(FMT_EXTRA_ARGS
-DFMT_TEST=Off
-DFMT_TEST=OFF
-DFMT_DOC=OFF
)
ExternalProject_Add(external_fmt

View File

@@ -32,6 +32,9 @@ add_dependencies(
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_freetype after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freetype ${HARVEST_TARGET}/freetype
# harfbuzz *NEEDS* to find freetype.lib and will not be conviced to take alternative names so just give it
# what it wants.
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/freetype/lib/freetype2st.lib ${LIBDIR}/freetype/lib/freetype.lib
DEPENDEES install
)
endif()

View File

@@ -0,0 +1,30 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(CONFIGURE_ENV ${CONFIGURE_ENV_MSVC})
endif()
ExternalProject_Add(external_fribidi
URL file://${PACKAGE_DIR}/${FRIBIDI_FILE}
URL_HASH ${FRIBIDI_HASH_TYPE}=${FRIBIDI_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/fribidi
CONFIGURE_COMMAND ${MESON} setup --prefix ${LIBDIR}/fribidi -Ddocs=false --default-library static --libdir lib ${BUILD_DIR}/fribidi/src/external_fribidi-build ${BUILD_DIR}/fribidi/src/external_fribidi
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
INSTALL_DIR ${LIBDIR}/fribidi
)
add_dependencies(
external_fribidi
external_python
external_python_site_packages
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_fribidi after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/fribidi/include ${HARVEST_TARGET}/fribidi/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fribidi/lib/libfribidi.a ${HARVEST_TARGET}/fribidi/lib/libfribidi.lib
DEPENDEES install
)
endif()

View File

@@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(HARFBUZZ_CONFIGURE_ENV ${CONFIGURE_ENV_MSVC})
set(HARFBUZZ_PKG_ENV FREETYPE_DIR=${LIBDIR}/freetype)
else()
set(HARFBUZZ_CONFIGURE_ENV ${CONFIGURE_ENV})
set(HARFBUZZ_PKG_ENV PKG_CONFIG_PATH=${LIBDIR}/freetype/lib/pkgconfig:${LIBDIR}/brotli/lib/pkgconfig:$PKG_CONFIG_PATH)
endif()
set(HARFBUZZ_EXTRA_OPTIONS
-Dtests=disabled
-Dfreetype=enabled
-Dglib=disabled
-Dgobject=disabled
)
ExternalProject_Add(external_harfbuzz
URL file://${PACKAGE_DIR}/${HARFBUZZ_FILE}
URL_HASH ${HARFBUZZ_HASH_TYPE}=${HARFBUZZ_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/harfbuzz
CONFIGURE_COMMAND ${HARFBUZZ_CONFIGURE_ENV} &&
${CMAKE_COMMAND} -E env ${HARFBUZZ_PKG_ENV} ${MESON} setup --prefix ${LIBDIR}/harfbuzz ${HARFBUZZ_EXTRA_OPTIONS} --default-library static --libdir lib ${BUILD_DIR}/harfbuzz/src/external_harfbuzz-build ${BUILD_DIR}/harfbuzz/src/external_harfbuzz
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
INSTALL_DIR ${LIBDIR}/harfbuzz
)
add_dependencies(
external_harfbuzz
external_python
external_python_site_packages
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_harfbuzz after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/harfbuzz/include ${HARVEST_TARGET}/harfbuzz/include
# We do not use the subset API currently, so copying only the main library will suffice for now
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/harfbuzz/lib/libharfbuzz.a ${HARVEST_TARGET}/harfbuzz/lib/libharfbuzz.lib
DEPENDEES install
)
endif()

View File

@@ -11,194 +11,259 @@ message("HARVEST_TARGET = ${HARVEST_TARGET}")
if(WIN32)
if(BUILD_MODE STREQUAL Release)
add_custom_target(Harvest_Release_Results
COMMAND # jpeg rename libfile + copy include
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
# png
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
# freeglut-> opengl
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
DEPENDS
if(BUILD_MODE STREQUAL Release)
add_custom_target(Harvest_Release_Results
COMMAND # jpeg rename libfile + copy include
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
# png
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
# freeglut-> opengl
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
DEPENDS
)
endif()
else(WIN32)
function(harvest from to)
set(pattern "")
foreach(f ${ARGN})
set(pattern ${f})
endforeach()
if(pattern STREQUAL "")
get_filename_component(dirpath ${to} DIRECTORY)
get_filename_component(filename ${to} NAME)
install(
FILES ${LIBDIR}/${from}
DESTINATION ${HARVEST_TARGET}/${dirpath}
RENAME ${filename}
)
else()
install(
DIRECTORY ${LIBDIR}/${from}/
DESTINATION ${HARVEST_TARGET}/${to}
USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN ${pattern}
PATTERN "pkgconfig" EXCLUDE
PATTERN "cmake" EXCLUDE
PATTERN "__pycache__" EXCLUDE
PATTERN "tests" EXCLUDE
PATTERN "meson*" EXCLUDE
)
endif()
endfunction()
# Set rpath on shared libraries to $ORIGIN since all will be installed in the same
# lib folder, and remove any absolute paths.
#
# Ideally this would be done as part of the Blender build since it makes assumptions
# about where the files will be installed. However it would add patchelf as a new
# dependency for building.
if(APPLE)
set(set_rpath_cmd python3 ${CMAKE_CURRENT_SOURCE_DIR}/darwin/set_rpath.py @loader_path)
else()
set(set_rpath_cmd patchelf --set-rpath $ORIGIN)
endif()
function(harvest from to)
set(pattern "")
foreach(f ${ARGN})
set(pattern ${f})
endforeach()
function(harvest_rpath_lib from to pattern)
harvest(${from} ${to} ${pattern})
if(pattern STREQUAL "")
get_filename_component(dirpath ${to} DIRECTORY)
get_filename_component(filename ${to} NAME)
install(
FILES ${LIBDIR}/${from}
DESTINATION ${HARVEST_TARGET}/${dirpath}
RENAME ${filename}
)
else()
install(
DIRECTORY ${LIBDIR}/${from}/
DESTINATION ${HARVEST_TARGET}/${to}
USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN ${pattern}
PATTERN "pkgconfig" EXCLUDE
PATTERN "cmake" EXCLUDE
PATTERN "__pycache__" EXCLUDE
PATTERN "tests" EXCLUDE
)
endif()
endfunction()
install(CODE "\
cmake_policy(SET CMP0009 NEW)\n
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
foreach(f \${shared_libs}) \n
if(NOT IS_SYMLINK \${f})\n
execute_process(COMMAND ${set_rpath_cmd} \${f}) \n
endif()\n
endforeach()")
endfunction()
harvest(alembic/include alembic/include "*.h")
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
harvest(alembic/bin alembic/bin "*")
harvest(brotli/include brotli/include "*.h")
harvest(brotli/lib brotli/lib "*.a")
harvest(boost/include boost/include "*")
harvest(boost/lib boost/lib "*.a")
harvest(imath/include imath/include "*.h")
harvest(imath/lib imath/lib "*.a")
harvest(ffmpeg/include ffmpeg/include "*.h")
harvest(ffmpeg/lib ffmpeg/lib "*.a")
harvest(fftw3/include fftw3/include "*.h")
harvest(fftw3/lib fftw3/lib "*.a")
harvest(flac/lib sndfile/lib "libFLAC.a")
harvest(freetype/include freetype/include "*.h")
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
harvest(epoxy/include epoxy/include "*.h")
harvest(epoxy/lib epoxy/lib "*.a")
harvest(gmp/include gmp/include "*.h")
harvest(gmp/lib gmp/lib "*.a")
harvest(jemalloc/include jemalloc/include "*.h")
harvest(jemalloc/lib jemalloc/lib "*.a")
harvest(jpeg/include jpeg/include "*.h")
harvest(jpeg/lib jpeg/lib "libjpeg.a")
harvest(lame/lib ffmpeg/lib "*.a")
if(NOT APPLE)
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
harvest(level-zero/lib level-zero/lib "*.so*")
endif()
harvest(llvm/bin llvm/bin "clang-format")
if(BUILD_CLANG_TOOLS)
harvest(llvm/bin llvm/bin "clang-tidy")
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
endif()
harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config")
harvest(llvm/lib llvm/lib "libLLVM*.a")
harvest(llvm/lib llvm/lib "libclang*.a")
harvest(llvm/lib/clang llvm/lib/clang "*.h")
if(APPLE)
harvest(openmp/lib openmp/lib "*")
harvest(openmp/include openmp/include "*.h")
endif()
if(BLENDER_PLATFORM_ARM)
harvest(sse2neon sse2neon "*.h")
endif()
harvest(ogg/lib ffmpeg/lib "*.a")
harvest(openal/include openal/include "*.h")
if(UNIX AND NOT APPLE)
harvest(openal/lib openal/lib "*.a")
# Set rpath on utility binaries assuming they are run from their install location.
function(harvest_rpath_bin from to pattern)
harvest(${from} ${to} ${pattern})
harvest(blosc/include blosc/include "*.h")
harvest(blosc/lib blosc/lib "*.a")
install(CODE "\
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
foreach(f \${shared_libs}) \n
execute_process(COMMAND ${set_rpath_cmd}/../lib; \${f}) \n
endforeach()")
endfunction()
harvest(zlib/include zlib/include "*.h")
harvest(zlib/lib zlib/lib "*.a")
# Set rpath on Python module to point to the shared libraries folder in the Blender
# installation.
function(harvest_rpath_python from to pattern)
harvest(${from} ${to} ${pattern})
harvest(xml2/include xml2/include "*.h")
harvest(xml2/lib xml2/lib "*.a")
install(CODE "\
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}\.so*) \n
foreach(f \${shared_libs}) \n
get_filename_component(f_dir \${f} DIRECTORY) \n
file(RELATIVE_PATH relative_dir \${f_dir} ${HARVEST_TARGET}) \n
execute_process(COMMAND ${set_rpath_cmd}/\${relative_dir}../lib \${f}) \n
endforeach()")
endfunction()
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
harvest(alembic/include alembic/include "*.h")
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
harvest(alembic/bin alembic/bin "*")
harvest(brotli/include brotli/include "*.h")
harvest(brotli/lib brotli/lib "*.a")
harvest(boost/include boost/include "*")
harvest_rpath_lib(boost/lib boost/lib "*${SHAREDLIBEXT}*")
harvest(imath/include imath/include "*.h")
harvest_rpath_lib(imath/lib imath/lib "*${SHAREDLIBEXT}*")
harvest(ffmpeg/include ffmpeg/include "*.h")
harvest(ffmpeg/lib ffmpeg/lib "*.a")
harvest(fftw3/include fftw3/include "*.h")
harvest(fftw3/lib fftw3/lib "*.a")
harvest(flac/lib sndfile/lib "libFLAC.a")
harvest(freetype/include freetype/include "*.h")
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
harvest(fribidi/include fribidi/include "*.h")
harvest(fribidi/lib fribidi/lib "*.a")
harvest(epoxy/include epoxy/include "*.h")
harvest(epoxy/lib epoxy/lib "*.a")
harvest(gmp/include gmp/include "*.h")
harvest(gmp/lib gmp/lib "*.a")
harvest(harfbuzz/include harfbuzz/include "*.h")
harvest(harfbuzz/lib harfbuzz/lib "*.a")
harvest(jemalloc/include jemalloc/include "*.h")
harvest(jemalloc/lib jemalloc/lib "*.a")
harvest(jpeg/include jpeg/include "*.h")
harvest(jpeg/lib jpeg/lib "libjpeg.a")
harvest(lame/lib ffmpeg/lib "*.a")
if(NOT APPLE)
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
harvest(level-zero/lib level-zero/lib "*${SHAREDLIBEXT}*")
endif()
harvest(llvm/bin llvm/bin "clang-format")
if(BUILD_CLANG_TOOLS)
harvest(llvm/bin llvm/bin "clang-tidy")
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
endif()
harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config")
harvest(llvm/lib llvm/lib "libLLVM*.a")
harvest(llvm/lib llvm/lib "libclang*.a")
harvest(llvm/lib/clang llvm/lib/clang "*.h")
if(APPLE)
harvest(openmp/lib openmp/lib "*")
harvest(openmp/include openmp/include "*.h")
endif()
if(BLENDER_PLATFORM_ARM)
harvest(sse2neon sse2neon "*.h")
endif()
harvest(ogg/lib ffmpeg/lib "*.a")
harvest(openal/include openal/include "*.h")
if(UNIX AND NOT APPLE)
harvest(openal/lib openal/lib "*.a")
harvest(zlib/include zlib/include "*.h")
harvest(zlib/lib zlib/lib "*.a")
harvest(xml2/include xml2/include "*.h")
harvest(xml2/lib xml2/lib "*.a")
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
harvest(wayland/bin wayland/bin "wayland-scanner")
harvest(wayland/include wayland/include "*.h")
harvest(wayland_libdecor/include wayland_libdecor/include "*.h")
else()
harvest(blosc/lib openvdb/lib "*.a")
harvest(xml2/lib opencollada/lib "*.a")
endif()
harvest(opencollada/include/opencollada opencollada/include "*.h")
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
harvest(opencolorio/include opencolorio/include "*.h")
harvest(opencolorio/lib opencolorio/lib "*.a")
harvest(opencolorio/lib/static opencolorio/lib "*.a")
harvest(openexr/include openexr/include "*.h")
harvest(openexr/lib openexr/lib "*.a")
harvest(openimageio/bin openimageio/bin "idiff")
harvest(openimageio/bin openimageio/bin "maketx")
harvest(openimageio/bin openimageio/bin "oiiotool")
harvest(openimageio/include openimageio/include "*")
harvest(openimageio/lib openimageio/lib "*.a")
harvest(openimagedenoise/include openimagedenoise/include "*")
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
harvest(openpgl/include openpgl/include "*.h")
harvest(openpgl/lib openpgl/lib "*.a")
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
harvest(openvdb/lib openvdb/lib "*.a")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
harvest(png/include png/include "*.h")
harvest(png/lib png/lib "*.a")
harvest(pugixml/include pugixml/include "*.hpp")
harvest(pugixml/lib pugixml/lib "*.a")
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
harvest(python/include python/include "*h")
harvest(python/lib python/lib "*")
harvest(sdl/include/SDL2 sdl/include "*.h")
harvest(sdl/lib sdl/lib "libSDL2.a")
harvest(sndfile/include sndfile/include "*.h")
harvest(sndfile/lib sndfile/lib "*.a")
harvest(spnav/include spnav/include "*.h")
harvest(spnav/lib spnav/lib "*.a")
harvest(tbb/include tbb/include "*.h")
harvest(tbb/lib/libtbb_static.a tbb/lib/libtbb.a)
harvest(theora/lib ffmpeg/lib "*.a")
harvest(tiff/include tiff/include "*.h")
harvest(tiff/lib tiff/lib "*.a")
harvest(vorbis/lib ffmpeg/lib "*.a")
harvest(opus/lib ffmpeg/lib "*.a")
harvest(vpx/lib ffmpeg/lib "*.a")
harvest(x264/lib ffmpeg/lib "*.a")
harvest(xvidcore/lib ffmpeg/lib "*.a")
harvest(aom/lib ffmpeg/lib "*.a")
harvest(webp/lib webp/lib "*.a")
harvest(webp/include webp/include "*.h")
harvest(usd/include usd/include "*.h")
harvest(usd/lib/usd usd/lib/usd "*")
harvest(usd/plugin usd/plugin "*")
harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
harvest(zstd/include zstd/include "*.h")
harvest(zstd/lib zstd/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")
harvest(mesa/lib64 mesa/lib "*.so*")
harvest(dpcpp dpcpp "*")
harvest(igc dpcpp/lib/igc "*")
harvest(ocloc dpcpp/lib/ocloc "*")
endif()
harvest(xml2/lib opencollada/lib "*.a")
endif()
harvest(opencollada/include/opencollada opencollada/include "*.h")
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
harvest(opencolorio/include opencolorio/include "*.h")
harvest_rpath_lib(opencolorio/lib opencolorio/lib "*${SHAREDLIBEXT}*")
harvest_rpath_python(opencolorio/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*")
harvest(openexr/include openexr/include "*.h")
harvest_rpath_lib(openexr/lib openexr/lib "*${SHAREDLIBEXT}*")
harvest_rpath_bin(openimageio/bin openimageio/bin "idiff")
harvest_rpath_bin(openimageio/bin openimageio/bin "maketx")
harvest_rpath_bin(openimageio/bin openimageio/bin "oiiotool")
harvest(openimageio/include openimageio/include "*")
harvest_rpath_lib(openimageio/lib openimageio/lib "*${SHAREDLIBEXT}*")
harvest_rpath_python(openimageio/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*")
harvest(openimagedenoise/include openimagedenoise/include "*")
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
harvest(openpgl/include openpgl/include "*.h")
harvest(openpgl/lib openpgl/lib "*.a")
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
harvest_rpath_lib(opensubdiv/lib opensubdiv/lib "*${SHAREDLIBEXT}*")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
harvest_rpath_lib(openvdb/lib openvdb/lib "*${SHAREDLIBEXT}*")
harvest_rpath_python(openvdb/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*pyopenvdb*")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
harvest(png/include png/include "*.h")
harvest(png/lib png/lib "*.a")
harvest(pugixml/include pugixml/include "*.hpp")
harvest(pugixml/lib pugixml/lib "*.a")
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
harvest(python/include python/include "*h")
harvest(python/lib python/lib "*")
harvest(sdl/include/SDL2 sdl/include "*.h")
harvest(sdl/lib sdl/lib "libSDL2.a")
harvest(sndfile/include sndfile/include "*.h")
harvest(sndfile/lib sndfile/lib "*.a")
harvest(spnav/include spnav/include "*.h")
harvest(spnav/lib spnav/lib "*.a")
harvest(tbb/include tbb/include "*.h")
harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}")
harvest(theora/lib ffmpeg/lib "*.a")
harvest(tiff/include tiff/include "*.h")
harvest(tiff/lib tiff/lib "*.a")
harvest(vorbis/lib ffmpeg/lib "*.a")
harvest(opus/lib ffmpeg/lib "*.a")
harvest(vpx/lib ffmpeg/lib "*.a")
harvest(x264/lib ffmpeg/lib "*.a")
harvest(xvidcore/lib ffmpeg/lib "*.a")
harvest(aom/lib ffmpeg/lib "*.a")
harvest(webp/lib webp/lib "*.a")
harvest(webp/include webp/include "*.h")
harvest(usd/include usd/include "*.h")
harvest_rpath_lib(usd/lib usd/lib "libusd_ms${SHAREDLIBEXT}")
harvest(usd/lib/usd usd/lib/usd "*")
harvest_rpath_python(usd/lib/python/pxr python/lib/python${PYTHON_SHORT_VERSION}/site-packages/pxr "*")
harvest(usd/plugin usd/plugin "*")
harvest(materialx/include materialx/include "*.h")
harvest(materialx/lib materialx/lib "*")
harvest(materialx/libraries materialx/libraries "*")
harvest(materialx/python materialx/python "*")
harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake")
harvest_rpath_python(materialx/python/MaterialX python/lib/python${PYTHON_SHORT_VERSION}/site-packages/MaterialX "*")
# We do not need anything from the resources folder, but the MaterialX config
# file will complain if the folder does not exist, so just copy the readme.md
# files to ensure the folder will exist.
harvest(materialx/resources materialx/resources "README.md")
harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
harvest(zstd/include zstd/include "*.h")
harvest(zstd/lib zstd/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*${SHAREDLIBEXT}*")
harvest(mesa/lib64 mesa/lib "*${SHAREDLIBEXT}*")
harvest(dpcpp dpcpp "*")
harvest(igc dpcpp/lib/igc "*")
harvest(ocloc dpcpp/lib/ocloc "*")
endif()
endif()

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(IMATH_EXTRA_ARGS
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
-DBUILD_TESTING=OFF
-DIMATH_LIB_SUFFIX=${OPENEXR_VERSION_BUILD_POSTFIX}
)
@@ -11,6 +11,7 @@ ExternalProject_Add(external_imath
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IMATH_HASH_TYPE}=${IMATH_HASH}
PREFIX ${BUILD_DIR}/imath
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/imath ${DEFAULT_CMAKE_FLAGS} ${IMATH_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/imath
)
@@ -19,6 +20,7 @@ if(WIN32)
ExternalProject_Add_Step(external_imath after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/imath/lib ${HARVEST_TARGET}/imath/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/imath/include ${HARVEST_TARGET}/imath/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/imath/bin/imath${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/imath/bin/imath${OPENEXR_VERSION_POSTFIX}.dll
DEPENDEES install
)
endif()

View File

@@ -13,9 +13,11 @@ if(APPLE)
)
set(LLVM_BUILD_CLANG_TOOLS_EXTRA ^^clang-tools-extra)
set(BUILD_CLANG_TOOLS ON)
else()
# NVIDIA PTX for OSL on Windows and Linux.
set(LLVM_TARGETS ${LLVM_TARGETS}$<SEMICOLON>NVPTX)
endif()
set(LLVM_EXTRA_ARGS
-DLLVM_USE_CRT_RELEASE=MD
-DLLVM_USE_CRT_DEBUG=MDd
@@ -38,6 +40,11 @@ else()
set(LLVM_GENERATOR "Unix Makefiles")
endif()
# LLVM does not switch over to cpp17 until llvm 16 and building ealier versions with
# MSVC is leading to some crashes in ISPC. Switch back to their default on all platforms
# for now.
string(REPLACE "-DCMAKE_CXX_STANDARD=17" " " LLVM_CMAKE_FLAGS "${DEFAULT_CMAKE_FLAGS}")
# short project name due to long filename issues on windows
ExternalProject_Add(ll
URL file://${PACKAGE_DIR}/${LLVM_FILE}
@@ -48,7 +55,7 @@ ExternalProject_Add(ll
PREFIX ${BUILD_DIR}/ll
SOURCE_SUBDIR llvm
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/ll/src/ll < ${PATCH_DIR}/llvm.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${LLVM_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/llvm
)

View File

@@ -0,0 +1,57 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(MATERIALX_EXTRA_ARGS
-DMATERIALX_BUILD_PYTHON=ON
-DMATERIALX_BUILD_RENDER=OFF
-DMATERIALX_INSTALL_PYTHON=OFF
-DMATERIALX_PYTHON_EXECUTABLE=${PYTHON_BINARY}
-DMATERIALX_PYTHON_VERSION=${PYTHON_SHORT_VERSION}
-DMATERIALX_BUILD_SHARED_LIBS=ON
-DCMAKE_DEBUG_POSTFIX=_d
-Dpybind11_ROOT=${LIBDIR}/pybind11
-DPython_EXECUTABLE=${PYTHON_BINARY}
)
ExternalProject_Add(external_materialx
URL file://${PACKAGE_DIR}/${MATERIALX_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${MATERIALX_HASH_TYPE}=${MATERIALX_HASH}
PREFIX ${BUILD_DIR}/materialx
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/materialx/src/external_materialx < ${PATCH_DIR}/materialx.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/materialx ${DEFAULT_CMAKE_FLAGS} ${MATERIALX_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/materialx
)
if(WIN32)
set(MATERIALX_PYTHON_TARGET ${HARVEST_TARGET}/materialx/python/${BUILD_MODE})
string(REPLACE "/" "\\" MATERIALX_PYTHON_TARGET_DOS "${MATERIALX_PYTHON_TARGET}")
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_materialx after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/include ${HARVEST_TARGET}/materialx/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/libraries ${HARVEST_TARGET}/materialx/libraries
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/lib/ ${HARVEST_TARGET}/materialx/lib/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/bin/ ${HARVEST_TARGET}/materialx/bin/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/python/ ${MATERIALX_PYTHON_TARGET}
COMMAND del ${MATERIALX_PYTHON_TARGET_DOS}\\MaterialX\\*.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_materialx after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/lib/ ${HARVEST_TARGET}/materialx/lib/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/bin/ ${HARVEST_TARGET}/materialx/bin/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/python/ ${MATERIALX_PYTHON_TARGET}
COMMAND del ${MATERIALX_PYTHON_TARGET_DOS}\\MaterialX\\*.lib
DEPENDEES install
)
endif()
unset(MATERIALX_PYTHON_TARGET)
unset(MATERIALX_PYTHON_TARGET_DOS)
endif()
add_dependencies(
external_materialx
external_python
external_pybind11
)

View File

@@ -43,7 +43,7 @@ ExternalProject_Add(external_mesa
PREFIX ${BUILD_DIR}/mesa
CONFIGURE_COMMAND ${CONFIGURE_ENV} &&
cd ${BUILD_DIR}/mesa/src/external_mesa/ &&
meson ${BUILD_DIR}/mesa/src/external_mesa-build --prefix=${LIBDIR}/mesa ${MESA_EXTRA_FLAGS}
${MESON} ${BUILD_DIR}/mesa/src/external_mesa-build --prefix=${LIBDIR}/mesa ${MESA_EXTRA_FLAGS}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/mesa/src/external_mesa-build && ninja -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/mesa/src/external_mesa-build && ninja install
INSTALL_DIR ${LIBDIR}/mesa
@@ -52,4 +52,5 @@ ExternalProject_Add(external_mesa
add_dependencies(
external_mesa
ll
external_zlib
)

View File

@@ -0,0 +1,33 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(MINIZIPNG_EXTRA_ARGS
-DMZ_FETCH_LIBS=OFF
-DMZ_LIBCOMP=OFF
-DMZ_PKCRYPT=OFF
-DMZ_WZAES=OFF
-DMZ_OPENSSL=OFF
-DMZ_SIGNING=OFF
-DMZ_LZMA=OFF
-DMZ_ZSTD=OFF
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBZIP2_LIBRARY=${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}
-DBZIP2_INCLUDE_DIR=${LIBDIR}/bzip2/include/
# Because OCIO hardcodes a non standard include path
-DCMAKE_INSTALL_INCLUDEDIR=${LIBDIR}/minizipng/include/minizip-ng
)
ExternalProject_Add(external_minizipng
URL file://${PACKAGE_DIR}/${MINIZIPNG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${MINIZIPNG_HASH_TYPE}=${MINIZIPNG_HASH}
PREFIX ${BUILD_DIR}/minizipng
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/minizipng ${DEFAULT_CMAKE_FLAGS} ${MINIZIPNG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/minizipng
)
add_dependencies(
external_minizipng
external_zlib
)

View File

@@ -9,13 +9,17 @@ if(UNIX)
# as does the OPENCOLLADA package, if this can be corrected upstream that would be better.
# For now use `sed` to force UNIX line endings so the patch applies.
# Needed as neither ignoring white-space or applying as a binary resolve this problem.
if(APPLE)
set(_dos2unix dos2unix)
else()
set(_dos2unix sed -i "s/\\r//")
endif()
set(PATCH_MAYBE_DOS2UNIX_CMD
sed -i "s/\\r//"
${_dos2unix}
${PATCH_DIR}/opencollada.diff
${BUILD_DIR}/opencollada/src/external_opencollada/CMakeLists.txt
${BUILD_DIR}/opencollada/src/external_opencollada/Externals/LibXML/CMakeLists.txt &&
)
else()
set(OPENCOLLADA_EXTRA_ARGS
-DCMAKE_DEBUG_POSTFIX=_d

View File

@@ -2,10 +2,10 @@
set(OPENCOLORIO_EXTRA_ARGS
-DOCIO_BUILD_APPS=OFF
-DOCIO_BUILD_PYTHON=OFF
-DOCIO_BUILD_PYTHON=ON
-DOCIO_BUILD_NUKE=OFF
-DOCIO_BUILD_JAVA=OFF
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
-DOCIO_BUILD_DOCS=OFF
-DOCIO_BUILD_TESTS=OFF
-DOCIO_BUILD_GPU_TESTS=OFF
@@ -15,10 +15,30 @@ set(OPENCOLORIO_EXTRA_ARGS
-Dexpat_ROOT=${LIBDIR}/expat
-Dyaml-cpp_ROOT=${LIBDIR}/yamlcpp
-Dyaml-cpp_VERSION=${YAMLCPP_VERSION}
-Dpystring_ROOT=${LIBDIR}/pystring
-DImath_ROOT=${LIBDIR}/imath
-Dminizip-ng_ROOT=${LIBDIR}/minizipng
-Dminizip-ng_INCLUDE_DIR=${LIBDIR}/minizipng/include
-Dminizip-ng_LIBRARY=${LIBDIR}/minizipng/lib/libminizip${LIBEXT}
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DPython_EXECUTABLE=${PYTHON_BINARY}
-Dpybind11_ROOT=${LIBDIR}/pybind11
)
if(APPLE)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
"-DCMAKE_SHARED_LINKER_FLAGS=-liconv ${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}"
)
elseif(UNIX)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
"-DCMAKE_SHARED_LINKER_FLAGS=${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}"
)
endif()
if(BLENDER_PLATFORM_ARM)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
@@ -27,11 +47,16 @@ if(BLENDER_PLATFORM_ARM)
endif()
if(WIN32)
set(OPENCOLORIO_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIMATH_DLL")
if(BUILD_MODE STREQUAL Debug)
set(OPENCOLORIO_CXX_FLAGS "${OPENCOLORIO_CXX_FLAGS} -DPy_DEBUG")
endif()
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
-Dexpat_LIBRARY=${LIBDIR}/expat/lib/libexpatMD
-Dyaml-cpp_LIBRARY=${LIBDIR}/expat/lib/libyaml-cppmd.lib
-DImath_LIBRARY=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}
-DCMAKE_DEBUG_POSTFIX=_d
-Dexpat_LIBRARY=${LIBDIR}/expat/lib/libexpat$<$<STREQUAL:${BUILD_MODE},Debug>:d>MD${LIBEXT}
-DImath_LIBRARY=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DCMAKE_CXX_FLAGS=${OPENCOLORIO_CXX_FLAGS}
)
else()
set(OPENCOLORIO_EXTRA_ARGS
@@ -43,6 +68,7 @@ ExternalProject_Add(external_opencolorio
URL file://${PACKAGE_DIR}/${OPENCOLORIO_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENCOLORIO_HASH_TYPE}=${OPENCOLORIO_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/opencolorio
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencolorio/src/external_opencolorio < ${PATCH_DIR}/opencolorio.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencolorio ${DEFAULT_CMAKE_FLAGS} ${OPENCOLORIO_EXTRA_ARGS}
@@ -55,25 +81,26 @@ add_dependencies(
external_expat
external_imath
external_pystring
external_zlib
external_minizipng
external_python
external_pybind11
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/include ${HARVEST_TARGET}/opencolorio/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/bin/OpenColorIO_2_2.dll ${HARVEST_TARGET}/opencolorio/bin/OpenColorIO_2_2.dll
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib ${HARVEST_TARGET}/opencolorio/lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/Opencolorio.lib ${HARVEST_TARGET}/opencolorio/lib/OpencolorIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmdd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatdMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatdMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/bin/OpenColorIO_d_2_2.dll ${HARVEST_TARGET}/opencolorio/bin/OpenColorIO_d_2_2.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/Opencolorio_d.lib ${HARVEST_TARGET}/opencolorio/lib/OpenColorIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib/site-packages ${HARVEST_TARGET}/opencolorio/lib/site-packages-debug
DEPENDEES install
)
endif()

View File

@@ -16,7 +16,7 @@ set(OPENEXR_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBUILD_TESTING=OFF
-DOPENEXR_BUILD_BOTH_STATIC_SHARED=OFF
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
-DOPENEXR_INSTALL_TOOLS=OFF
-DOPENEXR_INSTALL_EXAMPLES=OFF
-DImath_DIR=${LIBDIR}/imath/lib/cmake/Imath
@@ -27,6 +27,7 @@ ExternalProject_Add(external_openexr
URL file://${PACKAGE_DIR}/${OPENEXR_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENEXR_HASH_TYPE}=${OPENEXR_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openexr
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openexr ${DEFAULT_CMAKE_FLAGS} ${OPENEXR_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openexr
@@ -36,6 +37,11 @@ if(WIN32)
ExternalProject_Add_Step(external_openexr after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openexr/lib ${HARVEST_TARGET}/openexr/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openexr/include ${HARVEST_TARGET}/openexr/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/Iex${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/Iex${OPENEXR_VERSION_POSTFIX}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/IlmThread${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/IlmThread${OPENEXR_VERSION_POSTFIX}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/OpenEXRCore${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/OpenEXRCore${OPENEXR_VERSION_POSTFIX}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/OpenEXRUtil${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/OpenEXRUtil${OPENEXR_VERSION_POSTFIX}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/OpenEXR${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/OpenEXR${OPENEXR_VERSION_POSTFIX}.dll
DEPENDEES install
)
endif()
@@ -43,4 +49,5 @@ endif()
add_dependencies(
external_openexr
external_zlib
external_imath
)

View File

@@ -15,14 +15,16 @@ else()
endif()
if(WIN32)
set(PNG_LIBNAME libpng16_static${LIBEXT})
set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2)
set(OPENJPEG_POSTFIX _msvc)
if(BUILD_MODE STREQUAL Debug)
set(TIFF_POSTFIX d)
set(PNG_POSTFIX d)
else()
set(TIFF_POSTFIX)
set(PNG_POSTFIX)
endif()
set(PNG_LIBNAME libpng16_static${PNG_POSTFIX}${LIBEXT})
else()
set(PNG_LIBNAME libpng${LIBEXT})
set(OIIO_SIMD_FLAGS)
@@ -40,7 +42,7 @@ else()
endif()
set(OPENIMAGEIO_EXTRA_ARGS
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
${OPENIMAGEIO_LINKSTATIC}
${DEFAULT_BOOST_FLAGS}
-DUSE_LIBSQUISH=OFF
@@ -54,7 +56,7 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_OPENGL=OFF
-DUSE_TBB=OFF
-DUSE_QT=OFF
-DUSE_PYTHON=OFF
-DUSE_PYTHON=ON
-DUSE_GIF=OFF
-DUSE_OPENCV=OFF
-DUSE_OPENJPEG=ON
@@ -76,13 +78,14 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DJPEG_LIBRARY=${LIBDIR}/jpeg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpeg/include
${OPENJPEG_FLAGS}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
-DSTOP_ON_WARNING=OFF
-DUSE_EXTERNAL_PUGIXML=ON
-DPUGIXML_LIBRARY=${LIBDIR}/pugixml/lib/${LIBPREFIX}pugixml${LIBEXT}
-DPUGIXML_INCLUDE_DIR=${LIBDIR}/pugixml/include/
-Dpugixml_DIR=${LIBDIR}/pugixml/lib/cmake/pugixml
-DBUILD_MISSING_ROBINMAP=OFF
-DBUILD_MISSING_FMT=OFF
-DFMT_INCLUDE_DIR=${LIBDIR}/fmt/include/
@@ -91,12 +94,15 @@ set(OPENIMAGEIO_EXTRA_ARGS
${OIIO_SIMD_FLAGS}
-DOpenEXR_ROOT=${LIBDIR}/openexr
-DImath_ROOT=${LIBDIR}/imath
-Dpybind11_ROOT=${LIBDIR}/pybind11
-DPython_EXECUTABLE=${PYTHON_BINARY}
)
ExternalProject_Add(external_openimageio
URL file://${PACKAGE_DIR}/${OPENIMAGEIO_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENIMAGEIO_HASH_TYPE}=${OPENIMAGEIO_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openimageio
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimageio ${DEFAULT_CMAKE_FLAGS} ${OPENIMAGEIO_EXTRA_ARGS}
@@ -117,6 +123,8 @@ add_dependencies(
external_robinmap
external_openjpeg${OPENJPEG_POSTFIX}
external_webp
external_python
external_pybind11
)
if(WIN32)
@@ -125,7 +133,8 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/include ${HARVEST_TARGET}/OpenImageIO/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib ${HARVEST_TARGET}/OpenImageIO/lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/idiff.exe ${HARVEST_TARGET}/OpenImageIO/bin/idiff.exe
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/OpenImageIO.dll ${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/OpenImageIO_Util.dll ${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO_Util.dll
DEPENDEES install
)
endif()
@@ -133,6 +142,9 @@ if(WIN32)
ExternalProject_Add_Step(external_openimageio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_d.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util_d.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/OpenImageIO_d.dll ${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/OpenImageIO_Util_d.dll ${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO_Util_d.dll
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib/python${PYTHON_SHORT_VERSION}/ ${HARVEST_TARGET}/OpenImageIO/lib/python${PYTHON_SHORT_VERSION}_debug/
DEPENDEES install
)
endif()

View File

@@ -32,7 +32,7 @@ else()
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTBB_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
-DTBB_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb${SHAREDLIBEXT}
)
endif()

View File

@@ -4,23 +4,14 @@ if(BUILD_MODE STREQUAL Debug)
set(BLOSC_POST _d)
endif()
if(WIN32)
set(OPENVDB_SHARED ON)
set(OPENVDB_STATIC OFF)
else()
set(OPENVDB_SHARED OFF)
set(OPENVDB_STATIC ON)
endif()
set(OPENVDB_EXTRA_ARGS
${DEFAULT_BOOST_FLAGS}
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DUSE_STATIC_DEPENDENCIES=OFF # This is the global toggle for static libs
# Once the above switch is off, you can set it
# for each individual library below.
-DBLOSC_USE_STATIC_LIBS=ON
-DTBB_USE_STATIC_LIBS=OFF
-DBoost_USE_STATIC_LIBS=OFF
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBlosc_INCLUDE_DIR=${LIBDIR}/blosc/include/
@@ -28,32 +19,36 @@ set(OPENVDB_EXTRA_ARGS
-DBlosc_LIBRARY_RELEASE=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DBlosc_LIBRARY_DEBUG=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DOPENVDB_BUILD_UNITTESTS=OFF
-DOPENVDB_BUILD_PYTHON_MODULE=OFF
-DOPENVDB_BUILD_NANOVDB=ON
-DNANOVDB_BUILD_TOOLS=OFF
-DBlosc_ROOT=${LIBDIR}/blosc/
-DTBB_ROOT=${LIBDIR}/tbb/
-DOPENVDB_CORE_SHARED=${OPENVDB_SHARED}
-DOPENVDB_CORE_STATIC=${OPENVDB_STATIC}
-DTbb_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTbb_LEGACY_INCLUDE_DIR=${LIBDIR}/tbb/include
-DOPENVDB_CORE_SHARED=ON
-DOPENVDB_CORE_STATIC=OFF
-DOPENVDB_BUILD_BINARIES=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DBLOSC_USE_STATIC_LIBS=ON
-DUSE_NANOVDB=ON
)
-DOPENVDB_BUILD_PYTHON_MODULE=ON
-DOPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON
-DUSE_NUMPY=ON
-DPython_EXECUTABLE=${PYTHON_BINARY}
if(WIN32)
# Namespaces seem to be buggy and cause linker errors due to things not
# being in the correct namespace
# needs to link pthreads due to it being a blosc dependency
set(OPENVDB_EXTRA_ARGS ${OPENVDB_EXTRA_ARGS}
-DCMAKE_CXX_STANDARD_LIBRARIES="${LIBDIR}/pthreads/lib/pthreadVC3.lib"
)
endif()
# OPENVDB_AX Disabled for now as it adds ~25MB distribution wise
# with no blender code depending on it, seems wasteful.
# -DOPENVDB_BUILD_AX=ON
# -DOPENVDB_AX_SHARED=ON
# -DOPENVDB_AX_STATIC=OFF
# -DLLVM_DIR=${LIBDIR}/llvm/lib/cmake/llvm
)
ExternalProject_Add(openvdb
URL file://${PACKAGE_DIR}/${OPENVDB_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENVDB_HASH_TYPE}=${OPENVDB_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openvdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openvdb ${DEFAULT_CMAKE_FLAGS} ${OPENVDB_EXTRA_ARGS}
@@ -66,6 +61,8 @@ add_dependencies(
external_boost
external_zlib
external_blosc
external_python
external_numpy
)
if(WIN32)
@@ -74,6 +71,7 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include ${HARVEST_TARGET}/openvdb/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb.lib ${HARVEST_TARGET}/openvdb/lib/openvdb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb.pyd ${HARVEST_TARGET}openvdb/python/pyopenvdb.pyd
DEPENDEES install
)
endif()
@@ -81,6 +79,7 @@ if(WIN32)
ExternalProject_Add_Step(openvdb after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb_d.lib ${HARVEST_TARGET}/openvdb/lib/openvdb_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb_d.dll ${HARVEST_TARGET}/openvdb/bin/openvdb_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb_d.pyd ${HARVEST_TARGET}openvdb/python/pyopenvdb_d.pyd
DEPENDEES install
)
endif()

View File

@@ -4,7 +4,7 @@ if(WIN32)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/fftw3 by installing mingw64" ON)
endif()
option(FORCE_CHECK_HASH "Force a check of all hashses during CMake the configure phase" OFF)
option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF)
cmake_host_system_information(RESULT NUM_CORES QUERY NUMBER_OF_LOGICAL_CORES)
set(MAKE_THREADS ${NUM_CORES} CACHE STRING "Number of threads to run make with")
@@ -41,31 +41,36 @@ if(WIN32)
set(LIBEXT ".lib")
set(SHAREDLIBEXT ".lib")
set(LIBPREFIX "")
set(MESON ${LIBDIR}/python/Scripts/meson)
# For OIIO and OSL
set(COMMON_DEFINES /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
set(COMMON_DEFINES /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
if(MSVC_VERSION GREATER 1909)
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
endif()
string(APPEND COMMON_MSVC_FLAGS " /bigobj")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
endif()
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MD ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
# To keep MSVC from oversubscribing the CPU, force it to single threaded mode
# msbuild/ninja will queue as many compile units as there are cores, no need for
# msvc to be internally threading as well.
string(APPEND COMMON_MSVC_FLAGS " /cgthreads1 ")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D_DEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
endif()
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MD /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MD ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /O2 /Ob2 /D_DEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS /DBOOST_DEBUG_PYTHON /DBOOST_ALL_NO_LIB")
else()
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS /DBOOST_DEBUG_PYTHON /DBOOST_ALL_NO_LIB")
endif()
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MD /${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(PLATFORM_FLAGS)
set(PLATFORM_CXX_FLAGS)
@@ -76,6 +81,18 @@ if(WIN32)
set(PERL_SHELL ${DOWNLOAD_DIR}/perl/portableshell.bat)
set(MINGW_HOST x86_64-w64-mingw32)
# some build systems like meson will respect the *nix like environment vars
# like CFLAGS and LDFlags but will still build with the MSVC compiler, so for
# those we need to empty out the gcc style flags that are normally in there.
set(CONFIGURE_ENV_MSVC
cd ${MINGW_PATH} &&
call ${PERL_SHELL} &&
call ${MINGW_SHELL} &&
set path &&
set CFLAGS= &&
set LDFLAGS=
)
set(CONFIGURE_ENV
cd ${MINGW_PATH} &&
call ${PERL_SHELL} &&
@@ -98,10 +115,11 @@ if(WIN32)
else()
set(PATCH_CMD patch)
set(LIBEXT ".a")
set(SHAREDLIBEXT ".so")
set(LIBPREFIX "lib")
set(MESON ${LIBDIR}/python/bin/meson)
if(APPLE)
set(SHAREDLIBEXT ".dylib")
if(APPLE)
# Use same Xcode detection as Blender itself.
include(../cmake/platform/platform_apple_xcode.cmake)
@@ -110,7 +128,7 @@ else()
endif()
set(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -std=c++17 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_LDFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin17.0.0) # OS X 10.13
@@ -123,12 +141,14 @@ else()
-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
)
else()
set(SHAREDLIBEXT ".so")
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
set(BLENDER_PLATFORM_ARM ON)
endif()
set(PLATFORM_CFLAGS "-fPIC")
set(PLATFORM_CXXFLAGS "-std=c++11 -fPIC")
set(PLATFORM_CXXFLAGS "-std=c++17 -fPIC")
set(PLATFORM_LDFLAGS)
set(PLATFORM_BUILD_TARGET)
set(PLATFORM_CMAKE_FLAGS -DCMAKE_INSTALL_LIBDIR=lib)
@@ -175,6 +195,7 @@ set(DEFAULT_CMAKE_FLAGS
-DCMAKE_CXX_FLAGS_MINSIZEREL=${BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL}
-DCMAKE_CXX_FLAGS_RELEASE=${BLENDER_CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
-DCMAKE_CXX_STANDARD=17
${PLATFORM_CMAKE_FLAGS}
)
@@ -193,3 +214,11 @@ if(MSVC)
endif()
set(CMAKE_INSTALL_MESSAGE LAZY)
# On windows we sometimes want to build with ninja, but not all projects quite
# yet, so for select project we pass PLATFORM_ALT_GENERATOR as the generator
if(WIN32)
set(PLATFORM_ALT_GENERATOR "Ninja")
else()
set(PLATFORM_ALT_GENERATOR "Unix Makefiles")
endif()

View File

@@ -9,6 +9,7 @@ ExternalProject_Add(external_opus
--disable-shared
--enable-static
--with-pic
--disable-maintainer-mode
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/opus/src/external_opus/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/opus/src/external_opus/ && make install
INSTALL_DIR ${LIBDIR}/opus

View File

@@ -6,7 +6,7 @@ if(WIN32)
else()
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES)
set(OSL_FLEX_BISON)
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpeg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/OpenImageIO${SHAREDLIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpeg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/IlmImf${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}")
endif()
set(OSL_EXTRA_ARGS
@@ -21,7 +21,7 @@ set(OSL_EXTRA_ARGS
${OSL_FLEX_BISON}
-DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES}
-DBUILD_SHARED_LIBS=OFF
-DLINKSTATIC=ON
-DLINKSTATIC=OFF
-DOSL_BUILD_PLUGINS=OFF
-DSTOP_ON_WARNING=OFF
-DUSE_LLVM_BITCODE=OFF
@@ -35,13 +35,14 @@ set(OSL_EXTRA_ARGS
-DTIFF_ROOT=${LIBDIR}/tiff
-DJPEG_ROOT=${LIBDIR}/jpeg
-DUSE_PYTHON=OFF
-DCMAKE_CXX_STANDARD=14
-DImath_ROOT=${LIBDIR}/imath
-DUSE_OIIO_STATIC=OFF
)
ExternalProject_Add(external_osl
URL file://${PACKAGE_DIR}/${OSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
LIST_SEPARATOR ^^
URL_HASH ${OSL_HASH_TYPE}=${OSL_HASH}
PREFIX ${BUILD_DIR}/osl

View File

@@ -0,0 +1,21 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(PYBIND11_EXTRA_ARGS
-DPYBIND11_TEST=OFF
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
)
ExternalProject_Add(external_pybind11
URL file://${PACKAGE_DIR}/${PYBIND11_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${PYBIND11_HASH_TYPE}=${PYBIND11_HASH}
PREFIX ${BUILD_DIR}/pybind11
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/pybind11 ${DEFAULT_CMAKE_FLAGS} ${PYBIND11_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/pybind11
)
add_dependencies(
external_pybind11
external_python
)

View File

@@ -16,10 +16,12 @@ if(WIN32)
set(PYTHON_EXTERNALS_FOLDER ${BUILD_DIR}/python/src/external_python/externals)
set(ZLIB_SOURCE_FOLDER ${BUILD_DIR}/zlib/src/external_zlib)
set(SSL_SOURCE_FOLDER ${BUILD_DIR}/ssl/src/external_ssl)
set(DOWNLOADS_EXTERNALS_FOLDER ${DOWNLOAD_DIR}/externals)
cmake_to_dos_path(${PYTHON_EXTERNALS_FOLDER} PYTHON_EXTERNALS_FOLDER_DOS)
cmake_to_dos_path(${ZLIB_SOURCE_FOLDER} ZLIB_SOURCE_FOLDER_DOS)
cmake_to_dos_path(${SSL_SOURCE_FOLDER} SSL_SOURCE_FOLDER_DOS)
cmake_to_dos_path(${DOWNLOADS_EXTERNALS_FOLDER} DOWNLOADS_EXTERNALS_FOLDER_DOS)
ExternalProject_Add(external_python
@@ -31,11 +33,15 @@ if(WIN32)
# that beyond placing some code in their externals dir before it tries.
# the foldernames *HAVE* to match the ones inside pythons get_externals.cmd.
# python 3.10.8 still ships zlib 1.2.12, replace it with our 1.2.13
# copy until they update.
CONFIGURE_COMMAND mkdir ${PYTHON_EXTERNALS_FOLDER_DOS} &&
# copy until they update. Same rules apply to openssl foldernames HAVE to match
# regardless of the version actually in there.
PATCH_COMMAND mkdir ${PYTHON_EXTERNALS_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\zlib-1.2.12 ${ZLIB_SOURCE_FOLDER_DOS} &&
${CMAKE_COMMAND} -E copy ${ZLIB_SOURCE_FOLDER}/../external_zlib-build/zconf.h ${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.12/zconf.h
BUILD_COMMAND cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && call build.bat -e -p x64 -c ${BUILD_MODE}
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\openssl-1.1.1q ${SSL_SOURCE_FOLDER_DOS} &&
${CMAKE_COMMAND} -E copy ${ZLIB_SOURCE_FOLDER}/../external_zlib-build/zconf.h ${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.12/zconf.h &&
${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_windows.diff
CONFIGURE_COMMAND echo "."
BUILD_COMMAND ${CONFIGURE_ENV_MSVC} && cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && set LDFLAGS=/DEBUG && call prepare_ssl.bat && call build.bat -e -p x64 -c ${BUILD_MODE}
INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py -b ${PYTHON_SRC}/PCbuild/amd64 -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-stable --include-pip --include-dev --include-launchers --include-venv --include-symbols ${PYTHON_EXTRA_INSTLAL_FLAGS} --copy ${LIBDIR}/python
)
add_dependencies(
@@ -69,11 +75,10 @@ else()
set(PYTHON_FUNC_CONFIGS ${PYTHON_FUNC_CONFIGS} && export PYTHON_DECIMAL_WITH_MACHINE=ansi64)
endif()
set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV} && ${PYTHON_FUNC_CONFIGS})
set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python.exe)
else()
set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV})
set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python)
endif()
set(PYTHON_BINARY ${LIBDIR}/python/bin/python${PYTHON_SHORT_VERSION})
# Link against zlib statically (Unix). Avoid rpath issues (macOS).
set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_unix.diff)
set(PYTHON_CONFIGURE_EXTRA_ARGS "--with-openssl=${LIBDIR}/ssl")
@@ -97,14 +102,31 @@ else()
INSTALL_DIR ${LIBDIR}/python)
endif()
add_dependencies(
external_python
external_ssl
external_zlib
)
if(UNIX)
add_dependencies(
external_python
external_bzip2
external_ffi
external_lzma
external_ssl
external_sqlite
external_zlib
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_python after_install
# Boost can't keep it self from linking release python
# in a debug configuration even if all options are set
# correctly to instruct it to use the debug version
# of python. So just copy the debug imports file over
# and call it a day...
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}.lib ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -15,7 +15,7 @@ ExternalProject_Add(external_python_site_packages
CONFIGURE_COMMAND ${PIP_CONFIGURE_COMMAND}
BUILD_COMMAND ""
PREFIX ${BUILD_DIR}/site_packages
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} autopep8==${AUTOPEP8_VERSION} pycodestyle==${PYCODESTYLE_VERSION} toml==${TOML_VERSION} --no-binary :all:
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} autopep8==${AUTOPEP8_VERSION} pycodestyle==${PYCODESTYLE_VERSION} toml==${TOML_VERSION} meson==${MESON_VERSION} --no-binary :all:
)
if(USE_PIP_NUMPY)

View File

@@ -0,0 +1,64 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(SHADERC_EXTRA_ARGS
-DSHADERC_SKIP_TESTS=On
-DSHADERC_SPIRV_TOOLS_DIR=${BUILD_DIR}/shaderc_spirv_tools/src/external_shaderc_spirv_tools
-DSHADERC_SPIRV_HEADERS_DIR=${BUILD_DIR}/shaderc_spirv_headers/src/external_shaderc_spirv_headers
-DSHADERC_GLSLANG_DIR=${BUILD_DIR}/shaderc_glslang/src/external_shaderc_glslang
-DCMAKE_DEBUG_POSTFIX=_d
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
)
ExternalProject_Add(external_shaderc
URL file://${PACKAGE_DIR}/${SHADERC_FILE}
URL_HASH ${SHADERC_HASH_TYPE}=${SHADERC_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/shaderc
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/shaderc ${DEFAULT_CMAKE_FLAGS} ${SHADERC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/shaderc
)
add_dependencies(
external_shaderc
external_shaderc_spirv_tools
external_shaderc_spirv_headers
external_shaderc_glslang
external_python
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_shaderc after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/shaderc/include ${HARVEST_TARGET}/shaderc/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/bin/shaderc_shared.dll ${HARVEST_TARGET}/shaderc/bin/shaderc_shared.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/lib/shaderc_shared.lib ${HARVEST_TARGET}/shaderc/lib/shaderc_shared.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_shaderc after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/bin/shaderc_shared_d.dll ${HARVEST_TARGET}/shaderc/bin/shaderc_shared_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/lib/shaderc_shared_d.lib ${HARVEST_TARGET}/shaderc/lib/shaderc_shared_d.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -0,0 +1,51 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# These are build time requirements for shaderc. We only have to unpack these
# shaderc will build them.
ExternalProject_Add(external_shaderc_glslang
URL file://${PACKAGE_DIR}/${SHADERC_GLSLANG_FILE}
URL_HASH ${SHADERC_GLSLANG_HASH_TYPE}=${SHADERC_GLSLANG_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/shaderc_glslang
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
ExternalProject_Add(external_shaderc_spirv_headers
URL file://${PACKAGE_DIR}/${SHADERC_SPIRV_HEADERS_FILE}
URL_HASH ${SHADERC_SPIRV_HEADERS_HASH_TYPE}=${SHADERC_SPIRV_HEADERS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/shaderc_spirv_headers
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
ExternalProject_Add(external_shaderc_spirv_tools
URL file://${PACKAGE_DIR}/${SHADERC_SPIRV_TOOLS_FILE}
URL_HASH ${SHADERC_SPIRV_TOOLS_HASH_TYPE}=${SHADERC_SPIRV_TOOLS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/shaderc_spirv_tools
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(SNDFILE_EXTRA_ARGS)
set(SNDFILE_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/flac/lib/pkgconfig:${mingw_LIBDIR})
set(SNDFILE_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/flac/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:${mingw_LIBDIR})
if(WIN32)
set(SNDFILE_ENV set ${SNDFILE_ENV} &&)
@@ -30,6 +30,7 @@ add_dependencies(
external_sndfile
external_ogg
external_vorbis
external_opus
)
if(UNIX)
add_dependencies(

View File

@@ -3,33 +3,47 @@
set(SSL_CONFIGURE_COMMAND ./Configure)
set(SSL_PATCH_CMD echo .)
if(APPLE)
set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
set(SSL_PATCH_CMD ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/ssl/src/external_ssl < ${PATCH_DIR}/ssl.diff)
if(WIN32)
# Python will build this with its preferred build options and patches. We only need to unpack openssl
ExternalProject_Add(external_ssl
URL file://${PACKAGE_DIR}/${SSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
PREFIX ${BUILD_DIR}/ssl
CONFIGURE_COMMAND echo "."
BUILD_COMMAND echo "."
INSTALL_COMMAND echo "."
INSTALL_DIR ${LIBDIR}/ssl
)
else()
if(BLENDER_PLATFORM_ARM)
set(SSL_OS_COMPILER "blender-linux-aarch64")
elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128)
set(SSL_OS_COMPILER "blender-linux-x86_64")
if(APPLE)
set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
set(SSL_PATCH_CMD ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/ssl/src/external_ssl < ${PATCH_DIR}/ssl.diff)
else()
set(SSL_OS_COMPILER "blender-linux-x86")
if(BLENDER_PLATFORM_ARM)
set(SSL_OS_COMPILER "blender-linux-aarch64")
elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128)
set(SSL_OS_COMPILER "blender-linux-x86_64")
else()
set(SSL_OS_COMPILER "blender-linux-x86")
endif()
endif()
endif()
ExternalProject_Add(external_ssl
URL file://${PACKAGE_DIR}/${SSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
PREFIX ${BUILD_DIR}/ssl
PATCH_COMMAND ${SSL_PATCH_CMD}
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && ${SSL_CONFIGURE_COMMAND} --prefix=${LIBDIR}/ssl
--openssldir=${LIBDIR}/ssl
no-shared
no-idea no-mdc2 no-rc5 no-zlib no-ssl3 enable-unit-test no-ssl3-method enable-rfc3779 enable-cms
--config=${CMAKE_CURRENT_SOURCE_DIR}/cmake/ssl.conf
${SSL_OS_COMPILER}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make install
INSTALL_DIR ${LIBDIR}/ssl
)
ExternalProject_Add(external_ssl
URL file://${PACKAGE_DIR}/${SSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
PREFIX ${BUILD_DIR}/ssl
PATCH_COMMAND ${SSL_PATCH_CMD}
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && ${SSL_CONFIGURE_COMMAND} --prefix=${LIBDIR}/ssl
--openssldir=${LIBDIR}/ssl
no-shared
no-idea no-mdc2 no-rc5 no-zlib no-ssl3 enable-unit-test no-ssl3-method enable-rfc3779 enable-cms
--config=${CMAKE_CURRENT_SOURCE_DIR}/cmake/ssl.conf
${SSL_OS_COMPILER}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make install
INSTALL_DIR ${LIBDIR}/ssl
)
endif()

View File

@@ -1,26 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(TBB_EXTRA_ARGS
-DTBB_BUILD_SHARED=On
-DTBB_BUILD_TBBMALLOC=On
-DTBB_BUILD_TBBMALLOC_PROXY=On
-DTBB_BUILD_STATIC=Off
-DTBB_BUILD_TESTS=Off
-DCMAKE_DEBUG_POSTFIX=_debug
)
set(TBB_LIBRARY tbb)
set(TBB_STATIC_LIBRARY Off)
else()
set(TBB_EXTRA_ARGS
-DTBB_BUILD_SHARED=Off
-DTBB_BUILD_TBBMALLOC=On
-DTBB_BUILD_TBBMALLOC_PROXY=Off
-DTBB_BUILD_STATIC=On
-DTBB_BUILD_TESTS=Off
)
set(TBB_LIBRARY tbb_static)
set(TBB_STATIC_LIBRARY On)
endif()
set(TBB_EXTRA_ARGS
-DTBB_BUILD_SHARED=On
-DTBB_BUILD_TBBMALLOC=On
-DTBB_BUILD_TBBMALLOC_PROXY=On
-DTBB_BUILD_STATIC=Off
-DTBB_BUILD_TESTS=Off
-DCMAKE_DEBUG_POSTFIX=_debug
)
set(TBB_LIBRARY tbb)
set(TBB_STATIC_LIBRARY Off)
# CMake script for TBB from https://github.com/wjakob/tbb/blob/master/CMakeLists.txt
ExternalProject_Add(external_tbb

View File

@@ -7,32 +7,56 @@ if(WIN32)
# USD does not look for debug libs, nor does it link them
# when building static, so this is just to keep find_package happy
# if we ever link dynamically on windows util will need to be linked as well.
set(USD_OIIO_CMAKE_DEFINES "-DOIIO_LIBRARIES=${LIBDIR}/openimageio/lib/OpenImageIO_d${LIBEXT}")
set(USD_OIIO_CMAKE_DEFINES "-DOIIO_LIBRARIES=${LIBDIR}/openimageio/lib/OpenImageIO_d${LIBEXT}^^${LIBDIR}/openimageio/lib/OpenImageIO_util_d${LIBEXT}")
endif()
set(USD_PLATFORM_FLAGS
${USD_OIIO_CMAKE_DEFINES}
-DCMAKE_CXX_FLAGS=${USD_CXX_FLAGS}
-D_PXR_CXX_DEFINITIONS=/DBOOST_ALL_NO_LIB
-DCMAKE_SHARED_LINKER_FLAGS_INIT=/LIBPATH:${LIBDIR}/tbb/lib
-DPython_FIND_REGISTRY=NEVER
-DPYTHON_INCLUDE_DIRS=${LIBDIR}/python/include
-DPYTHON_LIBRARY=${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}${LIBEXT}
)
if(BUILD_MODE STREQUAL Debug)
list(APPEND USD_PLATFORM_FLAGS -DPXR_USE_DEBUG_PYTHON=ON)
list(APPEND USD_PLATFORM_FLAGS -DOPENVDB_LIBRARY=${LIBDIR}/openvdb/lib/openvdb_d.lib)
endif()
elseif(UNIX)
# Workaround USD not linking correctly with static Python library, where it would embed
# part of the interpret in the USD library. Allow undefined Python symbols and replace
# Python library with TBB so it doesn't complain about missing library.
set(USD_PLATFORM_FLAGS
-DPYTHON_INCLUDE_DIR=${LIBDIR}/python/include/python${PYTHON_SHORT_VERSION}/
-DPYTHON_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
)
if(APPLE)
set(USD_SHARED_LINKER_FLAGS "-Xlinker -undefined -Xlinker dynamic_lookup")
list(APPEND USD_PLATFORM_FLAGS
-DCMAKE_SHARED_LINKER_FLAGS=${USD_SHARED_LINKER_FLAGS})
endif()
endif()
set(USD_EXTRA_ARGS
${DEFAULT_BOOST_FLAGS}
${USD_PLATFORM_FLAGS}
# This is a preventative measure that avoids possible conflicts when add-ons
# try to load another USD library into the same process space.
-DPXR_SET_INTERNAL_NAMESPACE=usdBlender
-DOPENSUBDIV_ROOT_DIR=${LIBDIR}/opensubdiv
-DOpenImageIO_ROOT=${LIBDIR}/openimageio
-DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/imath/include
-DPXR_ENABLE_PYTHON_SUPPORT=OFF
-DImath_DIR=${LIBDIR}/imath
-DOPENVDB_LOCATION=${LIBDIR}/openvdb
-DPXR_ENABLE_PYTHON_SUPPORT=ON
-DPXR_USE_PYTHON_3=ON
-DPXR_BUILD_IMAGING=ON
-DPXR_BUILD_TESTS=OFF
-DPXR_BUILD_EXAMPLES=OFF
-DPXR_BUILD_TUTORIALS=OFF
-DPXR_BUILD_USDVIEW=OFF
-DPXR_ENABLE_HDF5_SUPPORT=OFF
-DPXR_ENABLE_MATERIALX_SUPPORT=OFF
-DPXR_ENABLE_OPENVDB_SUPPORT=OFF
-DPXR_ENABLE_OPENVDB_SUPPORT=ON
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DPXR_BUILD_MONOLITHIC=ON
# OSL is an optional dependency of the Imaging module. However, since that
@@ -40,41 +64,36 @@ set(USD_EXTRA_ARGS
# cube, etc.) to geometry, it's not necessary. Disabling it will make it
# simpler to build Blender; currently only Cycles uses OSL.
-DPXR_ENABLE_OSL_SUPPORT=OFF
# GL support on Linux also links to X11 libraries. Enabling it would break
# headless or Wayland-only builds. OpenGL support would be useful if someone
# wants to work on a Hydra viewport in Blender; when that's actually being
# worked on, we could patch in a new PXR_ENABLE_X11_SUPPORT option (to
# separate OpenGL from X11) and contribute it upstream.
-DPXR_ENABLE_GL_SUPPORT=OFF
# Disable Metal since USD fails to build this when OpenGL is disabled.
-DPXR_ENABLE_METAL_SUPPORT=OFF
# OIIO is used for loading image textures in Hydra Storm / Embree renderers,
# which we don't use.
-DPXR_BUILD_OPENIMAGEIO_PLUGIN=OFF
# Enable OpenGL for Hydra support. Note that this indirectly also adds an X11
# dependency on Linux. This would be good to eliminate for headless and Wayland
# only builds, however is not worse than what Blender already links to for
# official releases currently.
-DPXR_ENABLE_GL_SUPPORT=ON
# OIIO is used for loading image textures in Hydra Storm / Embree renderers.
-DPXR_BUILD_OPENIMAGEIO_PLUGIN=ON
# USD 22.03 does not support OCIO 2.x
# Tracking ticket https://github.com/PixarAnimationStudios/USD/issues/1386
-DPXR_BUILD_OPENCOLORIO_PLUGIN=OFF
-DPXR_ENABLE_PTEX_SUPPORT=OFF
-DPXR_BUILD_USD_TOOLS=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DBUILD_SHARED_LIBS=Off
# USD is hellbound on making a shared library,
# unless you point this variable to a valid CMAKE file doesn't have to make sense,
# but as long as it points somewhere valid it will skip the shared library.
-DPXR_MONOLITHIC_IMPORT=${BUILD_DIR}/usd/src/external_usd/cmake/defaults/Version.cmake
-DBUILD_SHARED_LIBS=ON
-DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
-DTBB_tbb_LIBRARY_RELEASE=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
# USD wants the tbb debug lib set even when you are doing a release build
# Otherwise it will error out during the cmake configure phase.
-DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
)
ExternalProject_Add(external_usd
URL file://${PACKAGE_DIR}/${USD_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${USD_HASH_TYPE}=${USD_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/usd
LIST_SEPARATOR ^^
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/usd -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${USD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/usd
@@ -85,10 +104,12 @@ add_dependencies(
external_tbb
external_boost
external_opensubdiv
external_python
external_openimageio
openvdb
)
# Since USD 21.11 the libraries are prefixed with "usd_", i.e.
# "libusd_m.a" became "libusd_usd_m.a".
# Since USD 21.11 the libraries are prefixed with "usd_", i.e. "libusd_m.a" became "libusd_usd_m.a".
# See https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01
if(NOT WIN32)
if (USD_VERSION VERSION_LESS 21.11)
@@ -101,27 +122,16 @@ endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/ ${HARVEST_TARGET}/usd
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Release/usd_usd_m.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd ${HARVEST_TARGET}/usd
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib ${HARVEST_TARGET}/usd/lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Debug/usd_usd_m_d.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m_d.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib/python ${HARVEST_TARGET}/usd/lib/debug/python
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_ms_d.dll ${HARVEST_TARGET}/usd/lib/usd_ms_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_ms_d.lib ${HARVEST_TARGET}/usd/lib/usd_ms_d.lib
DEPENDEES install
)
endif()
else()
# USD has two build options. The default build creates lots of small libraries,
# whereas the 'monolithic' build produces only a single library. The latter
# makes linking simpler, so that's what we use in Blender. However, running
# 'make install' in the USD sources doesn't install the static library in that
# case (only the shared library). As a result, we need to grab the `libusd_m.a`
# file from the build directory instead of from the install directory.
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/lib${PXR_LIB_PREFIX}usd_m.a ${HARVEST_TARGET}/usd/lib/lib${PXR_LIB_PREFIX}usd_m.a
DEPENDEES install
)
endif()

View File

@@ -35,12 +35,12 @@ set(JPEG_HASH_TYPE MD5)
set(JPEG_FILE libjpeg-turbo-${JPEG_VERSION}.tar.gz)
set(JPEG_CPE "cpe:2.3:a:d.r.commander:libjpeg-turbo:${JPEG_VERSION}:*:*:*:*:*:*:*")
set(BOOST_VERSION 1.78.0)
set(BOOST_VERSION_SHORT 1.78)
set(BOOST_VERSION_NODOTS 1_78_0)
set(BOOST_VERSION_NODOTS_SHORT 1_78)
set(BOOST_VERSION 1.80.0)
set(BOOST_VERSION_SHORT 1.80)
set(BOOST_VERSION_NODOTS 1_80_0)
set(BOOST_VERSION_NODOTS_SHORT 1_80)
set(BOOST_URI https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_HASH c2f6428ac52b0e5a3c9b2e1d8cc832b5)
set(BOOST_HASH 077f074743ea7b0cb49c6ed43953ae95)
set(BOOST_HASH_TYPE MD5)
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_CPE "cpe:2.3:a:boost:boost:${BOOST_VERSION}:*:*:*:*:*:*:*")
@@ -77,11 +77,11 @@ if(WIN32)
# we need to tell the build the postfix is _s while
# telling all other deps the postfix is _s_d
if(BUILD_MODE STREQUAL Release)
set(OPENEXR_VERSION_POSTFIX _s)
set(OPENEXR_VERSION_BUILD_POSTFIX _s)
set(OPENEXR_VERSION_POSTFIX )
set(OPENEXR_VERSION_BUILD_POSTFIX )
else()
set(OPENEXR_VERSION_POSTFIX _s_d)
set(OPENEXR_VERSION_BUILD_POSTFIX _s)
set(OPENEXR_VERSION_POSTFIX _d)
set(OPENEXR_VERSION_BUILD_POSTFIX )
endif()
else()
set(OPENEXR_VERSION_BUILD_POSTFIX)
@@ -114,9 +114,9 @@ set(ALEMBIC_HASH_TYPE MD5)
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
set(OPENSUBDIV_VERSION v3_4_4)
set(OPENSUBDIV_VERSION v3_5_0)
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
set(OPENSUBDIV_HASH 39ecc5caf0abebc943d1ce131855e76e)
set(OPENSUBDIV_HASH 230f5cd2911d6240e58a3773b9c6e5e4)
set(OPENSUBDIV_HASH_TYPE MD5)
set(OPENSUBDIV_FILE opensubdiv-${OPENSUBDIV_VERSION}.tar.gz)
@@ -133,12 +133,18 @@ set(OPENCOLLADA_HASH ee7dae874019fea7be11613d07567493)
set(OPENCOLLADA_HASH_TYPE MD5)
set(OPENCOLLADA_FILE opencollada-${OPENCOLLADA_VERSION}.tar.gz)
set(OPENCOLORIO_VERSION 2.1.1)
set(OPENCOLORIO_VERSION 2.2.0)
set(OPENCOLORIO_URI https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
set(OPENCOLORIO_HASH 604f562e073f23d88ce89ed4f7f709ba)
set(OPENCOLORIO_HASH d58a5980adba2d89a363100a09daa5f3)
set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
set(MINIZIPNG_VERSION 3.0.7)
set(MINIZIPNG_URI https://github.com/zlib-ng/minizip-ng/archive/${MINIZIPNG_VERSION}.tar.gz)
set(MINIZIPNG_HASH 09dcc8a9def348e1be9659e384c2cd55)
set(MINIZIPNG_HASH_TYPE MD5)
set(MINIZIPNG_FILE minizip-ng-${MINIZIPNG_VERSION}.tar.gz)
set(LLVM_VERSION 12.0.0)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
@@ -159,9 +165,9 @@ set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION v2.3.20.0)
set(OPENIMAGEIO_VERSION v2.4.6.0)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/refs/tags/${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH defb1fe7c8e64bac60eb3cacaf5c3736)
set(OPENIMAGEIO_HASH c7acc1b9a8fda04ef48f7de1feda4dae)
set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
@@ -189,9 +195,12 @@ set(TIFF_HASH_TYPE MD5)
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(TIFF_CPE "cpe:2.3:a:libtiff:libtiff:${TIFF_VERSION}:*:*:*:*:*:*:*")
set(OSL_VERSION 1.12.6.2)
set(OSL_URI https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/archive/refs/tags/v${OSL_VERSION}.tar.gz)
set(OSL_HASH 6fef11548adfdd3e5b25c49d2dae96ee)
# Commit c8dd33f5a37b6a6db0b6950d24f9a7cff5ceb799 breaks rendering in Cycles with OptiX, so this
# is intentionally still a commit before that and therefore 1.13.0.1. To be updated to a newer
# version before landing this in master.
set(OSL_VERSION 1.12.7.1)
set(OSL_URI https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/archive/v${OSL_VERSION}.tar.gz)
set(OSL_HASH 53211da86c34ba6e0344998c1a6d219c)
set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
@@ -212,9 +221,9 @@ set(TBB_HASH_TYPE MD5)
set(TBB_FILE oneTBB-${TBB_VERSION}.tar.gz)
set(TBB_CPE "cpe:2.3:a:intel:threading_building_blocks:${TBB_YEAR}:*:*:*:*:*:*:*")
set(OPENVDB_VERSION 9.0.0)
set(OPENVDB_VERSION 10.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH 684ce40c2f74f3a0c9cac530e1c7b07e)
set(OPENVDB_HASH 64301c737e16b26c8f3085a31e6397e9)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
@@ -224,7 +233,7 @@ set(URLLIB3_VERSION 1.26.8)
set(URLLIB3_CPE "cpe:2.3:a:urllib3:urllib3:${URLLIB3_VERSION}:*:*:*:*:*:*:*")
set(CERTIFI_VERSION 2021.10.8)
set(REQUESTS_VERSION 2.27.1)
set(CYTHON_VERSION 0.29.26)
set(CYTHON_VERSION 0.29.30)
# The version of the zstd library used to build the Python package should match ZSTD_VERSION
# defined below. At this time of writing, 0.17.0 was already released,
# but built against zstd 1.5.1, while we use 1.5.0.
@@ -232,13 +241,14 @@ set(ZSTANDARD_VERSION 0.16.0)
set(AUTOPEP8_VERSION 1.6.0)
set(PYCODESTYLE_VERSION 2.8.0)
set(TOML_VERSION 0.10.2)
set(MESON_VERSION 0.63.0)
set(NUMPY_VERSION 1.22.0)
set(NUMPY_SHORT_VERSION 1.22)
set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.zip)
set(NUMPY_HASH 252de134862a27bd66705d29622edbfe)
set(NUMPY_VERSION 1.23.2)
set(NUMPY_SHORT_VERSION 1.23)
set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.tar.gz)
set(NUMPY_HASH 9bf2a361509797de14ceee607387fe0f)
set(NUMPY_HASH_TYPE MD5)
set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip)
set(NUMPY_FILE numpy-${NUMPY_VERSION}.tar.gz)
set(NUMPY_CPE "cpe:2.3:a:numpy:numpy:${NUMPY_VERSION}:*:*:*:*:*:*:*")
set(LAME_VERSION 3.100)
@@ -359,9 +369,9 @@ set(XML2_HASH_TYPE MD5)
set(XML2_FILE libxml2-${XML2_VERSION}.tar.xz)
set(XML2_CPE "cpe:2.3:a:xmlsoft:libxml2:${XML2_VERSION}:*:*:*:*:*:*:*")
set(YAMLCPP_VERSION 0.6.3)
set(YAMLCPP_VERSION 0.7.0)
set(YAMLCPP_URI https://codeload.github.com/jbeder/yaml-cpp/tar.gz/yaml-cpp-${YAMLCPP_VERSION})
set(YAMLCPP_HASH b45bf1089a382e81f6b661062c10d0c2)
set(YAMLCPP_HASH 74d646a3cc1b5d519829441db96744f0)
set(YAMLCPP_HASH_TYPE MD5)
set(YAMLCPP_FILE yaml-cpp-${YAMLCPP_VERSION}.tar.gz)
set(YAMLCPP "cpe:2.3:a:yaml-cpp_project:yaml-cpp:${YAMLCPP_VERSION}:*:*:*:*:*:*:*")
@@ -457,12 +467,18 @@ set(EMBREE_HASH 52d0be294d6c88ba7a6c9e046796e7be)
set(EMBREE_HASH_TYPE MD5)
set(EMBREE_FILE embree-v${EMBREE_VERSION}.zip)
set(USD_VERSION 22.03)
set(USD_VERSION 22.11)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
set(USD_HASH e0e441a05057692a83124a1195b09eed)
set(USD_HASH 8c89459e48a2ef0e7ae9e7e490377507)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(MATERIALX_VERSION 1.38.6)
set(MATERIALX_URI https://github.com/AcademySoftwareFoundation/MaterialX/archive/refs/tags/v${MATERIALX_VERSION}.tar.gz)
set(MATERIALX_HASH d49c9fdef34b5702fc60058d3e1864f2)
set(MATERIALX_HASH_TYPE MD5)
set(MATERIALX_FILE materialx-v${MATERIALX_VERSION}.tar.gz)
set(OIDN_VERSION 1.4.3)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH 027093eaf5e8b4e45835b991137b38e6)
@@ -708,3 +724,60 @@ set(AOM_URI https://storage.googleapis.com/aom-releases/libaom-${AOM_VERSION}.ta
set(AOM_HASH bd754b58c3fa69f3ffd29da77de591bd9c26970e3b18537951336d6c0252e354)
set(AOM_HASH_TYPE SHA256)
set(AOM_FILE libaom-${AOM_VERSION}.tar.gz)
set(FRIBIDI_VERSION v1.0.12)
set(FRIBIDI_URI https://github.com/fribidi/fribidi/archive/refs/tags/${FRIBIDI_VERSION}.tar.gz)
set(FRIBIDI_HASH 2e9e859876571f03567ac91e5ed3b5308791f31cda083408c2b60fa1fe00a39d)
set(FRIBIDI_HASH_TYPE SHA256)
set(FRIBIDI_FILE fribidi-${FRIBIDI_VERSION}.tar.gz)
set(HARFBUZZ_VERSION 5.1.0)
set(HARFBUZZ_URI https://github.com/harfbuzz/harfbuzz/archive/refs/tags/${HARFBUZZ_VERSION}.tar.gz)
set(HARFBUZZ_HASH 5352ff2eec538ea9a63a485cf01ad8332a3f63aa79921c5a2e301cef185caea1)
set(HARFBUZZ_HASH_TYPE SHA256)
set(HARFBUZZ_FILE harfbuzz-${HARFBUZZ_VERSION}.tar.gz)
set(SHADERC_VERSION v2022.3)
set(SHADERC_URI https://github.com/google/shaderc/archive/${SHADERC_VERSION}.tar.gz)
set(SHADERC_HASH 5cb762af57637caf997d5f46baa4e8a4)
set(SHADERC_HASH_TYPE MD5)
set(SHADERC_FILE shaderc-${SHADERC_VERSION}.tar.gz)
# The versions of shaderc's dependencies can be found in the root of shaderc's
# source in a file called DEPS.
set(SHADERC_SPIRV_TOOLS_VERSION eb0a36633d2acf4de82588504f951ad0f2cecacb)
set(SHADERC_SPIRV_TOOLS_URI https://github.com/KhronosGroup/SPIRV-Tools/archive/${SHADERC_SPIRV_TOOLS_VERSION}.tar.gz)
set(SHADERC_SPIRV_TOOLS_HASH a4bdb8161f0e959c75d0d82d367c24f2)
set(SHADERC_SPIRV_TOOLS_HASH_TYPE MD5)
set(SHADERC_SPIRV_TOOLS_FILE SPIRV-Tools-${SHADERC_SPIRV_TOOLS_VERSION}.tar.gz)
set(SHADERC_SPIRV_HEADERS_VERSION 85a1ed200d50660786c1a88d9166e871123cce39)
set(SHADERC_SPIRV_HEADERS_URI https://github.com/KhronosGroup/SPIRV-Headers/archive/${SHADERC_SPIRV_HEADERS_VERSION}.tar.gz)
set(SHADERC_SPIRV_HEADERS_HASH 10d5e8160f39344a641523810b075568)
set(SHADERC_SPIRV_HEADERS_HASH_TYPE MD5)
set(SHADERC_SPIRV_HEADERS_FILE SPIRV-Headers-${SHADERC_SPIRV_HEADERS_VERSION}.tar.gz)
set(SHADERC_GLSLANG_VERSION 89db4e1caa273a057ea46deba709c6e50001b314)
set(SHADERC_GLSLANG_URI https://github.com/KhronosGroup/glslang/archive/${SHADERC_GLSLANG_VERSION}.tar.gz)
set(SHADERC_GLSLANG_HASH 3b3c79ad8e9132ffcb8b63cc29c532e2)
set(SHADERC_GLSLANG_HASH_TYPE MD5)
set(SHADERC_GLSLANG_FILE glslang-${SHADERC_GLSLANG_VERSION}.tar.gz)
set(VULKAN_VERSION v1.2.198)
set(VULKAN_HEADERS_URI https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/${VULKAN_VERSION}.tar.gz)
set(VULKAN_HEADERS_HASH 64fe73e887c963ad546bfc7f9505fa1d)
set(VULKAN_HEADERS_HASH_TYPE MD5)
set(VULKAN_HEADERS_FILE Vulkan-Headers-${VULKAN_VERSION}.tar.gz)
set(VULKAN_LOADER_URI https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/${VULKAN_VERSION}.tar.gz)
set(VULKAN_LOADER_HASH 015170a74f648fd2b41e209b6bf1ebc4)
set(VULKAN_LOADER_HASH_TYPE MD5)
set(VULKAN_LOADER_FILE Vulkan-Loader-${VULKAN_VERSION}.tar.gz)
set(PYBIND11_VERSION 2.10.1)
set(PYBIND11_URI https://github.com/pybind/pybind11/archive/refs/tags/v${PYBIND11_VERSION}.tar.gz)
set(PYBIND11_HASH ce07bfd5089245da7807b3faf6cbc878)
set(PYBIND11_HASH_TYPE MD5)
set(PYBIND11_FILE pybind-v${PYBIND11_VERSION}.tar.gz)

View File

@@ -0,0 +1,55 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(VULKAN_HEADERS_EXTRA_ARGS)
ExternalProject_Add(external_vulkan_headers
URL file://${PACKAGE_DIR}/${VULKAN_HEADERS_FILE}
URL_HASH ${VULKAN_HEADERS_HASH_TYPE}=${VULKAN_HEADERS_HASH}
PREFIX ${BUILD_DIR}/vulkan_headers
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/vulkan_headers -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${VULKAN_HEADERS_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/vulkan_headers
)
set(VULKAN_LOADER_EXTRA_ARGS
-DVULKAN_HEADERS_INSTALL_DIR=${LIBDIR}/vulkan_headers
)
ExternalProject_Add(external_vulkan_loader
URL file://${PACKAGE_DIR}/${VULKAN_LOADER_FILE}
URL_HASH ${VULKAN_LOADER_HASH_TYPE}=${VULKAN_LOADER_HASH}
PREFIX ${BUILD_DIR}/vulkan_loader
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/vulkan_loader -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${VULKAN_LOADER_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/vulkan_loader
)
add_dependencies(
external_vulkan_loader
external_vulkan_headers
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_vulkan_loader after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/vulkan_loader/ ${HARVEST_TARGET}/vulkan
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/vulkan_headers/ ${HARVEST_TARGET}/vulkan
DEPENDEES install
)
endif()
endif()

View File

@@ -14,7 +14,7 @@ ExternalProject_Add(external_wayland
# NOTE: `-lm` is needed for `libxml2` which is a static library that uses `libm.so`,
# without this, math symbols such as `floor` aren't found.
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig:${LIBDIR}/xml2/lib/pkgconfig:${LIBDIR}/ffi/lib/pkgconfig:$PKG_CONFIG_PATH
meson --prefix ${LIBDIR}/wayland -Ddocumentation=false -Dtests=false -D "c_link_args=-L${LIBDIR}/ffi/lib -lm" . ../external_wayland
${MESON} --prefix ${LIBDIR}/wayland -Ddocumentation=false -Dtests=false -D "c_link_args=-L${LIBDIR}/ffi/lib -lm" . ../external_wayland
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)

View File

@@ -7,7 +7,7 @@ ExternalProject_Add(external_wayland_protocols
PREFIX ${BUILD_DIR}/wayland-protocols
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own WAYLAND.
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/wayland/lib64/pkgconfig:$PKG_CONFIG_PATH
meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
${MESON} --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)

View File

@@ -18,6 +18,7 @@ ExternalProject_Add(external_yamlcpp
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${YAMLCPP_HASH_TYPE}=${YAMLCPP_HASH}
PREFIX ${BUILD_DIR}/yamlcpp
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/yamlcpp ${DEFAULT_CMAKE_FLAGS} ${YAMLCPP_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/yamlcpp
)

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env python3
# macOS utility to remove all rpaths and add a new one.
import subprocess
import sys
rpath = sys.argv[1]
file = sys.argv[2]
# Find existing rpaths and delete them one by one.
p = subprocess.run(['otool', '-l', file], capture_output=True)
tokens = p.stdout.split()
for i, token in enumerate(tokens):
if token == b'LC_RPATH':
old_rpath = tokens[i + 4]
subprocess.run(['install_name_tool', '-delete_rpath', old_rpath, file])
subprocess.run(['install_name_tool', '-add_rpath', rpath, file])

View File

@@ -3187,7 +3187,6 @@ compile_USD() {
if [ -d $INST/tbb ]; then
cmake_d="$cmake_d $cmake_d -D TBB_ROOT_DIR=$INST/tbb"
fi
cmake_d="$cmake_d -DPXR_SET_INTERNAL_NAMESPACE=usdBlender"
cmake_d="$cmake_d -DPXR_ENABLE_PYTHON_SUPPORT=OFF"
cmake_d="$cmake_d -DPXR_BUILD_IMAGING=OFF"
cmake_d="$cmake_d -DPXR_BUILD_TESTS=OFF"

View File

@@ -1,4 +1,4 @@
using python : @PYTHON_SHORT_VERSION@ : @PYTHON_BINARY@
: @LIBDIR@/python/include @LIBDIR@/python/include/python@PYTHON_SHORT_VERSION@m/
: @LIBDIR@/python/include @LIBDIR@/python/include/python@PYTHON_SHORT_VERSION@/
: @LIBDIR@/python/libs
;

View File

@@ -0,0 +1,13 @@
diff -Naur orig/source/PyMaterialX/PyBind11/tools/FindPythonLibsNew.cmake external_materialx/source/PyMaterialX/PyBind11/tools/FindPythonLibsNew.cmake
--- orig/source/PyMaterialX/PyBind11/tools/FindPythonLibsNew.cmake 2022-11-04 14:23:29 -0600
+++ external_materialx/source/PyMaterialX/PyBind11/tools/FindPythonLibsNew.cmake 2022-11-08 11:58:45 -0700
@@ -181,6 +181,9 @@
string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES "${PYTHON_SITE_PACKAGES}")
if(CMAKE_HOST_WIN32)
+ if(PYTHON_EXECUTABLE MATCHES "_d.exe$")
+ set(PYTHON_LIBRARY_SUFFIX ${PYTHON_LIBRARY_SUFFIX}_d)
+ endif()
set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/python${PYTHON_LIBRARY_SUFFIX}.lib")
# when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the

View File

@@ -3,19 +3,19 @@ index 95abbe2..4f14f30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -254,11 +254,11 @@ if(USE_STATIC_MSVC_RUNTIME)
endif()
#adding PCRE
-find_package(PCRE)
+#find_package(PCRE)
if (PCRE_FOUND)
message(STATUS "SUCCESSFUL: PCRE found")
else () # if pcre not found building its local copy from ./Externals
- if (WIN32 OR APPLE)
+ if (1)
message("WARNING: Native PCRE not found, taking PCRE from ./Externals")
add_definitions(-DPCRE_STATIC)
add_subdirectory(${EXTERNAL_LIBRARIES}/pcre)
endif()
#adding PCRE
-find_package(PCRE)
+#find_package(PCRE)
if (PCRE_FOUND)
message(STATUS "SUCCESSFUL: PCRE found")
else () # if pcre not found building its local copy from ./Externals
- if (WIN32 OR APPLE)
+ if (1)
message("WARNING: Native PCRE not found, taking PCRE from ./Externals")
add_definitions(-DPCRE_STATIC)
add_subdirectory(${EXTERNAL_LIBRARIES}/pcre)
diff --git a/DAEValidator/CMakeLists.txt b/DAEValidator/CMakeLists.txt
index 03ad540..f7d05cf 100644
--- a/DAEValidator/CMakeLists.txt
@@ -66,13 +66,13 @@ index 40081e7..e1d1bfa 100644
--- a/Externals/LibXML/CMakeLists.txt
+++ b/Externals/LibXML/CMakeLists.txt
@@ -9,6 +9,7 @@ add_definitions(
-DLIBXML_SCHEMAS_ENABLED
-DLIBXML_XPATH_ENABLED
-DLIBXML_TREE_ENABLED
+ -DLIBXML_STATIC
)
if(USE_STATIC_MSVC_RUNTIME)
-DLIBXML_SCHEMAS_ENABLED
-DLIBXML_XPATH_ENABLED
-DLIBXML_TREE_ENABLED
+ -DLIBXML_STATIC
)
if(USE_STATIC_MSVC_RUNTIME)
diff --git a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
index 1f9a3ee..d151e9a 100644
--- a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
@@ -155,3 +155,15 @@ diff -Naur a/CMakeLists.txt b/CMakeLists.txt
# Library export
install(EXPORT LibraryExport DESTINATION ${OPENCOLLADA_INST_CMAKECONFIG} FILE OpenCOLLADATargets.cmake)
diff -Naur OpenCOLLADA-1.6.68/common/libBuffer/include/CommonFWriteBufferFlusher.h external_opencollada/common/libBuffer/include/CommonFWriteBufferFlusher.h
--- OpenCOLLADA-1.6.68/common/libBuffer/include/CommonFWriteBufferFlusher.h 2018-11-26 14:43:10 -0700
+++ external_opencollada/common/libBuffer/include/CommonFWriteBufferFlusher.h 2022-08-19 11:36:04 -0600
@@ -23,7 +23,7 @@
# include <tr1/unordered_map>
#endif
-#ifdef _LIBCPP_VERSION
+#if defined(_LIBCPP_VERSION) || defined(WIN32)
// If we're compiling with libc++, create a namespace alias for tr1 that points to std.
// Not particularly elegant, and largely should be filed under "hack", but it works for OS X with clang for now.
namespace std {

View File

@@ -21,16 +21,3 @@ diff -Naur orig/src/cmake/compiler.cmake external_openimageio/src/cmake/compiler
endif (MSVC)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"
diff -Naur orig/src/include/OpenImageIO/platform.h external_openimageio/src/include/OpenImageIO/platform.h
--- orig/src/include/OpenImageIO/platform.h 2020-05-10 21:43:52 -0600
+++ external_openimageio/src/include/OpenImageIO/platform.h 2020-05-13 17:04:36 -0600
@@ -41,6 +41,9 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
+# ifndef NOGDI
+# define NOGDI
+# endif
# include <windows.h>
#endif

View File

@@ -1,30 +1,6 @@
diff -ur openvdb-9.0.0/cmake/FindTBB.cmake openvdb/cmake/FindTBB.cmake
--- openvdb-9.0.0/cmake/FindTBB.cmake 2021-10-30 03:55:40.000000000 +0100
+++ openvdb/cmake/FindTBB.cmake 2022-03-31 11:33:15.592329750 +0100
@@ -252,7 +252,8 @@
set(_TBB_LIB_NAME "${_TBB_LIB_NAME}${TBB_DEBUG_SUFFIX}")
endif()
- find_library(Tbb_${COMPONENT}_LIBRARY_${BUILD_TYPE} ${_TBB_LIB_NAME}
+ find_library(Tbb_${COMPONENT}_LIBRARY_${BUILD_TYPE}
+ NAMES ${_TBB_LIB_NAME} ${_TBB_LIB_NAME}_static
${_FIND_TBB_ADDITIONAL_OPTIONS}
PATHS ${_TBB_LIBRARYDIR_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} lib64 lib
diff -Naur openvdb-8.0.0/openvdb/openvdb/CMakeLists.txt openvdb/openvdb/openvdb/CMakeLists.txt
--- openvdb-8.0.0/openvdb/openvdb/CMakeLists.txt 2020-12-24 10:13:14 -0700
+++ openvdb/openvdb/openvdb/CMakeLists.txt 2021-02-05 11:18:33 -0700
@@ -107,7 +107,9 @@
# http://boost.2283326.n4.nabble.com/CMake-config-scripts-broken-in-1-70-td4708957.html
# https://github.com/boostorg/boost_install/commit/160c7cb2b2c720e74463865ef0454d4c4cd9ae7c
set(BUILD_SHARED_LIBS ON)
- set(Boost_USE_STATIC_LIBS OFF)
+ if(NOT WIN32) # blender links boost statically on windows
+ set(Boost_USE_STATIC_LIBS OFF)
+ endif()
endif()
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams system)
@@ -146,6 +148,7 @@
Boost::disable_autolinking # add -DBOOST_ALL_NO_LIB
)
@@ -99,321 +75,18 @@ diff -Naur openvdb-8.0.0/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/v
+
+ END
+END
diff --git a/nanovdb/nanovdb/NanoVDB.h b/nanovdb/nanovdb/NanoVDB.h
index cc2e54b77..703d2eabc 100644
--- a/nanovdb/nanovdb/NanoVDB.h
+++ b/nanovdb/nanovdb/NanoVDB.h
@@ -161,8 +161,8 @@ typedef unsigned long long uint64_t;
diff -Naur orig/openvdb/openvdb/tree/ValueAccessor.h openvdb/openvdb/openvdb/tree/ValueAccessor.h
--- orig/openvdb/openvdb/tree/ValueAccessor.h 2022-11-02 13:58:26 -0600
+++ openvdb/openvdb/openvdb/tree/ValueAccessor.h 2022-11-02 18:55:09 -0600
@@ -872,7 +872,10 @@
using LeafNodeType = typename NodeType::LeafNodeType;
using CoordLimits = std::numeric_limits<Int32>;
#endif // __CUDACC_RTC__
- static_assert(std::is_same<NodeType, LeafNodeType>::value);
+ // Blender: Technically not an issue in OpenVDB, but USD 21.11 still builds
+ // as C++14 which does not support terse asserts yet. Add a message to
+ // explicitly select the C++14 supported static assert.
+ static_assert(std::is_same<NodeType, LeafNodeType>::value, "cache item node type is not leaf node type");
-#ifdef __CUDACC__
-// Only define __hostdev__ when using NVIDIA CUDA compiler
+#if defined(__CUDACC__) || defined(__HIP__)
+// Only define __hostdev__ when using NVIDIA CUDA or HIP compiler
#define __hostdev__ __host__ __device__
#else
#define __hostdev__
@@ -611,7 +611,7 @@ struct Delta<double>
/// Maximum floating-point values
template<typename T>
struct Maximum;
-#ifdef __CUDA_ARCH__
+#if defined(__CUDA_ARCH__) || defined(__HIP__)
template<>
struct Maximum<int>
{
@@ -1176,10 +1176,10 @@ using Vec3f = Vec3<float>;
using Vec3i = Vec3<int>;
/// @brief Return a single precision floating-point vector of this coordinate
-Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
+__hostdev__ inline Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
/// @brief Return a double precision floating-point vector of this coordinate
-Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
+__hostdev__ inline Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
// ----------------------------> Vec4 <--------------------------------------
@@ -2042,7 +2042,7 @@ struct Map
}; // Map
template<typename Mat4T>
-void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
+__hostdev__ void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
{
float * mf = mMatF, *vf = mVecF;
float* mif = mInvMatF;
@@ -2486,7 +2486,7 @@ class Grid : private GridData
}; // Class Grid
template<typename TreeT>
-int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
+__hostdev__ int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
{
for (uint32_t i = 0, n = this->blindDataCount(); i < n; ++i)
if (this->blindMetaData(i).mSemantic == semantic)
@@ -2671,7 +2671,7 @@ class Tree : private TreeData<RootT::LEVEL>
}; // Tree class
template<typename RootT>
-void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
+__hostdev__ void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
{
min = this->root().minimum();
max = this->root().maximum();
@@ -3880,7 +3880,7 @@ class LeafNode : private LeafData<BuildT, CoordT, MaskT, Log2Dim>
}; // LeafNode class
template<typename ValueT, typename CoordT, template<uint32_t> class MaskT, uint32_t LOG2DIM>
-inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
+__hostdev__ inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
{
static_assert(LOG2DIM == 3, "LeafNode::updateBBox: only supports LOGDIM = 3!");
if (!this->isActive()) return;
diff --git a/nanovdb/nanovdb/util/SampleFromVoxels.h b/nanovdb/nanovdb/util/SampleFromVoxels.h
index 852123dac..e779d66cf 100644
--- a/nanovdb/nanovdb/util/SampleFromVoxels.h
+++ b/nanovdb/nanovdb/util/SampleFromVoxels.h
@@ -22,7 +22,7 @@
#define NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED
// Only define __hostdev__ when compiling as NVIDIA CUDA
-#ifdef __CUDACC__
+#if defined(__CUDACC__) || defined(__HIP__)
#define __hostdev__ __host__ __device__
#else
#include <cmath> // for floor
@@ -136,7 +136,7 @@ class SampleFromVoxels<TreeOrAccT, 0, false>
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
{
const CoordT ijk = Round<CoordT>(xyz);
if (ijk != mPos) {
@@ -147,7 +147,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
{
if (ijk != mPos) {
mPos = ijk;
@@ -158,7 +158,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
{
return mAcc.getValue(Round<CoordT>(xyz));
}
@@ -195,7 +195,7 @@ class TrilinearSampler
}; // TrilinearSamplerBase
template<typename TreeOrAccT>
-void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
+__hostdev__ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
{
v[0][0][0] = mAcc.getValue(ijk); // i, j, k
@@ -224,7 +224,7 @@ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) co
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
#if 0
auto lerp = [](ValueT a, ValueT b, ValueT w){ return fma(w, b-a, a); };// = w*(b-a) + a
@@ -239,7 +239,7 @@ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
static_assert(is_floating_point<ValueT>::value, "TrilinearSampler::gradient requires a floating-point type");
#if 0
@@ -270,7 +270,7 @@ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(con
}
template<typename TreeOrAccT>
-bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
+__hostdev__ bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
{
static_assert(is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -363,21 +363,21 @@ class SampleFromVoxels<TreeOrAccT, 1, true> : public TrilinearSampler<TreeOrAccT
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[0][0][0] : BaseT::mAcc.getValue(ijk);
}
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::gradient(xyz, mVal);
@@ -393,7 +393,7 @@ __hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, true>::zeroCrossing(Vec3T<RealT
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -406,7 +406,7 @@ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -418,7 +418,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator(
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
auto lerp = [](ValueT a, ValueT b, RealT w) { return a + ValueT(w) * (b - a); };
@@ -463,7 +463,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator(
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
+__hostdev__ inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -473,7 +473,7 @@ inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, fal
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -510,7 +510,7 @@ class TriquadraticSampler
}; // TriquadraticSamplerBase
template<typename TreeOrAccT>
-void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
+__hostdev__ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
{
CoordT p(ijk[0] - 1, 0, 0);
for (int dx = 0; dx < 3; ++dx, ++p[0]) {
@@ -526,7 +526,7 @@ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
+__hostdev__ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
{
auto kernel = [](const ValueT* value, double weight)->ValueT {
return weight * (weight * (0.5f * (value[0] + value[2]) - value[1]) +
@@ -545,7 +545,7 @@ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec
}
template<typename TreeOrAccT>
-bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
+__hostdev__ bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
{
static_assert(is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -624,14 +624,14 @@ class SampleFromVoxels<TreeOrAccT, 2, true> : public TriquadraticSampler<TreeOrA
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[1][1][1] : BaseT::mAcc.getValue(ijk);
}
@@ -646,7 +646,7 @@ __hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, true>::zeroCrossing(Vec3T<RealT
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -657,7 +657,7 @@ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -667,7 +667,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator(
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -710,7 +710,7 @@ class TricubicSampler
}; // TricubicSampler
template<typename TreeOrAccT>
-void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
+__hostdev__ void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
{
auto fetch = [&](int i, int j, int k) -> ValueT& { return C[((i + 1) << 4) + ((j + 1) << 2) + k + 1]; };
@@ -929,7 +929,7 @@ class SampleFromVoxels<TreeOrAccT, 3, true> : public TricubicSampler<TreeOrAccT>
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mC);
@@ -937,7 +937,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
CacheItem(TreeCacheT& parent)
: mParent(&parent)

View File

@@ -1,7 +1,8 @@
diff -Naur OpenShadingLanguage-1.12.6.2/CMakeLists.txt external_osl/CMakeLists.txt
--- OpenShadingLanguage-1.12.6.2/CMakeLists.txt 2022-09-30 17:43:53 -0600
+++ external_osl/CMakeLists.txt 2022-10-15 14:49:26 -0600
@@ -101,6 +101,11 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d527232..5ad6eaa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,6 +99,11 @@ set (OSL_PTX_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/ptx"
CACHE STRING "Directory where OptiX PTX files will be installed")
set (CMAKE_DEBUG_POSTFIX "" CACHE STRING "Library naming postfix for Debug builds (e.g., '_debug')")
@@ -13,10 +14,11 @@ diff -Naur OpenShadingLanguage-1.12.6.2/CMakeLists.txt external_osl/CMakeLists.t
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
if (OSL_NO_DEFAULT_TEXTURESYSTEM)
diff -Naur OpenShadingLanguage-1.12.6.2/src/cmake/externalpackages.cmake external_osl/src/cmake/externalpackages.cmake
--- OpenShadingLanguage-1.12.6.2/src/cmake/externalpackages.cmake 2022-09-30 17:43:53 -0600
+++ external_osl/src/cmake/externalpackages.cmake 2022-10-15 14:49:26 -0600
@@ -77,6 +77,7 @@
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index a7e098b..dad11d0 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -77,6 +77,7 @@ link_directories ("${Boost_LIBRARY_DIRS}")
checked_find_package (ZLIB REQUIRED) # Needed by several packages
@@ -24,30 +26,10 @@ diff -Naur OpenShadingLanguage-1.12.6.2/src/cmake/externalpackages.cmake externa
# IlmBase & OpenEXR
checked_find_package (OpenEXR REQUIRED
diff -Naur OpenShadingLanguage-1.12.6.2/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h
--- OpenShadingLanguage-1.12.6.2/src/include/OSL/llvm_util.h 2022-09-30 17:43:53 -0600
+++ external_osl/src/include/OSL/llvm_util.h 2022-10-15 15:37:24 -0600
@@ -9,6 +9,8 @@
#include <unordered_set>
#include <vector>
+#define OSL_HAS_BLENDER_CLEANUP_FIX
+
#ifdef LLVM_NAMESPACE
namespace llvm = LLVM_NAMESPACE;
#endif
@@ -455,7 +457,7 @@
llvm::BasicBlock* masked_return_block() const;
bool is_masking_required() const { return m_is_masking_required; }
-
+ static void Cleanup ();
struct ScopedMasking {
ScopedMasking() {}
diff -Naur OpenShadingLanguage-1.12.6.2/src/liboslcomp/oslcomp.cpp external_osl/src/liboslcomp/oslcomp.cpp
--- OpenShadingLanguage-1.12.6.2/src/liboslcomp/oslcomp.cpp 2022-09-30 17:43:53 -0600
+++ external_osl/src/liboslcomp/oslcomp.cpp 2022-10-15 14:49:26 -0600
diff --git a/src/liboslcomp/oslcomp.cpp b/src/liboslcomp/oslcomp.cpp
index 8c2e77b..211b8a7 100644
--- a/src/liboslcomp/oslcomp.cpp
+++ b/src/liboslcomp/oslcomp.cpp
@@ -21,6 +21,13 @@
#if !defined(__STDC_CONSTANT_MACROS)
# define __STDC_CONSTANT_MACROS 1
@@ -62,50 +44,34 @@ diff -Naur OpenShadingLanguage-1.12.6.2/src/liboslcomp/oslcomp.cpp external_osl/
#include <clang/Basic/TargetInfo.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
diff -Naur OpenShadingLanguage-1.12.6.2/src/liboslexec/llvm_util.cpp external_osl/src/liboslexec/llvm_util.cpp
--- OpenShadingLanguage-1.12.6.2/src/liboslexec/llvm_util.cpp 2022-09-30 17:43:53 -0600
+++ external_osl/src/liboslexec/llvm_util.cpp 2022-10-15 15:53:11 -0600
@@ -116,8 +116,6 @@
return { A.data(), size_t(A.size()) };
diff --git a/src/liboslexec/llvm_instance.cpp b/src/liboslexec/llvm_instance.cpp
index 8f52546..8c2d0c7 100644
--- a/src/liboslexec/llvm_instance.cpp
+++ b/src/liboslexec/llvm_instance.cpp
@@ -1363,6 +1363,10 @@ BackendLLVM::run()
#ifdef OSL_LLVM_NO_BITCODE
OSL_ASSERT(!use_rs_bitcode());
ll.module(ll.new_module("llvm_ops"));
+ if (use_optix()) {
+ ll.module()->setDataLayout("e-i64:64-i128:128-v16:16-v32:32-n16:32:64");
+ ll.module()->setTargetTriple("nvptx64-nvidia-cuda");
+ }
#else
if (!use_optix()) {
if (use_rs_bitcode()) {
diff --git a/src/liboslexec/shadingsys.cpp b/src/liboslexec/shadingsys.cpp
index 46e4529..8e86486 100644
--- a/src/liboslexec/shadingsys.cpp
+++ b/src/liboslexec/shadingsys.cpp
@@ -2121,6 +2121,11 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
return true;
}
+ if (name == "groupdata_size" && type == TypeDesc::TypeInt) {
+ *(int*)val = (int)group->m_llvm_groupdata_size;
+ return true;
+ }
+
return false;
}
-
-
namespace pvt {
typedef llvm::SectionMemoryManager LLVMMemoryManager;
@@ -182,6 +180,13 @@
++jit_mem_hold_users;
}
+void
+LLVM_Util::Cleanup()
+{
+ if (jitmm_hold)
+ jitmm_hold->clear();
+}
+
LLVM_Util::ScopedJitMemoryUser::~ScopedJitMemoryUser()
{
diff --git a/src/include/OSL/mask.h b/src/include/OSL/mask.h
index 24197af..b9275f6 100644
--- a/src/include/OSL/mask.h
+++ b/src/include/OSL/mask.h
@@ -4,7 +4,6 @@
#pragma once
-#include <immintrin.h>
#include <type_traits>
#include <OSL/oslconfig.h>
@@ -23,6 +22,8 @@ using std::countr_zero;
#elif OSL_INTEL_CLASSIC_COMPILER_VERSION
+#include <immintrin.h>
+
OSL_FORCEINLINE int popcount(uint32_t x) noexcept { return _mm_popcnt_u32(x);}
OSL_FORCEINLINE int popcount(uint64_t x) noexcept { return _mm_popcnt_u64(x); }
OSL_FORCEINLINE int countr_zero(uint32_t x) noexcept { return _bit_scan_forward(x); }

View File

@@ -0,0 +1,22 @@
--- a/PCbuild/prepare_ssl.bat 2022-10-30 11:48:14 -0600
+++ b/PCbuild/prepare_ssl.bat 2022-10-30 11:53:16 -0600
@@ -47,12 +47,13 @@
if "%PERL%" == "" where perl > "%TEMP%\perl.loc" 2> nul && set /P PERL= <"%TEMP%\perl.loc" & del "%TEMP%\perl.loc"
if "%PERL%" == "" (echo Cannot locate perl.exe on PATH or as PERL variable & exit /b 4)
-%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=Win32
-if errorlevel 1 exit /b
+REM Blender: we only need x64, ssl is kind of a long build, so just build what we need
+REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=Win32
+REM if errorlevel 1 exit /b
%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=x64
if errorlevel 1 exit /b
-%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM
-if errorlevel 1 exit /b
-%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM64
-if errorlevel 1 exit /b
+REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM
+REM if errorlevel 1 exit /b
+REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM64
+REM if errorlevel 1 exit /b

View File

@@ -1,7 +1,7 @@
diff -x .git -ur usd.orig/cmake/defaults/Packages.cmake external_usd/cmake/defaults/Packages.cmake
--- usd.orig/cmake/defaults/Packages.cmake 2019-10-24 22:39:53.000000000 +0200
+++ external_usd/cmake/defaults/Packages.cmake 2019-11-28 13:00:33.185957483 +0100
@@ -64,7 +64,7 @@
diff -Naur orig/cmake/defaults/Packages.cmake external_usd/cmake/defaults/Packages.cmake
--- orig/cmake/defaults/Packages.cmake 2022-10-27 12:56:33 -0600
+++ external_usd/cmake/defaults/Packages.cmake 2022-10-27 13:05:08 -0600
@@ -129,7 +129,7 @@
endif()
# --TBB
@@ -10,10 +10,9 @@ diff -x .git -ur usd.orig/cmake/defaults/Packages.cmake external_usd/cmake/defau
add_definitions(${TBB_DEFINITIONS})
# --math
diff -Naur usd_orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/defaults/msvcdefaults.cmake
--- usd_orig/cmake/defaults/msvcdefaults.cmake 2022-02-18 14:49:09 -0700
+++ external_usd/cmake/defaults/msvcdefaults.cmake 2022-03-14 11:41:50 -0600
diff -Naur orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/defaults/msvcdefaults.cmake
--- orig/cmake/defaults/msvcdefaults.cmake 2022-10-27 12:56:33 -0600
+++ external_usd/cmake/defaults/msvcdefaults.cmake 2022-10-27 13:05:08 -0600
@@ -120,9 +120,6 @@
# for all translation units.
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /bigobj")
@@ -24,38 +23,10 @@ diff -Naur usd_orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/default
# Enable multiprocessor builds.
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /MP")
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /Gm-")
diff --git a/pxr/base/work/singularTask.h b/pxr/base/work/singularTask.h
--- a/pxr/base/work/singularTask.h
+++ b/pxr/base/work/singularTask.h
@@ -120,7 +120,7 @@
// case we go again to ensure the task can do whatever it
// was awakened to do. Once we successfully take the count
// to zero, we stop.
- size_t old = count;
+ std::size_t old = count;
do { _fn(); } while (
!count.compare_exchange_strong(old, 0));
});
diff --git a/pxr/usd/sdr/shaderMetadataHelpers.h b/pxr/usd/sdr/shaderMetadataHelpers.h
--- a/pxr/usd/sdr/shaderMetadataHelpers.h
+++ b/pxr/usd/sdr/shaderMetadataHelpers.h
@@ -32,6 +32,8 @@
#include "pxr/base/tf/token.h"
#include "pxr/usd/sdr/declare.h"
+#include <limits>
+
PXR_NAMESPACE_OPEN_SCOPE
/// \namespace ShaderMetadataHelpers
diff --git a/pxr/base/arch/timing.h b/pxr/base/arch/timing.h
index 517561f..fda5a1f 100644
--- a/pxr/base/arch/timing.h
+++ b/pxr/base/arch/timing.h
@@ -91,6 +91,10 @@ ArchGetTickTime()
diff -Naur orig/pxr/base/arch/timing.h external_usd/pxr/base/arch/timing.h
--- orig/pxr/base/arch/timing.h 2022-10-27 12:56:34 -0600
+++ external_usd/pxr/base/arch/timing.h 2022-10-27 13:05:08 -0600
@@ -84,6 +84,10 @@
inline uint64_t
ArchGetStartTickTime()
{
@@ -66,7 +37,7 @@ index 517561f..fda5a1f 100644
uint64_t t;
#if defined (ARCH_OS_DARWIN)
return ArchGetTickTime();
@@ -123,6 +127,7 @@ ArchGetStartTickTime()
@@ -116,6 +120,7 @@
#error "Unsupported architecture."
#endif
return t;
@@ -74,7 +45,7 @@ index 517561f..fda5a1f 100644
}
/// Get a "stop" tick time for measuring an interval of time. See
@@ -132,6 +137,10 @@ ArchGetStartTickTime()
@@ -125,6 +130,10 @@
inline uint64_t
ArchGetStopTickTime()
{
@@ -85,7 +56,7 @@ index 517561f..fda5a1f 100644
uint64_t t;
#if defined (ARCH_OS_DARWIN)
return ArchGetTickTime();
@@ -162,11 +171,11 @@ ArchGetStopTickTime()
@@ -155,11 +164,11 @@
#error "Unsupported architecture."
#endif
return t;
@@ -100,3 +71,46 @@ index 517561f..fda5a1f 100644
/// A simple timer class for measuring an interval of time using the
/// ArchTickTimer facilities.
diff -Naur orig/pxr/imaging/hioOpenVDB/CMakeLists.txt external_usd/pxr/imaging/hioOpenVDB/CMakeLists.txt
--- orig/pxr/imaging/hioOpenVDB/CMakeLists.txt 2022-10-27 12:56:35 -0600
+++ external_usd/pxr/imaging/hioOpenVDB/CMakeLists.txt 2022-10-27 13:05:08 -0600
@@ -20,6 +20,12 @@
LIST(APPEND __VDB_IMATH_LIBS ${OPENEXR_Half_LIBRARY})
endif()
+if (WIN32)
+ # OpenVDB uses constants from <cmath> that aren't available on
+ # Windows unless this is defined.
+ add_definitions(-D_USE_MATH_DEFINES)
+endif()
+
pxr_library(hioOpenVDB
LIBRARIES
ar
diff -Naur orig/pxr/usdImaging/CMakeLists.txt external_usd/pxr/usdImaging/CMakeLists.txt
--- orig/pxr/usdImaging/CMakeLists.txt 2022-10-27 12:56:37 -0600
+++ external_usd/pxr/usdImaging/CMakeLists.txt 2022-10-27 13:05:08 -0600
@@ -7,7 +7,7 @@
usdVolImaging
usdAppUtils
usdviewq
- bin
+# bin
plugin
)
diff -Naur orig/cmake/macros/Private.cmake external_usd/cmake/macros/Private.cmake
--- orig/cmake/macros/Private.cmake 2022-02-18 14:49:09 -0700
+++ external_usd/cmake/macros/Private.cmake 2022-08-05 10:42:03 -0600
@@ -900,8 +900,10 @@
return()
endif()
- if (WIN32 AND PXR_USE_DEBUG_PYTHON)
+ if (WIN32 AND PXR_USE_DEBUG_PYTHON AND NOT CMAKE_DEBUG_POSTFIX)
# On Windows when compiling with debug python the library must be named with _d.
+ # Blender: but this can be skipped if CMAKE_DEBUG_POSTFIX is set, it knows
+ # what it is doing and we don't want libraries ending in _d_d.pyd
set(LIBRARY_NAME "_${NAME}_d")
else()
set(LIBRARY_NAME "_${NAME}")

View File

@@ -103,15 +103,19 @@ if %ERRORLEVEL% NEQ 0 (
)
set StatusFile=%BUILD_DIR%\%1_%2.log
set path=%BUILD_DIR%\downloads\mingw\mingw64\msys\1.0\bin\;%BUILD_DIR%\downloads\nasm-2.12.01\;%path%
set original_path=%path%
set oiio_paths=%Staging%\%BuildDir%%ARCH%R\Release\openimageio\bin;%Staging%\%BuildDir%%ARCH%D\Debug\openimageio\bin
set boost_paths=%Staging%\%BuildDir%%ARCH%R\Release\boost\lib;%Staging%\%BuildDir%%ARCH%D\Debug\boost\lib
set openexr_paths=%Staging%\%BuildDir%%ARCH%R\Release\openexr\bin;%Staging%\%BuildDir%%ARCH%D\Debug\openexr\bin
set imath_paths=%Staging%\%BuildDir%%ARCH%R\Release\imath\bin;%Staging%\%BuildDir%%ARCH%D\Debug\imath\bin
set path=%BUILD_DIR%\downloads\mingw\mingw64\msys\1.0\bin\;%BUILD_DIR%\downloads\nasm-2.12.01\;%path%;%boost_paths%;%oiio_paths%;%openexr_paths%;%imath_paths%
mkdir %STAGING%\%BuildDir%%ARCH%R
cd %Staging%\%BuildDir%%ARCH%R
echo %DATE% %TIME% : Start > %StatusFile%
cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% -Thost=x64 %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DBUILD_MODE=Release -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/
echo %DATE% %TIME% : Release Configuration done >> %StatusFile%
if "%dobuild%" == "1" (
msbuild /m:1 "ll.vcxproj" /p:Configuration=Release /fl /flp:logfile=BlenderDeps_llvm.log;Verbosity=normal
msbuild /m:1 "BlenderDependencies.sln" /p:Configuration=Release /fl /flp:logfile=BlenderDeps.log;Verbosity=minimal /verbosity:minimal
msbuild -maxcpucount:1 "BlenderDependencies.sln" /p:Configuration=Release /fl /flp:logfile=BlenderDeps.log;Verbosity=minimal /verbosity:minimal
echo %DATE% %TIME% : Release Build done >> %StatusFile%
cmake --build . --target Harvest_Release_Results > Harvest_Release.txt
)
@@ -123,8 +127,7 @@ cd %Staging%\%BuildDir%%ARCH%D
cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% -Thost=x64 %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DCMAKE_BUILD_TYPE=Debug -DBUILD_MODE=Debug -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ %CMAKE_DEBUG_OPTIONS%
echo %DATE% %TIME% : Debug Configuration done >> %StatusFile%
if "%dobuild%" == "1" (
msbuild /m:1 "ll.vcxproj" /p:Configuration=Debug /fl /flp:logfile=BlenderDeps_llvm.log;;Verbosity=normal
msbuild /m:1 "BlenderDependencies.sln" /p:Configuration=Debug /verbosity:n /fl /flp:logfile=BlenderDeps.log;;Verbosity=normal
msbuild -maxcpucount:1 "BlenderDependencies.sln" /p:Configuration=Debug /verbosity:n /fl /flp:logfile=BlenderDeps.log;;Verbosity=normal
echo %DATE% %TIME% : Debug Build done >> %StatusFile%
cmake --build . --target Harvest_Debug_Results> Harvest_Debug.txt
)
@@ -132,4 +135,5 @@ echo %DATE% %TIME% : Debug Harvest done >> %StatusFile%
cd %BUILD_DIR%
:exit
set path=%original_path%
Echo .

View File

@@ -28,4 +28,4 @@ set(LIBDIR "${CMAKE_CURRENT_LIST_DIR}/../../../../lib/${LIBDIR_NAME}" CACHE STRI
# Platform specific configuration, to ensure static linking against everything.
# Additional linking libraries
set(CMAKE_EXE_LINKER_FLAGS "-lrt -static-libstdc++ -no-pie" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS "-lrt -no-pie" CACHE STRING "" FORCE)

View File

@@ -24,6 +24,7 @@ SET(_opencolorio_FIND_COMPONENTS
yaml-cpp
expat
pystring
minizip
)
SET(_opencolorio_SEARCH_DIRS

View File

@@ -13,6 +13,7 @@
#
# This module defines
# PYTHON_VERSION
# PYTHON_VERSION_NO_DOTS
# PYTHON_INCLUDE_DIRS
# PYTHON_INCLUDE_CONFIG_DIRS
# PYTHON_LIBRARIES
@@ -64,11 +65,11 @@ IF(DEFINED PYTHON_LIBPATH)
SET(_IS_LIB_PATH_DEF ON)
ENDIF()
STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
STRING(REPLACE "." "" PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
SET(_python_SEARCH_DIRS
${PYTHON_ROOT_DIR}
"$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}"
"$ENV{HOME}/py${PYTHON_VERSION_NO_DOTS}"
"/opt/lib/python-${PYTHON_VERSION}"
)
@@ -211,7 +212,6 @@ IF(PYTHONLIBSUNIX_FOUND)
)
ENDIF()
UNSET(_PYTHON_VERSION_NO_DOTS)
UNSET(_PYTHON_ABI_FLAGS)
UNSET(_python_SEARCH_DIRS)

View File

@@ -59,6 +59,9 @@ ELSE()
get_filename_component(USD_LIBRARY_DIR ${USD_LIBRARY} DIRECTORY)
SET(USD_INCLUDE_DIRS ${USD_INCLUDE_DIR})
set(USD_LIBRARIES ${USD_LIBRARY})
IF(EXISTS ${USD_INCLUDE_DIR}/pxr/base/tf/pyModule.h)
SET(USD_PYTHON_SUPPORT ON)
ENDIF()
ENDIF()
ENDIF()

View File

@@ -95,6 +95,9 @@ macro(BLENDER_SRC_GTEST_EX)
set_tests_properties(${TARGET_NAME} PROPERTIES
ENVIRONMENT LSAN_OPTIONS=exitcode=0:$ENV{LSAN_OPTIONS}
)
if(WIN32)
set_tests_properties(${TARGET_NAME} PROPERTIES ENVIRONMENT "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/;$ENV{PATH}")
endif()
endif()
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES VS_GLOBAL_VcpkgEnabled "false")

View File

@@ -58,6 +58,7 @@ set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)
set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_TBB ON CACHE BOOL "" FORCE)
set(WITH_USD ON CACHE BOOL "" FORCE)
set(WITH_MATERIALX OFF CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)

View File

@@ -63,6 +63,7 @@ set(WITH_QUADRIFLOW OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)
set(WITH_TBB OFF CACHE BOOL "" FORCE)
set(WITH_USD OFF CACHE BOOL "" FORCE)
set(WITH_MATERIALX OFF CACHE BOOL "" FORCE)
set(WITH_WASAPI OFF CACHE BOOL "" FORCE)
set(WITH_XR_OPENXR OFF CACHE BOOL "" FORCE)

View File

@@ -59,6 +59,7 @@ set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)
set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_TBB ON CACHE BOOL "" FORCE)
set(WITH_USD ON CACHE BOOL "" FORCE)
set(WITH_MATERIALX OFF CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)

View File

@@ -422,7 +422,9 @@ function(blender_add_test_suite)
--test-assets-dir "${CMAKE_SOURCE_DIR}/../lib/tests"
--test-release-dir "${_test_release_dir}"
)
if(WIN32)
set_tests_properties(${ARGS_SUITE_NAME} PROPERTIES ENVIRONMENT "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/;$ENV{PATH}")
endif()
unset(_test_release_dir)
endfunction()
@@ -1257,3 +1259,88 @@ endmacro()
macro(without_system_libs_end)
unset(CMAKE_IGNORE_PATH)
endmacro()
# Utility to gather and install precompiled shared libraries.
macro(add_bundled_libraries library_dir)
if(EXISTS ${LIBDIR})
set(_library_dir ${LIBDIR}/${library_dir})
if(WIN32)
file(GLOB _all_library_versions ${_library_dir}/*\.dll)
elseif(APPLE)
file(GLOB _all_library_versions ${_library_dir}/*\.dylib*)
else()
file(GLOB _all_library_versions ${_library_dir}/*\.so*)
endif()
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_all_library_versions})
list(APPEND PLATFORM_BUNDLED_LIBRARY_DIRS ${_library_dir})
unset(_all_library_versions)
unset(_library_dir)
endif()
endmacro()
macro(windows_install_shared_manifest)
set(options OPTIONAL DEBUG RELEASE ALL)
set(oneValueArgs)
set(multiValueArgs FILES)
cmake_parse_arguments(WINDOWS_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
# If none of the options are set assume ALL.
unset(WINDOWS_CONFIGURATIONS)
if(NOT WINDOWS_INSTALL_ALL AND
NOT WINDOWS_INSTALL_DEBUG AND
NOT WINDOWS_INSTALL_RELEASE)
set(WINDOWS_INSTALL_ALL TRUE)
endif()
# If all is set, turn both DEBUG and RELEASE on.
if(WINDOWS_INSTALL_ALL)
set(WINDOWS_INSTALL_DEBUG TRUE)
set(WINDOWS_INSTALL_RELEASE TRUE)
endif()
if(WINDOWS_INSTALL_DEBUG)
set(WINDOWS_CONFIGURATIONS "${WINDOWS_CONFIGURATIONS};Debug")
list(APPEND WINDOWS_SHARED_MANIFEST_DEBUG ${WINDOWS_INSTALL_FILES})
endif()
if(WINDOWS_INSTALL_RELEASE)
list(APPEND WINDOWS_SHARED_MANIFEST_RELEASE ${WINDOWS_INSTALL_FILES})
set(WINDOWS_CONFIGURATIONS "${WINDOWS_CONFIGURATIONS};Release;RelWithDebInfo;MinSizeRel")
endif()
install(FILES ${WINDOWS_INSTALL_FILES}
CONFIGURATIONS ${WINDOWS_CONFIGURATIONS}
DESTINATION "./blender.shared"
)
endmacro()
macro(windows_generate_manifest)
set(options)
set(oneValueArgs OUTPUT NAME)
set(multiValueArgs FILES)
cmake_parse_arguments(WINDOWS_MANIFEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set(MANIFEST_LIBS "")
foreach(lib ${WINDOWS_MANIFEST_FILES})
get_filename_component(filename ${lib} NAME)
set(MANIFEST_LIBS "${MANIFEST_LIBS} <file name=\"${filename}\"/>\n")
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.manifest.in ${WINDOWS_MANIFEST_OUTPUT} @ONLY)
endmacro()
macro(windows_generate_shared_manifest)
windows_generate_manifest(
FILES "${WINDOWS_SHARED_MANIFEST_DEBUG}"
OUTPUT "${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest"
NAME "blender.shared"
)
windows_generate_manifest(
FILES "${WINDOWS_SHARED_MANIFEST_RELEASE}"
OUTPUT "${CMAKE_BINARY_DIR}/Release/blender.shared.manifest"
NAME "blender.shared"
)
install(
FILES ${CMAKE_BINARY_DIR}/Release/blender.shared.manifest
DESTINATION "./blender.shared"
CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
)
install(
FILES ${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest
DESTINATION "./blender.shared"
CONFIGURATIONS Debug
)
endmacro()

View File

@@ -21,18 +21,6 @@ function(print_found_status
endif()
endfunction()
# Utility to install precompiled shared libraries.
macro(add_bundled_libraries library)
if(EXISTS ${LIBDIR})
set(_library_dir ${LIBDIR}/${library}/lib)
file(GLOB _all_library_versions ${_library_dir}/*\.dylib*)
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_all_library_versions})
list(APPEND PLATFORM_BUNDLED_LIBRARY_DIRS ${_library_dir})
unset(_all_library_versions)
unset(_library_dir)
endif()
endmacro()
# ------------------------------------------------------------------------
# Find system provided libraries.
@@ -98,6 +86,15 @@ endif()
if(WITH_USD)
find_package(USD REQUIRED)
add_bundled_libraries(usd/lib)
endif()
if(WITH_MATERIALX)
find_package(MaterialX)
set_and_warn_library_found("MaterialX" MaterialX_FOUND WITH_MATERIALX)
if(WITH_MATERIALX)
add_bundled_libraries(materialx/lib)
endif()
endif()
if(WITH_VULKAN_BACKEND)
@@ -119,6 +116,7 @@ endif()
if(WITH_OPENSUBDIV)
find_package(OpenSubdiv)
add_bundled_libraries(opensubdiv/lib)
endif()
if(WITH_CODEC_SNDFILE)
@@ -157,6 +155,8 @@ list(APPEND FREETYPE_LIBRARIES
if(WITH_IMAGE_OPENEXR)
find_package(OpenEXR)
add_bundled_libraries(openexr/lib)
add_bundled_libraries(imath/lib)
endif()
if(WITH_CODEC_FFMPEG)
@@ -255,12 +255,17 @@ if(WITH_BOOST)
if(WITH_OPENVDB)
list(APPEND _boost_FIND_COMPONENTS iostreams)
endif()
if(WITH_USD AND USD_PYTHON_SUPPORT)
list(APPEND _boost_FIND_COMPONENTS python${PYTHON_VERSION_NO_DOTS})
endif()
find_package(Boost COMPONENTS ${_boost_FIND_COMPONENTS})
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
set(BOOST_DEFINITIONS)
add_bundled_libraries(boost/lib)
mark_as_advanced(Boost_LIBRARIES)
mark_as_advanced(Boost_INCLUDE_DIRS)
unset(_boost_FIND_COMPONENTS)
@@ -286,18 +291,24 @@ if(WITH_OPENIMAGEIO)
)
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
add_bundled_libraries(openimageio/lib)
endif()
if(WITH_OPENCOLORIO)
find_package(OpenColorIO 2.0.0 REQUIRED)
add_bundled_libraries(opencolorio/lib)
endif()
if(WITH_OPENVDB)
find_package(OpenVDB)
find_library(BLOSC_LIBRARIES NAMES blosc HINTS ${LIBDIR}/openvdb/lib)
print_found_status("Blosc" "${BLOSC_LIBRARIES}")
list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES})
if(BLOSC_LIBRARIES)
list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES})
else()
unset(BLOSC_LIBRARIES CACHE)
endif()
set(OPENVDB_DEFINITIONS)
add_bundled_libraries(openvdb/lib)
endif()
if(WITH_NANOVDB)
@@ -346,6 +357,7 @@ endif()
if(WITH_TBB)
find_package(TBB REQUIRED)
add_bundled_libraries(tbb/lib)
endif()
if(WITH_POTRACE)
@@ -364,7 +376,7 @@ if(WITH_OPENMP)
set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/")
set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp")
set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib")
add_bundled_libraries(openmp)
add_bundled_libraries(openmp/lib)
endif()
endif()
@@ -480,6 +492,12 @@ if(PLATFORM_BUNDLED_LIBRARIES)
# different.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
list(APPEND CMAKE_BUILD_RPATH ${PLATFORM_BUNDLED_LIBRARY_DIRS})
# Environment variables to run precompiled executables that needed libraries.
list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths)
set(PLATFORM_ENV_BUILD "DYLD_LIBRARY_PATH=\"${_library_paths};${DYLD_LIBRARY_PATH}\"")
set(PLATFORM_ENV_INSTALL "DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}Blender.app/Contents/Resources/lib/;$DYLD_LIBRARY_PATH")
unset(_library_paths)
endif()
# Same as `CFBundleIdentifier` in Info.plist.

View File

@@ -44,3 +44,20 @@ if(UNIX AND DEFINED NANOVDB_INCLUDE_DIR)
unset_cache_variables("^NANOVDB")
endif()
endif()
# Detect update to 3.4 libs with shared libraries.
if(UNIX AND
DEFINED TBB_LIBRARY AND
TBB_LIBRARY MATCHES "libtbb.a$" AND
EXISTS ${LIBDIR}/usd/include/pxr/base/tf/pyModule.h)
message(STATUS "Auto updating CMake configuration for Blender 3.4 libraries")
unset_cache_variables("^BLOSC")
unset_cache_variables("^BOOST")
unset_cache_variables("^OPENCOLORIO")
unset_cache_variables("^OPENEXR")
unset_cache_variables("^OPENIMAGEIO")
unset_cache_variables("^OPENSUBDIV")
unset_cache_variables("^OPENVDB")
unset_cache_variables("^TBB")
unset_cache_variables("^USD")
endif()

View File

@@ -68,10 +68,7 @@ if(EXISTS ${LIBDIR})
set(Boost_NO_SYSTEM_PATHS ON)
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
set(CLANG_ROOT_DIR ${LIBDIR}/llvm)
endif()
if(WITH_STATIC_LIBS)
string(APPEND CMAKE_EXE_LINKER_FLAGS " -static-libstdc++")
set(MaterialX_DIR ${LIBDIR}/materialx/lib/cmake/MaterialX)
endif()
# Wrapper to prefer static libraries
@@ -83,15 +80,6 @@ macro(find_package_wrapper)
endif()
endmacro()
# Utility to install precompiled shared libraries.
macro(add_bundled_libraries library)
if(EXISTS ${LIBDIR})
file(GLOB _all_library_versions ${LIBDIR}/${library}/lib/*\.so*)
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_all_library_versions})
unset(_all_library_versions)
endif()
endmacro()
# ----------------------------------------------------------------------------
# Precompiled Libraries
#
@@ -179,6 +167,10 @@ endif()
if(WITH_IMAGE_OPENEXR)
find_package_wrapper(OpenEXR) # our own module
set_and_warn_library_found("OpenEXR" OPENEXR_FOUND WITH_IMAGE_OPENEXR)
if(WITH_IMAGE_OPENEXR)
add_bundled_libraries(openexr/lib)
add_bundled_libraries(imath/lib)
endif()
endif()
if(WITH_IMAGE_OPENJPEG)
@@ -335,11 +327,12 @@ if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
endif()
if(WITH_OPENVDB)
find_package_wrapper(OpenVDB)
find_package(OpenVDB)
set_and_warn_library_found("OpenVDB" OPENVDB_FOUND WITH_OPENVDB)
if(OPENVDB_FOUND)
find_package_wrapper(Blosc)
add_bundled_libraries(openvdb/lib)
find_package_wrapper(Blosc)
set_and_warn_library_found("Blosc" BLOSC_FOUND WITH_OPENVDB_BLOSC)
endif()
endif()
@@ -361,13 +354,24 @@ endif()
if(WITH_USD)
find_package_wrapper(USD)
set_and_warn_library_found("USD" USD_FOUND WITH_USD)
if(WITH_USD)
add_bundled_libraries(usd/lib)
endif()
endif()
if(WITH_MATERIALX)
find_package_wrapper(MaterialX)
set_and_warn_library_found("MaterialX" MaterialX_FOUND WITH_MATERIALX)
if(WITH_MATERIALX)
add_bundled_libraries(materialx/lib)
endif()
endif()
if(WITH_BOOST)
# uses in build instructions to override include and library variables
if(NOT BOOST_CUSTOM)
if(WITH_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_LIBS OFF)
endif()
set(Boost_USE_MULTITHREADED ON)
set(__boost_packages filesystem regex thread date_time)
@@ -383,6 +387,9 @@ if(WITH_BOOST)
if(WITH_OPENVDB)
list(APPEND __boost_packages iostreams)
endif()
if(WITH_USD AND USD_PYTHON_SUPPORT)
list(APPEND __boost_packages python${PYTHON_VERSION_NO_DOTS})
endif()
list(APPEND __boost_packages system)
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
if(NOT Boost_FOUND)
@@ -409,6 +416,8 @@ if(WITH_BOOST)
find_package(IcuLinux)
list(APPEND BOOST_LIBRARIES ${ICU_LIBRARIES})
endif()
add_bundled_libraries(boost/lib)
endif()
if(WITH_PUGIXML)
@@ -431,7 +440,6 @@ if(WITH_OPENIMAGEIO)
${ZLIB_LIBRARIES}
${BOOST_LIBRARIES}
)
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
set(OPENIMAGEIO_DEFINITIONS "")
if(WITH_IMAGE_TIFF)
@@ -445,16 +453,20 @@ if(WITH_OPENIMAGEIO)
endif()
set_and_warn_library_found("OPENIMAGEIO" OPENIMAGEIO_FOUND WITH_OPENIMAGEIO)
if(WITH_OPENIMAGEIO)
add_bundled_libraries(openimageio/lib)
endif()
endif()
if(WITH_OPENCOLORIO)
find_package_wrapper(OpenColorIO 2.0.0)
set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
set(OPENCOLORIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
set(OPENCOLORIO_DEFINITIONS)
set_and_warn_library_found("OpenColorIO" OPENCOLORIO_FOUND WITH_OPENCOLORIO)
if(WITH_OPENCOLORIO)
add_bundled_libraries(opencolorio/lib)
endif()
endif()
if(WITH_CYCLES AND WITH_CYCLES_EMBREE)
@@ -490,17 +502,23 @@ if(WITH_LLVM)
endif()
if(WITH_OPENSUBDIV)
find_package_wrapper(OpenSubdiv)
find_package(OpenSubdiv)
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES})
set(OPENSUBDIV_LIBPATH) # TODO, remove and reference the absolute path everywhere
set_and_warn_library_found("OpenSubdiv" OPENSUBDIV_FOUND WITH_OPENSUBDIV)
if(WITH_OPENSUBDIV)
add_bundled_libraries(opensubdiv/lib)
endif()
endif()
if(WITH_TBB)
find_package_wrapper(TBB)
set_and_warn_library_found("TBB" TBB_FOUND WITH_TBB)
if(WITH_TBB)
add_bundled_libraries(tbb/lib)
endif()
endif()
if(WITH_XR_OPENXR)
@@ -1005,4 +1023,10 @@ if(PLATFORM_BUNDLED_LIBRARIES)
# and because the build and install folder may be different.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
list(APPEND CMAKE_BUILD_RPATH $ORIGIN/lib ${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib)
# Environment variables to run precompiled executables that needed libraries.
list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths)
set(PLATFORM_ENV_BUILD "LD_LIBRARY_PATH=\"${_library_paths};${LD_LIBRARY_PATH}\"")
set(PLATFORM_ENV_INSTALL "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib/;$LD_LIBRARY_PATH")
unset(_library_paths)
endif()

View File

@@ -83,7 +83,7 @@ string(APPEND CMAKE_MODULE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
list(APPEND PLATFORM_LINKLIBS
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32 version
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp Shlwapi
pathcch Shcore Dwmapi
pathcch Shcore Dwmapi Crypt32
)
if(WITH_INPUT_IME)
@@ -110,7 +110,41 @@ remove_cc_flag("/GR")
# Make the Windows 8.1 API available for use.
add_definitions(-D_WIN32_WINNT=0x603)
include(build_files/cmake/platform/platform_win32_bundle_crt.cmake)
# First generate the manifest for tests since it will not need the dependency on the CRT.
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/tests.exe.manifest @ONLY)
if(WITH_WINDOWS_BUNDLE_CRT)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
include(InstallRequiredSystemLibraries)
# ucrtbase(d).dll cannot be in the manifest, due to the way windows 10 handles
# redirects for this dll, for details see T88813.
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
string(FIND ${lib} "ucrtbase" pos)
if(NOT pos EQUAL -1)
list(REMOVE_ITEM CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${lib})
install(FILES ${lib} DESTINATION . COMPONENT Libraries)
endif()
endforeach()
# Install the CRT to the blender.crt Sub folder.
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ./blender.crt COMPONENT Libraries)
windows_generate_manifest(
FILES "${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}"
OUTPUT "${CMAKE_BINARY_DIR}/blender.crt.manifest"
NAME "blender.crt"
)
install(FILES ${CMAKE_BINARY_DIR}/blender.crt.manifest DESTINATION ./blender.crt)
set(BUNDLECRT "<dependency><dependentAssembly><assemblyIdentity type=\"win32\" name=\"blender.crt\" version=\"1.0.0.0\" /></dependentAssembly></dependency>")
set(BUNDLECRT "${BUNDLECRT}<dependency><dependentAssembly><assemblyIdentity type=\"win32\" name=\"blender.shared\" version=\"1.0.0.0\" /></dependentAssembly></dependency>")
endif()
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/blender.exe.manifest @ONLY)
remove_cc_flag("/MDd" "/MD" "/Zi")
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
@@ -251,6 +285,11 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND WITH_CLANG_TIDY)
set(VS_CLANG_TIDY ON)
endif()
# To support building against both 3.4 and 3.5 lib folders, disable materialX if it is not found
set(MATERIALX_LIB_FOLDER_EXISTS EXISTS ${LIBDIR}/materialx)
set_and_warn_library_found("MaterialX" MATERIALX_LIB_FOLDER_EXISTS WITH_MATERIALX)
unset(MATERIALX_LIB_FOLDER_EXISTS)
# Mark libdir as system headers with a lower warn level, to resolve some warnings
# that we have very little control over
if(NOT MSVC_CLANG AND # Available with MSVC 15.7+ but not for CLANG.
@@ -407,9 +446,12 @@ if(WITH_IMAGE_OPENEXR)
set(IMATH_INCLUDE_DIR ${IMATH}/include)
set(IMATH_INCLUDE_DIRS ${IMATH_INCLUDE_DIR} ${IMATH}/include/Imath)
set(IMATH_LIBPATH ${IMATH}/lib)
if(EXISTS ${IMATH_LIBPATH}/Imath_s.lib)
set(IMATH_POSTFIX _s)
endif()
set(IMATH_LIBRARIES
optimized ${IMATH_LIBPATH}/Imath_s.lib
debug ${IMATH_LIBPATH}/Imath_s_d.lib
optimized ${IMATH_LIBPATH}/Imath${IMATH_POSTFIX}.lib
debug ${IMATH_LIBPATH}/Imath${IMATH_POSTFIX}_d.lib
)
endif()
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
@@ -421,36 +463,24 @@ if(WITH_IMAGE_OPENEXR)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${IMATH_INCLUDE_DIRS} ${OPENEXR_INCLUDE_DIR}/OpenEXR)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
# Check if the 3.x library name exists
# if not assume this is a 2.x library folder
# Check if the blender 3.3 lib static library eixts
# if not assume this is a 3.4+ dynamic version.
if(EXISTS "${OPENEXR_LIBPATH}/OpenEXR_s.lib")
set(OPENEXR_LIBRARIES
optimized ${OPENEXR_LIBPATH}/Iex_s.lib
optimized ${OPENEXR_LIBPATH}/IlmThread_s.lib
optimized ${OPENEXR_LIBPATH}/OpenEXR_s.lib
optimized ${OPENEXR_LIBPATH}/OpenEXRCore_s.lib
optimized ${OPENEXR_LIBPATH}/OpenEXRUtil_s.lib
debug ${OPENEXR_LIBPATH}/Iex_s_d.lib
debug ${OPENEXR_LIBPATH}/IlmThread_s_d.lib
debug ${OPENEXR_LIBPATH}/OpenEXR_s_d.lib
debug ${OPENEXR_LIBPATH}/OpenEXRCore_s_d.lib
debug ${OPENEXR_LIBPATH}/OpenEXRUtil_s_d.lib
${IMATH_LIBRARIES}
)
else()
set(OPENEXR_LIBRARIES
optimized ${OPENEXR_LIBPATH}/Iex_s.lib
optimized ${OPENEXR_LIBPATH}/Half_s.lib
optimized ${OPENEXR_LIBPATH}/IlmImf_s.lib
optimized ${OPENEXR_LIBPATH}/Imath_s.lib
optimized ${OPENEXR_LIBPATH}/IlmThread_s.lib
debug ${OPENEXR_LIBPATH}/Iex_s_d.lib
debug ${OPENEXR_LIBPATH}/Half_s_d.lib
debug ${OPENEXR_LIBPATH}/IlmImf_s_d.lib
debug ${OPENEXR_LIBPATH}/Imath_s_d.lib
debug ${OPENEXR_LIBPATH}/IlmThread_s_d.lib
)
set(OPENEXR_POSTFIX _s)
endif()
set(OPENEXR_LIBRARIES
optimized ${OPENEXR_LIBPATH}/Iex${OPENEXR_POSTFIX}.lib
optimized ${OPENEXR_LIBPATH}/IlmThread${OPENEXR_POSTFIX}.lib
optimized ${OPENEXR_LIBPATH}/OpenEXR${OPENEXR_POSTFIX}.lib
optimized ${OPENEXR_LIBPATH}/OpenEXRCore${OPENEXR_POSTFIX}.lib
optimized ${OPENEXR_LIBPATH}/OpenEXRUtil${OPENEXR_POSTFIX}.lib
debug ${OPENEXR_LIBPATH}/Iex${OPENEXR_POSTFIX}_d.lib
debug ${OPENEXR_LIBPATH}/IlmThread${OPENEXR_POSTFIX}_d.lib
debug ${OPENEXR_LIBPATH}/OpenEXR${OPENEXR_POSTFIX}_d.lib
debug ${OPENEXR_LIBPATH}/OpenEXRCore${OPENEXR_POSTFIX}_d.lib
debug ${OPENEXR_LIBPATH}/OpenEXRUtil${OPENEXR_POSTFIX}_d.lib
${IMATH_LIBRARIES}
)
endif()
endif()
@@ -520,38 +550,47 @@ if(WITH_BOOST)
if(NOT BOOST_VERSION)
message(FATAL_ERROR "Unable to determine Boost version")
endif()
set(BOOST_POSTFIX "vc142-mt-x64-${BOOST_VERSION}.lib")
set(BOOST_DEBUG_POSTFIX "vc142-mt-gd-x64-${BOOST_VERSION}.lib")
if(NOT EXISTS ${BOOST_LIBPATH}/libboost_date_time-${BOOST_POSTFIX})
# If the new library names do not exist fall back to the old ones
# to ease the transition period between the libs.
set(BOOST_POSTFIX "vc141-mt-x64-${BOOST_VERSION}.lib")
set(BOOST_DEBUG_POSTFIX "vc141-mt-gd-x64-${BOOST_VERSION}.lib")
set(BOOST_POSTFIX "vc142-mt-x64-${BOOST_VERSION}")
set(BOOST_DEBUG_POSTFIX "vc142-mt-gyd-x64-${BOOST_VERSION}")
set(BOOST_PREFIX "")
# This is file new in 3.4 if it does not exist, assume we are building against 3.3 libs
set(BOOST_34_TRIGGER_FILE ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_DEBUG_POSTFIX}.lib)
if (NOT EXISTS ${BOOST_34_TRIGGER_FILE})
set(BOOST_DEBUG_POSTFIX "vc142-mt-gd-x64-${BOOST_VERSION}")
set(BOOST_PREFIX "lib")
endif()
set(BOOST_LIBRARIES
optimized ${BOOST_LIBPATH}/libboost_date_time-${BOOST_POSTFIX}
optimized ${BOOST_LIBPATH}/libboost_filesystem-${BOOST_POSTFIX}
optimized ${BOOST_LIBPATH}/libboost_regex-${BOOST_POSTFIX}
optimized ${BOOST_LIBPATH}/libboost_system-${BOOST_POSTFIX}
optimized ${BOOST_LIBPATH}/libboost_thread-${BOOST_POSTFIX}
optimized ${BOOST_LIBPATH}/libboost_chrono-${BOOST_POSTFIX}
debug ${BOOST_LIBPATH}/libboost_date_time-${BOOST_DEBUG_POSTFIX}
debug ${BOOST_LIBPATH}/libboost_filesystem-${BOOST_DEBUG_POSTFIX}
debug ${BOOST_LIBPATH}/libboost_regex-${BOOST_DEBUG_POSTFIX}
debug ${BOOST_LIBPATH}/libboost_system-${BOOST_DEBUG_POSTFIX}
debug ${BOOST_LIBPATH}/libboost_thread-${BOOST_DEBUG_POSTFIX}
debug ${BOOST_LIBPATH}/libboost_chrono-${BOOST_DEBUG_POSTFIX}
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_date_time-${BOOST_POSTFIX}.lib
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_filesystem-${BOOST_POSTFIX}.lib
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_regex-${BOOST_POSTFIX}.lib
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_system-${BOOST_POSTFIX}.lib
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_thread-${BOOST_POSTFIX}.lib
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_chrono-${BOOST_POSTFIX}.lib
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_date_time-${BOOST_DEBUG_POSTFIX}.lib
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_filesystem-${BOOST_DEBUG_POSTFIX}.lib
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_regex-${BOOST_DEBUG_POSTFIX}.lib
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_system-${BOOST_DEBUG_POSTFIX}.lib
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_thread-${BOOST_DEBUG_POSTFIX}.lib
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_chrono-${BOOST_DEBUG_POSTFIX}.lib
)
if (EXISTS ${BOOST_34_TRIGGER_FILE})
if(WITH_USD)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_DEBUG_POSTFIX}.lib
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_POSTFIX}.lib
)
endif()
endif()
if(WITH_CYCLES AND WITH_CYCLES_OSL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized ${BOOST_LIBPATH}/libboost_wave-${BOOST_POSTFIX}
debug ${BOOST_LIBPATH}/libboost_wave-${BOOST_DEBUG_POSTFIX}
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_wave-${BOOST_POSTFIX}.lib
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_wave-${BOOST_DEBUG_POSTFIX}.lib
)
endif()
if(WITH_INTERNATIONAL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized ${BOOST_LIBPATH}/libboost_locale-${BOOST_POSTFIX}
debug ${BOOST_LIBPATH}/libboost_locale-${BOOST_DEBUG_POSTFIX}
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_locale-${BOOST_POSTFIX}.lib
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_locale-${BOOST_DEBUG_POSTFIX}.lib
)
endif()
else() # we found boost using find_package
@@ -576,7 +615,10 @@ if(WITH_OPENIMAGEIO)
endif()
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
add_definitions(-DOIIO_STATIC_DEFINE)
# If the .dll does not exist, assume it is a static OIIO
if(NOT EXISTS ${OPENIMAGEIO}/bin/OpenImageIO.dll)
add_definitions(-DOIIO_STATIC_DEFINE)
endif()
add_definitions(-DOIIO_NO_SSE=1)
endif()
@@ -612,18 +654,25 @@ if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/OpenColorIO)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
set(OPENCOLORIO_LIBRARIES
optimized ${OPENCOLORIO_LIBPATH}/OpenColorIO.lib
optimized ${OPENCOLORIO_LIBPATH}/libyaml-cpp.lib
optimized ${OPENCOLORIO_LIBPATH}/libexpatMD.lib
optimized ${OPENCOLORIO_LIBPATH}/pystring.lib
debug ${OPENCOLORIO_LIBPATH}/OpencolorIO_d.lib
debug ${OPENCOLORIO_LIBPATH}/libyaml-cpp_d.lib
debug ${OPENCOLORIO_LIBPATH}/libexpatdMD.lib
debug ${OPENCOLORIO_LIBPATH}/pystring_d.lib
)
if(EXISTS ${OPENCOLORIO_LIBPATH}/libexpatMD.lib) # 3.4
set(OPENCOLORIO_LIBRARIES
optimized ${OPENCOLORIO_LIBPATH}/OpenColorIO.lib
optimized ${OPENCOLORIO_LIBPATH}/libexpatMD.lib
optimized ${OPENCOLORIO_LIBPATH}/pystring.lib
optimized ${OPENCOLORIO_LIBPATH}/libyaml-cpp.lib
debug ${OPENCOLORIO_LIBPATH}/OpencolorIO_d.lib
debug ${OPENCOLORIO_LIBPATH}/libexpatdMD.lib
debug ${OPENCOLORIO_LIBPATH}/pystring_d.lib
debug ${OPENCOLORIO_LIBPATH}/yaml-cppd.lib
)
set(OPENCOLORIO_DEFINITIONS "-DOpenColorIO_SKIP_IMPORTS")
else()
set(OPENCOLORIO_LIBRARIES
optimized ${OPENCOLORIO_LIBPATH}/OpenColorIO.lib
debug ${OPENCOLORIO_LIBPATH}/OpencolorIO_d.lib
)
endif()
endif()
set(OPENCOLORIO_DEFINITIONS "-DOpenColorIO_SKIP_IMPORTS")
endif()
if(WITH_OPENVDB)
@@ -827,16 +876,21 @@ endif()
if(WITH_USD)
windows_find_package(USD)
if(NOT USD_FOUND)
# 3.5 22.03 libs
set(USD_INCLUDE_DIRS ${LIBDIR}/usd/include)
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_usd_m.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_usd_m_d.lib)
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_usd_ms.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_usd_ms_d.lib)
set(USD_LIBRARY_DIR ${LIBDIR}/usd/lib)
if(NOT EXISTS "${USD_RELEASE_LIB}") # 3.5 22.11 libs
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_ms.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_ms_d.lib)
endif()
# Older USD had different filenames, if the new ones are
# not found see if the older ones exist, to ease the
# transition period while landing libs.
if(NOT EXISTS "${USD_RELEASE_LIB}")
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/libusd_m.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/libusd_m_d.lib)
if(NOT EXISTS "${USD_RELEASE_LIB}") # 3.3 static libs
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_usd_m.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_usd_m_d.lib)
endif()
set(USD_LIBRARIES
debug ${USD_DEBUG_LIB}
@@ -982,3 +1036,12 @@ if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries})
unset(_sycl_runtime_libraries)
endif()
# Environment variables to run precompiled executables that needed libraries.
list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ";" _library_paths)
set(PLATFORM_ENV_BUILD_DIRS "${LIBDIR}/OpenImageIO/bin\;${LIBDIR}/boost/lib\;${LIBDIR}/openexr/bin\;${LIBDIR}/imath/bin\;${PATH}")
set(PLATFORM_ENV_BUILD "PATH=${PLATFORM_ENV_BUILD_DIRS}")
# Install needs the additional folders from PLATFORM_ENV_BUILD_DIRS as well, as tools like idiff and abcls use the release mode dlls
set(PLATFORM_ENV_INSTALL "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/\;${PLATFORM_ENV_BUILD_DIRS}\;$ENV{PATH}")
unset(_library_paths)

View File

@@ -1,56 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# First generate the manifest for tests since it will not need the dependency on the CRT.
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/tests.exe.manifest @ONLY)
# Always detect system libraries, since they are also used by oneAPI.
# But don't always install them, only for WITH_WINDOWS_BUNDLE_CRT=ON.
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
# This sometimes can change when updates are installed and the compiler version
# changes, so test if it exists and if not, give InstallRequiredSystemLibraries
# another chance to figure out the path.
if(MSVC_REDIST_DIR AND NOT EXISTS "${MSVC_REDIST_DIR}")
unset(MSVC_REDIST_DIR CACHE)
endif()
include(InstallRequiredSystemLibraries)
if(WITH_WINDOWS_BUNDLE_CRT)
# ucrtbase(d).dll cannot be in the manifest, due to the way windows 10 handles
# redirects for this dll, for details see T88813.
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
string(FIND ${lib} "ucrtbase" pos)
if(NOT pos EQUAL -1)
list(REMOVE_ITEM CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${lib})
install(FILES ${lib} DESTINATION . COMPONENT Libraries)
endif()
endforeach()
# Install the CRT to the blender.crt Sub folder.
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ./blender.crt COMPONENT Libraries)
# Generating the manifest is a relatively expensive operation since
# it is collecting an sha1 hash for every file required. so only do
# this work when the libs have either changed or the manifest does
# not exist yet.
string(SHA1 libshash "${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}")
set(manifest_trigger_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/crt_${libshash}")
if(NOT EXISTS ${manifest_trigger_file})
set(CRTLIBS "")
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
get_filename_component(filename ${lib} NAME)
file(SHA1 "${lib}" sha1_file)
string(APPEND CRTLIBS " <file name=\"${filename}\" hash=\"${sha1_file}\" hashalg=\"SHA1\" />\n")
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.crt.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/blender.crt.manifest @ONLY)
file(TOUCH ${manifest_trigger_file})
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.crt.manifest DESTINATION ./blender.crt)
set(BUNDLECRT "<dependency><dependentAssembly><assemblyIdentity type=\"win32\" name=\"blender.crt\" version=\"1.0.0.0\" /></dependentAssembly></dependency>")
endif()
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/blender.exe.manifest @ONLY)

View File

@@ -19,20 +19,21 @@ update-code:
path: source/tools
svn:
libraries:
# Temporary branch names for testing, don't merge this into master.
darwin-arm64:
branch: trunk
branch: branches/vfx-platform-2023
commit_id: HEAD
path: lib/darwin_arm64
darwin-x86_64:
branch: trunk
branch: branches/vfx-platform-2023
commit_id: HEAD
path: lib/darwin
linux-x86_64:
branch: trunk
branch: branches/vfx-platform-2023
commit_id: HEAD
path: lib/linux_centos7_x86_64
windows-amd64:
branch: trunk
branch: branches/vfx-platform-2023
commit_id: HEAD
path: lib/win64_vc15
tests:

View File

@@ -31,13 +31,6 @@
# undef max
#endif
// redefine usage of some windows functions
#if defined(WIN32) || defined(_WIN32)
# ifndef snprintf
# define snprintf _snprintf
# endif
#endif
// use which fp-precision? 1=float, 2=double
#ifndef FLOATINGPOINT_PRECISION
# define FLOATINGPOINT_PRECISION 1

View File

@@ -133,6 +133,7 @@ macro(cycles_external_libraries_append libraries)
${OPENEXR_LIBRARIES} # For circular dependencies between libs.
${PUGIXML_LIBRARIES}
${BOOST_LIBRARIES}
${PYTHON_LIBRARIES}
${ZLIB_LIBRARIES}
${CMAKE_DL_LIBS}
${PTHREADS_LIBRARIES}

View File

@@ -135,8 +135,9 @@ foreach(_file ${SRC_OSL})
string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _OSO_FILE ${_OSO_FILE})
add_custom_command(
OUTPUT ${_OSO_FILE}
COMMAND ${OSL_COMPILER} -q -O2 -I"${CMAKE_CURRENT_SOURCE_DIR}" -I"${OSL_SHADER_DIR}" -o ${_OSO_FILE} ${_OSL_FILE}
DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS} ${OSL_COMPILER})
COMMAND ${CMAKE_COMMAND} -E env ${PLATFORM_ENV_BUILD} ${OSL_COMPILER} -q -O2 -I"${CMAKE_CURRENT_SOURCE_DIR}" -I"${OSL_SHADER_DIR}" -o ${_OSO_FILE} ${_OSL_FILE}
DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS} ${OSL_COMPILER}
)
list(APPEND SRC_OSO
${_OSO_FILE}
)

View File

@@ -22,5 +22,5 @@ if(WITH_GTESTS)
set(TEST_LIB ${TEST_LIB} ${OPENJPEG_LIBRARIES})
endif()
include(GTestTesting)
blender_add_test_executable(ffmpeg "${TEST_SRC}" "${TEST_INC}" "${TEST_INC_SYS}" "${TEST_LIB}")
blender_add_test_lib(ffmpeg_codecs "${TEST_SRC}" "${TEST_INC}" "${TEST_INC_SYS}" "${TEST_LIB}")
endif()

View File

@@ -17,6 +17,14 @@ set(SRC
set(LIB
)
if(WIN32)
# This is set in platform_win32.cmake, will exist for 3.4+ library
# folders which are dynamic, but not for 3.3 which will be static.
if (EXISTS ${BOOST_34_TRIGGER_FILE})
add_definitions (-DBOOST_ALL_DYN_LINK=1)
endif()
endif()
if(APPLE)
# Cocoa code to read the locale on OSX
list(APPEND SRC

View File

@@ -0,0 +1,41 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Make shared libraries needed by modules available in standalone Python binary.
import sys
import os
exe_dir, exe_file = os.path.split(sys.executable)
is_python = exe_file.startswith("python")
# Path to Blender shared libraries.
shared_lib_dirname = "blender.shared" if sys.platform == "win32" else "lib"
if is_python:
shared_lib_dir = os.path.abspath(os.path.join(exe_dir, "..", "..", "..", shared_lib_dirname))
else:
shared_lib_dir = os.path.abspath(os.path.join(exe_dir, shared_lib_dirname))
if sys.platform == "win32":
# Directory for extensions to find DLLs.
if is_python:
os.add_dll_directory(shared_lib_dir)
# Directory for USD extension to find DLLs.
import_paths = os.getenv("PXR_USD_WINDOWS_DLL_PATH")
if import_paths is None:
os.environ["PXR_USD_WINDOWS_DLL_PATH"] = shared_lib_dir
# OIIO will by default add all paths from the path variable to add_dll_directory
# problem there is that those folders will be searched before ours and versions of
# some dlls may be found that are not blenders and may not even be the right version
# causing compatibility issues.
os.environ["OIIO_LOAD_DLLS_FROM_PATH"] = "0"
# MaterialX libraries, append if already specified.
materialx_libs_dir = os.path.abspath(os.path.join(shared_lib_dir, "materialx", "libraries"))
materialx_libs_env = os.getenv("MATERIALX_SEARCH_PATH")
if materialx_libs_env is None:
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir
elif sys.platform == "win32":
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir + ";" + materialx_libs_env
else:
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir + ":" + materialx_libs_env

View File

@@ -468,7 +468,7 @@ class TOPBAR_MT_file_import(Menu):
self.layout.operator("wm.alembic_import", text="Alembic (.abc)")
if bpy.app.build_options.usd:
self.layout.operator(
"wm.usd_import", text="Universal Scene Description (.usd, .usdc, .usda)")
"wm.usd_import", text="Universal Scene Description (.usd*)")
if bpy.app.build_options.io_gpencil:
self.layout.operator("wm.gpencil_import_svg", text="SVG as Grease Pencil")
@@ -491,7 +491,7 @@ class TOPBAR_MT_file_export(Menu):
self.layout.operator("wm.alembic_export", text="Alembic (.abc)")
if bpy.app.build_options.usd:
self.layout.operator(
"wm.usd_export", text="Universal Scene Description (.usd, .usdc, .usda)")
"wm.usd_export", text="Universal Scene Description (.usd*)")
if bpy.app.build_options.io_gpencil:
# Pugixml lib dependency

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="Blender.CRT" version="1.0.0.0" />
@CRTLIBS@</assembly>
<assemblyIdentity type="win32" name="@WINDOWS_MANIFEST_NAME@" version="1.0.0.0" />
@MANIFEST_LIBS@</assembly>

View File

@@ -165,6 +165,7 @@ void BKE_image_alpha_mode_from_extension(struct Image *image);
/**
* Returns a new image or NULL if it can't load.
*/
struct Image *BKE_image_load_ex(struct Main *bmain, const char *filepath, int flag);
struct Image *BKE_image_load(struct Main *bmain, const char *filepath);
/**
* Returns existing Image when filename/type is same.

View File

@@ -366,7 +366,7 @@ void BKE_cachefile_eval(Main *bmain, Depsgraph *depsgraph, CacheFile *cache_file
}
#endif
#ifdef WITH_USD
if (BLI_path_extension_check_glob(filepath, "*.usd;*.usda;*.usdc")) {
if (BLI_path_extension_check_glob(filepath, "*.usd;*.usda;*.usdc;*.usdz")) {
cache_file->type = CACHEFILE_TYPE_USD;
cache_file->handle = USD_create_handle(bmain, filepath, &cache_file->object_paths);
BLI_strncpy(cache_file->handle_filepath, filepath, FILE_MAX);
@@ -387,7 +387,17 @@ bool BKE_cachefile_filepath_get(const Main *bmain,
char r_filepath[FILE_MAX])
{
BLI_strncpy(r_filepath, cache_file->filepath, FILE_MAX);
#ifdef WITH_USD
if (BLI_path_extension_check_glob(r_filepath, "*.usd;*.usda;*.usdc;*.usdz")) {
USD_path_abs(r_filepath, ID_BLEND_PATH(bmain, &cache_file->id), true /* for import */);
}
else {
BLI_path_abs(r_filepath, ID_BLEND_PATH(bmain, &cache_file->id));
}
#else
BLI_path_abs(r_filepath, ID_BLEND_PATH(bmain, &cache_file->id));
#endif
int fframe;
int frame_len;

View File

@@ -672,11 +672,11 @@ static void image_init(Image *ima, short source, short type)
ima->stereo3d_format = MEM_cnew<Stereo3dFormat>("Image Stereo Format");
}
static Image *image_alloc(Main *bmain, const char *name, short source, short type)
static Image *image_alloc_ex(Main *bmain, const char *name, short source, short type, int flag)
{
Image *ima;
ima = static_cast<Image *>(BKE_libblock_alloc(bmain, ID_IM, name, 0));
ima = static_cast<Image *>(BKE_libblock_alloc(bmain, ID_IM, name, flag));
if (ima) {
image_init(ima, source, type);
}
@@ -684,6 +684,11 @@ static Image *image_alloc(Main *bmain, const char *name, short source, short typ
return ima;
}
static Image *image_alloc(Main *bmain, const char *name, short source, short type)
{
return image_alloc_ex(bmain, name, source, type, 0);
}
/**
* Get the ibuf from an image cache by its index and entry.
* Local use here only.
@@ -1012,7 +1017,7 @@ void BKE_image_alpha_mode_from_extension(Image *image)
image->alpha_mode = BKE_image_alpha_mode_from_extension_ex(image->filepath);
}
Image *BKE_image_load(Main *bmain, const char *filepath)
Image *BKE_image_load_ex(Main *bmain, const char *filepath, int flag)
{
Image *ima;
int file;
@@ -1032,7 +1037,7 @@ Image *BKE_image_load(Main *bmain, const char *filepath)
close(file);
}
ima = image_alloc(bmain, BLI_path_basename(filepath), IMA_SRC_FILE, IMA_TYPE_IMAGE);
ima = image_alloc_ex(bmain, BLI_path_basename(filepath), IMA_SRC_FILE, IMA_TYPE_IMAGE, flag);
STRNCPY(ima->filepath, filepath);
if (BLI_path_extension_check_array(filepath, imb_ext_movie)) {
@@ -1044,6 +1049,11 @@ Image *BKE_image_load(Main *bmain, const char *filepath)
return ima;
}
Image *BKE_image_load(Main *bmain, const char *filepath)
{
return BKE_image_load_ex(bmain, filepath, 0);
}
Image *BKE_image_load_exists_ex(Main *bmain, const char *filepath, bool *r_exists)
{
Image *ima;

View File

@@ -142,6 +142,12 @@ double BLI_dir_free_space(const char *dir) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(
*/
char *BLI_current_working_dir(char *dir, size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
eFileAttributes BLI_file_attributes(const char *path);
/**
* Changes the current working directory to the provided path.
*
* \return true on success, false otherwise.
*/
bool BLI_change_working_dir(char *dir);
/** \} */

View File

@@ -458,7 +458,7 @@ int BLI_delete_soft(const char *file, const char **error_message)
return err;
}
/* Not used anywhere! */
/* Not used anywhere! Convention is to use BLI_rename. */
# if 0
int BLI_move(const char *file, const char *to)
{
@@ -822,8 +822,8 @@ static int delete_soft(const char *file, const char **error_message)
Class NSStringClass = objc_getClass("NSString");
SEL stringWithUTF8StringSel = sel_registerName("stringWithUTF8String:");
id pathString = ((
id(*)(Class, SEL, const char *))objc_msgSend)(NSStringClass, stringWithUTF8StringSel, file);
id pathString = ((id(*)(Class, SEL, const char *))objc_msgSend)(
NSStringClass, stringWithUTF8StringSel, file);
Class NSFileManagerClass = objc_getClass("NSFileManager");
SEL defaultManagerSel = sel_registerName("defaultManager");
@@ -834,8 +834,8 @@ static int delete_soft(const char *file, const char **error_message)
id nsurl = ((id(*)(Class, SEL, id))objc_msgSend)(NSURLClass, fileURLWithPathSel, pathString);
SEL trashItemAtURLSel = sel_registerName("trashItemAtURL:resultingItemURL:error:");
BOOL deleteSuccessful = ((
BOOL(*)(id, SEL, id, id, id))objc_msgSend)(fileManager, trashItemAtURLSel, nsurl, nil, nil);
BOOL deleteSuccessful = ((BOOL(*)(id, SEL, id, id, id))objc_msgSend)(
fileManager, trashItemAtURLSel, nsurl, nil, nil);
if (deleteSuccessful) {
ret = 0;
@@ -1123,7 +1123,7 @@ static int copy_single_file(const char *from, const char *to)
return RecursiveOp_Callback_OK;
}
/* Not used anywhere! */
/* Not used anywhere! Convention is to use BLI_rename. */
# if 0
static int move_callback_pre(const char *from, const char *to)
{

View File

@@ -56,6 +56,22 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
bool BLI_change_working_dir(char *dir)
{
if (!BLI_is_dir(dir)) {
return false;
}
#if defined(WIN32)
wchar_t wdir[FILE_MAX];
if (conv_utf_8_to_16(dir, wdir, ARRAY_SIZE(wdir)) != 0) {
return false;
}
return _wchdir(wdir) == 0;
#else
return chdir(dir) == 0;
#endif
}
char *BLI_current_working_dir(char *dir, const size_t maxncpy)
{
#if defined(WIN32)

File diff suppressed because it is too large Load Diff

View File

@@ -2668,7 +2668,7 @@ int ED_path_extension_type(const char *path)
if (BLI_path_extension_check(path, ".abc")) {
return FILE_TYPE_ALEMBIC;
}
if (BLI_path_extension_check_n(path, ".usd", ".usda", ".usdc", nullptr)) {
if (BLI_path_extension_check_n(path, ".usd", ".usda", ".usdc", ".usdz", nullptr)) {
return FILE_TYPE_USD;
}
if (BLI_path_extension_check(path, ".vdb")) {

View File

@@ -32,6 +32,11 @@ if(WITH_IMAGE_OPENEXR)
${OPENEXR_LIBRARIES}
)
add_definitions(-DWITH_OPENEXR)
if(WIN32)
if(EXISTS ${LIBDIR}/imath/bin/imath.dll)
add_definitions(-DIMATH_DLL)
endif()
endif()
endif()
blender_add_lib(bf_imbuf_openexr "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -199,7 +199,9 @@ class AbstractHierarchyIterator {
typedef std::map<ObjectIdentifier, ExportChildren> ExportGraph;
/* Mapping from ID to its export path. This is used for instancing; given an
* instanced datablock, the export path of the original can be looked up. */
typedef std::map<ID *, std::string> ExportPathMap;
typedef std::map<const ID *, std::string> ExportPathMap;
/* Set of IDs of objects that are the originals of instances. */
typedef std::set<const ID *> PrototypeObjects;
protected:
ExportGraph export_graph_;
@@ -208,6 +210,7 @@ class AbstractHierarchyIterator {
Depsgraph *depsgraph_;
WriterMap writers_;
ExportSubset export_subset_;
PrototypeObjects prototypes_;
public:
explicit AbstractHierarchyIterator(Main *bmain, Depsgraph *depsgraph);
@@ -244,6 +247,19 @@ class AbstractHierarchyIterator {
* data to be a child of the object. */
virtual std::string get_object_data_path(const HierarchyContext *context) const;
/* Returns the export path computed for the object with the given ID.
* This should be called after only all writers have been created for the
* dependency graph. This currently works for non-instanced objects only. */
std::string get_object_export_path(const ID *id) const;
/* Return true if the object with the given id is a prototype object
* for instancing. Returns false otherwise. */
bool is_prototype(const ID *id) const;
/* Return true if the object is a prototype object
* for instancing. Returns false otherwise. */
bool is_prototype(const Object *obj) const;
private:
void debug_print_export_graph(const ExportGraph &graph) const;
@@ -331,6 +347,18 @@ class AbstractHierarchyIterator {
/* Called by release_writers() to free what the create_XXX_writer() functions allocated. */
virtual void release_writer(AbstractHierarchyWriter *writer) = 0;
/* Return true if data writers should be created for this context. */
virtual bool include_data_writers(const HierarchyContext *) const
{
return true;
}
/* Return true if children of the context should be converted to writers. */
virtual bool include_child_writers(const HierarchyContext *) const
{
return true;
}
AbstractHierarchyWriter *get_writer(const std::string &export_path) const;
ExportChildren &graph_children(const HierarchyContext *context);
};

View File

@@ -222,6 +222,28 @@ std::string AbstractHierarchyIterator::get_object_data_path(const HierarchyConte
return path_concatenate(context->export_path, get_object_data_name(context->object));
}
std::string AbstractHierarchyIterator::get_object_export_path(const ID *id) const
{
const ExportPathMap::const_iterator &it = duplisource_export_path_.find(id);
if (it != duplisource_export_path_.end()) {
return it->second;
}
return std::string();
}
bool AbstractHierarchyIterator::is_prototype(const ID *id) const
{
return prototypes_.find(id) != prototypes_.end();
}
bool AbstractHierarchyIterator::is_prototype(const Object *obj) const
{
const ID *obj_id = reinterpret_cast<const ID *>(obj);
return is_prototype(obj_id);
}
void AbstractHierarchyIterator::debug_print_export_graph(const ExportGraph &graph) const
{
size_t total_graph_size = 0;
@@ -288,9 +310,14 @@ void AbstractHierarchyIterator::export_graph_construct()
/* Export the duplicated objects instanced by this object. */
ListBase *lb = object_duplilist(depsgraph_, scene, object);
if (lb) {
if (lb && object->particlesystem.first == nullptr) {
DupliParentFinder dupli_parent_finder;
// Construct the set of duplicated objects, so that later we can determine whether a parent
// is also duplicated itself.
std::set<Object *> dupli_set;
LISTBASE_FOREACH (DupliObject *, dupli_object, lb) {
PersistentID persistent_id(dupli_object);
if (!should_visit_dupli_object(dupli_object)) {
@@ -411,7 +438,7 @@ void AbstractHierarchyIterator::visit_object(Object *object,
context->export_parent = export_parent;
context->duplicator = nullptr;
context->weak_export = weak_export;
context->animation_check_include_parent = false;
context->animation_check_include_parent = true;
context->export_path = "";
context->original_export_path = "";
context->higher_up_export_path = "";
@@ -445,6 +472,7 @@ void AbstractHierarchyIterator::visit_dupli_object(DupliObject *dupli_object,
Object *duplicator,
const DupliParentFinder &dupli_parent_finder)
{
HierarchyContext *context = new HierarchyContext();
context->object = dupli_object->ob;
context->duplicator = duplicator;
@@ -467,6 +495,56 @@ void AbstractHierarchyIterator::visit_dupli_object(DupliObject *dupli_object,
context_update_for_graph_index(context, graph_index);
export_graph_[graph_index].insert(context);
// ExportGraph::key_type graph_index;
// bool animation_check_include_parent = true;
// HierarchyContext *context = new HierarchyContext();
// context->object = dupli_object->ob;
// context->duplicator = duplicator;
// context->persistent_id = PersistentID(dupli_object);
// context->weak_export = false;
// context->export_path = "";
// context->original_export_path = "";
// context->export_path = "";
// context->animation_check_include_parent = false;
///* If the dupli-object's parent is also instanced by this object, use that as the
// * export parent. Otherwise use the dupli-parent as export parent. */
// Object *parent = dupli_object->ob->parent;
// if (parent != nullptr && dupli_set.find(parent) != dupli_set.end()) {
// // The parent object is part of the duplicated collection.
// context->export_parent = parent;
// graph_index = std::make_pair(parent, duplicator);
// // This bool used to be false by default
// // This was stopping a certain combination of drivers
// // and rigging to not properly export.
// // For now, we have switched to only setting to false here
// animation_check_include_parent = false;
//}
// else {
// /* The parent object is NOT part of the duplicated collection. This means that the world
// * transform of this dupli-object can be influenced by objects that are not part of its
// * export graph. */
// context->export_parent = duplicator;
// graph_index = std::make_pair(duplicator, nullptr);
//}
// context->animation_check_include_parent = animation_check_include_parent;
//
// copy_m4_m4(context->matrix_world, dupli_object->mat);
///* Construct export name for the dupli-instance. */
// std::stringstream export_name_stream;
// export_name_stream << get_object_name(context->object) << "-"
// << context->persistent_id.as_object_name_suffix();
// context->export_name = make_valid_name(export_name_stream.str());
// ExportGraph::key_type graph_index = determine_graph_index_dupli(
// context, dupli_object, dupli_parent_finder);
// context_update_for_graph_index(context, graph_index);
// export_graph_[graph_index].insert(context);
}
AbstractHierarchyIterator::ExportGraph::key_type AbstractHierarchyIterator::
@@ -541,6 +619,7 @@ void AbstractHierarchyIterator::determine_duplication_references(
}
else {
context->mark_as_instance_of(it->second);
prototypes_.insert(source_id);
}
if (context->object->data) {
@@ -597,13 +676,15 @@ void AbstractHierarchyIterator::make_writers(const HierarchyContext *parent_cont
transform_writer->write(*context);
}
if (!context->weak_export) {
if (!context->weak_export && include_data_writers(context)) {
make_writers_particle_systems(context);
make_writer_object_data(context);
}
/* Recurse into this object's children. */
make_writers(context);
if (include_child_writers(context)) {
/* Recurse into this object's children. */
make_writers(context);
}
}
/* TODO(Sybren): iterate over all unused writers and call unused_during_iteration() or something.
@@ -633,6 +714,7 @@ void AbstractHierarchyIterator::make_writer_object_data(const HierarchyContext *
data_context.original_export_path = duplisource_export_path_[object_data];
/* If the object is marked as an instance, so should the object data. */
/* TODO(makowalski): this fails when testing with collection instances. */
BLI_assert(data_context.is_instance());
}

View File

@@ -9,13 +9,16 @@ if(UNIX AND NOT APPLE)
add_definitions(-D_GLIBCXX_PERMIT_BACKWARD_HASH)
endif()
if(WIN32)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN -DBOOST_DEBUG_PYTHON)
endif()
add_definitions(-DPXR_STATIC)
add_definitions(-DBOOST_ALL_NO_LIB)
# USD headers use deprecated TBB headers, silence warning.
add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
# Python is always required
add_definitions(-DWITH_PYTHON)
# Check if USD has the imaging headers available, if they are
# add a USD_HAS_IMAGING define so code can dynamically detect this.
# Cleanup of this variable is done at the end of the file since
@@ -47,70 +50,103 @@ set(INC
../../imbuf
../../makesdna
../../makesrna
../../python
../../windowmanager
../../../../intern/guardedalloc
../../../../intern/utfconv
${CMAKE_BINARY_DIR}/source/blender/makesrna/intern
)
set(INC_SYS
${USD_INCLUDE_DIRS}
${BOOST_INCLUDE_DIR}
${TBB_INCLUDE_DIR}
${PYTHON_INCLUDE_DIR}
)
set(SRC
intern/usd_asset_utils.cc
intern/usd_capi_export.cc
intern/usd_capi_import.cc
intern/usd_common.cc
intern/usd_hierarchy_iterator.cc
intern/usd_writer_abstract.cc
intern/usd_writer_camera.cc
intern/usd_writer_hair.cc
intern/usd_writer_light.cc
intern/usd_writer_material.cc
intern/usd_writer_mesh.cc
intern/usd_writer_metaball.cc
intern/usd_writer_transform.cc
intern/usd_writer_volume.cc
intern/usd_light_convert.cc
intern/usd_skel_convert.cc
intern/usd_reader_camera.cc
intern/usd_reader_curve.cc
intern/usd_reader_geom.cc
intern/usd_reader_shape.cc
intern/usd_reader_instance.cc
intern/usd_reader_light.cc
intern/usd_reader_material.cc
intern/usd_reader_mesh.cc
intern/usd_reader_nurbs.cc
intern/usd_reader_prim.cc
intern/usd_reader_skeleton.cc
intern/usd_reader_stage.cc
intern/usd_reader_volume.cc
intern/usd_reader_xform.cc
intern/usd_umm.cc
intern/usd_writer_abstract.cc
intern/usd_writer_armature.cc
intern/usd_writer_blendshape_mesh.cc
intern/usd_writer_camera.cc
intern/usd_writer_curve.cc
intern/usd_writer_hair.cc
intern/usd_writer_light.cc
intern/usd_writer_material.cc
intern/usd_writer_mesh.cc
intern/usd_writer_metaball.cc
intern/usd_writer_particle.cc
intern/usd_writer_skel_root.cc
intern/usd_writer_skinned_mesh.cc
intern/usd_writer_transform.cc
intern/usd_writer_volume.cc
usd.h
intern/usd_asset_utils.h
intern/usd_common.h
intern/usd_exporter_context.h
intern/usd_hierarchy_iterator.h
intern/usd_writer_abstract.h
intern/usd_writer_camera.h
intern/usd_writer_hair.h
intern/usd_writer_light.h
intern/usd_writer_material.h
intern/usd_writer_mesh.h
intern/usd_writer_metaball.h
intern/usd_writer_transform.h
intern/usd_writer_volume.h
intern/usd_light_convert.h
intern/usd_skel_convert.h
intern/usd_reader_camera.h
intern/usd_reader_curve.h
intern/usd_reader_geom.h
intern/usd_reader_shape.h
intern/usd_reader_instance.h
intern/usd_reader_light.h
intern/usd_reader_material.h
intern/usd_reader_mesh.h
intern/usd_reader_nurbs.h
intern/usd_reader_prim.h
intern/usd_reader_skeleton.h
intern/usd_reader_stage.h
intern/usd_reader_volume.h
intern/usd_reader_volume.h
intern/usd_reader_xform.h
intern/usd_umm.h
intern/usd_writer_abstract.h
intern/usd_writer_armature.h
intern/usd_writer_blendshape_mesh.h
intern/usd_writer_camera.h
intern/usd_writer_curve.h
intern/usd_writer_hair.h
intern/usd_writer_light.h
intern/usd_writer_material.h
intern/usd_writer_mesh.h
intern/usd_writer_metaball.h
intern/usd_writer_particle.h
intern/usd_writer_skel_root.h
intern/usd_writer_skinned_mesh.h
intern/usd_writer_transform.h
intern/usd_writer_volume.h
)
set(LIB
@@ -122,6 +158,7 @@ set(LIB
list(APPEND LIB
${BOOST_LIBRARIES}
${PYTHON_LIBRARIES}
)
if(WITH_OPENVDB)
@@ -147,6 +184,7 @@ endif()
# https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
if(WIN32)
target_link_libraries(bf_usd INTERFACE ${USD_LIBRARIES})
target_compile_options(bf_usd PRIVATE /w34101)
elseif(APPLE)
target_link_libraries(bf_usd INTERFACE -Wl,-force_load ${USD_LIBRARIES})
elseif(UNIX)

View File

@@ -0,0 +1,328 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2022 NVIDIA Corportation. All rights reserved. */
#include "usd_asset_utils.h"
#include <pxr/usd/ar/asset.h>
#include <pxr/usd/ar/packageUtils.h>
#include <pxr/usd/ar/resolver.h>
#include <pxr/usd/ar/writableAsset.h>
#include "BKE_main.h"
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "WM_api.h"
#include "WM_types.h"
#include <iostream>
static const char UDIM_PATTERN[] = "<UDIM>";
static const char UDIM_PATTERN2[] = "%3CUDIM%3E";
static const int UDIM_START_TILE = 1001;
static const int UDIM_END_TILE = 1100;
namespace blender::io::usd {
static std::string get_asset_file_name(const char *src_path)
{
char file_name[FILE_MAX];
if (pxr::ArIsPackageRelativePath(src_path)) {
std::pair<std::string, std::string> split = pxr::ArSplitPackageRelativePathInner(src_path);
if (split.second.empty()) {
WM_reportf(
RPT_WARNING,
"usd_import_texture(): Couldn't determine package-relative file name from path %s.",
src_path);
return src_path;
}
BLI_split_file_part(split.second.c_str(), file_name, FILE_MAX);
}
else {
BLI_split_file_part(src_path, file_name, FILE_MAX);
}
return file_name;
}
/* Return true if the given path is an existing director
* on the standard file system. */
static bool fs_parent_dir_exists(const char *path)
{
char dir_path[FILE_MAX];
BLI_split_dir_part(path, dir_path, FILE_MAX);
bool is_dir = BLI_is_dir(dir_path);
return is_dir;
}
static bool is_udim_path(const std::string &path)
{
return path.find(UDIM_PATTERN) != std::string::npos ||
path.find(UDIM_PATTERN2) != std::string::npos;
}
/* The following is copied from _SplitUdimPattern() in
* USD library source file materialParamsUtils.cpp.
* Split a udim file path such as /someDir/myFile.<UDIM>.exr into a
* prefix (/someDir/myFile.) and suffix (.exr). */
static std::pair<std::string, std::string> split_udim_pattern(const std::string &path)
{
static const std::vector<std::string> patterns = {UDIM_PATTERN, UDIM_PATTERN2};
for (const std::string &pattern : patterns) {
const std::string::size_type pos = path.find(pattern);
if (pos != std::string::npos) {
return {path.substr(0, pos), path.substr(pos + pattern.size())};
}
}
return {std::string(), std::string()};
}
static std::string copy_asset_to_directory(const char *src_path, const char *dest_dir_path, bool overwrite)
{
std::string file_name = get_asset_file_name(src_path);
char dest_file_path[FILE_MAX];
BLI_path_join(dest_file_path, FILE_MAX, dest_dir_path, file_name.c_str());
BLI_str_replace_char(dest_file_path, SEP, ALTSEP);
if (!overwrite && BLI_is_file(dest_file_path)) {
return dest_file_path;
}
if (!copy_usd_asset(src_path, dest_file_path, overwrite)) {
WM_reportf(
RPT_WARNING, "usd_import_texture(): Couldn't copy file %s to %s.", src_path, dest_file_path);
return src_path;
}
WM_reportf(RPT_INFO, "usd_import_texture(): Copied file %s to %s.", src_path, dest_file_path);
return dest_file_path;
}
static std::string copy_udim_asset_to_directory(const char *src_path,
const char *dest_dir_path,
bool overwrite)
{
/* Get prefix and suffix from udim pattern. */
std::pair<std::string, std::string> splitPath = split_udim_pattern(src_path);
if (splitPath.first.empty() || splitPath.second.empty()) {
WM_reportf(RPT_ERROR, "copy_udim_asset_to_directory(): Couldn't split UDIM pattern %s.", src_path);
return src_path;
}
for (int i = UDIM_START_TILE; i < UDIM_END_TILE; ++i) {
const std::string src_udim = splitPath.first + std::to_string(i) + splitPath.second;
if (usd_path_exists(src_udim.c_str())) {
copy_asset_to_directory(src_udim.c_str(), dest_dir_path, overwrite);
}
}
const std::string src_file_name = get_asset_file_name(src_path);
char ret_udim_path[FILE_MAX];
BLI_path_join(ret_udim_path, FILE_MAX, dest_dir_path, src_file_name.c_str());
BLI_str_replace_char(ret_udim_path, SEP, ALTSEP);
/* Blender only recognizes the <UDIM> pattern, not the
* alternative UDIM_PATTERN2, so we make sure the returned
* path has the former. */
splitPath = split_udim_pattern(ret_udim_path);
if (splitPath.first.empty() || splitPath.second.empty()) {
WM_reportf(RPT_ERROR, "copy_udim_asset_to_directory(): Couldn't split UDIM pattern %s.", ret_udim_path);
return ret_udim_path;
}
return splitPath.first + UDIM_PATTERN + splitPath.second;
}
bool copy_usd_asset(const char *src, const char *dst, bool overwrite)
{
if (!(src && dst)) {
return false;
}
pxr::ArResolver &ar = pxr::ArGetResolver();
if (!overwrite) {
if (!ar.Resolve(dst).IsEmpty()) {
/* The asset exists, so this is a no-op. */
WM_reportf(RPT_INFO, "copy_usd_asset(): Will not overwrite existing asset %s", dst);
return true;
}
}
pxr::ArResolvedPath src_path = ar.Resolve(src);
if (src_path.IsEmpty()) {
WM_reportf(RPT_ERROR, "copy_usd_asset(): Can't resolve path %s.", src);
return false;
}
pxr::ArResolvedPath dst_path = ar.ResolveForNewAsset(dst);
if (dst_path.IsEmpty()) {
WM_reportf(RPT_ERROR, "copy_usd_asset(): Can't resolve path %s for writing.", dst);
return false;
}
std::string why_not;
if (!ar.CanWriteAssetToPath(dst_path, &why_not)) {
WM_reportf(RPT_ERROR,
"copy_usd_asset(): Can't write to asset %s. %s.",
dst_path.GetPathString().c_str(),
why_not.c_str());
return false;
}
std::shared_ptr<pxr::ArAsset> src_asset = ar.OpenAsset(src_path);
if (!src_asset) {
WM_reportf(
RPT_ERROR, "copy_usd_asset(): Can't open source asset %s.", src_path.GetPathString().c_str());
return false;
}
const size_t size = src_asset->GetSize();
if (size == 0) {
WM_reportf(RPT_WARNING,
"copy_usd_asset(): Will not copy zero size source asset %s.",
src_path.GetPathString().c_str());
return false;
}
std::shared_ptr<const char> buf = src_asset->GetBuffer();
if (!buf) {
WM_reportf(RPT_ERROR,
"copy_usd_asset(): Null buffer for source asset %s.",
src_path.GetPathString().c_str());
return false;
}
std::shared_ptr<pxr::ArWritableAsset> dst_asset = ar.OpenAssetForWrite(
dst_path, pxr::ArResolver::WriteMode::Replace);
if (!dst_asset) {
WM_reportf(RPT_ERROR,
"copy_usd_asset(): Can't open destination asset %s for writing.",
src_path.GetPathString().c_str());
return false;
}
size_t bytes_written = dst_asset->Write(src_asset->GetBuffer().get(), src_asset->GetSize(), 0);
if (bytes_written == 0) {
WM_reportf(RPT_ERROR,
"copy_usd_asset(): Error writing to destination asset %s.",
dst_path.GetPathString().c_str());
}
else {
WM_reportf(RPT_INFO,
"copy_usd_asset(): Copied %s to %s.",
src_path.GetPathString().c_str(), dst_path.GetPathString().c_str());
}
if (!dst_asset->Close()) {
WM_reportf(RPT_ERROR,
"copy_usd_asset(): Couldn't close destination asset %s.",
dst_path.GetPathString().c_str());
return false;
}
return bytes_written > 0;
}
std::string get_textures_dir(const pxr::UsdStageRefPtr stage)
{
pxr::SdfLayerHandle layer = stage->GetRootLayer();
std::string stage_path = layer->GetRealPath();
if (stage_path.empty()) {
return "";
}
char usd_dir_path[FILE_MAX];
BLI_split_dir_part(stage_path.c_str(), usd_dir_path, FILE_MAX);
return std::string(usd_dir_path) + std::string("textures/");
}
bool usd_path_exists(const char *src)
{
return src && !pxr::ArGetResolver().Resolve(src).IsEmpty();
}
bool usd_paths_equal(const char *p1, const char *p2)
{
BLI_assert_msg(!BLI_path_is_rel(p1) && !BLI_path_is_rel(p2),
"Paths arguments must be absolute");
pxr::ArResolver &ar = pxr::ArGetResolver();
std::string resolved_p1 = ar.ResolveForNewAsset(p1).GetPathString();
std::string resolved_p2 = ar.ResolveForNewAsset(p2).GetPathString();
return resolved_p1 == resolved_p2;
}
std::string usd_import_texture(const char *src, const char *import_dir, const bool overwrite)
{
const bool udim_src = is_udim_path(src);
if (udim_src) {
if (fs_parent_dir_exists(src)) {
return src;
}
}
else if (BLI_is_file(src)) {
/* File exists in filesystem, no need to import. */
return src;
}
if (strlen(import_dir) == 0) {
WM_reportf(
RPT_ERROR,
"usd_import_texture(): Texture import directory path empty, couldn't import %s.",
src);
return src;
}
char dest_dir_path[FILE_MAX];
STRNCPY(dest_dir_path, import_dir);
if (BLI_path_is_rel(import_dir)) {
const char *basepath = BKE_main_blendfile_path_from_global();
if (!basepath || strlen(basepath) == 0) {
WM_reportf(RPT_ERROR,
"usd_import_texture(): Texture import directory is relative "
"but the blend file path is empty. "
"Please save the blend file before importing the USD. "
"Can't import %s.", src);
return src;
}
BLI_path_abs(dest_dir_path, basepath);
}
BLI_str_replace_char(dest_dir_path, SEP, ALTSEP);
if (!BLI_dir_create_recursive(dest_dir_path)) {
WM_reportf(RPT_ERROR,
"usd_import_texture(): Couldn't create texture import directory %s.",
dest_dir_path);
return src;
}
if (udim_src) {
return copy_udim_asset_to_directory(src, dest_dir_path, overwrite);
}
return copy_asset_to_directory(src, dest_dir_path, overwrite);
}
} // namespace blender::io::usd

View File

@@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2021 NVIDIA Corporation. All rights reserved. */
#pragma once
#include <pxr/usd/usd/stage.h>
#include <string>
namespace blender::io::usd {
/* Invoke the the USD asset resolver to copy assets. */
bool copy_usd_asset(const char *src, const char *dst, bool overwrite);
/* Return the path to a 'textures' directory which is a sibling to the given
* stage's root layer path. */
std::string get_textures_dir(const pxr::UsdStageRefPtr stage);
bool usd_path_exists(const char *src);
bool usd_paths_equal(const char *p1, const char *p2);
std::string usd_import_texture(const char *src, const char *import_textures_dir, bool overwrite);
} // namespace blender::io::usd

View File

@@ -2,13 +2,22 @@
* Copyright 2019 Blender Foundation. All rights reserved. */
#include "usd.h"
#include "usd_asset_utils.h"
#include "usd_common.h"
#include "usd_hierarchy_iterator.h"
#include "usd_light_convert.h"
#include "usd_umm.h"
#include "usd_writer_material.h"
#include "usd_writer_skel_root.h"
#include <pxr/base/plug/registry.h>
#include <pxr/pxr.h>
#include <pxr/usd/usd/stage.h>
#include <pxr/usd/usdGeom/metrics.h>
#include <pxr/usd/usdGeom/scope.h>
#include <pxr/usd/usdGeom/tokens.h>
#include <pxr/usd/usdGeom/xformCommonAPI.h>
#include <pxr/usd/usdUtils/dependencies.h>
#include "MEM_guardedalloc.h"
@@ -22,9 +31,17 @@
#include "BKE_blender_version.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_scene.h"
#include "BKE_image.h"
#include "BKE_image_save.h"
#include "BKE_image_format.h"
#include "BKE_lib_id.h"
#include "BLI_fileops.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_timeit.hh"
@@ -35,25 +52,275 @@
namespace blender::io::usd {
struct ExportJobData {
Scene *scene;
ViewLayer *view_layer;
Main *bmain;
Depsgraph *depsgraph;
wmWindowManager *wm;
char filepath[FILE_MAX];
char usdz_filepath[FILE_MAX];
bool is_usdz_export;
USDExportParams params;
bool *stop;
bool *do_update;
float *progress;
bool was_canceled;
bool export_ok;
timeit::TimePoint start_time;
};
/* Perform validation of export parameter settings. Returns
* true if the paramters are valid. Returns false otherwise. */
static bool validate_params(const USDExportParams &params)
{
bool valid = true;
if (params.export_materials && !pxr::SdfPath::IsValidPathString(params.material_prim_path)) {
WM_reportf(RPT_ERROR,
"USD Export: invalid material prim path parameter '%s'",
params.material_prim_path);
valid = false;
}
if (strlen(params.root_prim_path) != 0 &&
!pxr::SdfPath::IsValidPathString(params.root_prim_path)) {
WM_reportf(
RPT_ERROR, "USD Export: invalid root prim path parameter '%s'", params.root_prim_path);
valid = false;
}
if (strlen(params.default_prim_path) != 0 &&
!pxr::SdfPath::IsValidPathString(params.default_prim_path)) {
WM_reportf(RPT_ERROR,
"USD Export: invalid default prim path parameter '%s'",
params.default_prim_path);
valid = false;
}
return valid;
}
/* If a root prim path is set in the params, check if a
* root object matching the root path name already exists.
* If it does, clear the root prim path in the params.
* This is to avoid prepending the root prim path
* redundantly.
* TODO(makowalski): ideally, this functionality belongs
* in the USD hierarchy iterator, so that we don't iterate
* over the scene graph separately here. */
static void validate_unique_root_prim_path(USDExportParams &params, Depsgraph *depsgraph)
{
if (!depsgraph || strlen(params.root_prim_path) == 0) {
return;
}
pxr::SdfPath path(params.root_prim_path);
if (path.IsEmpty()) {
return;
}
pxr::SdfPath parent = path.GetParentPath();
while (!parent.IsEmpty() && !parent.IsAbsoluteRootPath()) {
path = parent;
parent = path.GetParentPath();
}
Object *match = nullptr;
std::string root_name = path.GetName();
DEGObjectIterSettings deg_iter_settings{};
deg_iter_settings.depsgraph = depsgraph;
deg_iter_settings.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
DEG_OBJECT_ITER_BEGIN (&deg_iter_settings, object) {
if (!match && !object->parent) {
/* We only care about root objects. */
if (pxr::TfMakeValidIdentifier(object->id.name + 2) == root_name) {
match = object;
}
}
}
DEG_OBJECT_ITER_END;
if (match) {
WM_reportf(
RPT_WARNING, "USD Export: the root prim will not be added because a root object named '%s' already exists", root_name.c_str());
params.root_prim_path[0] = '\0';
}
}
/* Create root prim if defined. */
static void ensure_root_prim(pxr::UsdStageRefPtr stage, const USDExportParams &params)
{
if (strlen(params.root_prim_path) == 0) {
return;
}
pxr::UsdPrim root_prim = stage->DefinePrim(pxr::SdfPath(params.root_prim_path),
pxr::TfToken("Xform"));
if (!(params.convert_orientation || params.convert_to_cm)) {
return;
}
if (!root_prim) {
return;
}
pxr::UsdGeomXformCommonAPI xf_api(root_prim);
if (!xf_api) {
return;
}
if (params.convert_to_cm) {
xf_api.SetScale(pxr::GfVec3f(100.0f));
}
if (params.convert_orientation) {
float mrot[3][3];
mat3_from_axis_conversion(
USD_GLOBAL_FORWARD_Y, USD_GLOBAL_UP_Z, params.forward_axis, params.up_axis, mrot);
transpose_m3(mrot);
float eul[3];
mat3_to_eul(eul, mrot);
/* Convert radians to degrees. */
mul_v3_fl(eul, 180.0f / M_PI);
xf_api.SetRotate(pxr::GfVec3f(eul[0], eul[1], eul[2]));
}
}
static void report_job_duration(const ExportJobData *data)
{
timeit::Nanoseconds duration = timeit::Clock::now() - data->start_time;
std::cout << "USD export of '" << data->filepath << "' took ";
const char *export_filepath = data->is_usdz_export ? data->usdz_filepath : data->filepath;
std::cout << "USD export of '" << export_filepath << "' took ";
timeit::print_duration(duration);
std::cout << '\n';
}
static void process_usdz_textures(const ExportJobData *data, const char *path) {
const eUSDZTextureDownscaleSize enum_value = data->params.usdz_downscale_size;
if (enum_value == USD_TEXTURE_SIZE_KEEP) {
return;
}
int image_size = (
(enum_value == USD_TEXTURE_SIZE_CUSTOM ? data->params.usdz_downscale_custom_size : enum_value)
);
image_size = image_size < 128 ? 128 : image_size;
char texture_path[4096];
BLI_strcpy_rlen(texture_path, path);
BLI_path_append(texture_path, 4096, "textures");
BLI_path_slash_ensure(texture_path, 4096);
struct direntry *entries;
unsigned int num_files = BLI_filelist_dir_contents(texture_path, &entries);
for (int index = 0; index < num_files; index++) {
/* We can skip checking extensions as this folder is only created
* when we're doing a USDZ export. */
if (!BLI_is_dir(entries[index].path)) {
Image *im = BKE_image_load_ex(data->bmain, entries[index].path, LIB_ID_CREATE_NO_MAIN);
if (!im) {
std::cerr << "-- Unable to open file for downscaling: " << entries[index].path << std::endl;
continue;
}
int width, height;
BKE_image_get_size(im, NULL, &width, &height);
const int longest = width >= height ? width : height;
const float scale = 1.0 / ((float)longest / (float)image_size);
if (longest > image_size) {
const int width_adjusted = (float)width * scale;
const int height_adjusted = (float)height * scale;
BKE_image_scale(im, width_adjusted, height_adjusted);
ImageSaveOptions opts;
if (BKE_image_save_options_init(&opts, data->bmain, data->scene, im, NULL, false, false)) {
bool result = BKE_image_save(NULL, data->bmain, im, NULL, &opts);
if (!result) {
std::cerr << "-- Unable to resave " << data->filepath << " (new size: "
<< width_adjusted << "x" << height_adjusted << ")" << std::endl;
}
else {
std::cout << "Downscaled " << entries[index].path << " to "
<< width_adjusted << "x" << height_adjusted << std::endl;
}
}
BKE_image_save_options_free(&opts);
}
/* Make sure to free the image so it doesn't stick
* around in the library of the open file. */
BKE_id_free(data->bmain, (void*)im);
}
}
BLI_filelist_free(entries, num_files);
}
static bool perform_usdz_conversion(const ExportJobData *data)
{
char usdc_temp_dir[FILE_MAX], usdc_file[FILE_MAX];
BLI_split_dirfile(data->filepath, usdc_temp_dir, usdc_file, FILE_MAX, FILE_MAX);
char usdz_file[FILE_MAX];
BLI_split_file_part(data->usdz_filepath, usdz_file, FILE_MAX);
char original_working_dir[FILE_MAX];
BLI_current_working_dir(original_working_dir, FILE_MAX);
BLI_change_working_dir(usdc_temp_dir);
process_usdz_textures(data, usdc_temp_dir);
if (data->params.usdz_is_arkit) {
std::cout << "USDZ Export: Creating ARKit Asset" << std::endl;
pxr::UsdUtilsCreateNewARKitUsdzPackage(pxr::SdfAssetPath(usdc_file), usdz_file);
}
else {
pxr::UsdUtilsCreateNewUsdzPackage(pxr::SdfAssetPath(usdc_file), usdz_file);
}
BLI_change_working_dir(original_working_dir);
char usdz_temp_dirfile[FILE_MAX];
BLI_path_join(usdz_temp_dirfile, FILE_MAX, usdc_temp_dir, usdz_file);
int result = 0;
if (BLI_exists(data->usdz_filepath)) {
result = BLI_delete(data->usdz_filepath, false, false);
if (result != 0) {
WM_reportf(
RPT_ERROR, "USD Export: Unable to delete existing usdz file %s", data->usdz_filepath);
return false;
}
}
if (!copy_usd_asset(usdz_temp_dirfile, data->usdz_filepath, true /* overwrite */)) {
WM_reportf(RPT_ERROR,
"USD Export: Couldn't copy new usdz file from temporary location %s to %s",
usdz_temp_dirfile,
data->usdz_filepath);
return false;
}
return true;
}
static void export_startjob(void *customdata,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
@@ -62,13 +329,22 @@ static void export_startjob(void *customdata,
float *progress)
{
ExportJobData *data = static_cast<ExportJobData *>(customdata);
data->export_ok = false;
data->stop = stop;
data->do_update = do_update;
data->progress = progress;
data->was_canceled = false;
data->start_time = timeit::Clock::now();
G.is_rendering = true;
WM_set_locked_interface(data->wm, true);
G.is_break = false;
if (!validate_params(data->params)) {
data->export_ok = false;
return;
}
/* Construct the depsgraph for exporting. */
Scene *scene = DEG_get_input_scene(data->depsgraph);
if (data->params.visible_objects_only) {
@@ -79,41 +355,103 @@ static void export_startjob(void *customdata,
}
BKE_scene_graph_update_tagged(data->depsgraph, data->bmain);
validate_unique_root_prim_path(data->params, data->depsgraph);
*progress = 0.0f;
*do_update = true;
/* For restoring the current frame after exporting animation is done. */
const int orig_frame = scene->r.cfra;
if (!BLI_path_extension_check_glob(data->filepath, "*.usd;*.usda;*.usdc"))
BLI_path_extension_ensure(data->filepath, FILE_MAX, ".usd");
pxr::UsdStageRefPtr usd_stage = pxr::UsdStage::CreateNew(data->filepath);
if (!usd_stage) {
/* This happens when the USD JSON files cannot be found. When that happens,
/* This may happen when the USD JSON files cannot be found. When that happens,
* the USD library doesn't know it has the functionality to write USDA and
* USDC files, and creating a new UsdStage fails. */
WM_reportf(
RPT_ERROR, "USD Export: unable to find suitable USD plugin to write %s", data->filepath);
WM_reportf(RPT_ERROR, "USD Export: unable to create a stage for writing %s", data->filepath);
pxr::SdfLayerRefPtr existing_layer = pxr::SdfLayer::FindOrOpen(data->filepath);
if (existing_layer) {
WM_reportf(RPT_ERROR,
"USD Export: layer %s is currently open in the scene, "
"possibly because it's referenced by modifiers, "
"and can't be overwritten",
data->filepath);
}
data->export_ok = false;
return;
}
usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, pxr::VtValue(pxr::UsdGeomTokens->z));
usd_stage->SetMetadata(pxr::UsdGeomTokens->metersPerUnit, double(scene->unit.scale_length));
if (data->params.export_lights && !data->params.selected_objects_only &&
data->params.convert_world_material) {
world_material_to_dome_light(data->params, scene, usd_stage);
}
/* Define the material prim path as a scope. */
if (data->params.export_materials) {
pxr::SdfPath mtl_prim_path(data->params.material_prim_path);
blender::io::usd::usd_define_or_over<pxr::UsdGeomScope>(
usd_stage, mtl_prim_path, data->params.export_as_overs);
}
pxr::VtValue upAxis = pxr::VtValue(pxr::UsdGeomTokens->z);
if (data->params.convert_orientation) {
if (data->params.up_axis == USD_GLOBAL_UP_X)
upAxis = pxr::VtValue(pxr::UsdGeomTokens->x);
else if (data->params.up_axis == USD_GLOBAL_UP_Y)
upAxis = pxr::VtValue(pxr::UsdGeomTokens->y);
}
usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, upAxis);
usd_stage->GetRootLayer()->SetDocumentation(std::string("Blender v") +
BKE_blender_version_string());
/* Add any Blender-specific custom export data */
if (data->params.export_blender_metadata && strlen(data->bmain->filepath)) {
auto root_layer = usd_stage->GetRootLayer();
char full_path[1024];
strcpy(full_path, data->bmain->filepath);
// make all paths uniformly unix-like
BLI_str_replace_char(full_path + 2, SEP, ALTSEP);
char basename[128];
strcpy(basename, BLI_path_basename(full_path));
BLI_split_dir_part(full_path, full_path, 1024);
pxr::VtDictionary custom_data;
custom_data.SetValueAtPath(std::string("sourceFilename"), pxr::VtValue(basename));
custom_data.SetValueAtPath(std::string("sourceDirPath"), pxr::VtValue(full_path));
root_layer->SetCustomLayerData(custom_data);
}
/* Set up the stage for animated data. */
if (data->params.export_animation) {
usd_stage->SetTimeCodesPerSecond(FPS);
usd_stage->SetStartTimeCode(scene->r.sfra);
usd_stage->SetEndTimeCode(scene->r.efra);
usd_stage->SetStartTimeCode(data->params.frame_start);
usd_stage->SetEndTimeCode(data->params.frame_end);
}
ensure_root_prim(usd_stage, data->params);
USDHierarchyIterator iter(data->bmain, data->depsgraph, usd_stage, data->params);
if (data->params.export_animation) {
/* Writing the animated frames is not 100% of the work, but it's our best guess. */
float progress_per_frame = 1.0f / std::max(1, (scene->r.efra - scene->r.sfra + 1));
for (float frame = scene->r.sfra; frame <= scene->r.efra; frame++) {
// Writing the animated frames is not 100% of the work, but it's our best guess.
float progress_per_frame = 1.0f / std::max(1.0f,
(float)(data->params.frame_end -
data->params.frame_start + 1.0) /
data->params.frame_step);
for (float frame = data->params.frame_start; frame <= data->params.frame_end;
frame += data->params.frame_step) {
if (G.is_break || (stop != nullptr && *stop)) {
break;
}
@@ -136,15 +474,52 @@ static void export_startjob(void *customdata,
}
iter.release_writers();
if (data->params.export_armatures) {
validate_skel_roots(usd_stage, data->params);
}
// Set Stage Default Prim Path
if (strlen(data->params.default_prim_path) > 0) {
std::string valid_default_prim_path = pxr::TfMakeValidIdentifier(
data->params.default_prim_path);
if (valid_default_prim_path[0] == '_') {
valid_default_prim_path[0] = '/';
}
if (valid_default_prim_path[0] != '/') {
valid_default_prim_path = "/" + valid_default_prim_path;
}
pxr::UsdPrim defaultPrim = usd_stage->GetPrimAtPath(pxr::SdfPath(valid_default_prim_path));
if (defaultPrim.IsValid()) {
usd_stage->SetDefaultPrim(defaultPrim);
}
}
/* Set unit scale.
* TODO(makowalsk): Add an option to use scene->unit.scale_length as well? */
double meters_per_unit = data->params.convert_to_cm ? pxr::UsdGeomLinearUnits::centimeters :
pxr::UsdGeomLinearUnits::meters;
pxr::UsdGeomSetStageMetersPerUnit(usd_stage, meters_per_unit);
usd_stage->GetRootLayer()->Save();
if (data->is_usdz_export) {
if (!perform_usdz_conversion(data)) {
return;
}
}
/* Finish up by going back to the keyframe that was current before we started. */
if (scene->r.cfra != orig_frame) {
scene->r.cfra = orig_frame;
BKE_scene_graph_update_for_newframe(data->depsgraph);
}
data->export_ok = true;
data->export_ok = !data->was_canceled;
*progress = 1.0f;
*do_update = true;
}
@@ -155,7 +530,21 @@ static void export_endjob(void *customdata)
DEG_graph_free(data->depsgraph);
if (!data->export_ok && BLI_exists(data->filepath)) {
if (data->is_usdz_export && BLI_exists(data->filepath))
{
char dir[FILE_MAX];
BLI_split_dir_part(data->filepath, dir, FILE_MAX);
char usdc_temp_dir[FILE_MAX];
BLI_path_join(usdc_temp_dir, FILE_MAX, BKE_tempdir_session(), "USDZ", SEP_STR);
BLI_assert(BLI_strcasecmp(dir, usdc_temp_dir) == 0);
BLI_delete(usdc_temp_dir, true, true);
}
MEM_freeN(data->params.default_prim_path);
MEM_freeN(data->params.root_prim_path);
MEM_freeN(data->params.material_prim_path);
if (data->was_canceled && BLI_exists(data->filepath)) {
BLI_delete(data->filepath, false, false);
}
@@ -166,6 +555,25 @@ static void export_endjob(void *customdata)
} // namespace blender::io::usd
/* To create a usdz file, we must first create a .usd/a/c file and then covert it to .usdz. The
* temporary files will be created in Blender's temporary session storage. The .usdz file will then
* copied to job->usdz_filepath. */
static void create_temp_path_for_usdz_export(const char *filepath,
blender::io::usd::ExportJobData *job)
{
char file[FILE_MAX];
BLI_split_file_part(filepath, file, FILE_MAX);
char *usdc_file = BLI_str_replaceN(file, ".usdz", ".usdc");
char usdc_temp_filepath[FILE_MAX];
BLI_path_join(usdc_temp_filepath, FILE_MAX, BKE_tempdir_session(), "USDZ", usdc_file);
BLI_strncpy(job->filepath, usdc_temp_filepath, strlen(usdc_temp_filepath) + 1);
BLI_strncpy(job->usdz_filepath, filepath, strlen(filepath) + 1);
MEM_freeN(usdc_file);
}
bool USD_export(bContext *C,
const char *filepath,
const USDExportParams *params,
@@ -174,15 +582,21 @@ bool USD_export(bContext *C,
ViewLayer *view_layer = CTX_data_view_layer(C);
Scene *scene = CTX_data_scene(C);
blender::io::usd::ensure_usd_plugin_path_registered();
blender::io::usd::ExportJobData *job = static_cast<blender::io::usd::ExportJobData *>(
MEM_mallocN(sizeof(blender::io::usd::ExportJobData), "ExportJobData"));
job->scene = scene;
job->bmain = CTX_data_main(C);
job->wm = CTX_wm_manager(C);
job->export_ok = false;
BLI_strncpy(job->filepath, filepath, sizeof(job->filepath));
job->is_usdz_export = false;
if (BLI_path_extension_check_n(filepath, ".usd", ".usda", ".usdc", NULL)) {
BLI_strncpy(job->filepath, filepath, sizeof(job->filepath));
}
else if (BLI_path_extension_check_n(filepath, ".usdz")) {
create_temp_path_for_usdz_export(filepath, job);
job->is_usdz_export = true;
}
job->depsgraph = DEG_graph_new(job->bmain, scene, view_layer, params->evaluation_mode);
job->params = *params;
@@ -231,3 +645,12 @@ int USD_get_version()
*/
return PXR_VERSION;
}
bool USD_umm_module_loaded(void)
{
#ifdef WITH_PYTHON
return blender::io::usd::umm_module_loaded();
#else
return fasle;
#endif
}

View File

@@ -5,10 +5,40 @@
#include "usd.h"
#include "usd_common.h"
#include "usd_hierarchy_iterator.h"
#include "usd_light_convert.h"
#include "usd_reader_geom.h"
#include "usd_reader_instance.h"
#include "usd_reader_prim.h"
#include "usd_reader_stage.h"
#include <pxr/base/plug/registry.h>
#include "usd_writer_material.h"
#include <pxr/pxr.h>
#include <pxr/usd/usd/stage.h>
#include <pxr/usd/usdGeom/metrics.h>
#include <pxr/usd/usdGeom/scope.h>
#include <pxr/usd/usdGeom/tokens.h>
#include <pxr/usd/usdGeom/xformCommonAPI.h>
#include <pxr/usd/usdLux/domeLight.h>
#include <pxr/usd/usdShade/materialBindingAPI.h>
#include "MEM_guardedalloc.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
#include "DNA_cachefile_types.h"
#include "DNA_collection_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "DNA_world_types.h"
#include "BKE_appdir.h"
#include "BKE_blender_version.h"
#include "BKE_cachefile.h"
@@ -86,6 +116,126 @@ static bool gather_objects_paths(const pxr::UsdPrim &object, ListBase *object_pa
return true;
}
/* Create a collection with the given parent and name. */
static Collection *create_collection(Main *bmain, Collection *parent, const char *name)
{
if (!bmain) {
return nullptr;
}
Collection *coll = BKE_collection_add(bmain, parent, name);
if (coll) {
id_fake_user_set(&coll->id);
DEG_id_tag_update(&coll->id, ID_RECALC_COPY_ON_WRITE);
}
return coll;
}
/* Set the instance collection on the given instance reader.
* The collection is assigned from the given map based on
* the prototype (maser) prim path. */
static void set_instance_collection(
USDInstanceReader *instance_reader,
const std::map<pxr::SdfPath, Collection *> &proto_collection_map)
{
if (!instance_reader) {
return;
}
pxr::SdfPath proto_path = instance_reader->proto_path();
std::map<pxr::SdfPath, Collection *>::const_iterator it = proto_collection_map.find(proto_path);
if (it != proto_collection_map.end()) {
instance_reader->set_instance_collection(it->second);
}
else {
std::cerr << "WARNING: Couldn't find prototype collection for " << instance_reader->prim_path()
<< std::endl;
}
}
/* Create instance collections for the USD instance readers. */
static void create_proto_collections(Main *bmain,
ViewLayer *view_layer,
Collection *parent_collection,
const ProtoReaderMap &proto_readers,
const std::vector<USDPrimReader *> &readers)
{
Collection *all_protos_collection = create_collection(bmain, parent_collection, "prototypes");
if (all_protos_collection) {
all_protos_collection->flag |= COLLECTION_HIDE_VIEWPORT;
all_protos_collection->flag |= COLLECTION_HIDE_RENDER;
}
std::map<pxr::SdfPath, Collection *> proto_collection_map;
for (const auto &pair : proto_readers) {
std::string proto_collection_name = pair.first.GetString();
// TODO(makowalski): Is it acceptable to have slashes in the collection names? Or should we
// replace them with another character, like an underscore, as in the following?
// std::replace(proto_collection_name.begin(), proto_collection_name.end(), '/', '_');
Collection *proto_collection = create_collection(
bmain, all_protos_collection, proto_collection_name.c_str());
proto_collection_map.insert(std::make_pair(pair.first, proto_collection));
}
// Set the instance collections on the readers, including the prototype
// readers, as instancing may be recursive.
for (const auto &pair : proto_readers) {
for (USDPrimReader *reader : pair.second) {
if (USDInstanceReader *instance_reader = dynamic_cast<USDInstanceReader *>(reader)) {
set_instance_collection(instance_reader, proto_collection_map);
}
}
}
for (USDPrimReader *reader : readers) {
if (USDInstanceReader *instance_reader = dynamic_cast<USDInstanceReader *>(reader)) {
set_instance_collection(instance_reader, proto_collection_map);
}
}
// Add the prototype objects to the collections.
for (const auto &pair : proto_readers) {
std::map<pxr::SdfPath, Collection *>::const_iterator it = proto_collection_map.find(
pair.first);
if (it == proto_collection_map.end()) {
std::cerr << "WARNING: Couldn't find collection when adding objects for prototype "
<< pair.first << std::endl;
continue;
}
for (USDPrimReader *reader : pair.second) {
Object *ob = reader->object();
if (!ob) {
continue;
}
Collection *coll = it->second;
BKE_collection_object_add(bmain, coll, ob);
DEG_id_tag_update(&coll->id, ID_RECALC_COPY_ON_WRITE);
DEG_id_tag_update_ex(bmain,
&ob->id,
ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION |
ID_RECALC_BASE_FLAGS);
}
}
}
/* Update the given import settings with the global rotation matrix to orient
* imported objects with Z-up, if necessary */
static void convert_to_z_up(pxr::UsdStageRefPtr stage, ImportSettings *r_settings)
@@ -136,6 +286,50 @@ struct ImportJobData {
timeit::TimePoint start_time;
};
static CacheFile *create_cache_file(const ImportJobData *data)
{
if (!data) {
return nullptr;
}
CacheFile *cache_file = static_cast<CacheFile *>(
BKE_cachefile_add(data->bmain, BLI_path_basename(data->filepath)));
/* Decrement the ID ref-count because it is going to be incremented for each
* modifier and constraint that it will be attached to, so since currently
* it is not used by anyone, its use count will off by one. */
id_us_min(&cache_file->id);
cache_file->is_sequence = data->params.is_sequence;
cache_file->scale = data->params.scale;
STRNCPY(cache_file->filepath, data->filepath);
cache_file->scale = data->settings.scale;
return cache_file;
}
/* Apply the given cache file to the given reader, if needed. Will create a cache file
* and return it in the r_cache_file out prameter, if needed. */
static void apply_cache_file(USDPrimReader *reader,
const ImportJobData *data,
CacheFile **r_cache_file)
{
if (!(reader && reader->needs_cachefile())) {
return;
}
if (!(data && r_cache_file)) {
return;
}
if (*r_cache_file == nullptr) {
*r_cache_file = create_cache_file(data);
}
reader->apply_cache_file(*r_cache_file);
}
static void report_job_duration(const ImportJobData *data)
{
timeit::Nanoseconds duration = timeit::Clock::now() - data->start_time;
@@ -175,21 +369,7 @@ static void import_startjob(void *customdata, bool *stop, bool *do_update, float
data->view_layer, import_collection);
}
BLI_path_abs(data->filepath, BKE_main_blendfile_path_from_global());
CacheFile *cache_file = static_cast<CacheFile *>(
BKE_cachefile_add(data->bmain, BLI_path_basename(data->filepath)));
/* Decrement the ID ref-count because it is going to be incremented for each
* modifier and constraint that it will be attached to, so since currently
* it is not used by anyone, its use count will off by one. */
id_us_min(&cache_file->id);
cache_file->is_sequence = data->params.is_sequence;
cache_file->scale = data->params.scale;
STRNCPY(cache_file->filepath, data->filepath);
data->settings.cache_file = cache_file;
USD_path_abs(data->filepath, BKE_main_blendfile_path_from_global(), true);
*data->do_update = true;
*data->progress = 0.05f;
@@ -202,8 +382,21 @@ static void import_startjob(void *customdata, bool *stop, bool *do_update, float
*data->do_update = true;
*data->progress = 0.1f;
pxr::UsdStageRefPtr stage = pxr::UsdStage::Open(data->filepath);
std::string prim_path_mask(data->params.prim_path_mask);
pxr::UsdStagePopulationMask pop_mask;
if (!prim_path_mask.empty()) {
const std::vector<std::string> mask_tokens = pxr::TfStringTokenize(prim_path_mask, " ,;");
for (const std::string &tok : mask_tokens) {
pxr::SdfPath prim_path(tok);
if (!prim_path.IsEmpty()) {
pop_mask.Add(prim_path);
}
}
}
pxr::UsdStageRefPtr stage = pop_mask.IsEmpty() ?
pxr::UsdStage::Open(data->filepath) :
pxr::UsdStage::OpenMasked(data->filepath, pop_mask);
if (!stage) {
WM_reportf(RPT_ERROR, "USD Import: unable to open stage to read %s", data->filepath);
data->import_ok = false;
@@ -212,6 +405,11 @@ static void import_startjob(void *customdata, bool *stop, bool *do_update, float
convert_to_z_up(stage, &data->settings);
if (data->params.apply_unit_conversion_scale) {
const double meters_per_unit = pxr::UsdGeomGetStageMetersPerUnit(stage);
data->settings.scale *= meters_per_unit;
}
/* Set up the stage for animated data. */
if (data->params.set_frame_range) {
data->scene->r.sfra = stage->GetStartTimeCode();
@@ -227,12 +425,68 @@ static void import_startjob(void *customdata, bool *stop, bool *do_update, float
archive->collect_readers(data->bmain);
if (data->params.import_lights && data->params.create_background_shader &&
!archive->dome_lights().empty()) {
dome_light_to_world_material(
data->params, data->settings, data->scene, data->bmain, archive->dome_lights().front());
}
*data->do_update = true;
*data->progress = 0.2f;
const float size = float(archive->readers().size());
size_t i = 0;
/* Read data, set prenting and create a cache file, if needed. */
/* We defer creating a cache file until we know that we need
* one. This is not only more efficient, but also avoids
* the problem where we can't overwrite the USD the
* cachefile is referencing because it has a pointer to the
* open stage for the lifetime of the scene. */
CacheFile *cache_file = nullptr;
/* Handle instance prototypes.
* TODO(makowalski): Move this logic inside USDReaderStage? */
/* Create prototype objects.
* TODO(makowalski): Sort prototype objects by name, as below? */
for (const auto &pair : archive->proto_readers()) {
for (USDPrimReader *reader : pair.second) {
if (reader) {
reader->create_object(data->bmain, 0.0);
}
}
}
for (const auto &pair : archive->proto_readers()) {
for (USDPrimReader *reader : pair.second) {
if (!reader) {
continue;
}
/* TODO(makowalski): Here and below, should we call
* read_object_data() with the actual time? */
reader->read_object_data(data->bmain, 0.0);
apply_cache_file(reader, data, &cache_file);
Object *ob = reader->object();
if (!ob) {
continue;
}
const USDPrimReader *parent_reader = reader->parent();
ob->parent = parent_reader ? parent_reader->object() : nullptr;
/* TODO(makowalski): Handle progress update. */
}
}
/* Sort readers by name: when creating a lot of objects in Blender,
* it is much faster if the order is sorted by name. */
archive->sort_readers();
@@ -263,6 +517,8 @@ static void import_startjob(void *customdata, bool *stop, bool *do_update, float
reader->read_object_data(data->bmain, 0.0);
apply_cache_file(reader, data, &cache_file);
USDPrimReader *parent = reader->parent();
if (parent == nullptr) {
@@ -281,6 +537,10 @@ static void import_startjob(void *customdata, bool *stop, bool *do_update, float
}
}
if (data->params.import_skeletons) {
archive->process_armature_modifiers();
}
data->import_ok = !data->was_canceled;
*progress = 1.0f;
@@ -306,6 +566,17 @@ static void import_endjob(void *customdata)
BKE_id_free_us(data->bmain, ob);
}
}
for (const auto &pair : data->archive->proto_readers()) {
for (USDPrimReader *reader : pair.second) {
/* It's possible that cancellation occurred between the creation of
* the reader and the creation of the Blender object. */
if (Object *ob = reader->object()) {
BKE_id_free_us(data->bmain, ob);
}
}
}
}
else if (data->archive) {
Base *base;
@@ -317,6 +588,14 @@ static void import_endjob(void *customdata)
lc = BKE_layer_collection_get_active(view_layer);
if (!data->archive->proto_readers().empty()) {
create_proto_collections(data->bmain,
view_layer,
lc->collection,
data->archive->proto_readers(),
data->archive->readers());
}
/* Add all objects to the collection. */
for (USDPrimReader *reader : data->archive->readers()) {
if (!reader) {
@@ -351,6 +630,9 @@ static void import_endjob(void *customdata)
}
DEG_id_tag_update(&data->scene->id, ID_RECALC_BASE_FLAGS);
if (!data->archive->dome_lights().empty()) {
DEG_id_tag_update(&data->scene->world->id, ID_RECALC_COPY_ON_WRITE);
}
DEG_relations_tag_update(data->bmain);
}
@@ -382,13 +664,16 @@ static void import_freejob(void *user_data)
using namespace blender::io::usd;
void USD_ensure_plugin_path_registered()
{
blender::io::usd::ensure_usd_plugin_path_registered();
}
bool USD_import(struct bContext *C,
const char *filepath,
const USDImportParams *params,
bool as_background_job)
{
blender::io::usd::ensure_usd_plugin_path_registered();
/* Using new here since `MEM_*` functions do not call constructor to properly initialize data. */
ImportJobData *job = new ImportJobData();
job->bmain = CTX_data_main(C);
@@ -516,10 +801,11 @@ CacheReader *CacheReader_open_usd_object(CacheArchiveHandle *handle,
}
/* TODO(makowalski): The handle does not have the proper import params or settings. */
USDPrimReader *usd_reader = archive->create_reader(prim);
pxr::UsdGeomXformCache xf_cache;
USDPrimReader *usd_reader = archive->create_reader(prim, &xf_cache);
if (usd_reader == nullptr) {
/* This object is not supported. */
/* This object is not supported */
return nullptr;
}
usd_reader->object(object);
@@ -542,9 +828,6 @@ CacheArchiveHandle *USD_create_handle(struct Main * /*bmain*/,
const char *filepath,
ListBase *object_paths)
{
/* Must call this so that USD file format plugins are loaded. */
ensure_usd_plugin_path_registered();
pxr::UsdStageRefPtr stage = pxr::UsdStage::Open(filepath);
if (!stage) {

View File

@@ -2,15 +2,26 @@
* Copyright 2021 Blender Foundation. All rights reserved. */
#include "usd_common.h"
#include "usd.h"
#include <pxr/usd/ar/resolver.h>
#include <pxr/base/plug/registry.h>
#include "BKE_appdir.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "WM_api.h"
#include "WM_types.h"
namespace blender::io::usd {
void ensure_usd_plugin_path_registered()
{
/* if PXR_PYTHON_SUPPORT_ENABLED is defined, we *must* be dynamic and
the plugins are placed relative to the USD shared library hence no
hinting is required. */
#ifndef PXR_PYTHON_SUPPORT_ENABLED
static bool plugin_path_registered = false;
if (plugin_path_registered) {
return;
@@ -22,6 +33,37 @@ void ensure_usd_plugin_path_registered()
const std::string blender_usd_datafiles = BKE_appdir_folder_id(BLENDER_DATAFILES, "usd");
/* The trailing slash indicates to the USD library that the path is a directory. */
pxr::PlugRegistry::GetInstance().RegisterPlugins(blender_usd_datafiles + "/");
#endif
}
} // namespace blender::io::usd
void USD_path_abs(char *path, const char *basepath, bool for_import)
{
if (BLI_path_is_rel(path)) {
/* The path is relative to the .blend file, so use Blender's
* standard absolute path resolution. */
BLI_path_abs(path, basepath);
/* Use forward slash separators, which is standard for USD. */
BLI_str_replace_char(path, SEP, ALTSEP);
}
pxr::ArResolvedPath resolved_path = for_import ? pxr::ArGetResolver().Resolve(path) :
pxr::ArGetResolver().ResolveForNewAsset(path);
std::string path_str = resolved_path.GetPathString();
if (!path_str.empty()) {
if (path_str.length() < FILE_MAX) {
BLI_strncpy(path, path_str.c_str(), FILE_MAX);
/* Use forward slash separators, which is standard for USD. */
BLI_str_replace_char(path, SEP, ALTSEP);
}
else {
WM_reportf(RPT_ERROR,
"USD_path_abs: resolved path %s exceeds path buffer length.",
path_str.c_str());
}
}
}

View File

@@ -6,6 +6,8 @@
#include <pxr/usd/sdf/path.h>
#include <pxr/usd/usd/common.h>
#include <pxr/usd/usd/prim.h>
#include <pxr/usd/usd/stage.h>
struct Depsgraph;
struct Main;
@@ -21,6 +23,11 @@ struct USDExporterContext {
const pxr::SdfPath usd_path;
const USDHierarchyIterator *hierarchy_iterator;
const USDExportParams &export_params;
template<typename T> T usd_define_or_over(pxr::SdfPath path) const
{
return (export_params.export_as_overs) ? T(stage->OverridePrim(path)) : T::Define(stage, path);
}
};
} // namespace blender::io::usd

View File

@@ -4,11 +4,17 @@
#include "usd_hierarchy_iterator.h"
#include "usd_writer_abstract.h"
#include "usd_writer_armature.h"
#include "usd_writer_blendshape_mesh.h"
#include "usd_writer_camera.h"
#include "usd_writer_curve.h"
#include "usd_writer_hair.h"
#include "usd_writer_light.h"
#include "usd_writer_mesh.h"
#include "usd_writer_metaball.h"
#include "usd_writer_particle.h"
#include "usd_writer_skel_root.h"
#include "usd_writer_skinned_mesh.h"
#include "usd_writer_transform.h"
#include "usd_writer_volume.h"
@@ -75,48 +81,110 @@ const pxr::UsdTimeCode &USDHierarchyIterator::get_export_time_code() const
return export_time_;
}
USDExporterContext USDHierarchyIterator::create_usd_export_context(const HierarchyContext *context)
USDExporterContext USDHierarchyIterator::create_usd_export_context(const HierarchyContext *context,
bool mergeTransformAndShape)
{
return USDExporterContext{
bmain_, depsgraph_, stage_, pxr::SdfPath(context->export_path), this, params_};
pxr::SdfPath prim_path = pxr::SdfPath(std::string(params_.root_prim_path) +
context->export_path);
// TODO: Somewhat of a workaround. There could be a better way to incoporate this...
bool can_merge_with_xform = true;
if (this->params_.export_armatures &&
(is_skinned_mesh(context->object) || context->object->type == OB_ARMATURE)) {
can_merge_with_xform = false;
}
if (this->params_.export_blendshapes && is_blendshape_mesh(context->object)) {
can_merge_with_xform = false;
}
if (can_merge_with_xform && mergeTransformAndShape)
prim_path = prim_path.GetParentPath();
return USDExporterContext{bmain_, depsgraph_, stage_, prim_path, this, params_};
}
AbstractHierarchyWriter *USDHierarchyIterator::create_transform_writer(
const HierarchyContext *context)
{
if (this->params_.export_armatures &&
(is_skinned_mesh(context->object) || context->object->type == OB_ARMATURE)) {
return new USDSkelRootWriter(create_usd_export_context(context));
}
if (this->params_.export_blendshapes && is_blendshape_mesh(context->object)) {
return new USDSkelRootWriter(create_usd_export_context(context));
}
return new USDTransformWriter(create_usd_export_context(context));
}
AbstractHierarchyWriter *USDHierarchyIterator::create_data_writer(const HierarchyContext *context)
{
USDExporterContext usd_export_context = create_usd_export_context(context);
if (context->is_instance() && params_.use_instancing) {
return nullptr;
}
USDExporterContext usd_export_context = create_usd_export_context(
context, params_.merge_transform_and_shape);
USDAbstractWriter *data_writer = nullptr;
switch (context->object->type) {
case OB_MESH:
data_writer = new USDMeshWriter(usd_export_context);
if (usd_export_context.export_params.export_meshes) {
if (usd_export_context.export_params.export_armatures &&
is_skinned_mesh(context->object)) {
data_writer = new USDSkinnedMeshWriter(usd_export_context);
}
else if (usd_export_context.export_params.export_blendshapes &&
is_blendshape_mesh(context->object)) {
data_writer = new USDBlendShapeMeshWriter(usd_export_context);
}
else {
data_writer = new USDMeshWriter(usd_export_context);
}
}
else
return nullptr;
break;
case OB_CAMERA:
data_writer = new USDCameraWriter(usd_export_context);
if (usd_export_context.export_params.export_cameras)
data_writer = new USDCameraWriter(usd_export_context);
else
return nullptr;
break;
case OB_LAMP:
data_writer = new USDLightWriter(usd_export_context);
if (usd_export_context.export_params.export_lights)
data_writer = new USDLightWriter(usd_export_context);
else
return nullptr;
break;
case OB_MBALL:
data_writer = new USDMetaballWriter(usd_export_context);
break;
case OB_CURVES_LEGACY:
if (usd_export_context.export_params.export_curves) {
data_writer = new USDCurveWriter(usd_export_context);
}
else
return nullptr;
break;
case OB_ARMATURE:
if (usd_export_context.export_params.export_armatures) {
data_writer = new USDArmatureWriter(usd_export_context);
}
else
return nullptr;
break;
case OB_VOLUME:
data_writer = new USDVolumeWriter(usd_export_context);
break;
case OB_EMPTY:
case OB_CURVES_LEGACY:
case OB_SURF:
case OB_FONT:
case OB_SPEAKER:
case OB_LIGHTPROBE:
case OB_LATTICE:
case OB_ARMATURE:
case OB_GPENCIL:
return nullptr;
case OB_TYPE_MAX:
@@ -124,7 +192,7 @@ AbstractHierarchyWriter *USDHierarchyIterator::create_data_writer(const Hierarch
return nullptr;
}
if (!data_writer->is_supported(context)) {
if (data_writer && !data_writer->is_supported(context)) {
delete data_writer;
return nullptr;
}
@@ -134,6 +202,10 @@ AbstractHierarchyWriter *USDHierarchyIterator::create_data_writer(const Hierarch
AbstractHierarchyWriter *USDHierarchyIterator::create_hair_writer(const HierarchyContext *context)
{
if (context->is_instance() && params_.use_instancing) {
return nullptr;
}
if (!params_.export_hair) {
return nullptr;
}
@@ -141,9 +213,36 @@ AbstractHierarchyWriter *USDHierarchyIterator::create_hair_writer(const Hierarch
}
AbstractHierarchyWriter *USDHierarchyIterator::create_particle_writer(
const HierarchyContext * /*context*/)
const HierarchyContext *context)
{
return nullptr;
if (context->is_instance() && params_.use_instancing) {
return nullptr;
}
if (!params_.export_particles) {
return nullptr;
}
return new USDParticleWriter(create_usd_export_context(context));
}
/* Don't generate data writers for instances. */
bool USDHierarchyIterator::include_data_writers(const HierarchyContext *context) const
{
if (!context) {
return false;
}
return !(params_.use_instancing && context->is_instance());
}
/* Don't generate writers for children of instances. */
bool USDHierarchyIterator::include_child_writers(const HierarchyContext *context) const
{
if (!context) {
return false;
}
return !(params_.use_instancing && context->is_instance());
}
} // namespace blender::io::usd

View File

@@ -51,8 +51,12 @@ class USDHierarchyIterator : public AbstractHierarchyIterator {
virtual void release_writer(AbstractHierarchyWriter *writer) override;
virtual bool include_data_writers(const HierarchyContext *context) const override;
virtual bool include_child_writers(const HierarchyContext *context) const override;
private:
USDExporterContext create_usd_export_context(const HierarchyContext *context);
USDExporterContext create_usd_export_context(const HierarchyContext *context,
bool mergeTransformAndShape = false);
};
} // namespace blender::io::usd

View File

@@ -0,0 +1,574 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2021 NVIDIA Corporation.
* All rights reserved.
*/
#include "usd_light_convert.h"
#include "usd.h"
#include "usd_reader_prim.h"
#include "usd_writer_material.h"
#include <pxr/base/gf/matrix4f.h>
#include <pxr/base/gf/rotation.h>
#include <pxr/base/gf/vec3f.h>
#include <pxr/usd/usdGeom/scope.h>
#include <pxr/usd/usdGeom/xformCache.h>
#include <pxr/usd/usdGeom/xformCommonAPI.h>
#include <pxr/usd/usdLux/domeLight.h>
#include <pxr/usd/usdShade/material.h>
#include <pxr/usd/usdShade/materialBindingAPI.h>
#include "BKE_image.h"
#include "BKE_light.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node_tree_update.h"
#include "BKE_scene.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "DNA_light_types.h"
#include "DNA_scene_types.h"
#include "DNA_world_types.h"
#include "ED_node.h"
#include <iostream>
#include <string>
namespace usdtokens {
// Attribute names.
static const pxr::TfToken color("color", pxr::TfToken::Immortal);
static const pxr::TfToken intensity("intensity", pxr::TfToken::Immortal);
static const pxr::TfToken texture_file("texture:file", pxr::TfToken::Immortal);
} // namespace usdtokens
namespace {
template<typename T>
bool get_authored_value(const pxr::UsdAttribute attr, const double motionSampleTime, T *r_value)
{
if (attr && attr.HasAuthoredValue()) {
return attr.Get<T>(r_value, motionSampleTime);
}
return false;
}
struct WorldNtreeSearchResults {
const USDExportParams params;
pxr::UsdStageRefPtr stage;
float world_color[3];
float world_intensity;
float tex_rot[3];
std::string file_path;
float color_mult[3];
bool background_found;
bool env_tex_found;
bool mult_found;
WorldNtreeSearchResults(const USDExportParams &in_params, pxr::UsdStageRefPtr in_stage)
: params(in_params),
stage(in_stage),
world_intensity(0.0f),
background_found(false),
env_tex_found(false),
mult_found(false)
{
}
};
} // End anonymous namespace.
namespace blender::io::usd {
static const float nits_to_watts_per_meter_sq = 0.0014641f;
static const float watts_per_meter_sq_to_nits = 1.0f / nits_to_watts_per_meter_sq;
static bool node_search(bNode *fromnode, bNode *tonode, void *userdata, const bool reversed)
{
if (!(userdata && fromnode && tonode)) {
return true;
}
/* TODO(makowalski): can we validate that node connectiona are correct? */
WorldNtreeSearchResults *res = reinterpret_cast<WorldNtreeSearchResults *>(userdata);
if (!res->background_found && ELEM(fromnode->type, SH_NODE_BACKGROUND)) {
/* Get light color and intensity */
bNodeSocketValueRGBA *color_data =
(bNodeSocketValueRGBA *)((bNodeSocket *)BLI_findlink(&fromnode->inputs, 0))->default_value;
bNodeSocketValueFloat *strength_data = (bNodeSocketValueFloat *)((bNodeSocket *)BLI_findlink(
&fromnode->inputs, 1))
->default_value;
res->background_found = true;
res->world_intensity = strength_data->value;
res->world_color[0] = color_data->value[0];
res->world_color[1] = color_data->value[1];
res->world_color[2] = color_data->value[2];
}
else if (!res->env_tex_found && ELEM(fromnode->type, SH_NODE_TEX_ENVIRONMENT)) {
/* Get env tex path. */
res->file_path = get_tex_image_asset_path(fromnode, res->stage, res->params);
if (!res->file_path.empty()) {
/* Get the rotation. */
NodeTexEnvironment *tex = static_cast<NodeTexEnvironment *>(fromnode->storage);
copy_v3_v3(res->tex_rot, tex->base.tex_mapping.rot);
res->env_tex_found = true;
if (res->params.export_textures) {
export_texture(fromnode, res->stage, res->params.overwrite_textures);
}
}
}
else if (!res->env_tex_found && !res->mult_found && ELEM(fromnode->type, SH_NODE_VECTOR_MATH)) {
if (fromnode->custom1 == NODE_VECTOR_MATH_MULTIPLY) {
res->mult_found = true;
bNodeSocket *vec_sock = nodeFindSocket(fromnode, SOCK_IN, "Vector");
if (vec_sock) {
vec_sock = vec_sock->next;
}
if (vec_sock) {
copy_v3_v3(res->color_mult, ((bNodeSocketValueVector *)vec_sock->default_value)->value);
}
}
}
return true;
}
/* Return the scale factor to convert nits to light energy
* (Watts or Watts per meter squared) for the given light. */
float nits_to_energy_scale_factor(const Light *light,
const float meters_per_unit,
const float radius_scale)
{
if (!light) {
return 1.0f;
}
/* Compute meters per unit squared. */
const float mpu_sq = meters_per_unit * meters_per_unit;
float scale = nits_to_watts_per_meter_sq;
/* Scale by the light surface area, for lights other than sun. */
switch (light->type) {
case LA_AREA:
switch (light->area_shape) {
case LA_AREA_DISK:
case LA_AREA_ELLIPSE: { /* An ellipse light will deteriorate into a disk light. */
float r = light->area_size / 2.0f;
scale *= 2.0f * M_PI * (r * r) * mpu_sq;
break;
}
case LA_AREA_RECT: {
scale *= light->area_size * light->area_sizey * mpu_sq;
break;
}
case LA_AREA_SQUARE: {
scale *= light->area_size * light->area_size * mpu_sq;
break;
}
}
break;
case LA_LOCAL: {
float r = light->area_size * radius_scale;
scale *= 4.0f * M_PI * (r * r) * mpu_sq;
break;
}
case LA_SPOT: {
float r = light->area_size * radius_scale;
float angle = light->spotsize / 2.0f;
scale *= 2.0f * M_PI * (r * r) * (1.0f - cosf(angle)) * mpu_sq;
break;
}
case LA_SUN: {
/* Sun energy is Watts per square meter so we don't scale by area. */
break;
}
default:
break;
}
return scale;
}
/* If the Blender scene has an environment texture,
* export it as a USD dome light. */
void world_material_to_dome_light(const USDExportParams &params,
const Scene *scene,
pxr::UsdStageRefPtr stage)
{
if (!(stage && scene && scene->world && scene->world->use_nodes && scene->world->nodetree)) {
return;
}
/* Find the world output. */
bNode *output = ntreeFindType(scene->world->nodetree, SH_NODE_OUTPUT_WORLD);
if (!output) {
/* No output, no valid network to convert. */
return;
}
pxr::SdfPath light_path(std::string(params.root_prim_path) + "/lights");
usd_define_or_over<pxr::UsdGeomScope>(stage, light_path, params.export_as_overs);
WorldNtreeSearchResults res(params, stage);
nodeChainIter(scene->world->nodetree, output, node_search, &res, true);
if (!(res.background_found || res.env_tex_found)) {
/* No nodes to convert */
return;
}
/* Create USD dome light. */
pxr::SdfPath env_light_path = light_path.AppendChild(pxr::TfToken("environment"));
pxr::UsdLuxDomeLight dome_light = usd_define_or_over<pxr::UsdLuxDomeLight>(
stage, env_light_path, params.export_as_overs);
if (res.env_tex_found) {
/* Convert radians to degrees. */
mul_v3_fl(res.tex_rot, 180.0f / M_PI);
/* Note the negative Z rotation with 180 deg offset, to match Create and Maya. */
pxr::GfVec3f rot(-res.tex_rot[0], -res.tex_rot[1], -res.tex_rot[2] - 180.0f);
pxr::UsdGeomXformCommonAPI xform_api(dome_light);
/* We reverse the rotation order to convert between extrinsic and intrinsic euler angles. */
xform_api.SetRotate(rot, pxr::UsdGeomXformCommonAPI::RotationOrderZYX);
pxr::SdfAssetPath path(res.file_path);
dome_light.CreateTextureFileAttr().Set(path);
if (params.backward_compatible) {
pxr::UsdAttribute attr = dome_light.GetPrim().CreateAttribute(
usdtokens::texture_file, pxr::SdfValueTypeNames->Asset, true);
if (attr) {
attr.Set(path);
}
}
if (res.mult_found) {
pxr::GfVec3f color_val(res.color_mult[0], res.color_mult[1], res.color_mult[2]);
dome_light.CreateColorAttr().Set(color_val);
if (params.backward_compatible) {
pxr::UsdAttribute attr = dome_light.GetPrim().CreateAttribute(
usdtokens::color, pxr::SdfValueTypeNames->Color3f, true);
if (attr) {
attr.Set(color_val);
}
}
}
}
else {
pxr::GfVec3f color_val(res.world_color[0], res.world_color[1], res.world_color[2]);
dome_light.CreateColorAttr().Set(color_val);
if (params.backward_compatible) {
pxr::UsdAttribute attr = dome_light.GetPrim().CreateAttribute(
usdtokens::color, pxr::SdfValueTypeNames->Color3f, true);
if (attr) {
attr.Set(color_val);
}
}
}
if (res.background_found) {
float usd_intensity = res.world_intensity * params.light_intensity_scale;
if (params.convert_light_to_nits) {
usd_intensity *= watts_per_meter_sq_to_nits;
}
dome_light.CreateIntensityAttr().Set(usd_intensity);
if (params.backward_compatible) {
pxr::UsdAttribute attr = dome_light.GetPrim().CreateAttribute(
usdtokens::intensity, pxr::SdfValueTypeNames->Float, true);
if (attr) {
attr.Set(usd_intensity);
}
}
}
}
/* Import the dome light as a world material. */
void dome_light_to_world_material(const USDImportParams &params,
const ImportSettings &settings,
Scene *scene,
Main *bmain,
const pxr::UsdLuxDomeLight &dome_light,
const double time)
{
if (!(scene && scene->world && dome_light)) {
return;
}
if (!scene->world->use_nodes) {
scene->world->use_nodes = true;
}
if (!scene->world->nodetree) {
scene->world->nodetree = ntreeAddTree(NULL, "Shader Nodetree", "ShaderNodeTree");
if (!scene->world->nodetree) {
std::cerr << "WARNING: couldn't create world ntree.\n";
return;
}
}
bNodeTree *ntree = scene->world->nodetree;
bNode *output = nullptr;
bNode *shader = nullptr;
/* We never delete existing nodes, but we might disconnect them
* and move them out of the way. */
/* Look for the output and background shader nodes, which we will reuse.
* TODO(makowalski): add logic to properly verify node connections. */
for (bNode *node = static_cast<bNode *>(ntree->nodes.first); node; node = node->next) {
if (ELEM(node->type, SH_NODE_OUTPUT_WORLD)) {
output = node;
}
else if (ELEM(node->type, SH_NODE_BACKGROUND)) {
shader = node;
}
else {
/* Move node out of the way. */
node->locy += 300;
}
}
/* Create the output and shader nodes, if they don't exist. */
if (!output) {
output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_WORLD);
if (!output) {
std::cerr << "WARNING: couldn't create world output node.\n";
return;
}
output->locx = 300.0f;
output->locy = 300.0f;
}
if (!shader) {
shader = nodeAddStaticNode(NULL, ntree, SH_NODE_BACKGROUND);
if (!shader) {
std::cerr << "WARNING: couldn't create world shader node.\n";
return;
}
nodeAddLink(scene->world->nodetree,
shader,
nodeFindSocket(shader, SOCK_OUT, "Background"),
output,
nodeFindSocket(output, SOCK_IN, "Surface"));
bNodeSocket *color_sock = nodeFindSocket(shader, SOCK_IN, "Color");
copy_v3_v3(((bNodeSocketValueRGBA *)color_sock->default_value)->value, &scene->world->horr);
shader->locx = output->locx - 200;
shader->locy = output->locy;
}
/* Make sure the first input to the shader node is disconnected. */
bNodeSocket *shader_input = static_cast<bNodeSocket *>(BLI_findlink(&shader->inputs, 0));
if (shader_input && shader_input->link) {
nodeRemLink(ntree, shader_input->link);
}
pxr::UsdAttribute intensity_attr = dome_light.GetIntensityAttr();
float intensity = 1.0f;
intensity_attr.Get(&intensity, time);
if (!get_authored_value(dome_light.GetIntensityAttr(), time, &intensity)) {
dome_light.GetPrim().GetAttribute(usdtokens::intensity).Get(&intensity, time);
}
intensity *= params.light_intensity_scale;
if (params.convert_light_from_nits) {
intensity *= nits_to_watts_per_meter_sq;
}
bNodeSocket *strength_sock = nodeFindSocket(shader, SOCK_IN, "Strength");
((bNodeSocketValueFloat *)strength_sock->default_value)->value = intensity;
pxr::SdfAssetPath tex_path;
bool has_tex = get_authored_value(dome_light.GetTextureFileAttr(), time, &tex_path);
if (!has_tex) {
has_tex = dome_light.GetPrim().GetAttribute(usdtokens::texture_file).Get(&tex_path, time);
}
pxr::GfVec3f color;
bool has_color = get_authored_value(dome_light.GetColorAttr(), time, &color);
if (!has_color) {
has_color = dome_light.GetPrim().GetAttribute(usdtokens::color).Get(&color, time);
}
if (!has_tex) {
if (has_color) {
bNodeSocket *color_sock = nodeFindSocket(shader, SOCK_IN, "Color");
copy_v3_v3(((bNodeSocketValueRGBA *)color_sock->default_value)->value, color.data());
}
nodeSetActive(ntree, output);
BKE_ntree_update_main_tree(bmain, ntree, nullptr);
return;
}
/* If the light has authored color, create the color multiply for the env texture output. */
bNode *mult = nullptr;
if (has_color) {
mult = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
if (!mult) {
std::cerr << "WARNING: couldn't create vector multiply node.\n";
return;
}
nodeAddLink(scene->world->nodetree,
mult,
nodeFindSocket(mult, SOCK_OUT, "Vector"),
shader,
nodeFindSocket(shader, SOCK_IN, "Color"));
mult->locx = shader->locx - 200;
mult->locy = shader->locy;
mult->custom1 = NODE_VECTOR_MATH_MULTIPLY;
bNodeSocket *vec_sock = nodeFindSocket(mult, SOCK_IN, "Vector");
if (vec_sock) {
vec_sock = vec_sock->next;
}
if (vec_sock) {
copy_v3_v3(((bNodeSocketValueVector *)vec_sock->default_value)->value, color.data());
}
else {
std::cout << "ERROR: couldn't find vector multiply second vector input.\n";
}
}
bNode *tex = nodeAddStaticNode(NULL, ntree, SH_NODE_TEX_ENVIRONMENT);
if (!tex) {
std::cerr << "WARNING: couldn't create world environment texture node.\n";
return;
}
if (mult) {
nodeAddLink(scene->world->nodetree,
tex,
nodeFindSocket(tex, SOCK_OUT, "Color"),
mult,
nodeFindSocket(mult, SOCK_IN, "Vector"));
tex->locx = mult->locx - 400;
tex->locy = mult->locy;
}
else {
nodeAddLink(scene->world->nodetree,
tex,
nodeFindSocket(tex, SOCK_OUT, "Color"),
shader,
nodeFindSocket(shader, SOCK_IN, "Color"));
tex->locx = shader->locx - 400;
tex->locy = shader->locy;
}
std::string tex_path_str = tex_path.GetResolvedPath();
if (tex_path_str.empty()) {
std::cerr << "WARNING: Couldn't get resolved path for asset " << tex_path
<< " for Texture Image node.\n";
return;
}
Image *image = BKE_image_load_exists(bmain, tex_path_str.c_str());
if (!image) {
std::cerr << "WARNING: Couldn't open image file '" << tex_path_str
<< "' for Texture Image node.\n";
return;
}
tex->id = &image->id;
/* Set the transform. */
pxr::UsdGeomXformCache xf_cache(time);
pxr::GfMatrix4d xf = xf_cache.GetLocalToWorldTransform(dome_light.GetPrim());
if (settings.do_convert_mat) {
/* Apply matrix for z-up conversion. */
pxr::GfMatrix4d convert_xf(pxr::GfMatrix4f(settings.conversion_mat));
xf *= convert_xf;
}
pxr::GfRotation rot = xf.ExtractRotation();
pxr::GfVec3d rot_vec = rot.Decompose(
pxr::GfVec3d::XAxis(), pxr::GfVec3d::YAxis(), pxr::GfVec3d::ZAxis());
NodeTexEnvironment *tex_env = static_cast<NodeTexEnvironment *>(tex->storage);
tex_env->base.tex_mapping.rot[0] = -static_cast<float>(rot_vec[0]);
tex_env->base.tex_mapping.rot[1] = -static_cast<float>(rot_vec[1]);
tex_env->base.tex_mapping.rot[2] = 180 - static_cast<float>(rot_vec[2]);
/* Convert radians to degrees. */
mul_v3_fl(tex_env->base.tex_mapping.rot, M_PI / 180.0f);
eul_to_mat4(tex_env->base.tex_mapping.mat, tex_env->base.tex_mapping.rot);
nodeSetActive(ntree, output);
BKE_ntree_update_main_tree(bmain, ntree, nullptr);
}
} // namespace blender::io::usd

View File

@@ -0,0 +1,49 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2021 NVIDIA Corporation.
* All rights reserved.
*/
#pragma once
#include <pxr/usd/usd/stage.h>
#include <pxr/usd/usdLux/domeLight.h>
struct Light;
struct Main;
struct Scene;
struct USDExportParams;
struct USDImportParams;
namespace blender::io::usd {
struct ImportSettings;
float nits_to_energy_scale_factor(const Light *light,
float meters_per_unit,
float radius_scale = 1.0f);
void world_material_to_dome_light(const USDExportParams &params,
const Scene *scene,
pxr::UsdStageRefPtr stage);
void dome_light_to_world_material(const USDImportParams &params,
const ImportSettings &settings,
Scene *scene,
Main *bmain,
const pxr::UsdLuxDomeLight &dome_light,
const double time = 0.0);
} // namespace blender::io::usd

View File

@@ -27,7 +27,11 @@ void USDCameraReader::create_object(Main *bmain, const double /* motionSampleTim
void USDCameraReader::read_object_data(Main *bmain, const double motionSampleTime)
{
Camera *bcam = (Camera *)object_->data;
if (!object_->data) {
return;
}
Camera *bcam = static_cast<Camera *>(object_->data);
pxr::UsdGeomCamera cam_prim(prim_);
@@ -35,46 +39,37 @@ void USDCameraReader::read_object_data(Main *bmain, const double motionSampleTim
return;
}
pxr::VtValue val;
cam_prim.GetFocalLengthAttr().Get(&val, motionSampleTime);
pxr::VtValue verApOffset;
cam_prim.GetVerticalApertureOffsetAttr().Get(&verApOffset, motionSampleTime);
pxr::VtValue horApOffset;
cam_prim.GetHorizontalApertureOffsetAttr().Get(&horApOffset, motionSampleTime);
pxr::VtValue clippingRangeVal;
cam_prim.GetClippingRangeAttr().Get(&clippingRangeVal, motionSampleTime);
pxr::VtValue focalDistanceVal;
cam_prim.GetFocusDistanceAttr().Get(&focalDistanceVal, motionSampleTime);
pxr::VtValue fstopVal;
cam_prim.GetFStopAttr().Get(&fstopVal, motionSampleTime);
pxr::VtValue projectionVal;
cam_prim.GetProjectionAttr().Get(&projectionVal, motionSampleTime);
pxr::VtValue verAp;
cam_prim.GetVerticalApertureAttr().Get(&verAp, motionSampleTime);
pxr::VtValue horAp;
cam_prim.GetHorizontalApertureAttr().Get(&horAp, motionSampleTime);
pxr::GfCamera usd_cam = cam_prim.GetCamera(motionSampleTime);
bcam->lens = val.Get<float>();
/* TODO(@makowalski): support sensor size. */
#if 0
bcam->sensor_x = 0.0f;
bcam->sensor_y = 0.0f;
#endif
bcam->shiftx = verApOffset.Get<float>();
bcam->shifty = horApOffset.Get<float>();
const float apperture_x = usd_cam.GetHorizontalAperture();
const float apperture_y = usd_cam.GetVerticalAperture();
const float h_film_offset = usd_cam.GetHorizontalApertureOffset();
const float v_film_offset = usd_cam.GetVerticalApertureOffset();
const float film_aspect = apperture_x / apperture_y;
bcam->type = (projectionVal.Get<pxr::TfToken>().GetString() == "perspective") ? CAM_PERSP :
CAM_ORTHO;
bcam->type = usd_cam.GetProjection() == pxr::GfCamera::Perspective ? CAM_PERSP : CAM_ORTHO;
/* Calling UncheckedGet() to silence compiler warnings. */
bcam->clip_start = max_ff(0.1f, clippingRangeVal.UncheckedGet<pxr::GfVec2f>()[0]);
bcam->clip_end = clippingRangeVal.UncheckedGet<pxr::GfVec2f>()[1];
bcam->lens = usd_cam.GetFocalLength();
bcam->dof.focus_distance = focalDistanceVal.Get<float>();
bcam->dof.aperture_fstop = float(fstopVal.Get<float>());
bcam->sensor_x = apperture_x;
bcam->sensor_y = apperture_y;
bcam->shiftx = h_film_offset / apperture_x;
bcam->shifty = v_film_offset / apperture_y / film_aspect;
pxr::GfRange1f usd_clip_range = usd_cam.GetClippingRange();
bcam->clip_start = usd_clip_range.GetMin() * settings_->scale;
bcam->clip_end = usd_clip_range.GetMax() * settings_->scale;
bcam->dof.focus_distance = usd_cam.GetFocusDistance() * settings_->scale;
bcam->dof.aperture_fstop = usd_cam.GetFStop();
if (bcam->dof.focus_distance > 0.0f || bcam->dof.aperture_fstop > 0.0f) {
bcam->dof.flag |= CAM_DOF_ENABLED;
}
if (bcam->type == CAM_ORTHO) {
bcam->ortho_scale = max_ff(verAp.Get<float>(), horAp.Get<float>());
bcam->ortho_scale = max_ff(apperture_x, apperture_y);
}
USDXformReader::read_object_data(bmain, motionSampleTime);

Some files were not shown because too many files have changed in this diff Show More