2022-02-11 09:07:11 +11:00
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2016 Blender Foundation. All rights reserved.
2016-08-09 15:19:11 +02:00
# Libraries configuration for Windows.
add_definitions ( -DWIN32 )
2017-10-29 13:16:22 -06:00
if ( NOT MSVC )
2017-05-27 15:34:55 -04:00
message ( FATAL_ERROR "Compiler is unsupported" )
2016-08-09 15:19:11 +02:00
endif ( )
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 14:34:47 -06:00
if ( CMAKE_C_COMPILER_ID MATCHES "Clang" )
2021-11-04 14:50:24 +11:00
set ( MSVC_CLANG ON )
2018-06-05 07:25:37 -06:00
set ( VC_TOOLS_DIR $ENV{ VCToolsRedistDir } CACHE STRING "Location of the msvc redistributables" )
set ( MSVC_REDIST_DIR ${ VC_TOOLS_DIR } )
2019-06-19 07:24:55 +10:00
if ( DEFINED MSVC_REDIST_DIR )
2018-05-28 20:07:24 -06:00
file ( TO_CMAKE_PATH ${ MSVC_REDIST_DIR } MSVC_REDIST_DIR )
else ( )
message ( "Unable to detect the Visual Studio redist directory, copying of the runtime dlls will not work, try running from the visual studio developer prompt." )
endif ( )
2019-10-07 10:24:13 -06:00
# 1) CMake has issues detecting openmp support in clang-cl so we have to provide
# the right switches here.
# 2) While the /openmp switch *should* work, it currently doesn't as for clang 9.0.0
if ( WITH_OPENMP )
set ( OPENMP_CUSTOM ON )
set ( OPENMP_FOUND ON )
set ( OpenMP_C_FLAGS "/clang:-fopenmp" )
set ( OpenMP_CXX_FLAGS "/clang:-fopenmp" )
2022-09-23 14:33:44 +10:00
get_filename_component ( LLVMROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\LLVM\\LLVM;]" ABSOLUTE CACHE )
2019-10-07 10:24:13 -06:00
set ( CLANG_OPENMP_DLL "${LLVMROOT}/bin/libomp.dll" )
set ( CLANG_OPENMP_LIB "${LLVMROOT}/lib/libomp.lib" )
if ( NOT EXISTS "${CLANG_OPENMP_DLL}" )
message ( FATAL_ERROR "Clang OpenMP library (${CLANG_OPENMP_DLL}) not found." )
endif ( )
2021-02-25 15:02:38 +01:00
set ( OpenMP_LINKER_FLAGS "\" ${ CLANG_OPENMP_LIB } \"")
2019-10-07 10:24:13 -06:00
endif ( )
2020-05-01 07:37:48 -06:00
if ( WITH_WINDOWS_STRIPPED_PDB )
message ( WARNING "stripped pdb not supported with clang, disabling.." )
2021-11-04 14:50:24 +11:00
set ( WITH_WINDOWS_STRIPPED_PDB OFF )
2020-05-01 07:37:48 -06:00
endif ( )
2022-01-26 17:56:38 -07:00
else ( )
2022-03-23 16:07:43 +01:00
if ( WITH_BLENDER AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28.29921 ) # MSVC 2019 16.9.16
2022-01-26 17:56:38 -07:00
message ( FATAL_ERROR "Compiler is unsupported, MSVC 2019 16.9.16 or newer is required for building blender." )
endif ( )
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 14:34:47 -06:00
endif ( )
2017-10-29 13:16:22 -06:00
2022-03-23 16:07:43 +01:00
if ( WITH_BLENDER AND NOT WITH_PYTHON_MODULE )
2018-02-03 16:38:27 -07:00
set_property ( DIRECTORY PROPERTY VS_STARTUP_PROJECT blender )
endif ( )
2017-10-29 13:16:22 -06:00
macro ( warn_hardcoded_paths package_name
)
if ( WITH_WINDOWS_FIND_MODULES )
message ( WARNING "Using HARDCODED ${package_name} locations" )
2017-10-30 12:58:44 +11:00
endif ( )
2017-10-29 13:16:22 -06:00
endmacro ( )
macro ( windows_find_package package_name
)
if ( WITH_WINDOWS_FIND_MODULES )
find_package ( ${ package_name } )
2017-10-30 12:58:44 +11:00
endif ( )
2017-10-29 13:16:22 -06:00
endmacro ( )
macro ( find_package_wrapper )
if ( WITH_WINDOWS_FIND_MODULES )
find_package ( ${ ARGV } )
endif ( )
endmacro ( )
add_definitions ( -DWIN32 )
2017-12-10 15:12:31 +11:00
# Needed, otherwise system encoding causes utf-8 encoding to fail in some cases (C4819)
add_compile_options ( "$<$<C_COMPILER_ID:MSVC>:/utf-8>" )
add_compile_options ( "$<$<CXX_COMPILER_ID:MSVC>:/utf-8>" )
2017-10-29 13:16:22 -06:00
# needed for some MSVC installations
2020-05-04 08:29:48 -06:00
# 4099 : PDB 'filename' was not found with 'object/library'
2020-11-06 10:29:04 +11:00
string ( APPEND CMAKE_EXE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099" )
string ( APPEND CMAKE_SHARED_LINKER_FLAGS " /SAFESEH:NO /ignore:4099" )
string ( APPEND CMAKE_MODULE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099" )
2017-10-29 13:16:22 -06:00
list ( APPEND PLATFORM_LINKLIBS
2020-05-01 07:37:48 -06:00
w s 2 _ 3 2 v f w 3 2 w i n m m k e r n e l 3 2 u s e r 3 2 g d i 3 2 c o m d l g 3 2 C o m c t l 3 2 v e r s i o n
USD: Introducing a simple USD Exporter
This commit introduces the first version of an exporter to Pixar's
Universal Scene Description (USD) format.
Reviewed By: sergey, LazyDodo
Differential Revision: https://developer.blender.org/D6287
- The USD libraries are built by `make deps`, but not yet built by
install_deps.sh.
- Only experimental support for instancing; by default all duplicated
objects are made real in the USD file. This is fine for exporting a
linked-in posed character, not so much for thousands of pebbles etc.
- The way materials and UV coordinates and Normals are exported is going
to change soon.
- This patch contains LazyDodo's fixes for building on Windows in D5359.
== Meshes ==
USD seems to support neither per-material nor per-face-group
double-sidedness, so we just use the flag from the first non-empty
material slot. If there is no material we default to double-sidedness.
Each UV map is stored on the mesh in a separate primvar. Materials can
refer to these UV maps, but this is not yet exported by Blender. The
primvar name is the same as the UV Map name. This is to allow the
standard name "st" for texture coordinates by naming the UV Map as such,
without having to guess which UV Map is the "standard" one.
Face-varying mesh normals are written to USD. When the mesh has custom
loop normals those are written. Otherwise the poly flag `ME_SMOOTH` is
inspected to determine the normals.
The UV maps and mesh normals take up a significant amount of space, so
exporting them is optional. They're still enabled by default, though.
For comparison: a shot of Spring (03_035_A) is 1.2 GiB when exported
with UVs and normals, and 262 MiB without. We probably have room for
optimisation of written UVs and normals.
The mesh subdivision scheme isn't using the default value 'Catmull
Clark', but uses 'None', indicating we're exporting a polygonal mesh.
This is necessary for USD to understand our normals; otherwise the mesh
is always rendered smooth. In the future we may want to expose this
choice of subdivision scheme to the user, or auto-detect it when we
actually support exporting pre-subdivision meshes.
A possible optimisation could be to inspect whether all polygons are
smooth or flat, and mark the USD mesh as such. This can be added when
needed.
== Animation ==
Mesh and transform animation are now written when passing
`animation=True` to the export operator. There is no inspection of
whether an object is actually animated or not; USD can handle
deduplication of static values for us.
The administration of which timecode to use for the export is left to
the file-format-specific concrete subclasses of
`AbstractHierarchyIterator`; the abstract iterator itself doesn't know
anything about the passage of time. This will allow subclasses for the
frame-based USD format and time-based Alembic format.
== Support for simple preview materials ==
Very simple versions of the materials are now exported, using only the
viewport diffuse RGB, metallic, and roughness.
When there are multiple materials, the mesh faces are stored as geometry
subset and each material is assigned to the appropriate subset. If there
is only one material this is skipped.
The first material if any) is always applied to the mesh itself
(regardless of the existence of geometry subsets), because the Hydra
viewport doesn't support materials on subsets. See
https://github.com/PixarAnimationStudios/USD/issues/542 for more info.
Note that the geometry subsets are not yet time-sampled, so it may break
when an animated mesh changes topology.
Materials are exported as a flat list under a top-level '/_materials'
namespace. This inhibits instancing of the objects using those
materials, so this is subject to change.
== Hair ==
Only the parent strands are exported, and only with a constant colour.
No UV coordinates, no information about the normals.
== Camera ==
Only perspective cameras are supported for now.
== Particles ==
Particles are only written when they are alive, which means that they
are always visible (there is currently no code that deals with marking
them as invisible outside their lifespan).
Particle-system-instanced objects are exported by suffixing the object
name with the particle's persistent ID, giving each particle XForm a
unique name.
== Instancing/referencing ==
This exporter has experimental support for instancing/referencing.
Dupli-object meshes are now written to USD as references to the original
mesh. This is still very limited in correctness, as there are issues
referencing to materials from a referenced mesh.
I am still committing this, as it gives us a place to start when
continuing the quest for proper instancing in USD.
== Lights ==
USD does not directly support spot lights, so those aren't exported yet.
It's possible to add this in the future via the UsdLuxShapingAPI. The
units used for the light intensity are also still a bit of a mystery.
== Fluid vertex velocities ==
Currently only fluid simulations (not meshes in general) have explicit
vertex velocities. This is the most important case for exporting
velocities, though, as the baked mesh changes topology all the time, and
thus computing the velocities at import time in a post-processing step
is hard.
== The Building Process ==
- USD is built as monolithic library, instead of 25 smaller libraries.
We were linking all of them as 'whole archive' anyway, so this doesn't
affect the final file size. It does, however, make life easier with
respect to linking order, and handling upstream changes.
- The JSON files required by USD are installed into datafiles/usd; they
are required on every platform. Set the `PXR_PATH_DEBUG` to any value
to have the USD library print the paths it uses to find those files.
- USD is patched so that it finds the aforementioned JSON files in a path
that we pass to it from Blender.
- USD is patched to have a `PXR_BUILD_USD_TOOLS` CMake option to disable
building the tools in its `bin` directory. This is sent as a pull
request at https://github.com/PixarAnimationStudios/USD/pull/1048
2019-12-13 10:27:40 +01:00
a d v a p i 3 2 s h f o l d e r s h e l l 3 2 o l e 3 2 o l e a u t 3 2 u u i d p s a p i D b g h e l p S h l w a p i
2022-05-04 20:18:15 -07:00
p a t h c c h S h c o r e D w m a p i
2017-10-29 13:16:22 -06:00
)
if ( WITH_INPUT_IME )
list ( APPEND PLATFORM_LINKLIBS imm32 )
endif ( )
add_definitions (
- D _ C R T _ N O N S T D C _ N O _ D E P R E C A T E
- D _ C R T _ S E C U R E _ N O _ D E P R E C A T E
- D _ S C L _ S E C U R E _ N O _ D E P R E C A T E
- D _ C O N S O L E
- D _ L I B
)
# MSVC11 needs _ALLOW_KEYWORD_MACROS to build
add_definitions ( -D_ALLOW_KEYWORD_MACROS )
2020-08-26 22:20:34 -06:00
# RTTI is on by default even without this switch
# however having it in the CXX Flags makes it difficult
# to remove for individual files that want to disable it
# using the /GR- flag without generating a build warning
# that both /GR and /GR- are specified.
remove_cc_flag ( "/GR" )
2021-05-31 08:56:57 -06:00
# Make the Windows 8.1 API available for use.
add_definitions ( -D_WIN32_WINNT=0x603 )
2019-12-06 10:12:03 -07:00
include ( build_files/cmake/platform/platform_win32_bundle_crt.cmake )
2020-04-20 12:51:43 -06:00
remove_cc_flag ( "/MDd" "/MD" "/Zi" )
2018-05-25 21:46:42 -06:00
2018-06-10 08:12:13 +02:00
if ( MSVC_CLANG ) # Clangs version of cl doesn't support all flags
2020-11-06 10:29:04 +11:00
string ( APPEND CMAKE_CXX_FLAGS " ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference " )
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 14:34:47 -06:00
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference" )
else ( )
2021-08-25 10:55:45 -06:00
string ( APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj /Zc:inline" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj /Zc:inline" )
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 14:34:47 -06:00
endif ( )
2017-10-29 13:16:22 -06:00
2021-03-29 19:11:17 -06:00
# X64 ASAN is available and usable on MSVC 16.9 preview 4 and up)
if ( WITH_COMPILER_ASAN AND MSVC AND NOT MSVC_CLANG )
if ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28.29828 )
#set a flag so we don't have to do this comparison all the time
2022-08-09 13:36:45 +10:00
set ( MSVC_ASAN ON )
2021-03-29 19:11:17 -06:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=address" )
string ( APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " /INCREMENTAL:NO" )
string ( APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG " /INCREMENTAL:NO" )
else ( )
message ( "-- ASAN not supported on MSVC ${CMAKE_CXX_COMPILER_VERSION}" )
endif ( )
endif ( )
2020-02-13 17:13:07 -07:00
# C++ standards conformace (/permissive-) is available on msvc 15.5 (1912) and up
2022-09-26 12:26:48 +10:00
if ( NOT MSVC_CLANG )
2020-11-06 10:29:04 +11:00
string ( APPEND CMAKE_CXX_FLAGS " /permissive-" )
2020-02-13 17:13:07 -07:00
# Two-phase name lookup does not place nicely with OpenMP yet, so disable for now
2020-11-06 10:29:04 +11:00
string ( APPEND CMAKE_CXX_FLAGS " /Zc:twoPhase-" )
2020-02-13 17:13:07 -07:00
endif ( )
2020-04-20 12:51:43 -06:00
if ( WITH_WINDOWS_SCCACHE AND CMAKE_VS_MSBUILD_COMMAND )
message ( WARNING "Disabling sccache, sccache is not supported with msbuild" )
2021-11-04 14:50:24 +11:00
set ( WITH_WINDOWS_SCCACHE OFF )
2020-04-20 12:51:43 -06:00
endif ( )
2020-02-13 17:13:07 -07:00
2021-03-29 19:11:17 -06:00
# Debug Symbol format
# sccache # MSVC_ASAN # format # why
2022-11-03 12:10:16 +11:00
# ON # ON # Z7 # sccache will only play nice with Z7.
# ON # OFF # Z7 # sccache will only play nice with Z7.
# OFF # ON # Zi # Asan will not play nice with Edit and Continue.
# OFF # OFF # ZI # Neither ASAN nor sscache is enabled Edit and
# Continue is available.
2021-03-29 19:11:17 -06:00
# Release Symbol format
# sccache # MSVC_ASAN # format # why
2021-11-04 14:50:24 +11:00
# ON # ON # Z7 # sccache will only play nice with Z7
# ON # OFF # Z7 # sccache will only play nice with Z7
# OFF # ON # Zi # Asan will not play nice with Edit and Continue
# OFF # OFF # Zi # Edit and Continue disables some optimizations
2021-03-29 19:11:17 -06:00
2020-04-20 12:51:43 -06:00
if ( WITH_WINDOWS_SCCACHE )
2022-08-09 13:36:45 +10:00
set ( CMAKE_C_COMPILER_LAUNCHER sccache )
set ( CMAKE_CXX_COMPILER_LAUNCHER sccache )
set ( SYMBOL_FORMAT /Z7 )
set ( SYMBOL_FORMAT_RELEASE /Z7 )
else ( )
unset ( CMAKE_C_COMPILER_LAUNCHER )
unset ( CMAKE_CXX_COMPILER_LAUNCHER )
if ( MSVC_ASAN )
2020-04-20 12:51:43 -06:00
set ( SYMBOL_FORMAT /Z7 )
2021-03-29 19:11:17 -06:00
set ( SYMBOL_FORMAT_RELEASE /Z7 )
2022-08-09 13:36:45 +10:00
else ( )
set ( SYMBOL_FORMAT /ZI )
set ( SYMBOL_FORMAT_RELEASE /Zi )
endif ( )
2021-03-29 19:11:17 -06:00
endif ( )
if ( WITH_WINDOWS_PDB )
2021-08-05 12:02:49 +10:00
set ( PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}" )
set ( PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO" )
2020-04-20 12:51:43 -06:00
endif ( )
2020-11-06 10:29:04 +11:00
string ( APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}" )
string ( APPEND CMAKE_C_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}" )
string ( APPEND CMAKE_CXX_FLAGS_RELEASE " /MD ${PDB_INFO_OVERRIDE_FLAGS}" )
string ( APPEND CMAKE_C_FLAGS_RELEASE " /MD ${PDB_INFO_OVERRIDE_FLAGS}" )
string ( APPEND CMAKE_CXX_FLAGS_MINSIZEREL " /MD ${PDB_INFO_OVERRIDE_FLAGS}" )
string ( APPEND CMAKE_C_FLAGS_MINSIZEREL " /MD ${PDB_INFO_OVERRIDE_FLAGS}" )
2021-03-29 19:11:17 -06:00
string ( APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /MD ${SYMBOL_FORMAT_RELEASE}" )
string ( APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " /MD ${SYMBOL_FORMAT_RELEASE}" )
2020-04-20 12:51:43 -06:00
unset ( SYMBOL_FORMAT )
2021-03-29 19:11:17 -06:00
unset ( SYMBOL_FORMAT_RELEASE )
2019-10-29 01:32:33 +11:00
# JMC is available on msvc 15.8 (1915) and up
2022-09-26 12:26:48 +10:00
if ( NOT MSVC_CLANG )
2020-11-06 10:29:04 +11:00
string ( APPEND CMAKE_CXX_FLAGS_DEBUG " /JMC" )
2019-07-30 14:40:05 -06:00
endif ( )
2020-11-06 10:29:04 +11:00
string ( APPEND PLATFORM_LINKFLAGS " /SUBSYSTEM:CONSOLE /STACK:2097152" )
2019-11-08 09:01:00 -07:00
set ( PLATFORM_LINKFLAGS_RELEASE "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib" )
2020-11-06 10:29:04 +11:00
string ( APPEND PLATFORM_LINKFLAGS_DEBUG " /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib" )
2017-10-29 13:16:22 -06:00
# Ignore meaningless for us linker warnings.
2020-11-06 10:29:04 +11:00
string ( APPEND PLATFORM_LINKFLAGS " /ignore:4049 /ignore:4217 /ignore:4221" )
2020-05-01 07:37:48 -06:00
set ( PLATFORM_LINKFLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${PDB_INFO_OVERRIDE_LINKER_FLAGS}" )
2020-11-06 10:29:04 +11:00
string ( APPEND CMAKE_STATIC_LINKER_FLAGS " /ignore:4221" )
2017-10-29 13:16:22 -06:00
if ( CMAKE_CL_64 )
2020-11-06 10:29:04 +11:00
string ( PREPEND PLATFORM_LINKFLAGS "/MACHINE:X64 " )
2017-10-29 13:16:22 -06:00
else ( )
2020-11-06 10:29:04 +11:00
string ( PREPEND PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE " )
2017-10-29 13:16:22 -06:00
endif ( )
if ( NOT DEFINED LIBDIR )
# Setup 64bit and 64bit windows systems
if ( CMAKE_CL_64 )
message ( STATUS "64 bit compiler detected." )
set ( LIBDIR_BASE "win64" )
else ( )
2019-08-05 10:31:51 -06:00
message ( FATAL_ERROR "32 bit compiler detected, blender no longer provides pre-build libraries for 32 bit windows, please set the LIBDIR cmake variable to your own library folder" )
2017-10-29 13:16:22 -06:00
endif ( )
2021-09-09 17:19:58 -06:00
if ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.30.30423 )
2021-06-21 18:11:30 -06:00
message ( STATUS "Visual Studio 2022 detected." )
set ( LIBDIR ${ CMAKE_SOURCE_DIR } /../lib/ ${ LIBDIR_BASE } _vc15 )
elseif ( MSVC_VERSION GREATER 1919 )
2019-02-22 20:49:22 -07:00
message ( STATUS "Visual Studio 2019 detected." )
2019-11-08 09:01:00 -07:00
set ( LIBDIR ${ CMAKE_SOURCE_DIR } /../lib/ ${ LIBDIR_BASE } _vc15 )
2017-10-29 13:16:22 -06:00
endif ( )
else ( )
message ( STATUS "Using pre-compiled LIBDIR: ${LIBDIR}" )
endif ( )
if ( NOT EXISTS "${LIBDIR}/" )
2019-11-08 09:01:00 -07:00
message ( FATAL_ERROR "\n\nWindows requires pre-compiled libs at: '${LIBDIR}'. Please run `make update` in the blender source folder to obtain them." )
2017-10-29 13:16:22 -06:00
endif ( )
2022-04-19 18:09:05 +02:00
include ( platform_old_libs_update )
2022-09-26 12:26:48 +10:00
# Only supported in the VS IDE & Clang Tidy needs to be on.
if ( CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND WITH_CLANG_TIDY )
2020-12-03 11:00:58 -07:00
set ( CMAKE_VS_GLOBALS
" R u n C o d e A n a l y s i s = f a l s e "
" E n a b l e M i c r o s o f t C o d e A n a l y s i s = f a l s e "
" E n a b l e C l a n g T i d y C o d e A n a l y s i s = t r u e "
)
2021-11-04 14:50:24 +11:00
set ( VS_CLANG_TIDY ON )
2020-12-03 11:00:58 -07:00
endif ( )
2019-05-25 12:13:06 -06:00
# Mark libdir as system headers with a lower warn level, to resolve some warnings
2019-05-26 09:25:17 -06:00
# that we have very little control over
2022-09-26 12:26:48 +10:00
if ( NOT MSVC_CLANG AND # Available with MSVC 15.7+ but not for CLANG.
2020-12-03 11:00:58 -07:00
N O T W I T H _ W I N D O W S _ S C C A C H E A N D # And not when sccache is enabled
N O T V S _ C L A N G _ T I D Y ) # Clang-tidy does not like these options
2019-05-26 09:25:17 -06:00
add_compile_options ( /experimental:external /external:templates- /external:I "${LIBDIR}" /external:W0 )
2019-05-25 12:13:06 -06:00
endif ( )
2017-10-29 13:16:22 -06:00
# Add each of our libraries to our cmake_prefix_path so find_package() could work
file ( GLOB children RELATIVE ${ LIBDIR } ${ LIBDIR } /* )
foreach ( child ${ children } )
if ( IS_DIRECTORY ${ LIBDIR } / ${ child } )
list ( APPEND CMAKE_PREFIX_PATH ${ LIBDIR } / ${ child } )
endif ( )
endforeach ( )
2020-11-29 14:01:33 -07:00
if ( WITH_PUGIXML )
set ( PUGIXML_LIBRARIES optimized ${ LIBDIR } /pugixml/lib/pugixml.lib debug ${ LIBDIR } /pugixml/lib/pugixml_d.lib )
set ( PUGIXML_INCLUDE_DIR ${ LIBDIR } /pugixml/include )
endif ( )
2017-10-29 13:16:22 -06:00
set ( ZLIB_INCLUDE_DIRS ${ LIBDIR } /zlib/include )
set ( ZLIB_LIBRARIES ${ LIBDIR } /zlib/lib/libz_st.lib )
set ( ZLIB_INCLUDE_DIR ${ LIBDIR } /zlib/include )
set ( ZLIB_LIBRARY ${ LIBDIR } /zlib/lib/libz_st.lib )
set ( ZLIB_DIR ${ LIBDIR } /zlib )
2022-03-23 16:07:43 +01:00
windows_find_package ( ZLIB ) # we want to find before finding things that depend on it like png
windows_find_package ( PNG )
2017-10-29 13:16:22 -06:00
if ( NOT PNG_FOUND )
warn_hardcoded_paths ( libpng )
set ( PNG_PNG_INCLUDE_DIR ${ LIBDIR } /png/include )
CMake: Refactor external dependencies handling
This is a more correct fix to the issue Brecht was fixing in D6600.
While the fix in that patch worked fine for linking it broke ASAN
runtime under some circumstances.
For example, `make full debug developer` would compile, but trying
to start blender will cause assert failure in ASAN (related on check
that ASAN is not running already).
Top-level idea: leave it to CMake to keep track of dependency graph.
The root of the issue comes to the fact that target like "blender" is
configured to use a lot of static libraries coming from Blender sources
and to use external static libraries. There is nothing which ensures
order between blender's and external libraries. Only order of blender
libraries is guaranteed.
It was possible that due to a cycle or other circumstances some of
blender libraries would have been passed to linker after libraries
it uses, causing linker errors.
For example, this order will likely fail:
libbf_blenfont.a libfreetype6.a libbf_blenfont.a
This change makes it so blender libraries are explicitly provided
their dependencies to an external libraries, which allows CMake to
ensure they are always linked against them.
General rule here: if bf_foo depends on an external library it is
to be provided to LIBS for bf_foo.
For example, if bf_blenkernel depends on opensubdiv then LIBS in
blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES.
The change is made based on searching for used include folders
such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries
to LIBS ion that CMakeLists.txt. Transitive dependencies are not
simplified by this approach, but I am not aware of any downside of
this: CMake should be smart enough to simplify them on its side.
And even if not, this shouldn't affect linking time.
Benefit of not relying on transitive dependencies is that build
system is more robust towards future changes. For example, if
bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES
and all such code is moved to bf_blenkernel this will not break
linking.
The not-so-trivial part is change to blender_add_lib (and its
version in Cycles). The complexity is caused by libraries being
provided as a single list argument which doesn't allow to use
different release and debug libraries on Windows. The idea is:
- Have every library prefixed as "optimized" or "debug" if
separation is needed (non-prefixed libraries will be considered
"generic").
- Loop through libraries passed to function and do simple parsing
which will look for "optimized" and "debug" words and specify
following library to corresponding category.
This isn't something particularly great. Alternative would be to
use target_link_libraries() directly, which sounds like more code
but which is more explicit and allows to have more flexibility
and control comparing to wrapper approach.
Tested the following configurations on Linux, macOS and Windows:
- make full debug developer
- make full release developer
- make lite debug developer
- make lite release developer
NOTE: Linux libraries needs to be compiled with D6641 applied,
otherwise, depending on configuration, it's possible to run into
duplicated zlib symbols error.
Differential Revision: https://developer.blender.org/D6642
2020-01-20 18:36:19 +01:00
set ( PNG_LIBRARIES ${ LIBDIR } /png/lib/libpng.lib ${ ZLIB_LIBRARY } )
2017-10-29 13:16:22 -06:00
set ( PNG "${LIBDIR}/png" )
set ( PNG_INCLUDE_DIRS "${PNG}/include" )
set ( PNG_LIBPATH ${ PNG } /lib ) # not cmake defined
endif ( )
set ( JPEG_NAMES ${ JPEG_NAMES } libjpeg )
2022-03-23 16:07:43 +01:00
windows_find_package ( JPEG REQUIRED )
2017-10-29 13:16:22 -06:00
if ( NOT JPEG_FOUND )
2022-03-23 16:07:43 +01:00
warn_hardcoded_paths ( libjpeg )
2017-10-29 13:16:22 -06:00
set ( JPEG_INCLUDE_DIR ${ LIBDIR } /jpeg/include )
set ( JPEG_LIBRARIES ${ LIBDIR } /jpeg/lib/libjpeg.lib )
endif ( )
2022-08-15 14:58:04 +02:00
set ( EPOXY_ROOT_DIR ${ LIBDIR } /epoxy )
windows_find_package ( Epoxy REQUIRED )
if ( NOT EPOXY_FOUND )
set ( Epoxy_INCLUDE_DIRS ${ LIBDIR } /epoxy/include )
set ( Epoxy_LIBRARIES ${ LIBDIR } /epoxy/lib/epoxy.lib )
endif ( )
2017-10-29 13:16:22 -06:00
set ( PTHREADS_INCLUDE_DIRS ${ LIBDIR } /pthreads/include )
2018-12-11 15:12:56 -07:00
set ( PTHREADS_LIBRARIES ${ LIBDIR } /pthreads/lib/pthreadVC3.lib )
2017-10-29 13:16:22 -06:00
set ( FREETYPE ${ LIBDIR } /freetype )
set ( FREETYPE_INCLUDE_DIRS
$ { L I B D I R } / f r e e t y p e / i n c l u d e
$ { L I B D I R } / f r e e t y p e / i n c l u d e / f r e e t y p e 2
)
2022-01-21 11:40:53 -07:00
set ( FREETYPE_LIBRARIES
$ { L I B D I R } / f r e e t y p e / l i b / f r e e t y p e 2 S T . l i b
$ { L I B D I R } / b r o t l i / l i b / b r o t l i d e c - s t a t i c . l i b
$ { L I B D I R } / b r o t l i / l i b / b r o t l i c o m m o n - s t a t i c . l i b
)
2022-03-23 16:07:43 +01:00
windows_find_package ( Freetype REQUIRED )
2017-10-29 13:16:22 -06:00
if ( WITH_FFTW3 )
set ( FFTW3 ${ LIBDIR } /fftw3 )
set ( FFTW3_LIBRARIES ${ FFTW3 } /lib/libfftw.lib )
set ( FFTW3_INCLUDE_DIRS ${ FFTW3 } /include )
set ( FFTW3_LIBPATH ${ FFTW3 } /lib )
endif ( )
2022-04-19 18:09:05 +02:00
if ( WITH_IMAGE_WEBP )
2022-09-29 19:01:35 +02:00
set ( WEBP_INCLUDE_DIRS ${ LIBDIR } /webp/include )
set ( WEBP_ROOT_DIR ${ LIBDIR } /webp )
set ( WEBP_LIBRARIES ${ LIBDIR } /webp/lib/webp.lib ${ LIBDIR } /webp/lib/webpdemux.lib ${ LIBDIR } /webp/lib/webpmux.lib )
set ( WEBP_FOUND ON )
2022-03-24 18:24:06 -04:00
endif ( )
2017-10-29 13:16:22 -06:00
if ( WITH_OPENCOLLADA )
set ( OPENCOLLADA ${ LIBDIR } /opencollada )
2019-04-17 06:35:54 +02:00
2017-10-29 13:16:22 -06:00
set ( OPENCOLLADA_INCLUDE_DIRS
$ { O P E N C O L L A D A } / i n c l u d e / o p e n c o l l a d a / C O L L A D A S t r e a m W r i t e r
$ { O P E N C O L L A D A } / i n c l u d e / o p e n c o l l a d a / C O L L A D A B a s e U t i l s
$ { O P E N C O L L A D A } / i n c l u d e / o p e n c o l l a d a / C O L L A D A F r a m e w o r k
$ { O P E N C O L L A D A } / i n c l u d e / o p e n c o l l a d a / C O L L A D A S a x F r a m e w o r k L o a d e r
$ { O P E N C O L L A D A } / i n c l u d e / o p e n c o l l a d a / G e n e r a t e d S a x P a r s e r
)
2019-04-17 06:35:54 +02:00
2017-10-29 13:16:22 -06:00
set ( OPENCOLLADA_LIBRARIES
CMake: Refactor external dependencies handling
This is a more correct fix to the issue Brecht was fixing in D6600.
While the fix in that patch worked fine for linking it broke ASAN
runtime under some circumstances.
For example, `make full debug developer` would compile, but trying
to start blender will cause assert failure in ASAN (related on check
that ASAN is not running already).
Top-level idea: leave it to CMake to keep track of dependency graph.
The root of the issue comes to the fact that target like "blender" is
configured to use a lot of static libraries coming from Blender sources
and to use external static libraries. There is nothing which ensures
order between blender's and external libraries. Only order of blender
libraries is guaranteed.
It was possible that due to a cycle or other circumstances some of
blender libraries would have been passed to linker after libraries
it uses, causing linker errors.
For example, this order will likely fail:
libbf_blenfont.a libfreetype6.a libbf_blenfont.a
This change makes it so blender libraries are explicitly provided
their dependencies to an external libraries, which allows CMake to
ensure they are always linked against them.
General rule here: if bf_foo depends on an external library it is
to be provided to LIBS for bf_foo.
For example, if bf_blenkernel depends on opensubdiv then LIBS in
blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES.
The change is made based on searching for used include folders
such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries
to LIBS ion that CMakeLists.txt. Transitive dependencies are not
simplified by this approach, but I am not aware of any downside of
this: CMake should be smart enough to simplify them on its side.
And even if not, this shouldn't affect linking time.
Benefit of not relying on transitive dependencies is that build
system is more robust towards future changes. For example, if
bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES
and all such code is moved to bf_blenkernel this will not break
linking.
The not-so-trivial part is change to blender_add_lib (and its
version in Cycles). The complexity is caused by libraries being
provided as a single list argument which doesn't allow to use
different release and debug libraries on Windows. The idea is:
- Have every library prefixed as "optimized" or "debug" if
separation is needed (non-prefixed libraries will be considered
"generic").
- Loop through libraries passed to function and do simple parsing
which will look for "optimized" and "debug" words and specify
following library to corresponding category.
This isn't something particularly great. Alternative would be to
use target_link_libraries() directly, which sounds like more code
but which is more explicit and allows to have more flexibility
and control comparing to wrapper approach.
Tested the following configurations on Linux, macOS and Windows:
- make full debug developer
- make full release developer
- make lite debug developer
- make lite release developer
NOTE: Linux libraries needs to be compiled with D6641 applied,
otherwise, depending on configuration, it's possible to run into
duplicated zlib symbols error.
Differential Revision: https://developer.blender.org/D6642
2020-01-20 18:36:19 +01:00
o p t i m i z e d $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / O p e n C O L L A D A S a x F r a m e w o r k L o a d e r . l i b
o p t i m i z e d $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / O p e n C O L L A D A F r a m e w o r k . l i b
o p t i m i z e d $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / O p e n C O L L A D A B a s e U t i l s . l i b
o p t i m i z e d $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / O p e n C O L L A D A S t r e a m W r i t e r . l i b
o p t i m i z e d $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / M a t h M L S o l v e r . l i b
o p t i m i z e d $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / G e n e r a t e d S a x P a r s e r . l i b
o p t i m i z e d $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / b u f f e r . l i b
o p t i m i z e d $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / f t o a . l i b
d e b u g $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / O p e n C O L L A D A S a x F r a m e w o r k L o a d e r _ d . l i b
d e b u g $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / O p e n C O L L A D A F r a m e w o r k _ d . l i b
d e b u g $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / O p e n C O L L A D A B a s e U t i l s _ d . l i b
d e b u g $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / O p e n C O L L A D A S t r e a m W r i t e r _ d . l i b
d e b u g $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / M a t h M L S o l v e r _ d . l i b
d e b u g $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / G e n e r a t e d S a x P a r s e r _ d . l i b
d e b u g $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / b u f f e r _ d . l i b
d e b u g $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / f t o a _ d . l i b
2017-10-29 13:16:22 -06:00
)
2022-10-21 07:04:21 -06:00
if ( EXISTS ${ LIBDIR } /xml2/lib/libxml2s.lib ) # 3.4 libraries
list ( APPEND OPENCOLLADA_LIBRARIES ${ LIBDIR } /xml2/lib/libxml2s.lib )
else ( )
list ( APPEND OPENCOLLADA_LIBRARIES ${ OPENCOLLADA } /lib/opencollada/xml.lib )
endif ( )
2019-04-17 06:35:54 +02:00
2018-08-27 19:37:55 -06:00
list ( APPEND OPENCOLLADA_LIBRARIES ${ OPENCOLLADA } /lib/opencollada/UTF.lib )
2019-04-17 06:35:54 +02:00
2017-10-29 13:16:22 -06:00
set ( PCRE_LIBRARIES
CMake: Refactor external dependencies handling
This is a more correct fix to the issue Brecht was fixing in D6600.
While the fix in that patch worked fine for linking it broke ASAN
runtime under some circumstances.
For example, `make full debug developer` would compile, but trying
to start blender will cause assert failure in ASAN (related on check
that ASAN is not running already).
Top-level idea: leave it to CMake to keep track of dependency graph.
The root of the issue comes to the fact that target like "blender" is
configured to use a lot of static libraries coming from Blender sources
and to use external static libraries. There is nothing which ensures
order between blender's and external libraries. Only order of blender
libraries is guaranteed.
It was possible that due to a cycle or other circumstances some of
blender libraries would have been passed to linker after libraries
it uses, causing linker errors.
For example, this order will likely fail:
libbf_blenfont.a libfreetype6.a libbf_blenfont.a
This change makes it so blender libraries are explicitly provided
their dependencies to an external libraries, which allows CMake to
ensure they are always linked against them.
General rule here: if bf_foo depends on an external library it is
to be provided to LIBS for bf_foo.
For example, if bf_blenkernel depends on opensubdiv then LIBS in
blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES.
The change is made based on searching for used include folders
such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries
to LIBS ion that CMakeLists.txt. Transitive dependencies are not
simplified by this approach, but I am not aware of any downside of
this: CMake should be smart enough to simplify them on its side.
And even if not, this shouldn't affect linking time.
Benefit of not relying on transitive dependencies is that build
system is more robust towards future changes. For example, if
bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES
and all such code is moved to bf_blenkernel this will not break
linking.
The not-so-trivial part is change to blender_add_lib (and its
version in Cycles). The complexity is caused by libraries being
provided as a single list argument which doesn't allow to use
different release and debug libraries on Windows. The idea is:
- Have every library prefixed as "optimized" or "debug" if
separation is needed (non-prefixed libraries will be considered
"generic").
- Loop through libraries passed to function and do simple parsing
which will look for "optimized" and "debug" words and specify
following library to corresponding category.
This isn't something particularly great. Alternative would be to
use target_link_libraries() directly, which sounds like more code
but which is more explicit and allows to have more flexibility
and control comparing to wrapper approach.
Tested the following configurations on Linux, macOS and Windows:
- make full debug developer
- make full release developer
- make lite debug developer
- make lite release developer
NOTE: Linux libraries needs to be compiled with D6641 applied,
otherwise, depending on configuration, it's possible to run into
duplicated zlib symbols error.
Differential Revision: https://developer.blender.org/D6642
2020-01-20 18:36:19 +01:00
o p t i m i z e d $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / p c r e . l i b
d e b u g $ { O P E N C O L L A D A } / l i b / o p e n c o l l a d a / p c r e _ d . l i b
2017-10-29 13:16:22 -06:00
)
endif ( )
if ( WITH_CODEC_FFMPEG )
set ( FFMPEG_INCLUDE_DIRS
$ { L I B D I R } / f f m p e g / i n c l u d e
$ { L I B D I R } / f f m p e g / i n c l u d e / m s v c
)
2022-03-23 16:07:43 +01:00
windows_find_package ( FFmpeg )
2022-03-31 19:27:32 +02:00
if ( NOT FFmpeg_FOUND )
2022-03-23 16:07:43 +01:00
warn_hardcoded_paths ( FFmpeg )
2017-10-29 13:16:22 -06:00
set ( FFMPEG_LIBRARIES
$ { L I B D I R } / f f m p e g / l i b / a v c o d e c . l i b
$ { L I B D I R } / f f m p e g / l i b / a v f o r m a t . l i b
$ { L I B D I R } / f f m p e g / l i b / a v d e v i c e . l i b
$ { L I B D I R } / f f m p e g / l i b / a v u t i l . l i b
$ { L I B D I R } / f f m p e g / l i b / s w s c a l e . l i b
2022-08-09 13:36:45 +10:00
)
2017-10-29 13:16:22 -06:00
endif ( )
endif ( )
if ( WITH_IMAGE_OPENEXR )
2022-04-19 18:09:05 +02:00
# Imath and OpenEXR have a single combined build option and include and library variables
# used by the rest of the build system.
set ( IMATH_ROOT_DIR ${ LIBDIR } /imath )
set ( IMATH_VERSION "3.14" )
windows_find_package ( IMATH REQUIRED )
if ( NOT IMATH_FOUND )
set ( IMATH ${ LIBDIR } /imath )
set ( IMATH_INCLUDE_DIR ${ IMATH } /include )
set ( IMATH_INCLUDE_DIRS ${ IMATH_INCLUDE_DIR } ${ IMATH } /include/Imath )
set ( IMATH_LIBPATH ${ IMATH } /lib )
set ( IMATH_LIBRARIES
o p t i m i z e d $ { I M A T H _ L I B P A T H } / I m a t h _ s . l i b
d e b u g $ { I M A T H _ L I B P A T H } / I m a t h _ s _ d . l i b
)
endif ( )
set ( OPENEXR_ROOT_DIR ${ LIBDIR } /openexr )
set ( OPENEXR_VERSION "3.14" )
windows_find_package ( OPENEXR REQUIRED )
2022-03-31 19:27:32 +02:00
if ( NOT OpenEXR_FOUND )
2017-10-29 13:16:22 -06:00
warn_hardcoded_paths ( OpenEXR )
set ( OPENEXR ${ LIBDIR } /openexr )
set ( OPENEXR_INCLUDE_DIR ${ OPENEXR } /include )
2022-11-09 14:25:32 +01:00
set ( OPENEXR_INCLUDE_DIRS ${ OPENEXR_INCLUDE_DIR } ${ IMATH_INCLUDE_DIRS } ${ OPENEXR_INCLUDE_DIR } /OpenEXR )
2017-10-29 13:16:22 -06:00
set ( OPENEXR_LIBPATH ${ OPENEXR } /lib )
2022-04-19 18:09:05 +02:00
# Check if the 3.x library name exists
# if not assume this is a 2.x library folder
if ( EXISTS "${OPENEXR_LIBPATH}/OpenEXR_s.lib" )
set ( OPENEXR_LIBRARIES
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / I e x _ s . l i b
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / I l m T h r e a d _ s . l i b
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / O p e n E X R _ s . l i b
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / O p e n E X R C o r e _ s . l i b
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / O p e n E X R U t i l _ s . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / I e x _ s _ d . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / I l m T h r e a d _ s _ d . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / O p e n E X R _ s _ d . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / O p e n E X R C o r e _ s _ d . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / O p e n E X R U t i l _ s _ d . l i b
$ { I M A T H _ L I B R A R I E S }
)
else ( )
set ( OPENEXR_LIBRARIES
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / I e x _ s . l i b
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / H a l f _ s . l i b
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / I l m I m f _ s . l i b
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / I m a t h _ s . l i b
o p t i m i z e d $ { O P E N E X R _ L I B P A T H } / I l m T h r e a d _ s . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / I e x _ s _ d . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / H a l f _ s _ d . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / I l m I m f _ s _ d . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / I m a t h _ s _ d . l i b
d e b u g $ { O P E N E X R _ L I B P A T H } / I l m T h r e a d _ s _ d . l i b
)
endif ( )
2017-10-29 13:16:22 -06:00
endif ( )
endif ( )
if ( WITH_IMAGE_TIFF )
# Try to find tiff first then complain and set static and maybe wrong paths
windows_find_package ( TIFF )
if ( NOT TIFF_FOUND )
warn_hardcoded_paths ( libtiff )
set ( TIFF_LIBRARY ${ LIBDIR } /tiff/lib/libtiff.lib )
set ( TIFF_INCLUDE_DIR ${ LIBDIR } /tiff/include )
endif ( )
endif ( )
if ( WITH_JACK )
set ( JACK_INCLUDE_DIRS
$ { L I B D I R } / j a c k / i n c l u d e / j a c k
$ { L I B D I R } / j a c k / i n c l u d e
)
set ( JACK_LIBRARIES optimized ${ LIBDIR } /jack/lib/libjack.lib debug ${ LIBDIR } /jack/lib/libjack_d.lib )
endif ( )
if ( WITH_PYTHON )
2022-09-15 18:01:15 +02:00
# Cache version for make_bpy_wheel.py to detect.
unset ( PYTHON_VERSION CACHE )
set ( PYTHON_VERSION "3.10" CACHE STRING "Python version" )
2017-10-29 13:16:22 -06:00
string ( REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${ PYTHON_VERSION } )
2019-08-13 17:02:19 -06:00
set ( PYTHON_LIBRARY ${ LIBDIR } /python/ ${ _PYTHON_VERSION_NO_DOTS } /libs/python ${ _PYTHON_VERSION_NO_DOTS } .lib )
set ( PYTHON_LIBRARY_DEBUG ${ LIBDIR } /python/ ${ _PYTHON_VERSION_NO_DOTS } /libs/python ${ _PYTHON_VERSION_NO_DOTS } _d.lib )
2019-08-14 17:57:01 -06:00
2022-09-15 18:10:44 +02:00
set ( PYTHON_EXECUTABLE ${ LIBDIR } /python/ ${ _PYTHON_VERSION_NO_DOTS } /bin/python $< $<CONFIG:Debug > :_d>.exe )
2019-08-13 17:02:19 -06:00
set ( PYTHON_INCLUDE_DIR ${ LIBDIR } /python/ ${ _PYTHON_VERSION_NO_DOTS } /include )
set ( PYTHON_NUMPY_INCLUDE_DIRS ${ LIBDIR } /python/ ${ _PYTHON_VERSION_NO_DOTS } /lib/site-packages/numpy/core/include )
2021-11-04 14:50:24 +11:00
set ( NUMPY_FOUND ON )
2017-10-29 13:16:22 -06:00
unset ( _PYTHON_VERSION_NO_DOTS )
# uncached vars
set ( PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}" )
2019-04-17 13:26:02 -06:00
set ( PYTHON_LIBRARIES debug "${PYTHON_LIBRARY_DEBUG}" optimized "${PYTHON_LIBRARY}" )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_BOOST )
2021-12-07 18:31:36 +01:00
if ( WITH_CYCLES AND WITH_CYCLES_OSL )
2017-10-29 13:16:22 -06:00
set ( boost_extra_libs wave )
endif ( )
if ( WITH_INTERNATIONAL )
list ( APPEND boost_extra_libs locale )
endif ( )
set ( Boost_USE_STATIC_RUNTIME ON ) # prefix lib
set ( Boost_USE_MULTITHREADED ON ) # suffix -mt
set ( Boost_USE_STATIC_LIBS ON ) # suffix -s
2017-10-30 12:58:44 +11:00
if ( WITH_WINDOWS_FIND_MODULES )
2017-10-29 13:16:22 -06:00
find_package ( Boost COMPONENTS date_time filesystem thread regex system ${ boost_extra_libs } )
2017-10-30 12:58:44 +11:00
endif ( )
2017-10-29 13:16:22 -06:00
if ( NOT Boost_FOUND )
warn_hardcoded_paths ( BOOST )
set ( BOOST ${ LIBDIR } /boost )
set ( BOOST_INCLUDE_DIR ${ BOOST } /include )
2018-08-27 19:37:55 -06:00
set ( BOOST_LIBPATH ${ BOOST } /lib )
2021-02-22 11:03:44 -07:00
set ( BOOST_VERSION_HEADER ${ BOOST_INCLUDE_DIR } /boost/version.hpp )
if ( EXISTS ${ BOOST_VERSION_HEADER } )
file ( STRINGS "${BOOST_VERSION_HEADER}" BOOST_LIB_VERSION REGEX "#define BOOST_LIB_VERSION " )
if ( BOOST_LIB_VERSION MATCHES "#define BOOST_LIB_VERSION \" ( [0-9_]+ ) \"")
set ( BOOST_VERSION "${CMAKE_MATCH_1}" )
endif ( )
2017-10-29 13:16:22 -06:00
endif ( )
2021-02-22 11:03:44 -07:00
if ( NOT BOOST_VERSION )
message ( FATAL_ERROR "Unable to determine Boost version" )
endif ( )
2022-04-19 18:09:05 +02:00
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" )
endif ( )
2017-10-29 13:16:22 -06:00
set ( BOOST_LIBRARIES
o p t i m i z e d $ { B O O S T _ L I B P A T H } / l i b b o o s t _ d a t e _ t i m e - $ { B O O S T _ P O S T F I X }
o p t i m i z e d $ { B O O S T _ L I B P A T H } / l i b b o o s t _ f i l e s y s t e m - $ { B O O S T _ P O S T F I X }
o p t i m i z e d $ { B O O S T _ L I B P A T H } / l i b b o o s t _ r e g e x - $ { B O O S T _ P O S T F I X }
o p t i m i z e d $ { B O O S T _ L I B P A T H } / l i b b o o s t _ s y s t e m - $ { B O O S T _ P O S T F I X }
o p t i m i z e d $ { B O O S T _ L I B P A T H } / l i b b o o s t _ t h r e a d - $ { B O O S T _ P O S T F I X }
o p t i m i z e d $ { B O O S T _ L I B P A T H } / l i b b o o s t _ c h r o n o - $ { B O O S T _ P O S T F I X }
d e b u g $ { B O O S T _ L I B P A T H } / l i b b o o s t _ d a t e _ t i m e - $ { B O O S T _ D E B U G _ P O S T F I X }
d e b u g $ { B O O S T _ L I B P A T H } / l i b b o o s t _ f i l e s y s t e m - $ { B O O S T _ D E B U G _ P O S T F I X }
d e b u g $ { B O O S T _ L I B P A T H } / l i b b o o s t _ r e g e x - $ { B O O S T _ D E B U G _ P O S T F I X }
d e b u g $ { B O O S T _ L I B P A T H } / l i b b o o s t _ s y s t e m - $ { B O O S T _ D E B U G _ P O S T F I X }
d e b u g $ { B O O S T _ L I B P A T H } / l i b b o o s t _ t h r e a d - $ { B O O S T _ D E B U G _ P O S T F I X }
d e b u g $ { B O O S T _ L I B P A T H } / l i b b o o s t _ c h r o n o - $ { B O O S T _ D E B U G _ P O S T F I X }
)
2021-12-07 18:31:36 +01:00
if ( WITH_CYCLES AND WITH_CYCLES_OSL )
2017-10-29 13:16:22 -06:00
set ( BOOST_LIBRARIES ${ BOOST_LIBRARIES }
o p t i m i z e d $ { B O O S T _ L I B P A T H } / l i b b o o s t _ w a v e - $ { B O O S T _ P O S T F I X }
2022-08-09 13:36:45 +10:00
d e b u g $ { B O O S T _ L I B P A T H } / l i b b o o s t _ w a v e - $ { B O O S T _ D E B U G _ P O S T F I X }
)
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_INTERNATIONAL )
set ( BOOST_LIBRARIES ${ BOOST_LIBRARIES }
o p t i m i z e d $ { B O O S T _ L I B P A T H } / l i b b o o s t _ l o c a l e - $ { B O O S T _ P O S T F I X }
2022-08-09 13:36:45 +10:00
d e b u g $ { B O O S T _ L I B P A T H } / l i b b o o s t _ l o c a l e - $ { B O O S T _ D E B U G _ P O S T F I X }
)
2017-10-29 13:16:22 -06:00
endif ( )
else ( ) # we found boost using find_package
set ( BOOST_INCLUDE_DIR ${ Boost_INCLUDE_DIRS } )
set ( BOOST_LIBRARIES ${ Boost_LIBRARIES } )
set ( BOOST_LIBPATH ${ Boost_LIBRARY_DIRS } )
endif ( )
2022-03-31 19:27:32 +02:00
2017-10-29 13:16:22 -06:00
set ( BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB" )
endif ( )
if ( WITH_OPENIMAGEIO )
windows_find_package ( OpenImageIO )
2022-03-31 19:27:32 +02:00
if ( NOT OpenImageIO_FOUND )
set ( OPENIMAGEIO ${ LIBDIR } /OpenImageIO )
set ( OPENIMAGEIO_LIBPATH ${ OPENIMAGEIO } /lib )
2022-11-09 14:25:32 +01:00
set ( OPENIMAGEIO_INCLUDE_DIR ${ OPENIMAGEIO } /include )
set ( OPENIMAGEIO_INCLUDE_DIRS ${ OPENIMAGEIO_INCLUDE_DIR } )
2022-03-31 19:27:32 +02:00
set ( OIIO_OPTIMIZED optimized ${ OPENIMAGEIO_LIBPATH } /OpenImageIO.lib optimized ${ OPENIMAGEIO_LIBPATH } /OpenImageIO_Util.lib )
set ( OIIO_DEBUG debug ${ OPENIMAGEIO_LIBPATH } /OpenImageIO_d.lib debug ${ OPENIMAGEIO_LIBPATH } /OpenImageIO_Util_d.lib )
set ( OPENIMAGEIO_LIBRARIES ${ OIIO_OPTIMIZED } ${ OIIO_DEBUG } )
endif ( )
2017-10-29 13:16:22 -06:00
set ( OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0" )
set ( OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe" )
2020-05-31 13:15:40 -06:00
add_definitions ( -DOIIO_STATIC_DEFINE )
2017-10-29 13:16:22 -06:00
add_definitions ( -DOIIO_NO_SSE=1 )
endif ( )
if ( WITH_LLVM )
set ( LLVM_ROOT_DIR ${ LIBDIR } /llvm CACHE PATH "Path to the LLVM installation" )
2019-03-08 07:17:56 -07:00
set ( LLVM_INCLUDE_DIRS ${ LLVM_ROOT_DIR } / $< $<CONFIG:Debug > :Debug>/include CACHE PATH "Path to the LLVM include directory" )
2017-10-29 13:16:22 -06:00
file ( GLOB LLVM_LIBRARY_OPTIMIZED ${ LLVM_ROOT_DIR } /lib/*.lib )
if ( EXISTS ${ LLVM_ROOT_DIR } /debug/lib )
foreach ( LLVM_OPTIMIZED_LIB ${ LLVM_LIBRARY_OPTIMIZED } )
get_filename_component ( LIBNAME ${ LLVM_OPTIMIZED_LIB } ABSOLUTE )
list ( APPEND LLVM_LIBS optimized ${ LIBNAME } )
endforeach ( LLVM_OPTIMIZED_LIB )
file ( GLOB LLVM_LIBRARY_DEBUG ${ LLVM_ROOT_DIR } /debug/lib/*.lib )
foreach ( LLVM_DEBUG_LIB ${ LLVM_LIBRARY_DEBUG } )
get_filename_component ( LIBNAME ${ LLVM_DEBUG_LIB } ABSOLUTE )
list ( APPEND LLVM_LIBS debug ${ LIBNAME } )
endforeach ( LLVM_DEBUG_LIB )
set ( LLVM_LIBRARY ${ LLVM_LIBS } )
else ( )
message ( WARNING "LLVM debug libs not present on this system. Using release libs for debug builds." )
set ( LLVM_LIBRARY ${ LLVM_LIBRARY_OPTIMIZED } )
endif ( )
2022-04-19 18:09:05 +02:00
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_OPENCOLORIO )
2022-03-31 19:27:32 +02:00
windows_find_package ( OpenColorIO )
if ( NOT OpenColorIO_FOUND )
set ( OPENCOLORIO ${ LIBDIR } /OpenColorIO )
set ( OPENCOLORIO_INCLUDE_DIRS ${ OPENCOLORIO } /include )
set ( OPENCOLORIO_LIBPATH ${ OPENCOLORIO } /lib )
set ( OPENCOLORIO_LIBRARIES
o p t i m i z e d $ { O P E N C O L O R I O _ L I B P A T H } / O p e n C o l o r I O . l i b
o p t i m i z e d $ { O P E N C O L O R I O _ L I B P A T H } / l i b y a m l - c p p . l i b
o p t i m i z e d $ { O P E N C O L O R I O _ L I B P A T H } / l i b e x p a t M D . l i b
o p t i m i z e d $ { O P E N C O L O R I O _ L I B P A T H } / p y s t r i n g . l i b
d e b u g $ { O P E N C O L O R I O _ L I B P A T H } / O p e n c o l o r I O _ d . l i b
d e b u g $ { O P E N C O L O R I O _ L I B P A T H } / l i b y a m l - c p p _ d . l i b
d e b u g $ { O P E N C O L O R I O _ L I B P A T H } / l i b e x p a t d M D . l i b
d e b u g $ { O P E N C O L O R I O _ L I B P A T H } / p y s t r i n g _ d . l i b
)
endif ( )
2021-06-23 08:45:37 -06:00
set ( OPENCOLORIO_DEFINITIONS "-DOpenColorIO_SKIP_IMPORTS" )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_OPENVDB )
2022-03-31 19:27:32 +02:00
windows_find_package ( OpenVDB )
if ( NOT OpenVDB_FOUND )
set ( OPENVDB ${ LIBDIR } /openVDB )
set ( OPENVDB_LIBPATH ${ OPENVDB } /lib )
set ( OPENVDB_INCLUDE_DIRS ${ OPENVDB } /include )
2022-04-19 18:09:05 +02:00
set ( OPENVDB_LIBRARIES optimized ${ OPENVDB_LIBPATH } /openvdb.lib debug ${ OPENVDB_LIBPATH } /openvdb_d.lib )
2022-03-31 19:27:32 +02:00
endif ( )
2020-08-13 11:42:05 -06:00
set ( OPENVDB_DEFINITIONS -DNOMINMAX -D_USE_MATH_DEFINES )
2017-10-29 13:16:22 -06:00
endif ( )
2020-10-02 17:40:28 +02:00
if ( WITH_NANOVDB )
2022-04-19 18:09:05 +02:00
set ( NANOVDB ${ LIBDIR } /openvdb )
2020-10-02 17:40:28 +02:00
set ( NANOVDB_INCLUDE_DIR ${ NANOVDB } /include )
2022-04-19 18:09:05 +02:00
if ( NOT EXISTS "${NANOVDB_INCLUDE_DIR}/nanovdb" )
# When not found, could be an older lib folder with where nanovdb
# had its own lib folder, to ease the transition period, fall back
# to that copy if the copy in openvdb is not found.
set ( NANOVDB ${ LIBDIR } /nanoVDB )
set ( NANOVDB_INCLUDE_DIR ${ NANOVDB } /include )
endif ( )
2020-10-02 17:40:28 +02:00
endif ( )
2022-04-19 18:09:05 +02:00
Compositor: Added denoising node
This node is built on Intel's OpenImageDenoise library.
Other denoisers could be integrated, for example Lukas' Cycles denoiser.
Compositor: Made OpenImageDenoise optional, added CMake and build_env files to find OIDN
Compositor: Fixed some warnings in the denoising operator
build_environment: Updated OpenImageDenoise to 0.8.1
build_environment: Updated OpenImageDenoise in `make deps` for macOS
Reviewers: sergey, jbakker, brecht
Reviewed By: brecht
Subscribers: YAFU, LazyDodo, Zen_YS, slumber, samgreen, tjvoll, yeus, ponomarovmax, getrad, coder.kalyan, vitos1k, Yegor, DeepBlender, kumaran7, Darkfie9825, aliasguru, aafra, ace_dragon, juang3d, pandrodor, cdog, lordodin, jtheninja, mavek, marcog, 5k1n2, Atair, rawalanche, 0o00o0oo, filibis, poor, lukasstockner97
Tags: #compositing
Differential Revision: https://developer.blender.org/D4304
2019-08-14 15:30:26 +02:00
if ( WITH_OPENIMAGEDENOISE )
set ( OPENIMAGEDENOISE ${ LIBDIR } /OpenImageDenoise )
set ( OPENIMAGEDENOISE_LIBPATH ${ LIBDIR } /OpenImageDenoise/lib )
2019-10-09 16:44:29 +02:00
set ( OPENIMAGEDENOISE_INCLUDE_DIRS ${ OPENIMAGEDENOISE } /include )
2019-08-14 17:57:01 -06:00
set ( OPENIMAGEDENOISE_LIBRARIES
2019-11-08 09:01:00 -07:00
o p t i m i z e d $ { O P E N I M A G E D E N O I S E _ L I B P A T H } / O p e n I m a g e D e n o i s e . l i b
o p t i m i z e d $ { O P E N I M A G E D E N O I S E _ L I B P A T H } / c o m m o n . l i b
2020-06-25 12:44:39 +02:00
o p t i m i z e d $ { O P E N I M A G E D E N O I S E _ L I B P A T H } / d n n l . l i b
2019-11-08 09:01:00 -07:00
d e b u g $ { O P E N I M A G E D E N O I S E _ L I B P A T H } / O p e n I m a g e D e n o i s e _ d . l i b
d e b u g $ { O P E N I M A G E D E N O I S E _ L I B P A T H } / c o m m o n _ d . l i b
2022-08-09 13:36:45 +10:00
d e b u g $ { O P E N I M A G E D E N O I S E _ L I B P A T H } / d n n l _ d . l i b
)
Compositor: Added denoising node
This node is built on Intel's OpenImageDenoise library.
Other denoisers could be integrated, for example Lukas' Cycles denoiser.
Compositor: Made OpenImageDenoise optional, added CMake and build_env files to find OIDN
Compositor: Fixed some warnings in the denoising operator
build_environment: Updated OpenImageDenoise to 0.8.1
build_environment: Updated OpenImageDenoise in `make deps` for macOS
Reviewers: sergey, jbakker, brecht
Reviewed By: brecht
Subscribers: YAFU, LazyDodo, Zen_YS, slumber, samgreen, tjvoll, yeus, ponomarovmax, getrad, coder.kalyan, vitos1k, Yegor, DeepBlender, kumaran7, Darkfie9825, aliasguru, aafra, ace_dragon, juang3d, pandrodor, cdog, lordodin, jtheninja, mavek, marcog, 5k1n2, Atair, rawalanche, 0o00o0oo, filibis, poor, lukasstockner97
Tags: #compositing
Differential Revision: https://developer.blender.org/D4304
2019-08-14 15:30:26 +02:00
set ( OPENIMAGEDENOISE_DEFINITIONS )
endif ( )
2017-10-29 13:16:22 -06:00
if ( WITH_ALEMBIC )
set ( ALEMBIC ${ LIBDIR } /alembic )
set ( ALEMBIC_INCLUDE_DIR ${ ALEMBIC } /include )
set ( ALEMBIC_INCLUDE_DIRS ${ ALEMBIC_INCLUDE_DIR } )
set ( ALEMBIC_LIBPATH ${ ALEMBIC } /lib )
2019-08-15 09:27:15 -06:00
set ( ALEMBIC_LIBRARIES optimized ${ ALEMBIC } /lib/Alembic.lib debug ${ ALEMBIC } /lib/Alembic_d.lib )
2017-10-29 13:16:22 -06:00
set ( ALEMBIC_FOUND 1 )
endif ( )
2018-08-27 19:37:55 -06:00
if ( WITH_IMAGE_OPENJPEG )
set ( OPENJPEG ${ LIBDIR } /openjpeg )
2022-10-20 13:25:54 +02:00
set ( OPENJPEG_INCLUDE_DIRS ${ OPENJPEG } /include/openjpeg-2.5 )
2022-04-19 18:09:05 +02:00
if ( NOT EXISTS "${OPENJPEG_INCLUDE_DIRS}" )
2022-10-20 13:25:54 +02:00
# when not found, could be an older lib folder with openjpeg 2.4
# to ease the transition period, fall back if 2.5 is not found.
set ( OPENJPEG_INCLUDE_DIRS ${ OPENJPEG } /include/openjpeg-2.4 )
2022-04-19 18:09:05 +02:00
endif ( )
2018-08-27 19:37:55 -06:00
set ( OPENJPEG_LIBRARIES ${ OPENJPEG } /lib/openjp2.lib )
endif ( )
2018-11-26 11:41:38 +01:00
if ( WITH_OPENSUBDIV )
2017-10-29 13:16:22 -06:00
windows_find_package ( OpenSubdiv )
2022-03-31 19:27:32 +02:00
if ( NOT OpenSubdiv_FOUND )
set ( OPENSUBDIV ${ LIBDIR } /opensubdiv )
set ( OPENSUBDIV_INCLUDE_DIRS ${ OPENSUBDIV } /include )
set ( OPENSUBDIV_LIBPATH ${ OPENSUBDIV } /lib )
2022-03-23 16:07:43 +01:00
set ( OPENSUBDIV_LIBRARIES
o p t i m i z e d $ { O P E N S U B D I V _ L I B P A T H } / o s d C P U . l i b
o p t i m i z e d $ { O P E N S U B D I V _ L I B P A T H } / o s d G P U . l i b
d e b u g $ { O P E N S U B D I V _ L I B P A T H } / o s d C P U _ d . l i b
d e b u g $ { O P E N S U B D I V _ L I B P A T H } / o s d G P U _ d . l i b
)
endif ( )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_SDL )
set ( SDL ${ LIBDIR } /sdl )
set ( SDL_INCLUDE_DIR ${ SDL } /include )
set ( SDL_LIBPATH ${ SDL } /lib )
set ( SDL_LIBRARY ${ SDL_LIBPATH } /SDL2.lib )
endif ( )
# Audio IO
if ( WITH_SYSTEM_AUDASPACE )
set ( AUDASPACE_INCLUDE_DIRS ${ LIBDIR } /audaspace/include/audaspace )
set ( AUDASPACE_LIBRARIES ${ LIBDIR } /audaspace/lib/audaspace.lib )
set ( AUDASPACE_C_INCLUDE_DIRS ${ LIBDIR } /audaspace/include/audaspace )
set ( AUDASPACE_C_LIBRARIES ${ LIBDIR } /audaspace/lib/audaspace-c.lib )
set ( AUDASPACE_PY_INCLUDE_DIRS ${ LIBDIR } /audaspace/include/audaspace )
set ( AUDASPACE_PY_LIBRARIES ${ LIBDIR } /audaspace/lib/audaspace-py.lib )
endif ( )
2019-10-09 16:44:29 +02:00
if ( WITH_TBB )
2022-03-23 16:07:43 +01:00
windows_find_package ( TBB )
2022-03-31 19:27:32 +02:00
if ( NOT TBB_FOUND )
2022-03-23 16:07:43 +01:00
set ( TBB_LIBRARIES optimized ${ LIBDIR } /tbb/lib/tbb.lib debug ${ LIBDIR } /tbb/lib/tbb_debug.lib )
set ( TBB_INCLUDE_DIR ${ LIBDIR } /tbb/include )
set ( TBB_INCLUDE_DIRS ${ TBB_INCLUDE_DIR } )
if ( WITH_TBB_MALLOC_PROXY )
set ( TBB_MALLOC_LIBRARIES optimized ${ LIBDIR } /tbb/lib/tbbmalloc.lib debug ${ LIBDIR } /tbb/lib/tbbmalloc_debug.lib )
add_definitions ( -DWITH_TBB_MALLOC )
endif ( )
2019-11-12 20:55:39 -07:00
endif ( )
2019-10-09 16:44:29 +02:00
endif ( )
2017-10-29 13:16:22 -06:00
# used in many places so include globally, like OpenGL
2022-09-18 07:41:13 +02:00
include_directories ( SYSTEM "${PTHREADS_INCLUDE_DIRS}" )
2017-10-29 13:16:22 -06:00
2016-08-09 15:19:11 +02:00
set ( WINTAB_INC ${ LIBDIR } /wintab/include )
if ( WITH_OPENAL )
set ( OPENAL ${ LIBDIR } /openal )
set ( OPENALDIR ${ LIBDIR } /openal )
2017-08-18 08:24:12 +02:00
set ( OPENAL_INCLUDE_DIR ${ OPENAL } /include/AL )
2017-10-29 13:16:22 -06:00
set ( OPENAL_LIBPATH ${ OPENAL } /lib )
2016-08-09 15:19:11 +02:00
if ( MSVC )
2017-10-29 13:16:22 -06:00
set ( OPENAL_LIBRARY ${ OPENAL_LIBPATH } /openal32.lib )
2016-08-09 15:19:11 +02:00
else ( )
2017-10-29 13:16:22 -06:00
set ( OPENAL_LIBRARY ${ OPENAL_LIBPATH } /wrap_oal.lib )
2016-08-09 15:19:11 +02:00
endif ( )
endif ( )
if ( WITH_CODEC_SNDFILE )
2017-08-18 08:24:12 +02:00
set ( LIBSNDFILE ${ LIBDIR } /sndfile )
set ( LIBSNDFILE_INCLUDE_DIRS ${ LIBSNDFILE } /include )
set ( LIBSNDFILE_LIBPATH ${ LIBSNDFILE } /lib ) # TODO, deprecate
2017-10-29 18:20:24 -02:00
set ( LIBSNDFILE_LIBRARIES ${ LIBSNDFILE_LIBPATH } /libsndfile-1.lib )
2016-08-09 15:19:11 +02:00
endif ( )
2021-12-07 18:31:36 +01:00
if ( WITH_CYCLES AND WITH_CYCLES_OSL )
2016-08-09 15:19:11 +02:00
set ( CYCLES_OSL ${ LIBDIR } /osl CACHE PATH "Path to OpenShadingLanguage installation" )
2020-02-17 10:28:12 -07:00
set ( OSL_SHADER_DIR ${ CYCLES_OSL } /shaders )
2021-02-24 07:13:37 -07:00
# Shaders have moved around a bit between OSL versions, check multiple locations
if ( NOT EXISTS "${OSL_SHADER_DIR}" )
set ( OSL_SHADER_DIR ${ CYCLES_OSL } /share/OSL/shaders )
endif ( )
2016-08-09 15:19:11 +02:00
find_library ( OSL_LIB_EXEC NAMES oslexec PATHS ${ CYCLES_OSL } /lib )
find_library ( OSL_LIB_COMP NAMES oslcomp PATHS ${ CYCLES_OSL } /lib )
find_library ( OSL_LIB_QUERY NAMES oslquery PATHS ${ CYCLES_OSL } /lib )
2022-10-20 13:33:08 +02:00
find_library ( OSL_LIB_NOISE NAMES oslnoise PATHS ${ CYCLES_OSL } /lib )
2016-08-09 15:19:11 +02:00
find_library ( OSL_LIB_EXEC_DEBUG NAMES oslexec_d PATHS ${ CYCLES_OSL } /lib )
find_library ( OSL_LIB_COMP_DEBUG NAMES oslcomp_d PATHS ${ CYCLES_OSL } /lib )
find_library ( OSL_LIB_QUERY_DEBUG NAMES oslquery_d PATHS ${ CYCLES_OSL } /lib )
2022-10-20 13:33:08 +02:00
find_library ( OSL_LIB_NOISE_DEBUG NAMES oslnoise_d PATHS ${ CYCLES_OSL } /lib )
2016-08-09 15:19:11 +02:00
list ( APPEND OSL_LIBRARIES
o p t i m i z e d $ { O S L _ L I B _ C O M P }
o p t i m i z e d $ { O S L _ L I B _ E X E C }
o p t i m i z e d $ { O S L _ L I B _ Q U E R Y }
d e b u g $ { O S L _ L I B _ E X E C _ D E B U G }
d e b u g $ { O S L _ L I B _ C O M P _ D E B U G }
d e b u g $ { O S L _ L I B _ Q U E R Y _ D E B U G }
2020-11-29 14:01:33 -07:00
$ { P U G I X M L _ L I B R A R I E S }
2016-08-09 15:19:11 +02:00
)
2022-10-20 13:33:08 +02:00
if ( OSL_LIB_NOISE )
list ( APPEND OSL_LIBRARIES optimized ${ OSL_LIB_NOISE } )
endif ( )
if ( OSL_LIB_NOISE_DEBUG )
list ( APPEND OSL_LIBRARIES debug ${ OSL_LIB_NOISE_DEBUG } )
endif ( )
2016-08-09 15:19:11 +02:00
find_path ( OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${ CYCLES_OSL } /include )
find_program ( OSL_COMPILER NAMES oslc PATHS ${ CYCLES_OSL } /bin )
2022-11-09 14:25:32 +01:00
file ( STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MAJOR
R E G E X " ^ [ \ t ] * #define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+[0-9]+.*$")
file ( STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MINOR
R E G E X " ^ [ \ t ] * #define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+[0-9]+.*$")
string ( REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+([.0-9]+).*"
" \ \ 1 " O S L _ L I B R A R Y _ V E R S I O N _ M A J O R $ { O S L _ L I B R A R Y _ V E R S I O N _ M A J O R } )
string ( REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+([.0-9]+).*"
" \ \ 1 " O S L _ L I B R A R Y _ V E R S I O N _ M I N O R $ { O S L _ L I B R A R Y _ V E R S I O N _ M I N O R } )
2016-08-09 15:19:11 +02:00
endif ( )
2018-10-22 10:17:08 -06:00
2021-12-07 18:31:36 +01:00
if ( WITH_CYCLES AND WITH_CYCLES_EMBREE )
2018-11-07 19:34:49 -07:00
windows_find_package ( Embree )
2022-03-31 19:27:32 +02:00
if ( NOT Embree_FOUND )
2018-11-07 19:34:49 -07:00
set ( EMBREE_INCLUDE_DIRS ${ LIBDIR } /embree/include )
set ( EMBREE_LIBRARIES
o p t i m i z e d $ { L I B D I R } / e m b r e e / l i b / e m b r e e 3 . l i b
o p t i m i z e d $ { L I B D I R } / e m b r e e / l i b / e m b r e e _ a v x 2 . l i b
o p t i m i z e d $ { L I B D I R } / e m b r e e / l i b / e m b r e e _ a v x . l i b
o p t i m i z e d $ { L I B D I R } / e m b r e e / l i b / e m b r e e _ s s e 4 2 . l i b
o p t i m i z e d $ { L I B D I R } / e m b r e e / l i b / l e x e r s . l i b
o p t i m i z e d $ { L I B D I R } / e m b r e e / l i b / m a t h . l i b
o p t i m i z e d $ { L I B D I R } / e m b r e e / l i b / s i m d . l i b
o p t i m i z e d $ { L I B D I R } / e m b r e e / l i b / s y s . l i b
o p t i m i z e d $ { L I B D I R } / e m b r e e / l i b / t a s k i n g . l i b
2019-04-17 06:35:54 +02:00
2018-11-07 19:34:49 -07:00
d e b u g $ { L I B D I R } / e m b r e e / l i b / e m b r e e 3 _ d . l i b
d e b u g $ { L I B D I R } / e m b r e e / l i b / e m b r e e _ a v x 2 _ d . l i b
d e b u g $ { L I B D I R } / e m b r e e / l i b / e m b r e e _ a v x _ d . l i b
d e b u g $ { L I B D I R } / e m b r e e / l i b / e m b r e e _ s s e 4 2 _ d . l i b
d e b u g $ { L I B D I R } / e m b r e e / l i b / l e x e r s _ d . l i b
d e b u g $ { L I B D I R } / e m b r e e / l i b / m a t h _ d . l i b
d e b u g $ { L I B D I R } / e m b r e e / l i b / s i m d _ d . l i b
d e b u g $ { L I B D I R } / e m b r e e / l i b / s y s _ d . l i b
2022-08-09 13:36:45 +10:00
d e b u g $ { L I B D I R } / e m b r e e / l i b / t a s k i n g _ d . l i b
)
2018-11-07 19:34:49 -07:00
endif ( )
2018-11-07 12:58:12 +01:00
endif ( )
USD: Introducing a simple USD Exporter
This commit introduces the first version of an exporter to Pixar's
Universal Scene Description (USD) format.
Reviewed By: sergey, LazyDodo
Differential Revision: https://developer.blender.org/D6287
- The USD libraries are built by `make deps`, but not yet built by
install_deps.sh.
- Only experimental support for instancing; by default all duplicated
objects are made real in the USD file. This is fine for exporting a
linked-in posed character, not so much for thousands of pebbles etc.
- The way materials and UV coordinates and Normals are exported is going
to change soon.
- This patch contains LazyDodo's fixes for building on Windows in D5359.
== Meshes ==
USD seems to support neither per-material nor per-face-group
double-sidedness, so we just use the flag from the first non-empty
material slot. If there is no material we default to double-sidedness.
Each UV map is stored on the mesh in a separate primvar. Materials can
refer to these UV maps, but this is not yet exported by Blender. The
primvar name is the same as the UV Map name. This is to allow the
standard name "st" for texture coordinates by naming the UV Map as such,
without having to guess which UV Map is the "standard" one.
Face-varying mesh normals are written to USD. When the mesh has custom
loop normals those are written. Otherwise the poly flag `ME_SMOOTH` is
inspected to determine the normals.
The UV maps and mesh normals take up a significant amount of space, so
exporting them is optional. They're still enabled by default, though.
For comparison: a shot of Spring (03_035_A) is 1.2 GiB when exported
with UVs and normals, and 262 MiB without. We probably have room for
optimisation of written UVs and normals.
The mesh subdivision scheme isn't using the default value 'Catmull
Clark', but uses 'None', indicating we're exporting a polygonal mesh.
This is necessary for USD to understand our normals; otherwise the mesh
is always rendered smooth. In the future we may want to expose this
choice of subdivision scheme to the user, or auto-detect it when we
actually support exporting pre-subdivision meshes.
A possible optimisation could be to inspect whether all polygons are
smooth or flat, and mark the USD mesh as such. This can be added when
needed.
== Animation ==
Mesh and transform animation are now written when passing
`animation=True` to the export operator. There is no inspection of
whether an object is actually animated or not; USD can handle
deduplication of static values for us.
The administration of which timecode to use for the export is left to
the file-format-specific concrete subclasses of
`AbstractHierarchyIterator`; the abstract iterator itself doesn't know
anything about the passage of time. This will allow subclasses for the
frame-based USD format and time-based Alembic format.
== Support for simple preview materials ==
Very simple versions of the materials are now exported, using only the
viewport diffuse RGB, metallic, and roughness.
When there are multiple materials, the mesh faces are stored as geometry
subset and each material is assigned to the appropriate subset. If there
is only one material this is skipped.
The first material if any) is always applied to the mesh itself
(regardless of the existence of geometry subsets), because the Hydra
viewport doesn't support materials on subsets. See
https://github.com/PixarAnimationStudios/USD/issues/542 for more info.
Note that the geometry subsets are not yet time-sampled, so it may break
when an animated mesh changes topology.
Materials are exported as a flat list under a top-level '/_materials'
namespace. This inhibits instancing of the objects using those
materials, so this is subject to change.
== Hair ==
Only the parent strands are exported, and only with a constant colour.
No UV coordinates, no information about the normals.
== Camera ==
Only perspective cameras are supported for now.
== Particles ==
Particles are only written when they are alive, which means that they
are always visible (there is currently no code that deals with marking
them as invisible outside their lifespan).
Particle-system-instanced objects are exported by suffixing the object
name with the particle's persistent ID, giving each particle XForm a
unique name.
== Instancing/referencing ==
This exporter has experimental support for instancing/referencing.
Dupli-object meshes are now written to USD as references to the original
mesh. This is still very limited in correctness, as there are issues
referencing to materials from a referenced mesh.
I am still committing this, as it gives us a place to start when
continuing the quest for proper instancing in USD.
== Lights ==
USD does not directly support spot lights, so those aren't exported yet.
It's possible to add this in the future via the UsdLuxShapingAPI. The
units used for the light intensity are also still a bit of a mystery.
== Fluid vertex velocities ==
Currently only fluid simulations (not meshes in general) have explicit
vertex velocities. This is the most important case for exporting
velocities, though, as the baked mesh changes topology all the time, and
thus computing the velocities at import time in a post-processing step
is hard.
== The Building Process ==
- USD is built as monolithic library, instead of 25 smaller libraries.
We were linking all of them as 'whole archive' anyway, so this doesn't
affect the final file size. It does, however, make life easier with
respect to linking order, and handling upstream changes.
- The JSON files required by USD are installed into datafiles/usd; they
are required on every platform. Set the `PXR_PATH_DEBUG` to any value
to have the USD library print the paths it uses to find those files.
- USD is patched so that it finds the aforementioned JSON files in a path
that we pass to it from Blender.
- USD is patched to have a `PXR_BUILD_USD_TOOLS` CMake option to disable
building the tools in its `bin` directory. This is sent as a pull
request at https://github.com/PixarAnimationStudios/USD/pull/1048
2019-12-13 10:27:40 +01:00
if ( WITH_USD )
windows_find_package ( USD )
if ( NOT USD_FOUND )
set ( USD_INCLUDE_DIRS ${ LIBDIR } /usd/include )
2022-04-19 18:09:05 +02:00
set ( USD_RELEASE_LIB ${ LIBDIR } /usd/lib/usd_usd_m.lib )
set ( USD_DEBUG_LIB ${ LIBDIR } /usd/lib/usd_usd_m_d.lib )
2020-04-06 14:38:52 -06:00
set ( USD_LIBRARY_DIR ${ LIBDIR } /usd/lib )
2022-04-19 18:09:05 +02:00
# 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 )
endif ( )
USD: Introducing a simple USD Exporter
This commit introduces the first version of an exporter to Pixar's
Universal Scene Description (USD) format.
Reviewed By: sergey, LazyDodo
Differential Revision: https://developer.blender.org/D6287
- The USD libraries are built by `make deps`, but not yet built by
install_deps.sh.
- Only experimental support for instancing; by default all duplicated
objects are made real in the USD file. This is fine for exporting a
linked-in posed character, not so much for thousands of pebbles etc.
- The way materials and UV coordinates and Normals are exported is going
to change soon.
- This patch contains LazyDodo's fixes for building on Windows in D5359.
== Meshes ==
USD seems to support neither per-material nor per-face-group
double-sidedness, so we just use the flag from the first non-empty
material slot. If there is no material we default to double-sidedness.
Each UV map is stored on the mesh in a separate primvar. Materials can
refer to these UV maps, but this is not yet exported by Blender. The
primvar name is the same as the UV Map name. This is to allow the
standard name "st" for texture coordinates by naming the UV Map as such,
without having to guess which UV Map is the "standard" one.
Face-varying mesh normals are written to USD. When the mesh has custom
loop normals those are written. Otherwise the poly flag `ME_SMOOTH` is
inspected to determine the normals.
The UV maps and mesh normals take up a significant amount of space, so
exporting them is optional. They're still enabled by default, though.
For comparison: a shot of Spring (03_035_A) is 1.2 GiB when exported
with UVs and normals, and 262 MiB without. We probably have room for
optimisation of written UVs and normals.
The mesh subdivision scheme isn't using the default value 'Catmull
Clark', but uses 'None', indicating we're exporting a polygonal mesh.
This is necessary for USD to understand our normals; otherwise the mesh
is always rendered smooth. In the future we may want to expose this
choice of subdivision scheme to the user, or auto-detect it when we
actually support exporting pre-subdivision meshes.
A possible optimisation could be to inspect whether all polygons are
smooth or flat, and mark the USD mesh as such. This can be added when
needed.
== Animation ==
Mesh and transform animation are now written when passing
`animation=True` to the export operator. There is no inspection of
whether an object is actually animated or not; USD can handle
deduplication of static values for us.
The administration of which timecode to use for the export is left to
the file-format-specific concrete subclasses of
`AbstractHierarchyIterator`; the abstract iterator itself doesn't know
anything about the passage of time. This will allow subclasses for the
frame-based USD format and time-based Alembic format.
== Support for simple preview materials ==
Very simple versions of the materials are now exported, using only the
viewport diffuse RGB, metallic, and roughness.
When there are multiple materials, the mesh faces are stored as geometry
subset and each material is assigned to the appropriate subset. If there
is only one material this is skipped.
The first material if any) is always applied to the mesh itself
(regardless of the existence of geometry subsets), because the Hydra
viewport doesn't support materials on subsets. See
https://github.com/PixarAnimationStudios/USD/issues/542 for more info.
Note that the geometry subsets are not yet time-sampled, so it may break
when an animated mesh changes topology.
Materials are exported as a flat list under a top-level '/_materials'
namespace. This inhibits instancing of the objects using those
materials, so this is subject to change.
== Hair ==
Only the parent strands are exported, and only with a constant colour.
No UV coordinates, no information about the normals.
== Camera ==
Only perspective cameras are supported for now.
== Particles ==
Particles are only written when they are alive, which means that they
are always visible (there is currently no code that deals with marking
them as invisible outside their lifespan).
Particle-system-instanced objects are exported by suffixing the object
name with the particle's persistent ID, giving each particle XForm a
unique name.
== Instancing/referencing ==
This exporter has experimental support for instancing/referencing.
Dupli-object meshes are now written to USD as references to the original
mesh. This is still very limited in correctness, as there are issues
referencing to materials from a referenced mesh.
I am still committing this, as it gives us a place to start when
continuing the quest for proper instancing in USD.
== Lights ==
USD does not directly support spot lights, so those aren't exported yet.
It's possible to add this in the future via the UsdLuxShapingAPI. The
units used for the light intensity are also still a bit of a mystery.
== Fluid vertex velocities ==
Currently only fluid simulations (not meshes in general) have explicit
vertex velocities. This is the most important case for exporting
velocities, though, as the baked mesh changes topology all the time, and
thus computing the velocities at import time in a post-processing step
is hard.
== The Building Process ==
- USD is built as monolithic library, instead of 25 smaller libraries.
We were linking all of them as 'whole archive' anyway, so this doesn't
affect the final file size. It does, however, make life easier with
respect to linking order, and handling upstream changes.
- The JSON files required by USD are installed into datafiles/usd; they
are required on every platform. Set the `PXR_PATH_DEBUG` to any value
to have the USD library print the paths it uses to find those files.
- USD is patched so that it finds the aforementioned JSON files in a path
that we pass to it from Blender.
- USD is patched to have a `PXR_BUILD_USD_TOOLS` CMake option to disable
building the tools in its `bin` directory. This is sent as a pull
request at https://github.com/PixarAnimationStudios/USD/pull/1048
2019-12-13 10:27:40 +01:00
set ( USD_LIBRARIES
2020-03-04 10:47:24 +11:00
d e b u g $ { U S D _ D E B U G _ L I B }
o p t i m i z e d $ { U S D _ R E L E A S E _ L I B }
USD: Introducing a simple USD Exporter
This commit introduces the first version of an exporter to Pixar's
Universal Scene Description (USD) format.
Reviewed By: sergey, LazyDodo
Differential Revision: https://developer.blender.org/D6287
- The USD libraries are built by `make deps`, but not yet built by
install_deps.sh.
- Only experimental support for instancing; by default all duplicated
objects are made real in the USD file. This is fine for exporting a
linked-in posed character, not so much for thousands of pebbles etc.
- The way materials and UV coordinates and Normals are exported is going
to change soon.
- This patch contains LazyDodo's fixes for building on Windows in D5359.
== Meshes ==
USD seems to support neither per-material nor per-face-group
double-sidedness, so we just use the flag from the first non-empty
material slot. If there is no material we default to double-sidedness.
Each UV map is stored on the mesh in a separate primvar. Materials can
refer to these UV maps, but this is not yet exported by Blender. The
primvar name is the same as the UV Map name. This is to allow the
standard name "st" for texture coordinates by naming the UV Map as such,
without having to guess which UV Map is the "standard" one.
Face-varying mesh normals are written to USD. When the mesh has custom
loop normals those are written. Otherwise the poly flag `ME_SMOOTH` is
inspected to determine the normals.
The UV maps and mesh normals take up a significant amount of space, so
exporting them is optional. They're still enabled by default, though.
For comparison: a shot of Spring (03_035_A) is 1.2 GiB when exported
with UVs and normals, and 262 MiB without. We probably have room for
optimisation of written UVs and normals.
The mesh subdivision scheme isn't using the default value 'Catmull
Clark', but uses 'None', indicating we're exporting a polygonal mesh.
This is necessary for USD to understand our normals; otherwise the mesh
is always rendered smooth. In the future we may want to expose this
choice of subdivision scheme to the user, or auto-detect it when we
actually support exporting pre-subdivision meshes.
A possible optimisation could be to inspect whether all polygons are
smooth or flat, and mark the USD mesh as such. This can be added when
needed.
== Animation ==
Mesh and transform animation are now written when passing
`animation=True` to the export operator. There is no inspection of
whether an object is actually animated or not; USD can handle
deduplication of static values for us.
The administration of which timecode to use for the export is left to
the file-format-specific concrete subclasses of
`AbstractHierarchyIterator`; the abstract iterator itself doesn't know
anything about the passage of time. This will allow subclasses for the
frame-based USD format and time-based Alembic format.
== Support for simple preview materials ==
Very simple versions of the materials are now exported, using only the
viewport diffuse RGB, metallic, and roughness.
When there are multiple materials, the mesh faces are stored as geometry
subset and each material is assigned to the appropriate subset. If there
is only one material this is skipped.
The first material if any) is always applied to the mesh itself
(regardless of the existence of geometry subsets), because the Hydra
viewport doesn't support materials on subsets. See
https://github.com/PixarAnimationStudios/USD/issues/542 for more info.
Note that the geometry subsets are not yet time-sampled, so it may break
when an animated mesh changes topology.
Materials are exported as a flat list under a top-level '/_materials'
namespace. This inhibits instancing of the objects using those
materials, so this is subject to change.
== Hair ==
Only the parent strands are exported, and only with a constant colour.
No UV coordinates, no information about the normals.
== Camera ==
Only perspective cameras are supported for now.
== Particles ==
Particles are only written when they are alive, which means that they
are always visible (there is currently no code that deals with marking
them as invisible outside their lifespan).
Particle-system-instanced objects are exported by suffixing the object
name with the particle's persistent ID, giving each particle XForm a
unique name.
== Instancing/referencing ==
This exporter has experimental support for instancing/referencing.
Dupli-object meshes are now written to USD as references to the original
mesh. This is still very limited in correctness, as there are issues
referencing to materials from a referenced mesh.
I am still committing this, as it gives us a place to start when
continuing the quest for proper instancing in USD.
== Lights ==
USD does not directly support spot lights, so those aren't exported yet.
It's possible to add this in the future via the UsdLuxShapingAPI. The
units used for the light intensity are also still a bit of a mystery.
== Fluid vertex velocities ==
Currently only fluid simulations (not meshes in general) have explicit
vertex velocities. This is the most important case for exporting
velocities, though, as the baked mesh changes topology all the time, and
thus computing the velocities at import time in a post-processing step
is hard.
== The Building Process ==
- USD is built as monolithic library, instead of 25 smaller libraries.
We were linking all of them as 'whole archive' anyway, so this doesn't
affect the final file size. It does, however, make life easier with
respect to linking order, and handling upstream changes.
- The JSON files required by USD are installed into datafiles/usd; they
are required on every platform. Set the `PXR_PATH_DEBUG` to any value
to have the USD library print the paths it uses to find those files.
- USD is patched so that it finds the aforementioned JSON files in a path
that we pass to it from Blender.
- USD is patched to have a `PXR_BUILD_USD_TOOLS` CMake option to disable
building the tools in its `bin` directory. This is sent as a pull
request at https://github.com/PixarAnimationStudios/USD/pull/1048
2019-12-13 10:27:40 +01:00
)
endif ( )
endif ( )
2019-06-19 07:24:55 +10:00
if ( WINDOWS_PYTHON_DEBUG )
2018-10-22 10:17:08 -06:00
# Include the system scripts in the blender_python_system_scripts project.
2022-09-23 14:33:44 +10:00
file ( GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" )
add_custom_target ( blender_python_system_scripts SOURCES ${ inFiles } )
2018-10-22 10:17:08 -06:00
foreach ( _source IN ITEMS ${ inFiles } )
get_filename_component ( _source_path "${_source}" PATH )
string ( REPLACE "${CMAKE_SOURCE_DIR}/release/scripts/" "" _source_path "${_source_path}" )
string ( REPLACE "/" "\\" _group_path "${_source_path}" )
source_group ( "${_group_path}" FILES "${_source}" )
endforeach ( )
2020-12-11 14:59:08 +11:00
2020-10-13 08:45:22 -06:00
# If the user scripts env var is set, include scripts from there otherwise
# include user scripts in the profile folder.
if ( DEFINED ENV{BLENDER_USER_SCRIPTS} )
message ( STATUS "Including user scripts from environment BLENDER_USER_SCRIPTS=$ENV{BLENDER_USER_SCRIPTS}" )
set ( USER_SCRIPTS_ROOT "$ENV{BLENDER_USER_SCRIPTS}" )
else ( )
message ( STATUS "Including user scripts from the profile folder" )
# Include the user scripts from the profile folder in the blender_python_user_scripts project.
set ( USER_SCRIPTS_ROOT "$ENV{appdata}/blender foundation/blender/${BLENDER_VERSION}/scripts" )
endif ( )
2020-12-11 14:59:08 +11:00
2018-10-22 10:17:08 -06:00
file ( TO_CMAKE_PATH ${ USER_SCRIPTS_ROOT } USER_SCRIPTS_ROOT )
2022-09-23 14:33:44 +10:00
file ( GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" )
add_custom_target ( blender_python_user_scripts SOURCES ${ inFiles } )
2018-10-22 10:17:08 -06:00
foreach ( _source IN ITEMS ${ inFiles } )
get_filename_component ( _source_path "${_source}" PATH )
2020-10-13 08:45:22 -06:00
string ( REPLACE "${USER_SCRIPTS_ROOT}" "" _source_path "${_source_path}" )
2018-10-22 10:17:08 -06:00
string ( REPLACE "/" "\\" _group_path "${_source_path}" )
source_group ( "${_group_path}" FILES "${_source}" )
endforeach ( )
set_target_properties ( blender_python_system_scripts PROPERTIES FOLDER "scripts" )
set_target_properties ( blender_python_user_scripts PROPERTIES FOLDER "scripts" )
# Set the default debugging options for the project, only write this file once so the user
# is free to override them at their own perril.
set ( USER_PROPS_FILE "${CMAKE_CURRENT_BINARY_DIR}/source/creator/blender.Cpp.user.props" )
if ( NOT EXISTS ${ USER_PROPS_FILE } )
# Layout below is messy, because otherwise the generated file will look messy.
file ( WRITE ${ USER_PROPS_FILE } "<?xml version=\" 1.0\ " encoding=\" utf-8\ " ?>
< P r o j e c t D e f a u l t T a r g e t s = \ " B u i l d \ " x m l n s = \ " h t t p : / / s c h e m a s . m i c r o s o f t . c o m / d e v e l o p e r / m s b u i l d / 2 0 0 3 \ " >
< P r o p e r t y G r o u p >
< L o c a l D e b u g g e r C o m m a n d A r g u m e n t s > - c o n - - e n v - s y s t e m - s c r i p t s \ " $ { C M A K E _ S O U R C E _ D I R } / r e l e a s e / s c r i p t s \ " < / L o c a l D e b u g g e r C o m m a n d A r g u m e n t s >
< / P r o p e r t y G r o u p >
< / P r o j e c t > " )
endif ( )
endif ( )
2020-03-04 16:39:00 +01:00
if ( WITH_XR_OPENXR )
2022-09-29 19:01:35 +02:00
set ( XR_OPENXR_SDK ${ LIBDIR } /xr_openxr_sdk )
set ( XR_OPENXR_SDK_LIBPATH ${ LIBDIR } /xr_openxr_sdk/lib )
set ( XR_OPENXR_SDK_INCLUDE_DIR ${ XR_OPENXR_SDK } /include )
# This is the old name of this library, it is checked to
# support the transition between the old and new lib versions
# this can be removed after the next lib update.
if ( EXISTS ${ XR_OPENXR_SDK_LIBPATH } /openxr_loader_d.lib )
set ( XR_OPENXR_SDK_LIBRARIES optimized ${ XR_OPENXR_SDK_LIBPATH } /openxr_loader.lib debug ${ XR_OPENXR_SDK_LIBPATH } /openxr_loader_d.lib )
2020-03-04 16:39:00 +01:00
else ( )
2022-09-29 19:01:35 +02:00
set ( XR_OPENXR_SDK_LIBRARIES optimized ${ XR_OPENXR_SDK_LIBPATH } /openxr_loader.lib debug ${ XR_OPENXR_SDK_LIBPATH } /openxr_loaderd.lib )
2020-03-04 16:39:00 +01:00
endif ( )
endif ( )
2020-07-31 09:34:26 -06:00
if ( WITH_GMP )
set ( GMP_INCLUDE_DIRS ${ LIBDIR } /gmp/include )
set ( GMP_LIBRARIES ${ LIBDIR } /gmp/lib/libgmp-10.lib optimized ${ LIBDIR } /gmp/lib/libgmpxx.lib debug ${ LIBDIR } /gmp/lib/libgmpxx_d.lib )
set ( GMP_ROOT_DIR ${ LIBDIR } /gmp )
2021-11-04 14:50:24 +11:00
set ( GMP_FOUND ON )
2020-07-31 09:34:26 -06:00
endif ( )
2020-09-15 13:16:37 -06:00
if ( WITH_POTRACE )
set ( POTRACE_INCLUDE_DIRS ${ LIBDIR } /potrace/include )
set ( POTRACE_LIBRARIES ${ LIBDIR } /potrace/lib/potrace.lib )
2021-11-04 14:50:24 +11:00
set ( POTRACE_FOUND ON )
2020-09-15 13:16:37 -06:00
endif ( )
2021-02-01 21:58:57 +05:30
if ( WITH_HARU )
2022-09-29 19:01:35 +02:00
set ( HARU_FOUND ON )
set ( HARU_ROOT_DIR ${ LIBDIR } /haru )
set ( HARU_INCLUDE_DIRS ${ HARU_ROOT_DIR } /include )
set ( HARU_LIBRARIES ${ HARU_ROOT_DIR } /lib/libhpdfs.lib )
2021-02-01 21:58:57 +05:30
endif ( )
Add support for Zstandard compression for .blend files
Compressing blendfiles can help save a lot of disk space, but the slowdown
while loading and saving is a major annoyance.
Currently Blender uses Zlib (aka gzip aka Deflate) for compression, but there
are now several more modern algorithms that outperform it in every way.
In this patch, I decided for Zstandard aka Zstd for several reasons:
- It is widely supported, both in other programs and libraries as well as in
general-purpose compression utilities on Unix
- It is extremely flexible - spanning several orders of magnitude of
compression speeds depending on the level setting.
- It is pretty much on the Pareto frontier for all of its configurations
(meaning that no other algorithm is both faster and more efficient).
One downside of course is that older versions of Blender will not be able to
read these files, but one can always just re-save them without compression or
decompress the file manually with an external tool.
The implementation here saves additional metadata into the compressed file in
order to allow for efficient seeking when loading. This is standard-compliant
and will be ignored by other tools that support Zstd.
If the metadata is not present (e.g. because you manually compressed a .blend
file with another tool), Blender will fall back to sequential reading.
Saving is multithreaded to improve performance. Loading is currently not
multithreaded since it's not easy to predict the access patterns of the
loading code when seeking is supported.
In the future, we might want to look into making this more predictable or
disabling seeking for the main .blend file, which would then allow for
multiple background threads that decompress data ahead of time.
The compression level was chosen to get sizes comparable to previous versions
at much higher speeds. In the future, this could be exposed as an option.
Reviewed By: campbellbarton, brecht, mont29
Differential Revision: https://developer.blender.org/D5799
2021-08-21 03:15:31 +02:00
2022-11-22 11:28:37 +01:00
if ( WITH_VULKAN_BACKEND )
if ( EXISTS ${ LIBDIR } /vulkan )
set ( VULKAN_FOUND On )
set ( VULKAN_ROOT_DIR ${ LIBDIR } /vulkan )
set ( VULKAN_INCLUDE_DIR ${ VULKAN_ROOT_DIR } /include )
set ( VULKAN_INCLUDE_DIRS ${ VULKAN_INCLUDE_DIR } )
set ( VULKAN_LIBRARY ${ VULKAN_ROOT_DIR } /lib/vulkan-1.lib )
set ( VULKAN_LIBRARIES ${ VULKAN_LIBRARY } )
else ( )
message ( WARNING "Vulkan was not found, disabling WITH_VULKAN_BACKEND" )
set ( WITH_VULKAN_BACKEND OFF )
endif ( )
endif ( )
2022-10-17 13:24:24 +02:00
if ( WITH_CYCLES AND WITH_CYCLES_PATH_GUIDING )
2022-10-04 19:29:52 +02:00
find_package ( openpgl QUIET )
if ( openpgl_FOUND )
get_target_property ( OPENPGL_LIBRARIES_RELEASE openpgl::openpgl LOCATION_RELEASE )
get_target_property ( OPENPGL_LIBRARIES_DEBUG openpgl::openpgl LOCATION_DEBUG )
set ( OPENPGL_LIBRARIES optimized ${ OPENPGL_LIBRARIES_RELEASE } debug ${ OPENPGL_LIBRARIES_DEBUG } )
get_target_property ( OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES )
else ( )
set ( WITH_CYCLES_PATH_GUIDING OFF )
message ( STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING" )
endif ( )
endif ( )
Add support for Zstandard compression for .blend files
Compressing blendfiles can help save a lot of disk space, but the slowdown
while loading and saving is a major annoyance.
Currently Blender uses Zlib (aka gzip aka Deflate) for compression, but there
are now several more modern algorithms that outperform it in every way.
In this patch, I decided for Zstandard aka Zstd for several reasons:
- It is widely supported, both in other programs and libraries as well as in
general-purpose compression utilities on Unix
- It is extremely flexible - spanning several orders of magnitude of
compression speeds depending on the level setting.
- It is pretty much on the Pareto frontier for all of its configurations
(meaning that no other algorithm is both faster and more efficient).
One downside of course is that older versions of Blender will not be able to
read these files, but one can always just re-save them without compression or
decompress the file manually with an external tool.
The implementation here saves additional metadata into the compressed file in
order to allow for efficient seeking when loading. This is standard-compliant
and will be ignored by other tools that support Zstd.
If the metadata is not present (e.g. because you manually compressed a .blend
file with another tool), Blender will fall back to sequential reading.
Saving is multithreaded to improve performance. Loading is currently not
multithreaded since it's not easy to predict the access patterns of the
loading code when seeking is supported.
In the future, we might want to look into making this more predictable or
disabling seeking for the main .blend file, which would then allow for
multiple background threads that decompress data ahead of time.
The compression level was chosen to get sizes comparable to previous versions
at much higher speeds. In the future, this could be exposed as an option.
Reviewed By: campbellbarton, brecht, mont29
Differential Revision: https://developer.blender.org/D5799
2021-08-21 03:15:31 +02:00
set ( ZSTD_INCLUDE_DIRS ${ LIBDIR } /zstd/include )
set ( ZSTD_LIBRARIES ${ LIBDIR } /zstd/lib/zstd_static.lib )
2022-06-29 12:58:04 +02:00
2022-10-17 13:24:24 +02:00
if ( WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI )
2022-10-06 18:35:51 +02:00
set ( LEVEL_ZERO_ROOT_DIR ${ LIBDIR } /level_zero )
set ( CYCLES_SYCL ${ LIBDIR } /dpcpp CACHE PATH "Path to oneAPI DPC++ compiler" )
if ( EXISTS ${ CYCLES_SYCL } AND NOT SYCL_ROOT_DIR )
set ( SYCL_ROOT_DIR ${ CYCLES_SYCL } )
endif ( )
2022-10-06 20:49:53 +02:00
file ( GLOB _sycl_runtime_libraries_glob
2022-10-06 18:35:51 +02:00
$ { S Y C L _ R O O T _ D I R } / b i n / s y c l . d l l
$ { S Y C L _ R O O T _ D I R } / b i n / s y c l [ 0 - 9 ] . d l l
)
2022-10-06 20:49:53 +02:00
foreach ( sycl_runtime_library IN LISTS _sycl_runtime_libraries_glob )
string ( REPLACE ".dll" "$<$<CONFIG:Debug>:d>.dll" sycl_runtime_library ${ sycl_runtime_library } )
list ( APPEND _sycl_runtime_libraries ${ sycl_runtime_library } )
endforeach ( )
unset ( _sycl_runtime_libraries_glob )
list ( APPEND _sycl_runtime_libraries ${ SYCL_ROOT_DIR } /bin/pi_level_zero.dll )
2022-10-06 18:35:51 +02:00
list ( APPEND PLATFORM_BUNDLED_LIBRARIES ${ _sycl_runtime_libraries } )
unset ( _sycl_runtime_libraries )
endif ( )