2016-08-09 15:19:11 +02:00
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for Windows.
add_definitions ( -DWIN32 )
2017-10-29 13:16:22 -06:00
if ( NOT MSVC )
2019-04-17 06:35:54 +02: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" )
2019-04-17 06:35:54 +02:00
set ( MSVC_CLANG On )
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 )
2019-04-17 06:35:54 +02: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" )
GET_FILENAME_COMPONENT ( LLVMROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\LLVM\\LLVM;]" ABSOLUTE CACHE )
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 ( )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \" ${ CLANG_OPENMP_LIB } \"")
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
2019-06-15 15:35:36 -03:00
set_property ( GLOBAL PROPERTY USE_FOLDERS ${ WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS } )
2018-02-03 16:38:27 -07:00
if ( NOT WITH_PYTHON_MODULE )
2019-04-17 06:35:54 +02:00
set_property ( DIRECTORY PROPERTY VS_STARTUP_PROJECT blender )
2018-02-03 16:38:27 -07:00
endif ( )
2017-10-29 13:16:22 -06:00
macro ( warn_hardcoded_paths package_name
2019-04-17 06:35:54 +02:00
)
if ( WITH_WINDOWS_FIND_MODULES )
message ( WARNING "Using HARDCODED ${package_name} locations" )
endif ( )
2017-10-29 13:16:22 -06:00
endmacro ( )
macro ( windows_find_package package_name
2019-04-17 06:35:54 +02:00
)
if ( WITH_WINDOWS_FIND_MODULES )
find_package ( ${ package_name } )
endif ( )
2017-10-29 13:16:22 -06:00
endmacro ( )
macro ( find_package_wrapper )
2019-04-17 06:35:54 +02:00
if ( WITH_WINDOWS_FIND_MODULES )
find_package ( ${ ARGV } )
endif ( )
2017-10-29 13:16:22 -06:00
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
# Minimum MSVC Version
if ( CMAKE_CXX_COMPILER_ID MATCHES MSVC )
2019-04-17 06:35:54 +02:00
if ( MSVC_VERSION EQUAL 1800 )
set ( _min_ver "18.0.31101" )
if ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${ _min_ver } )
message ( FATAL_ERROR
" V i s u a l S t u d i o 2013 ( Update 4, ${ _min_ver } ) r e q u i r e d , "
" found ( ${ CMAKE_CXX_COMPILER_VERSION } ) " )
endif ( )
endif ( )
if ( MSVC_VERSION EQUAL 1900 )
set ( _min_ver "19.0.24210" )
if ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${ _min_ver } )
message ( FATAL_ERROR
" V i s u a l S t u d i o 2015 ( Update 3, ${ _min_ver } ) r e q u i r e d , "
" found ( ${ CMAKE_CXX_COMPILER_VERSION } ) " )
endif ( )
endif ( )
2017-10-29 13:16:22 -06:00
endif ( )
unset ( _min_ver )
# needed for some MSVC installations
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO" )
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO" )
set ( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO" )
list ( APPEND PLATFORM_LINKLIBS
2019-10-09 13:36:56 +02: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
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
2017-10-29 13:16:22 -06:00
)
if ( WITH_INPUT_IME )
2019-04-17 06:35:54 +02:00
list ( APPEND PLATFORM_LINKLIBS imm32 )
2017-10-29 13:16:22 -06:00
endif ( )
add_definitions (
2019-04-17 06:35:54 +02:00
- 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
2017-10-29 13:16:22 -06:00
)
# MSVC11 needs _ALLOW_KEYWORD_MACROS to build
add_definitions ( -D_ALLOW_KEYWORD_MACROS )
# We want to support Vista level ABI
add_definitions ( -D_WIN32_WINNT=0x600 )
2019-12-06 10:12:03 -07:00
include ( build_files/cmake/platform/platform_win32_bundle_crt.cmake )
2018-05-25 21:46:42 -06:00
remove_cc_flag ( "/MDd" "/MD" )
2018-06-10 08:12:13 +02:00
if ( MSVC_CLANG ) # Clangs version of cl doesn't support all flags
2019-04-17 06:35:54 +02:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference " )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -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
else ( )
2019-08-14 17:57:01 -06:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc /bigobj" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj" )
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
2019-11-08 09:01:00 -07:00
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /ZI" )
set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd /ZI" )
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD" )
set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD" )
set ( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD" )
set ( CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD" )
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD" )
2017-10-29 13:16:22 -06:00
2019-10-29 01:32:33 +11:00
# JMC is available on msvc 15.8 (1915) and up
2019-07-30 14:40:05 -06:00
if ( MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG )
2019-07-30 14:50:53 -06:00
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /JMC" )
2019-07-30 14:40:05 -06:00
endif ( )
2018-05-31 11:50:30 -06:00
set ( PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO " )
2019-11-08 09:01:00 -07:00
set ( PLATFORM_LINKFLAGS_RELEASE "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib" )
set ( PLATFORM_LINKFLAGS_DEBUG "${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.
set ( PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221" )
set ( CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221" )
if ( CMAKE_CL_64 )
2019-04-17 06:35:54 +02:00
set ( PLATFORM_LINKFLAGS "/MACHINE:X64 ${PLATFORM_LINKFLAGS}" )
2017-10-29 13:16:22 -06:00
else ( )
2019-04-17 06:35:54 +02:00
set ( PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}" )
2017-10-29 13:16:22 -06:00
endif ( )
if ( NOT DEFINED LIBDIR )
2019-04-17 06:35:54 +02:00
# 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" )
2019-04-17 06:35:54 +02:00
endif ( )
# Can be 1910..1912
if ( MSVC_VERSION GREATER 1919 )
message ( STATUS "Visual Studio 2019 detected." )
2019-11-08 09:01:00 -07:00
set ( LIBDIR ${ CMAKE_SOURCE_DIR } /../lib/ ${ LIBDIR_BASE } _vc15 )
2019-04-17 06:35:54 +02:00
elseif ( MSVC_VERSION GREATER 1909 )
message ( STATUS "Visual Studio 2017 detected." )
2019-11-08 09:01:00 -07:00
set ( LIBDIR ${ CMAKE_SOURCE_DIR } /../lib/ ${ LIBDIR_BASE } _vc15 )
2019-04-17 06:35:54 +02:00
elseif ( MSVC_VERSION EQUAL 1900 )
message ( STATUS "Visual Studio 2015 detected." )
2019-11-08 09:01:00 -07:00
set ( LIBDIR ${ CMAKE_SOURCE_DIR } /../lib/ ${ LIBDIR_BASE } _vc15 )
2019-04-17 06:35:54 +02:00
endif ( )
2017-10-29 13:16:22 -06:00
else ( )
2019-04-17 06:35:54 +02:00
message ( STATUS "Using pre-compiled LIBDIR: ${LIBDIR}" )
2017-10-29 13:16:22 -06:00
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 ( )
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
2019-05-27 13:48:40 -06:00
if ( MSVC_VERSION GREATER_EQUAL 1914 AND NOT MSVC_CLANG )
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 } )
2019-04-17 06:35:54 +02:00
if ( IS_DIRECTORY ${ LIBDIR } / ${ child } )
list ( APPEND CMAKE_PREFIX_PATH ${ LIBDIR } / ${ child } )
endif ( )
2017-10-29 13:16:22 -06:00
endforeach ( )
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 )
windows_find_package ( zlib ) # we want to find before finding things that depend on it like png
windows_find_package ( png )
if ( NOT PNG_FOUND )
2019-04-17 06:35:54 +02:00
warn_hardcoded_paths ( libpng )
set ( PNG_PNG_INCLUDE_DIR ${ LIBDIR } /png/include )
set ( PNG_LIBRARIES ${ LIBDIR } /png/lib/libpng.lib )
set ( PNG "${LIBDIR}/png" )
set ( PNG_INCLUDE_DIRS "${PNG}/include" )
set ( PNG_LIBPATH ${ PNG } /lib ) # not cmake defined
2017-10-29 13:16:22 -06:00
endif ( )
set ( JPEG_NAMES ${ JPEG_NAMES } libjpeg )
windows_find_package ( jpeg REQUIRED )
if ( NOT JPEG_FOUND )
2019-04-17 06:35:54 +02:00
warn_hardcoded_paths ( jpeg )
set ( JPEG_INCLUDE_DIR ${ LIBDIR } /jpeg/include )
set ( JPEG_LIBRARIES ${ LIBDIR } /jpeg/lib/libjpeg.lib )
2017-10-29 13:16:22 -06:00
endif ( )
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
2019-04-17 06:35:54 +02:00
$ { 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
2017-10-29 13:16:22 -06:00
)
set ( FREETYPE_LIBRARY ${ LIBDIR } /freetype/lib/freetype2ST.lib )
windows_find_package ( freetype REQUIRED )
if ( WITH_FFTW3 )
2019-04-17 06:35:54 +02:00
set ( FFTW3 ${ LIBDIR } /fftw3 )
set ( FFTW3_LIBRARIES ${ FFTW3 } /lib/libfftw.lib )
set ( FFTW3_INCLUDE_DIRS ${ FFTW3 } /include )
set ( FFTW3_LIBPATH ${ FFTW3 } /lib )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_OPENCOLLADA )
2019-04-17 06:35:54 +02:00
set ( OPENCOLLADA ${ LIBDIR } /opencollada )
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
)
set ( OPENCOLLADA_LIBRARIES
$ { 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 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 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 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 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 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 E N C O L L A D A } / l i b / o p e n c o l l a d a / x m l . l i b
$ { 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 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
)
list ( APPEND OPENCOLLADA_LIBRARIES ${ OPENCOLLADA } /lib/opencollada/UTF.lib )
set ( PCRE_LIBRARIES
$ { 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
)
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_CODEC_FFMPEG )
2019-04-17 06:35:54 +02:00
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
)
windows_find_package ( FFMPEG )
if ( NOT FFMPEG_FOUND )
warn_hardcoded_paths ( ffmpeg )
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
)
endif ( )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_IMAGE_OPENEXR )
2019-04-17 06:35:54 +02:00
set ( OPENEXR_ROOT_DIR ${ LIBDIR } /openexr )
set ( OPENEXR_VERSION "2.1" )
windows_find_package ( OPENEXR REQUIRED )
if ( NOT OPENEXR_FOUND )
warn_hardcoded_paths ( OpenEXR )
set ( OPENEXR ${ LIBDIR } /openexr )
set ( OPENEXR_INCLUDE_DIR ${ OPENEXR } /include )
set ( OPENEXR_INCLUDE_DIRS ${ OPENEXR_INCLUDE_DIR } ${ OPENEXR } /include/OpenEXR )
set ( OPENEXR_LIBPATH ${ OPENEXR } /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 } / 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 ( )
if ( WITH_IMAGE_TIFF )
2019-04-17 06:35:54 +02:00
# 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 ( )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_JACK )
2019-04-17 06:35:54 +02:00
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 )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_PYTHON )
2019-04-17 06:35:54 +02:00
set ( PYTHON_VERSION 3.7 ) # CACHE STRING)
2017-10-29 13:16:22 -06:00
2019-04-17 06:35:54 +02: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
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 )
set ( NUMPY_FOUND On )
2019-04-17 06:35:54 +02: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 )
2019-04-17 06:35:54 +02:00
if ( WITH_CYCLES_OSL )
set ( boost_extra_libs wave )
endif ( )
if ( WITH_INTERNATIONAL )
list ( APPEND boost_extra_libs locale )
endif ( )
if ( WITH_OPENVDB )
list ( APPEND boost_extra_libs iostreams )
endif ( )
set ( Boost_USE_STATIC_RUNTIME ON ) # prefix lib
set ( Boost_USE_MULTITHREADED ON ) # suffix -mt
set ( Boost_USE_STATIC_LIBS ON ) # suffix -s
if ( WITH_WINDOWS_FIND_MODULES )
find_package ( Boost COMPONENTS date_time filesystem thread regex system ${ boost_extra_libs } )
endif ( )
if ( NOT Boost_FOUND )
warn_hardcoded_paths ( BOOST )
set ( BOOST ${ LIBDIR } /boost )
set ( BOOST_INCLUDE_DIR ${ BOOST } /include )
set ( BOOST_LIBPATH ${ BOOST } /lib )
if ( CMAKE_CL_64 )
2019-11-08 09:01:00 -07:00
set ( BOOST_POSTFIX "vc141-mt-x64-1_68.lib" )
set ( BOOST_DEBUG_POSTFIX "vc141-mt-gd-x64-1_68.lib" )
2019-04-17 06:35:54 +02:00
endif ( )
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 }
)
if ( WITH_CYCLES_OSL )
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 }
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 } )
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 }
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 } )
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 ( )
set ( BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB" )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_OPENIMAGEIO )
2019-04-17 06:35:54 +02:00
windows_find_package ( OpenImageIO )
2019-08-15 09:27:15 -06:00
set ( OPENIMAGEIO ${ LIBDIR } /OpenImageIO )
2019-04-17 06:35:54 +02:00
set ( OPENIMAGEIO_LIBPATH ${ OPENIMAGEIO } /lib )
set ( OPENIMAGEIO_INCLUDE_DIRS ${ OPENIMAGEIO } /include )
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 } )
2018-06-10 08:12:13 +02:00
2019-04-17 06:35:54 +02:00
set ( OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0" )
set ( OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD" )
set ( OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe" )
add_definitions ( -DOIIO_STATIC_BUILD )
add_definitions ( -DOIIO_NO_SSE=1 )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_LLVM )
2019-04-17 06:35:54 +02:00
set ( LLVM_ROOT_DIR ${ LIBDIR } /llvm CACHE PATH "Path to the LLVM installation" )
set ( LLVM_INCLUDE_DIRS ${ LLVM_ROOT_DIR } / $< $<CONFIG:Debug > :Debug>/include CACHE PATH "Path to the LLVM include directory" )
file ( GLOB LLVM_LIBRARY_OPTIMIZED ${ LLVM_ROOT_DIR } /lib/*.lib )
2017-10-29 13:16:22 -06:00
2019-04-17 06:35:54 +02:00
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 )
2017-10-29 13:16:22 -06:00
2019-04-17 06:35:54 +02:00
file ( GLOB LLVM_LIBRARY_DEBUG ${ LLVM_ROOT_DIR } /debug/lib/*.lib )
2017-10-29 13:16:22 -06:00
2019-04-17 06:35:54 +02:00
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 )
2017-10-29 13:16:22 -06:00
2019-04-17 06:35:54 +02:00
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 ( )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_OPENCOLORIO )
2019-08-15 09:27:15 -06:00
set ( OPENCOLORIO ${ LIBDIR } /OpenColorIO )
2019-04-17 06:35:54 +02:00
set ( OPENCOLORIO_INCLUDE_DIRS ${ OPENCOLORIO } /include )
2019-08-15 09:27:15 -06:00
set ( OPENCOLORIO_LIBPATH ${ OPENCOLORIO } /lib )
2019-04-17 06:35:54 +02:00
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 } / t i n y x m l . 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
2019-08-15 09:27:15 -06:00
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
2019-04-17 06:35:54 +02:00
d e b u g $ { O P E N C O L O R I O _ L I B P A T H } / t i n y x m l _ 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
)
set ( OPENCOLORIO_DEFINITIONS )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_OPENVDB )
2019-04-17 06:35:54 +02:00
set ( BLOSC_LIBRARIES optimized ${ LIBDIR } /blosc/lib/libblosc.lib debug ${ LIBDIR } /blosc/lib/libblosc_d.lib )
2019-08-15 09:27:15 -06:00
set ( OPENVDB ${ LIBDIR } /openVDB )
set ( OPENVDB_LIBPATH ${ OPENVDB } /lib )
2019-10-09 16:44:29 +02:00
set ( OPENVDB_INCLUDE_DIRS ${ OPENVDB } /include )
set ( OPENVDB_LIBRARIES optimized ${ OPENVDB_LIBPATH } /openvdb.lib debug ${ OPENVDB_LIBPATH } /openvdb_d.lib ${ BLOSC_LIBRARIES } )
2019-04-17 06:35:54 +02:00
set ( OPENVDB_DEFINITIONS -DNOMINMAX )
2017-10-29 13:16:22 -06:00
endif ( )
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
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 } / m k l d n n . 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 } / 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
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 } / m k l d n n _ 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 )
2019-04-17 06:35:54 +02:00
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 )
2019-04-17 06:35:54 +02:00
set ( ALEMBIC_FOUND 1 )
2017-10-29 13:16:22 -06:00
endif ( )
2018-08-27 19:37:55 -06:00
if ( WITH_IMAGE_OPENJPEG )
2019-04-17 06:35:54 +02:00
set ( OPENJPEG ${ LIBDIR } /openjpeg )
set ( OPENJPEG_INCLUDE_DIRS ${ OPENJPEG } /include/openjpeg-2.3 )
set ( OPENJPEG_LIBRARIES ${ OPENJPEG } /lib/openjp2.lib )
2018-08-27 19:37:55 -06:00
endif ( )
2018-11-26 11:41:38 +01:00
if ( WITH_OPENSUBDIV )
2019-04-17 06:35:54 +02:00
set ( OPENSUBDIV_INCLUDE_DIR ${ LIBDIR } /opensubdiv/include )
set ( OPENSUBDIV_LIBPATH ${ LIBDIR } /opensubdiv/lib )
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
)
set ( OPENSUBDIV_HAS_OPENMP TRUE )
set ( OPENSUBDIV_HAS_TBB FALSE )
set ( OPENSUBDIV_HAS_OPENCL TRUE )
set ( OPENSUBDIV_HAS_CUDA FALSE )
set ( OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK TRUE )
set ( OPENSUBDIV_HAS_GLSL_COMPUTE TRUE )
windows_find_package ( OpenSubdiv )
2017-10-29 13:16:22 -06:00
endif ( )
if ( WITH_SDL )
2019-04-17 06:35:54 +02:00
set ( SDL ${ LIBDIR } /sdl )
set ( SDL_INCLUDE_DIR ${ SDL } /include )
set ( SDL_LIBPATH ${ SDL } /lib )
set ( SDL_LIBRARY ${ SDL_LIBPATH } /SDL2.lib )
2017-10-29 13:16:22 -06:00
endif ( )
# Audio IO
if ( WITH_SYSTEM_AUDASPACE )
2019-04-17 06:35:54 +02:00
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 )
2017-10-29 13:16:22 -06:00
endif ( )
2019-10-09 16:44:29 +02:00
if ( WITH_TBB )
set ( TBB_LIBRARIES optimized ${ LIBDIR } /tbb/lib/tbb.lib debug ${ LIBDIR } /tbb/lib/tbb_debug.lib )
set ( TBB_INCLUDE_DIR ${ LIBDIR } /tbb/include )
2019-10-10 18:01:45 +02:00
set ( TBB_INCLUDE_DIRS ${ TBB_INCLUDE_DIR } )
2019-11-12 20:55:39 -07:00
if ( WITH_TBB_MALLOC_PROXY )
add_definitions ( -DWITH_TBB_MALLOC )
endif ( )
2019-10-09 16:44:29 +02:00
else ( )
if ( WITH_OPENIMAGEDENOISE )
message ( STATUS "TBB disabled, also disabling OpenImageDenoise" )
set ( WITH_OPENIMAGEDENOISE OFF )
endif ( )
if ( WITH_OPENVDB )
message ( STATUS "TBB disabled, also disabling OpenVDB" )
set ( WITH_OPENVDB OFF )
endif ( )
2019-12-16 15:45:47 +01:00
if ( WITH_MOD_FLUID )
message ( STATUS "TBB disabled, disabling Fluid modifier" )
set ( WITH_MOD_FLUID OFF )
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
blender_include_dirs_sys ( "${PTHREADS_INCLUDE_DIRS}" )
2016-08-09 15:19:11 +02:00
set ( WINTAB_INC ${ LIBDIR } /wintab/include )
if ( WITH_OPENAL )
2019-04-17 06:35:54 +02:00
set ( OPENAL ${ LIBDIR } /openal )
set ( OPENALDIR ${ LIBDIR } /openal )
set ( OPENAL_INCLUDE_DIR ${ OPENAL } /include/AL )
set ( OPENAL_LIBPATH ${ OPENAL } /lib )
if ( MSVC )
set ( OPENAL_LIBRARY ${ OPENAL_LIBPATH } /openal32.lib )
else ( )
set ( OPENAL_LIBRARY ${ OPENAL_LIBPATH } /wrap_oal.lib )
endif ( )
2017-10-29 18:20:24 -02:00
2016-08-09 15:19:11 +02:00
endif ( )
if ( WITH_CODEC_SNDFILE )
2019-04-17 06:35:54 +02:00
set ( LIBSNDFILE ${ LIBDIR } /sndfile )
set ( LIBSNDFILE_INCLUDE_DIRS ${ LIBSNDFILE } /include )
set ( LIBSNDFILE_LIBPATH ${ LIBSNDFILE } /lib ) # TODO, deprecate
set ( LIBSNDFILE_LIBRARIES ${ LIBSNDFILE_LIBPATH } /libsndfile-1.lib )
2016-08-09 15:19:11 +02:00
endif ( )
if ( WITH_CYCLES_OSL )
2019-04-17 06:35:54 +02:00
set ( CYCLES_OSL ${ LIBDIR } /osl CACHE PATH "Path to OpenShadingLanguage installation" )
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 )
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 )
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 }
o p t i m i z e d $ { C Y C L E S _ O S L } / l i b / p u g i x m l . l i b
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 }
d e b u g $ { C Y C L E S _ O S L } / l i b / p u g i x m l _ d . l i b
)
find_path ( OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${ CYCLES_OSL } /include )
find_program ( OSL_COMPILER NAMES oslc PATHS ${ CYCLES_OSL } /bin )
if ( OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER )
set ( OSL_FOUND TRUE )
else ( )
message ( STATUS "OSL not found" )
set ( WITH_CYCLES_OSL OFF )
endif ( )
2016-08-09 15:19:11 +02:00
endif ( )
2018-10-22 10:17:08 -06:00
2018-11-07 12:58:12 +01:00
if ( WITH_CYCLES_EMBREE )
2019-04-17 06:35:54 +02:00
windows_find_package ( Embree )
if ( NOT EMBREE_FOUND )
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
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
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 )
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_FOUND ON )
set ( USD_INCLUDE_DIRS ${ LIBDIR } /usd/include )
set ( USD_LIBRARIES
d e b u g $ { L I B D I R } / u s d / l i b / l i b u s d _ m _ d . l i b
o p t i m i z e d $ { L I B D I R } / u s d / l i b / l i b u s d _ m . l i b
)
endif ( )
endif ( )
2019-06-19 07:24:55 +10:00
if ( WINDOWS_PYTHON_DEBUG )
2019-04-17 06:35:54 +02:00
# Include the system scripts in the blender_python_system_scripts project.
FILE ( GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" )
ADD_CUSTOM_TARGET ( blender_python_system_scripts SOURCES ${ inFiles } )
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 ( )
# 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}" )
file ( TO_CMAKE_PATH ${ USER_SCRIPTS_ROOT } USER_SCRIPTS_ROOT )
FILE ( GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/scripts/*.*" )
ADD_CUSTOM_TARGET ( blender_python_user_scripts SOURCES ${ inFiles } )
foreach ( _source IN ITEMS ${ inFiles } )
get_filename_component ( _source_path "${_source}" PATH )
string ( REPLACE "${USER_SCRIPTS_ROOT}/scripts" "" _source_path "${_source_path}" )
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\ " ?>
2018-10-22 10:17:08 -06:00
< 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 \ " >
2019-04-17 06:35:54 +02:00
< 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 >
2018-10-22 10:17:08 -06:00
< / P r o j e c t > " )
2019-04-17 06:35:54 +02:00
endif ( )
2018-10-22 10:17:08 -06:00
endif ( )