Commit Graph

546 Commits

Author SHA1 Message Date
Jeroen Bakker 597aecc016 MacOS: Update Min Requirement to 10.15.
A few weeks ago we enabled the Metal back-end for the viewport.
Due to metal, master is only able to build on MacOS 10.15 and above.
The previous minimum requirement is MacOS 10.13.

It was already planned to bump to a higher version for Blender 3.6. After
a short discussion via bf-committers it was decided that it is fine to bump it for
3.5 release.

This patch cleans up the CMake files and update the minimum requirement.

With this patch the next deprecations will be listsed.
- `NSOpenGLView`, `NSOpenGLContext` is deprecated. (replaced by metal)
- `NSStringPboardType` is replaced by `NSPasteboardTypeString`
- `NSTIFFPboardType` is replaced by `NSPasteboardTypeTIFF`
- `NSFilenamesPboardType` should be replaved by multiple pasteboard items with `NSPasteboardTypeFileURL` instead.
- `NSUserNotification` should be replaced with UserNotifications.frameworks API

Deprecations will be handled in separate tasks and commits. OpenGL won't be
fixed at this moment, as it will be phased out in the future. NSStringPboardType, NSTiffPboardType & NSFilenamesPboardType
 will be provided in a single patch. NSUserNotification will also be provided in
its own patch.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D16953
2023-01-10 15:01:16 +01:00
Brecht Van Lommel f9ddfffd6f Cleanup: compiler warnings 2023-01-04 11:20:02 +01:00
Brecht Van Lommel eb7ac996cc Build: install all shared libraries regardless of build options
There are dependencies between shared libraries, and Python modules which are
always installed on Linux and macOS can use these also.

Instead of adding logic for dealing with dependencies and conditional Python
module installs, just always install everything when using precompiled
libraries. This does not affect compile time which would be the main reason to
turn off build options, and it does not affect the case where system libraries
are used.
2023-01-04 11:20:02 +01:00
Brecht Van Lommel 65d8da97b8 Build: clear old linux centos7 cache variables instead of printing them
More automatic and convenient to update existing configurations this way.

Also move into platform_old_libs_update.cmake where similar logic was put
already.
2023-01-04 11:20:02 +01:00
Ray Molenkamp cef5841e12 Cmake: Fix building with WITH_WINDOWS_BUNDLE_CRT Off
When building without WITH_WINDOWS_BUNDLE_CRT the manifest
did not contain the blender.shared dependentAssembly leading
to missing dll errors at blender startup.
2022-12-21 13:25:02 -07:00
Campbell Barton 2ac6e26c25 Cleanup: cmake formatting 2022-12-17 13:33:27 +11:00
Campbell Barton 599c0db3ff Cleanup: indentation in CMake files 2022-12-16 23:47:35 +11:00
Campbell Barton 9a25c48f08 Build: resolve failure to copy indirect dependencies for USD on Linux
Even when building without OpenImageIO and OpenVDB, USD depends on these
libraries.

Ensure these libraries are copied when building with USD.
2022-12-16 23:31:50 +11:00
Campbell Barton 2c22795dfd Build: upgrade pre-built libraries for Linux
Replace ../lib/linux_centos7_x86_64 with ../lib/linux_x86_64_glibc_228,
built with Rocky8 Linux, compatible with the VFX platform CY2023,
see: T99618.

- Update build-bot configuration.
- Remove unnecessary check for Blosc, this is part of OpenVDB lib now.
- Remove WITH_CXX11_ABI, always use new C++11 ABI now
- Replace centos7 by glibc_228 everywhere

Note that existing builds with cached paths pointing to
"../lib/linux_centos7_x86_64" will need to be updated.

Includes contributions by Brecht.
2022-12-16 10:42:40 +11:00
Jeroen Bakker 9c0d822737 GPU: Compile vulkan shaders to Spir-V binaries.
Compile each static shader using shaderc to Spir-V binaries.

The main goal is to make sure that the GLSL created using ShaderCreateInfo and able to compile to Spir-V.
For the second stage a correct pipeline needs to be created and some shader would need more
adjustments (push constants size).

With this patch future changes to GLSL sources can already be checked against vulkan, without the
backend finished.

Mechanism has been tested using MacOS and MoltenVK. For other OS, we should finetune CMake
files to find the right location to shaderc.

```
************************************************************
*** Build Mon 12 Dec 2022 11:08:07 CET
************************************************************
Shader Test compilation result: 463 / 463 passed (skipped 118 for compatibility reasons)
OpenGL backend shader compilation succeeded.
Shader Test compilation result: 529 / 529 passed (skipped 52 for compatibility reasons)
Vulkan backend shader compilation succeeded.
```

Reviewed By: fclem

Maniphest Tasks: T102760

Differential Revision: https://developer.blender.org/D16610
2022-12-12 12:25:22 +01:00
Brecht Van Lommel fedef4c13a Fix cycles_test link error on macOS due to boost python in new 3.5 libraries
The executable would get boost python linking in when not needed, and even when
linking to Python libraries there were still unresolved symbols. Instead split
off boost python libraries and link them only where needed.
2022-12-07 20:45:47 +01:00
Brecht Van Lommel bbfb074155 Fix macOS tests failures with new libraries on buildbot
Don't assume a trailing slash in the install path.
2022-12-07 19:56:51 +01:00
Ray Molenkamp d384ad38bc cmake: fix windows debug build
debug library for yaml-cpp was set to an incorrect name
2022-12-07 09:22:32 -07:00
Brecht Van Lommel d8ffb4655c Fix missed libraries in auto CMake config update for 3.5 libraries 2022-12-07 15:37:06 +01:00
Ray Molenkamp 388bbc3290 Build: library updates for Blender 3.5
This updates the libraries dependencies for VFX platform 2023, and adds various
new libraries. It also enables Python bindings and switches from static to
shared for various libraries.

The precompiled libraries for all platforms will be updated to these new
versions in the coming weeks.

New:

Fribidi 1.0.12
Harfbuzz 5.1.0
MaterialX 1.38.6 (shared lib with python bindings)
Minizipng 3.0.7
Pybind11 2.10.1
Shaderc 2022.3
Vulkan 1.2.198

Updated:

Boost 1.8.0 (shared lib)
Cython 0.29.30
Numpy 1.23.2
OpenColorIO 2.2.0 (shared lib with python bindings)
OpenImageIO 2.4.6.0 (shared lib with python bindings)
OpenSubdiv 3.5.0
OpenVDB 10.0.0 (shared lib with python bindings)
OSL 1.12.7.1 (enable nvptx backend)
TBB (shared lib)
USD 22.11 (shared lib with python bindings, enable hydra)
yaml-cpp 0.8.0

Includes contributions by Ray Molenkamp, Brecht Van Lommel, Georgiy Markelov
and Campbell Barton.

Ref T99618
2022-12-07 15:28:17 +01:00
Ray Molenkamp 6d27a2ff76 Windows: install shared libraries in blender.shared
Instead of the the same folder as the Blender executable, generate a manifest
that lets us move the libraries out of the way of users and into a separate
folder.

Ref T99618
2022-12-07 15:28:17 +01:00
Brecht Van Lommel ebff39d5bb Build: make running executables as part of build/tests work with shared libs
Ensure the environment is set up for blender_test, idiff and oslc so that they
can find the required shared libraries.

Also deduplicate add_bundled_libraries() between Linux and macOS.

Includes contributions by Ray Molenkamp and Brecht Van Lommel.

Ref T99618
2022-12-07 15:28:17 +01:00
Brecht Van Lommel 0302ab4e02 Fix link error on Linux + Clang due to missing atomic symbols
The new atomic disjoint set uses additional atomics which are not supported
as intrinsics on all architectures and require linking to libatomic.

Now always link to libatomic on Linux when it is available, instead of only
checking if atomic add for int64_t requires linking to this library.

Thanks to Sergey for the help fixing this.
2022-12-02 18:27:07 +01:00
Nikita Sirgienko f07b09da27 Cycles: Improve oneAPI backend support for non-Intel platforms 2022-11-25 17:46:59 +01:00
Jeroen Bakker dd5fdb9370 GPU: Add MoltenVK as dependencies to Vulkan SDK.
MoltenVK is part of the vulkan SDK. Blender requires the vulkan SDK
to compile. This patch adds the MoltenVK includes and libraries to
the Vulkan includes and libraries.
2022-11-22 14:07:34 +01:00
Jeroen Bakker 6dac345a64 GHOST: Vulkan Backend.
This adds a vulkan backend to GHOST. The code was extracted from the
tmp-vulkan branch. The main difference with the original code is that
GHOST isn't responsible for fallback. For Metal backend there is already
an idea that the GPU module is responsible for the fallback, not the system.

For Blender we target Vulkan 1.2 at the time of this patch.
MoltenVK (needed to convert Vulkan calls to Metal) has been added as
a separate package.

This patch isn't useful for end-users, currently when starting blender with
`--gpu-backend vulkan` it would crash as the `VBBackend` doesn't initialize
the expected global structs in the GPU module.

Validated to be working on Windows and Apple. Linux still needs to be tested.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13155
2022-11-22 11:29:09 +01:00
Patrick Mours e6b38deb9d Cycles: Add basic support for using OSL with OptiX
This patch  generalizes the OSL support in Cycles to include GPU
device types and adds an implementation for that in the OptiX
device. There are some caveats still, including simplified texturing
due to lack of OIIO on the GPU and a few missing OSL intrinsics.

Note that this is incomplete and missing an update to the OSL
library before being enabled! The implementation is already
committed now to simplify further development.

Maniphest Tasks: T101222

Differential Revision: https://developer.blender.org/D15902
2022-11-09 15:30:21 +01:00
Campbell Barton d5ce854fb1 CMake: workaround unsupported cmake_path(IS_PREFIX ..) in v3.20
Add a macro that implements something similar to cmake_path's IS_PREFIX
which isn't supported in older versions of CMake.

This caused the build-bot to fail.
2022-11-03 16:57:38 +11:00
Campbell Barton 6377d00a61 Cleanup: cmake comment line length 2022-11-03 12:11:08 +11:00
Campbell Barton 4d139601ba CMake: mark Wayland variables advanced 2022-11-01 12:48:57 +11:00
Brecht Van Lommel e7a6917617 Build: add option to error when features can't be enabled
This is to help ensure buildbot builds are correct, while still gracefully
disabling features in user/developer builds.

* Add WITH_STRICT_BUILD_OPTIONS to give an error when features can't be
  enabled due to missing libraries or other reasons. Add new macro
  set_and_warn_library_found used everywhere features were being
  automatically disabled.

* Remove code from Windows and macOS for various libraries that would
  automatically disable features. set_and_warn_library_found could be
  used here also, but we are generally assuming the precompiled libraries
  are complete and only test for availability when libraries are just
  added.

Differential Revision: https://developer.blender.org/D16104
2022-10-21 20:04:47 +02:00
Sergey Sharybin 56d1f0772d Fix missing OpenMP in Linux builds
OpenSubdiv OpenMP detection was interfering, but we don't use it there
anymore so just remove that code.
2022-10-21 20:04:47 +02:00
Ray Molenkamp 3ccec47841 cmake/windows: Prepare for 3.4 library changes for opencollada
The opencollada dependency will be using an external xml2 library
for 3.4. This change allows to build against both old and new
style lib folders.

As it is a C library it did not need a special debug version.
2022-10-21 07:04:21 -06:00
Ray Molenkamp 21deba56aa Build: update various libraries for 3.4, fixing bugs and security issues
THis is bumping dependencies to fix known CVEs, with the exception of
OpenImageIO which also includes bugfixes for performance and correctness
with some image types.

zlib 1.2.12 -> 1.2.13
freetype 2.11.1 -> 2.12.1
openimageio 2.3.13.0 -> 2.3.20.0
python 3.10.2 -> 3.10.8
openjpeg 2.4.0 -> 2.5.0
ffmpeg 5.0 -> 5.1.2
sndfile 1.0.28 -> 1.1.0
xml2 2.9.10 -> 2.10.3
expat 2.4.4 -> 2.4.9
openssl 1.1.1g/i -> 1.1.1q
sqlite 3.31.1 -> 3.37.2

Notable changes:
* AOM: the hack we had in place to make it not detect pthreads on windows no
  longer worked with a more recent cmake version. Disabled pthreads with a
  diff on Windows.
* Python: embedded copy of zlib 2.1.12 swapped out for our 2.1.13 copy with
  some folder manipulation on Windows.
* Freetype: was harbouring a copy of zlib 2.1.12 as well, so that had to end.
* FFmpeg: patch used to fix D11796 is no longer needed. Add new patch to deal
  with simple_idct.asm generating an object file with no sections in it,
  backport from upstream commit.
* TinyXML: still being downloaded but no longer used by OpenColorIO, removed.
* GMP applied upstream patch to fix CVE-2021-43618, as there is no release yet.
* SQLite and Libsndfile patches no longer needed.

Includes contributes by Ray Molenkamp, Campbell Barton and Brecht Van Lommel.

Ref T101403

Differential Revision: https://developer.blender.org/D16269
2022-10-20 13:56:01 +02:00
Ray Molenkamp 303dd263e2 Build: update OSL to version 1.12.6.2
Required changes to make OSL pick up the new oslnoise library.

Ref D16269, T101403
2022-10-20 13:56:01 +02:00
Xavier Hallade d763e294fc Cycles: oneAPI: fix libsycl.so files harvesting
was missing libsycl.so.5.7.0-16 when using such version.
2022-10-19 16:42:10 +02:00
Brecht Van Lommel 3eaf2b7fc6 Fix OpenPGL and OneAPI being detected by CMake when Cycles is disabled 2022-10-17 14:34:25 +02:00
Brecht Van Lommel baa9a00f5f Fix Wayland not being disabled when dependencies are not found 2022-10-17 14:34:25 +02:00
Sebastian Parborg c425599216 Fix linker order of X11 and Wayland libs
For some compiler and linker configurations, linking would fail as the
wayland libs were linked at a high level and not at the actual code
where they were needed.

After talking to Campbell, we decided to clean up this part and now
only link both the X11 and Wayland libs where they are used.
2022-10-11 14:52:35 +02:00
Campbell Barton d779792977 Build: reference bundled wayland and libdecor headers
When using pre-compiled libs, reference the bundled wayland headers,
needed so the headers from the bundled wayland-scanner are compatible.

Part of D16091.
2022-10-08 08:00:17 +11:00
Xavier Hallade 3714d3c3ce Cycles: link oneAPI backend with debug version of sycl when in Debug
It fixes SYCL runtime issues in Debug builds that were due to mixing
Release and Debug MSVC runtimes.
This commit also removes specific handling of dpcpp compiler executable
to simplify the CMake implementation. Using it like clang++ works and
clang++ executable is also available from Intel oneAPI DPC++ compiler in
case it doesn't.
2022-10-07 16:14:50 +02:00
Xavier Hallade 7eeeaec6da Cycles: use direct linking for oneAPI backend
This is a minimal set of changes, allowing a lot of cleanup that can
happen afterward as it allows sycl method and objects to be used outside
of kernel.cpp.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D15397
2022-10-07 09:50:05 +02:00
Brecht Van Lommel ea95d04245 Build: integrate OpenPGL into platform files like other libraries
To avoid issues with install_deps. If we more generally switch to using
CMake configs then perhaps this code can be deduplicated again or at
least simplified.
2022-10-04 20:24:27 +02:00
Campbell Barton 0c282c068f Cleanup: cmake indentation 2022-09-29 13:32:16 +10:00
Brecht Van Lommel e191cf89b2 Fix macOS cmake warning about missing OpenAL, after Python module changes 2022-09-28 14:39:25 +02:00
Campbell Barton cbab734445 Build: add wayland to deps build
This is needed to ensure and up to date "wayland-scanner" is used,
as versions before 1.20.0 generate headers incompatible with
dynamic linking (WITH_GHOST_WAYLAND_DYNLOAD).

As the centos7 version of wayland is 1.15 so make this part of Blender's
dependencies on Linux.

We intend to enable Wayland for Blender 3.4 release, this is needed for
the build-bot.

Reviewed By: brecht

Ref D16074
2022-09-27 19:22:07 +10:00
Campbell Barton 2edb8ab739 Revert "Cleanup: remove redundant WITH_GHOST_WAYLAND check"
This reverts commit 7fa7c7ceda.

The check was not redundant, it accounted for wayland not being found.
2022-09-27 11:53:12 +10:00
Campbell Barton 7fa7c7ceda Cleanup: remove redundant WITH_GHOST_WAYLAND check 2022-09-27 09:14:24 +10:00
Campbell Barton bcb7b119ae Cleanup: remove workarounds and version checks for unsupported compilers
Match minimum supported versions from the WIKI [0] by raising them to:

- GCC 9.3.1
- CLANG 8.0
- MVCS 2019 (16.9.16 / 1928)

Details:

- Add CMake checks that ensure supported compiler versions early on.
- Previously GCC per-processor version checks served to exclude
  `__clang__`, in some cases this has been replaced by explicitly
  excluding `__clang__`. This was needed as CLANG treated some of these
  flags differently to GCC, causing the build to fail.
- Remove USE_APPLE_OMP_FIX GCC-4.2 OpenMP workaround.
- Remove linking error workaround for old MSVC versions.

[0]: https://wiki.blender.org/wiki/Building_Blender

Reviewed by: brecht, LazyDodo

Ref D16068
2022-09-27 07:05:13 +10:00
Campbell Barton 998ace3463 Cleanup: use lowercase function calls & macros in for CMake
This is already the case for most CMake usage.
Although some find modules are an exception to this, as they were
originally maintained externally they use some different conventions.

Also corrected bad indentation in: intern/cycles/CMakeLists.txt
2022-09-23 14:33:44 +10:00
Campbell Barton 09308c4b6a CMake: fail to build with unsupported versions of wayland-scanner
When WITH_GHOST_WAYLAND_DYNLOAD is enabled.
2022-09-20 12:53:06 +10:00
Brecht Van Lommel 0ffd288fab Build: fix gtest build flags affecting actual library
Switch to target_ functions to avoid this.
2022-09-18 11:26:34 +02:00
Brecht Van Lommel 9f76d0c8e6 Python: script for packing bpy module as wheel
The buildbot will call this script to create a binary .whl file that can be
easily installed through pip.

This wheel will only work with the same Python version used for Blender.
Other minimum system requirements are the same as regular Blender builds.

Includes contributions by Campbell Barton.

Differential Revision: https://developer.blender.org/D15957
2022-09-15 18:27:03 +02:00
Brecht Van Lommel f70fac6382 Python: fix failing bpy build with full release config on Windows
* Fix issue with different build and install paths.
* Fix issue with oneAPI kernel build.

Ref D15957
2022-09-15 18:27:02 +02:00
Brecht Van Lommel 5228b0b74f Python: fix failing tests when building bpy module
* Use Python executable from lib folder since it's not installed.
* Make bpy module test work for portable install.
* Disable gtests which don't work with different Python link flags
  and shared library locations.

Ref D15957
2022-09-15 18:27:01 +02:00
Campbell Barton 7bd60d40ef CMake: warn when "bpy" installs into the site-packages from LIBDIR
Using "../lib" as a target is unlikely to be useful,
add a warning & suggest alternatives.
2022-09-14 14:06:41 +10:00
Brecht Van Lommel 3839a4dd84 Fix broken Cycles Metal build after recent changes
It was unable to find the Metal framework, thanks to Alaska for tracking
this down.
2022-09-13 13:52:14 +02:00
Sergey Sharybin cca416cfe6 Fix compilation on Linux, glibc 2.34, and CentOS libraries
A continuation of previous fix for malloc hooks which got removed
from the new glibc library.

The pre-compiled jemalloc has definitions which interpose hooks
in glibc leading to linking errors with multiple hook definitions.

A simple fix is to skip doing the workaround when using jemalloc
from pre-compiled libraries.

This will likely be revisited in the future, but for now it is
important to fix compilation errors for developers.
2022-09-13 10:38:42 +02:00
Brecht Van Lommel 2c23b4e0bf Python: on macOS, stop requiring framework for building bpy module
Build against Python from precompiled libraries by default, instead of
requiring framework from python.org package install. The resulting bpy module
can still be used with any Python install of the same version.

Use the same CMake find module as Linux. This simplifies code, and makes it
possible to manually set PYTHON_* variables in CMake configuration.

Remove WITH_PYTHON_FRAMEWORK option for regular Blender build, as this doesn't
work well due to missing required Python packages. Advanced users can still
set PYTHON_ROOT_DIR=/Library/Frameworks/Python.framework/Versions/3.10 for
the same result.
2022-09-10 13:47:48 +02:00
Brecht Van Lommel 7fbf72f148 Build: automatically disable WITH_GHOST_WAYLAND if missing libraries
Same as other build options, don't make it a hard requirement to have
Wayland libraries installed when it gets enabled by default.

Also fixes wayland-protocols not being found on the buildbot.
2022-08-29 19:51:07 +02:00
Brecht Van Lommel a87d3edb98 Build: add system for shipping with dynamic libraries on Linux and macOS
PLATFORM_BUNDLED_LIBRARIES gathers shared libraries that will be installed
to the lib/ folder. The Blender executable gets a relative rpath pointing to
this folder as part of the install step.

The build rpath is different and uses absolute paths, so that it works for
executables like tests that are in different locations, and to support the
case where the build and install folders are different.

The system is already used for the OpenMP library on macOS. But on Linux it
will only kick in once we start using shared libraries for dependencies.

This also removes Mesa libraries from the old location, as these would cause
Blender to start with software OpenGL.

Ref T99618
2022-08-23 15:27:16 +02:00
Campbell Barton 2a2ca3292a CMake: always unset CMAKE_REQUIRED_* variables after use
Always unset these variables after use as they could interfere with
other checks made afterwards.
2022-08-18 10:01:27 +10:00
Christian Rauch a296b8f694 GPU: replace GLEW with libepoxy
With libepoxy we can choose between EGL and GLX at runtime, as well as
dynamically open EGL and GLX libraries without linking to them.

This will make it possible to build with Wayland, EGL, GLVND support while
still running on systems that only have X11, GLX and libGL. It also paves
the way for headless rendering through EGL.

libepoxy is a new library dependency, and is included in the precompiled
libraries. GLEW is no longer a dependency, and WITH_SYSTEM_GLEW was removed.

Includes contributions by Brecht Van Lommel, Ray Molenkamp, Campbell Barton
and Sergey Sharybin.

Ref T76428

Differential Revision: https://developer.blender.org/D15291
2022-08-15 16:10:29 +02:00
Campbell Barton dfbba7c0eb Cleanup: CMake file indentation 2022-08-09 13:37:29 +10:00
Sebastian Parborg 0830320a7c CMake: Check if freetype is compiled with brotli support
Because of the recent changes to our core fonts,
Freetype has to support Woff2 fonts or Blender will segfault on startup.

This adds an explicit check for this to inform people compiling Blender
about this requirement.
2022-08-02 14:50:38 +02:00
Brecht Van Lommel cfd16c04f8 Build: hide all symbols except a few required ones on Linux
Instead of specifying which symbols to hide, we hide all and make a few
visible. Some users may be relying on calling internal Blender functions,
but Windows is already hiding all of them and this is just not supported.

Fixes T99900: crash with some third-party Python libraries since OneAPI

Ref T76442

Differential Revision: https://developer.blender.org/D14971
2022-07-29 17:54:32 +02:00
Ray Molenkamp aa788b759a deps: FFmpeg vpx/aom-av1 updates
This is a refresh of our current FFmpeg 5.0.0 (unchanged) version with the
following changes:

* libvpx all platforms: enable SSE3/4/AVX/AVX2 instruction sets. libvpx has a
  proper CPUID check in place and will not call the faster kernels unless it is
  sure the CPU supports it. So we can safely enable this, this partially
  resolves T95743 (completely on Linux and macOS).

* libvpx Windows - threading was disabled due to a shared dependency on
  libwinpthreads.dll which we prefer not to distribute. However when configure
  cannot find pthreads it will happily fall back on a win32 threads based
  emulation layer. This also resolves the final part of T95743.

* libaom-av1 - new dependency required for D14920, this is a somewhat odd
  dependency, it's cmake based, but still needs the perl environment setup, so
  we have to setup the env and call cmake our selves for the configure, build
  and install commands. This dep has the same libwinpthreads issue as vpx on
  Windows, however since it's cmake based, it's easier to prevent cmake from
  detecting it.

Differential Revision: https://developer.blender.org/D15399
2022-07-26 13:25:58 +02:00
Campbell Barton e58e023e1a GHOST/Wayland: support dynamic loading libraries for Wayland
Add intern/wayland_dynload which is used when WITH_GHOST_WAYLAND_DYNLOAD
is enabled (off by default). When enabled, systems without Wayland
installed will fall back to X11.

This allows Blender to dynamically load:
- libwayland-client
- libwayland-cursor
- libwayland-egl
- libdecor-0 (when WITH_GHOST_WAYLAND_LIBDECOR is enabled).
2022-07-06 15:30:47 +10:00
Xavier Hallade a02992f131 Cycles: Add support for rendering on Intel GPUs using oneAPI
This patch adds a new Cycles device with similar functionality to the
existing GPU devices.  Kernel compilation and runtime interaction happen
via oneAPI DPC++ compiler and SYCL API.

This implementation is primarly focusing on Intel® Arc™ GPUs and other
future Intel GPUs.  The first supported drivers are 101.1660 on Windows
and 22.10.22597 on Linux.

The necessary tools for compilation are:
- A SYCL compiler such as oneAPI DPC++ compiler or
  https://github.com/intel/llvm
- Intel® oneAPI Level Zero which is used for low level device queries:
  https://github.com/oneapi-src/level-zero
- To optionally generate prebuilt graphics binaries: Intel® Graphics
  Compiler All are included in Linux precompiled libraries on svn:
  https://svn.blender.org/svnroot/bf-blender/trunk/lib The same goes for
  Windows precompiled binaries but for the graphics compiler, available
  as "Intel® Graphics Offline Compiler for OpenCL™ Code" from
  https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html,
  for which path can be set as OCLOC_INSTALL_DIR.

Being based on the open SYCL standard, this implementation could also be
extended to run on other compatible non-Intel hardware in the future.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D15254

Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Stefan Werner <stefan.werner@intel.com>
2022-06-29 12:58:04 +02:00
Christian Rauch bd6912930f Build: when using Wayland, always enable EGL and disable system GLEW
GLEW does not support GLX and EGL at the same time, and the distribution version
is likely to have GLX.

This also refactors the code so all OpenGL related CMake options are together.

Differential Revision: https://developer.blender.org/D12034
2022-06-28 16:54:45 +02:00
Campbell Barton 3a8fa77c1f GHOST/Wayland: Add a build time option for DBUS, disable by default
Add WITH_GHOST_WAYLAND_DBUS option, so Blender can be built without
DBUS support. Currently it's only used to access the cursor theme.
Without this the "default" cursors are used instead.

Disabling this since it adds an additional dependency for a minor gain
in functionality, with the benefit of removing a library requirement.

There is also a problem where Blender hangs on startup for ~5 seconds
when DBUS isn't running. Eventually it would be good to be able to avoid
this problem without a build option.
2022-06-27 16:49:21 +10:00
Christian Rauch 29755e1df8 GHOST/Wayland: support client-side window decorations
This implements client-side window decorations for moving and resizing
windows and HiDPI support.

This functionality depends on the external project 'libdecor' that is
currently a build option: WITH_GHOST_WAYLAND_LIBDECOR.

Reviewed by: brecht, campbellbarton

Ref D7989
2022-06-25 00:10:39 +10:00
Harley Acheson ddbac88c08 Win32: Dark Mode Title Bar Color
Blender will respect Windows "Dark Mode" setting for title bar color.

See D14847 for details.

Differential Revision: https://developer.blender.org/D14847

Reviewed by Ray Molenkamp
2022-05-04 20:19:10 -07:00
Brecht Van Lommel a7db7f88b0 Fix CMake error in new builds after previous NanoVDB fix 2022-04-29 15:38:21 +02:00
Brecht Van Lommel a111a0f1e1 Fix missing NanoVDB patch for HIP support, after unifying with OpenVDB
This patch has also been contributed upstream, so will not be needed anymore
soon. Also automatically clear cached variables for new nanovdb location in
libs.
2022-04-29 15:12:46 +02:00
Brecht Van Lommel 0539208f97 Fix T97666: Blender not starting on macOS 10.14 after library upgrade 2022-04-28 00:24:10 +02:00
Sybren A. Stüvel 1640fbe7c6 CMake: add `^NANOVDB` to variables to reset after library upgrade
Cycles needed this to build properly after switching to the newly built
libraries.
2022-04-25 14:28:06 +02:00
Brecht Van Lommel 604c33e694 Build: updates for Blender to build against new 3.2 libraries
Building against the existing 3.1 libraries should continue to work, until
the precompiled libraries are committed for all platforms.

* Enable WebP by default.
* Update Windows for new library file names.
* Automatically clear outdated CMake cache variables when upgrading to new
  libraries.
* Fix static library linking order issues on Linux for OpenEXR and OpenVDB.

Implemented by Ray Molenkamp, Sybren Stüvel and Brecht Van Lommel.

Ref T95206
2022-04-20 16:42:16 +02:00
Brecht Van Lommel fc58368263 Build: link with GameController and CoreHaptics frameworks on macOS
In preparation of upcoming SDL upgrade, which uses these.
2022-04-18 19:14:36 +02:00
Patrick Mours f60cffad38 Cycles: Use USD dependencies when building Hydra render delegate
Adds support for linking with some of the dependencies of a USD
build instead of the precompiled libraries from Blender, specifically
OpenSubdiv, OpenVDB and TBB. Other dependencies keep using the
precompiled libraries from Blender, since they are linked statically
anyway so it does't matter as much. Plus they have interdependencies
that are difficult to resolve when only using selected libraries from
the USD build and can't simply assume that USD was built with all
of them.

This patch also makes building the Hydra render delegate via the
standalone repository work and fixes various small issues I ran into
in general on Windows (e.g. the use of both fixed paths and
`find_package` did not seem to work correctly). Building both the
standalone Cycles application and the Hydra render delegate at the
same time is supported now as well (the paths in the USD plugin JSON
file are updated accordingly).

All that needs to be done now to build is to specify a `PXR_ROOT`
or `USD_ROOT` CMake variable pointing to the USD installation,
everything else is taken care of automatically (CMake targets are
loaded from the `pxrTargets.cmake` of USD and linked into the
render delegate and OpenSubdiv, OpenVDB and TBB are replaced
with those from USD when they exist).

Differential Revision: https://developer.blender.org/D14523
2022-04-05 17:23:52 +02:00
Ray Molenkamp 59de9ceda0 MSVC: Fix build issue with webp
The webp variables should only be set if
the libs actually exist in the lib folder
2022-03-25 07:31:15 -06:00
Aaron Carlisle 4fd0a69d7b ImBuf: Add support for WebP image format
Currently only supports single image frames (no animation possible).

If quality slider is set to 100 then lossless compression will be used,
otherwise lossy compression is used.

Gives about 35% reduction of filesize  save when re-saving splash screens with lossless
compression.
Also saves much faster, up to 15x faster than PNG with a better compression ratio as a plus.

Note, this is currently left disabled until we have WebP libs (see T95206)

For testing precompiled libs can be downloaded from Google:
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html

Differential Revision: https://developer.blender.org/D1598
2022-03-24 18:24:06 -04:00
Patrick Mours d350976ba0 Cycles: Add Hydra render delegate
This patch adds a Hydra render delegate to Cycles, allowing Cycles to be used for rendering
in applications that provide a Hydra viewport. The implementation was written from scratch
against Cycles X, for integration into the Blender repository to make it possible to continue
developing it in step with the rest of Cycles. For this purpose it follows the style of the rest of
the Cycles code and can be built with a CMake option
(`WITH_CYCLES_HYDRA_RENDER_DELEGATE=1`) similar to the existing standalone version
of Cycles.

Since Hydra render delegates need to be built against the exact USD version and other
dependencies as the target application is using, this is intended to be built separate from
Blender (`WITH_BLENDER=0` CMake option) and with support for library versions different
from what Blender is using. As such the CMake build scripts for Windows had to be modified
slightly, so that the Cycles Hydra render delegate can e.g. be built with MSVC 2017 again
even though Blender requires MSVC 2019 now, and it's possible to specify custom paths to
the USD SDK etc. The codebase supports building against the latest USD release 22.03 and all
the way back to USD 20.08 (with some limitations).

Reviewed By: brecht, LazyDodo

Differential Revision: https://developer.blender.org/D14398
2022-03-23 16:39:05 +01:00
Brecht Van Lommel f130d4f211 Cleanup: fix various typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D14203
2022-03-07 17:28:39 +01:00
Sergey Sharybin b861d3e4c1 Merge branch 'blender-v3.1-release' 2022-02-22 16:08:38 +01:00
Sergey Sharybin ca991e3012 Fix compilation error on certain platforms
Atomic operations performed by the C++ standard library might require
libatomic on platforms which do not have hardware support for those
operations.

This change makes it that such configurations are automatically detected
and -latomic is added when needed.

Differential Revision: https://developer.blender.org/D14106
2022-02-22 15:47:43 +01:00
Sebastian Parborg b6fe1b0c65 Merge branch 'blender-v3.1-release' 2022-02-17 18:44:18 +01:00
Sebastian Parborg a04300c436 Cleanup: Move more cmake library variables to be advanced
I noticed that there were a few variables that should not be visible per default.
It seems to me to simply be an oversight, so I went ahead and cleaned them up.

Reviewed By: Sybren, Ray molenkamp

Differential Revision: http://developer.blender.org/D14132
2022-02-17 18:42:06 +01:00
Campbell Barton 1df8a5f8fb File headers: use SPDX license for CMake files 2022-02-11 14:23:56 +11:00
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Campbell Barton 9f6b19526d Cleanup: spelling in comments
Also minor wording improvements.
2022-01-28 14:52:47 +11:00
Brecht Van Lommel 5400018106 Build: enable Python 3.10 on macOS 2022-01-27 15:03:11 +01:00
Ray Molenkamp 78f29c0467 cmake/windows: Enable Python 3.10 2022-01-27 06:57:25 -07:00
Ray Molenkamp 1edf520439 Windows: Retire MSVC 2017 support
The lower bar for building blender
is now MSVC 2019 16.9.16.
2022-01-26 17:56:38 -07:00
Campbell Barton b3bf46b78d Revert "CMake: include BROTLI_LIBRARIES in FREETYPE_LIBRARIES on UNIX"
This reverts commit 086f191169.

There was apparently a problem using APPEND which wasn't referenced
in the commit log.

Added comment noting the reason for the discrepancy.
2022-01-26 20:51:04 +11:00
Campbell Barton 086f191169 CMake: include BROTLI_LIBRARIES in FREETYPE_LIBRARIES on UNIX
This was already done for APPLE & WIN32, which would
reference these libraries twice.

Now append BROTLI_LIBRARIES to FREETYPE_LIBRARIES when they're
required for linking.

No functional changes as all references to FREETYPE_LIBRARIES also
used BROTLI_LIBRARIES.
2022-01-26 16:00:55 +11:00
Campbell Barton 4c951bfa82 CMake: add WITH_SYSTEM_FREETYPE to link against the systems freetype 2022-01-26 15:31:30 +11:00
Campbell Barton 4530449317 CMake: resolve issues using pre-compiled & system libraries for Unix
When LIBDIR existed, searching for system libraries would always
first search 'LIBDIR'.

This meant "WITH_SYSTEM_*" would still prefer LIBDIR versions of
libraries if they exist.

The presence of LIBDIR also ignored the setting for WITH_STATIC_LIBS
which is now restored to the cached value once pre-compiled libraries
have been handled.
2022-01-26 15:20:32 +11:00
Sybren A. Stüvel 0477ca75f0 CMake/Linux: only link to brotli when using static precompiled libraries
The Brotli library only needs to be explicitly linked when using the
statically linked libraries. When using system libs they're shared, and
the .so loading mechanism takes care of dependencies.
2022-01-25 16:18:59 +01:00
Sybren A. Stüvel a000de7c2a CMake/Linux: find Brotli library the proper way
Use a `FindBrotli.cmake` module instead of manually appending library
paths.

This is just for Linux; Windows and macOS will be reviewed separately.
2022-01-25 11:34:13 +01:00
Sybren A. Stüvel 4c617c06e9 Linux/CMake: link `libbbrotli*.a` along with new FreeType
Add `libbrotlidec-static.a` and `libbrotlicommon-static.a` to the CMake
`$FREETYPE_LIBRARIES` variable; they'll be required when the Linux libs
for the FreeType upgrade lands (D13448).

The order of libraries is different compared to the similar lines in the
Windows and Apple CMake files, to prevent linker errors on Linux.
2022-01-24 15:44:03 +01:00
Brecht Van Lommel e07b217669 Build: update macOS for FreeType library with woff2 support
Ref D13448, T93161
2022-01-21 21:36:00 +01:00
Ray Molenkamp 9d274a609c cmake/win: Platform update for freetype 2.11.0
freetype now depends on brotli
2022-01-21 11:40:53 -07:00
Ray Molenkamp c20f209b1c Cmake/Deps: Freetype 2.11.0 / brotli 1.0.9
The UI team requested adding woff2 support to freetype.
this required a new dependency brotli.

This changes adds brotili to the builder and bumps
freetype to version 2.11.0

As freetype now depends on other libraries, for consistency
all use of ${FREETYPE_LIBRARY} in cmake has been updated to
use ${FREETYPE_LIBRARIES} adjustments have been made in the
windows platform file, all other platforms use cmake's
FindFreeType.cmake which already sets this variable.

reviewed by: brecht

Differential Revision: https://developer.blender.org/D13448
2022-01-21 10:26:05 -07:00
Campbell Barton e1e3043a51 CMake: resolve issue finding mold
The default installation path uses `libexec`, missed this as the
package for Arch replaces this with `lib`,
now both are checked.
2022-01-17 18:12:15 +11:00
Ankit Meel b87d87b1d3 macOS: fix llvm-ranlib invalid option error 2022-01-16 11:47:55 +05:30
Campbell Barton e69020ad0f CMake: only ever enable one alternative linker for UNIX/GCC
Since the option to enable linkers are booleans,
it's possible to enable them all at once.

Now only the first enabled + available linker is used
(with priority given to link is with better performance).
2022-01-15 16:40:24 +11:00
Campbell Barton 18c5d4ccb3 CMake: use LINKER flags instead of CFLAGS for setting the linker
Set the linker using CMAKE_*_LINKER_FLAGS instead of {C/CXX}FLAGS.

There is no advantage in using the CFLAGS to set the linker, it has the
downside of triggering a full rebuild when changing the linker.

Tested building Blender and the bpy.so Python module.

Ref D13833

Reviewed by: sergey, brecht
2022-01-15 16:12:13 +11:00
Ankit Meel ba48c1ee58 macOS: silence bundle identifier mismatch Xcode warning
Blender.xcodeproj User-supplied CFBundleIdentifier value
'org.blenderfoundation.blender' in the Info.plist must be the same as
the PRODUCT_BUNDLE_IDENTIFIER build setting value ''.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13826
2022-01-14 19:33:23 +05:30
Campbell Barton 8b3d798374 CMake: add WITH_LINKER_MOLD option for GCC/Clang Unix platforms
Can give considerably faster linking, especially on system with many
cores.

The mold linker recently reached 1.0, see:
https://github.com/rui314/mold

The current stable release of GCC can't use this linker via
-fuse-ld=mold, so this patch uses the "-B" argument to add a binary
directory containing an alternate "ld" command that points to
"mold" (which is part of the default mold installation).

Some timing tests for linking full builds for AMD TR 3970X:

- BFD: 20.78 seconds.
- LLD: 12.16 seconds.
- GOLD: 7.21 seconds.
- MOLD: 2.53 seconds.

Ref D13807

Reviewed by: sergey, brecht
2022-01-14 09:44:58 +11:00
Brecht Van Lommel 19a6220308 Fix link errors after recent FFMPEG / link_directories changes 2022-01-13 11:12:56 +01:00
Brecht Van Lommel 75a1a578bd CMake: use FFmpeg find module on Linux
And change install_deps.sh to build shared (instead of static) FFMPEG
libraries, for consistency with other library dependencies and to simplify
the logic. This may require users of install_deps.sh to rebuild FFMPEG.

This is the last step that lets us get rid of LIBPATH variables and
link_directories() entirely, as recommended by the CMake docs.

Some fixes were needed in the find FFMPEG module to make it actually work,
this code was unused up to now.

Followup to D8855.

Differential Revision: https://developer.blender.org/D9177
2022-01-13 10:27:11 +01:00
Brecht Van Lommel e594f23a27 Revert "CMake: use FFmpeg find module on Linux"
This reverts commit 62a0de1673. Linux buildbot
is giving link errors.
2022-01-12 19:07:40 +01:00
Brecht Van Lommel 62a0de1673 CMake: use FFmpeg find module on Linux
And change install_deps.sh to build shared (instead of static) FFMPEG
libraries, for consistency with other library dependencies and to simplify
the logic. This may require users of install_deps.sh to rebuild FFMPEG.

This is the last step that lets us get rid of LIBPATH variables and
link_directories() entirely, as recommended by the CMake docs.

Some fixes were needed in the find FFMPEG module to make it actually work,
this code was unused up to now.

Followup to D8855.

Differential Revision: https://developer.blender.org/D9177
2022-01-12 18:25:24 +01:00
Clément Foucault fb6bd88644 Revert "BLI: Refactor vector types & functions to use templates"
Includes unwanted changes

This reverts commit 46e049d0ce.
2022-01-12 12:50:02 +01:00
Clment Foucault 46e049d0ce BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:`float2`) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the `blender::math` namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

####Motivations:
 - We are aiming to share UBO and SSBO structures between GLSL and C++.
 This means we will use many of the existing vector types and others
 we currently don't have (uintX, intX). All these variations were
 asking for many more code duplication.
 - Deduplicate existing code which is duplicated for each vector size.
 - We also want to share small functions. Which means that vector
 functions should be static and not in the class namespace.
 - Reduce friction to use these types in new projects due to their
 incompleteness.
 - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a
 bit of a let down. Most clases are incomplete, out of sync with each
 others with different codestyles, and some functions that should be
 static are not (i.e: `float3::reflect()`).

####Upsides:
 - Still support `.x, .y, .z, .w` for readability.
 - Compact, readable and easilly extendable.
 - All of the vector functions are available for all the vectors types
 and can be restricted to certain types. Also template specialization
 let us define exception for special class (like mpq).
 - With optimization ON, the compiler unroll the loops and performance
 is the same.

####Downsides:
 - Might impact debugability. Though I would arge that the bugs are
 rarelly caused by the vector class itself (since the operations are
 quite trivial) but by the type conversions.
 - Might impact compile time. I did not saw a significant impact since
 the usage is not really widespread.
 - Functions needs to be rewritten to support arbitrary vector length.
 For instance, one can't call `len_squared_v3v3` in
 `math::length_squared()` and call it a day.
 - Type cast does not work with the template version of the `math::`
 vector functions. Meaning you need to manually cast `float *` and
 `(float *)[3]` to `float3` for the function calls.
 i.e: `math::distance_squared(float3(nearest.co), positions[i]);`
 - Some parts might loose in readability:
 `float3::dot(v1.normalized(), v2.normalized())`
 becoming
 `math::dot(math::normalize(v1), math::normalize(v2))`
 But I propose, when appropriate, to use
 `using namespace blender::math;` on function local or file scope to
 increase readability.
 `dot(normalize(v1), normalize(v2))`

####Consideration:
 - Include back `.length()` method. It is quite handy and is more C++
 oriented.
 - I considered the GLM library as a candidate for replacement. It felt
 like too much for what we need and would be difficult to extend / modify
 to our needs.
 - I used Macros to reduce code in operators declaration and potential
 copy paste bugs. This could reduce debugability and could be reverted.
 - This touches `delaunay_2d.cc` and the intersection code. I would like
 to know @howardt opinion on the matter.
 - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed.
 But according to @JacquesLucke it is not a real problem for now.

I would like to give a huge thanks to @JacquesLucke who helped during this
and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: https://developer.blender.org/D13791
2022-01-12 12:47:43 +01:00
Clément Foucault e5766752d0 Revert "BLI: Refactor vector types & functions to use templates"
Reverted because the commit removes a lot of commits.

This reverts commit a2c1c368af.
2022-01-12 12:44:26 +01:00
Clément Foucault a2c1c368af BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:float2) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the blender::math namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

Motivations:
- We are aiming to share UBO and SSBO structures between GLSL and C++.
  This means we will use many of the existing vector types and others we
  currently don't have (uintX, intX). All these variations were asking
  for many more code duplication.
- Deduplicate existing code which is duplicated for each vector size.
- We also want to share small functions. Which means that vector functions
  should be static and not in the class namespace.
- Reduce friction to use these types in new projects due to their
  incompleteness.
- The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a
  let down. Most clases are incomplete, out of sync with each others with
  different codestyles, and some functions that should be static are not
  (i.e: float3::reflect()).

Upsides:
- Still support .x, .y, .z, .w for readability.
- Compact, readable and easilly extendable.
- All of the vector functions are available for all the vectors types and
  can be restricted to certain types. Also template specialization let us
  define exception for special class (like mpq).
- With optimization ON, the compiler unroll the loops and performance is
  the same.

Downsides:
- Might impact debugability. Though I would arge that the bugs are rarelly
  caused by the vector class itself (since the operations are quite trivial)
  but by the type conversions.
- Might impact compile time. I did not saw a significant impact since the
  usage is not really widespread.
- Functions needs to be rewritten to support arbitrary vector length. For
  instance, one can't call len_squared_v3v3 in math::length_squared() and
  call it a day.
- Type cast does not work with the template version of the math:: vector
  functions. Meaning you need to manually cast float * and (float *)[3] to
  float3 for the function calls.
  i.e: math::distance_squared(float3(nearest.co), positions[i]);
- Some parts might loose in readability:
  float3::dot(v1.normalized(), v2.normalized())
  becoming
  math::dot(math::normalize(v1), math::normalize(v2))
  But I propose, when appropriate, to use
  using namespace blender::math; on function local or file scope to
  increase readability. dot(normalize(v1), normalize(v2))

Consideration:
- Include back .length() method. It is quite handy and is more C++
  oriented.
- I considered the GLM library as a candidate for replacement.
  It felt like too much for what we need and would be difficult to
  extend / modify to our needs.
- I used Macros to reduce code in operators declaration and potential
  copy paste bugs. This could reduce debugability and could be reverted.
- This touches delaunay_2d.cc and the intersection code. I would like to
  know @Howard Trickey (howardt) opinion on the matter.
- The noexcept on the copy constructor of mpq(2|3) is being removed.
  But according to @Jacques Lucke (JacquesLucke) it is not a real problem
  for now.

I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who
helped during this and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: http://developer.blender.org/D13791
2022-01-12 12:19:39 +01:00
Campbell Barton ebad1d8d33 CMake: exclude linker options for APPLE and non-UNIX
These are only used for non-apple unix systems.
2022-01-12 18:55:13 +11:00
Ankit Meel 4b8cf11fa5 macOS: fix xcrun sdk detection for minimal CLT
Differential Revision: https://developer.blender.org/D13783
2022-01-11 01:07:31 +05:30
Brecht Van Lommel 13af88b23f Build: clean up handling of some Cycles build options
* Don't link embree / OSL when WITH_CYCLES is disabled
* Simplify lite config by disabling Cycles as a whole using this
* Remove code handling the removed WITH_CYCLES_NETWORK option
2021-12-07 19:01:39 +01:00
luzpaz dea26253a0 cleanup: fix typos in comments and docs
Followup to https://developer.blender.org/D10288

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10346
2021-11-16 18:45:10 -05:00
Campbell Barton b849f290c5 Cleanup: capitalize ON/OFF with CMake 2021-11-04 14:50:24 +11:00
Ray Molenkamp ee3b4e8420 Windows: Fix VS2022 detection
VS2019 had a compiler update moving it into the
range that was used to detect VS2022. This patch
updates the detection to the current VS2022
preview compiler version.

Reported by Jesse Y on chat.
2021-09-09 17:19:58 -06:00
Ray Molenkamp 518b97e674 Windows/Ninja: Optimize linker performance
The /Zc:inline flag is by default off in the MSVC
compiler however when you build with msbuild it adds
it to the build flags on its own.

Ninja however does not decide on its own to add
flags you didn't ask for and was building without
this flag.

This change explicitly adds the compiler flag so
msbuild and ninja builds are once more building
with the same build flags leading to smaller .obj
files when building with ninja and lightening the
workload for the linker.

This flag is available starting MSVC 2013 update 2
so does not need to be guarded with version checks.
2021-08-25 10:55:45 -06:00
Lukas Stockner 2ea66af742 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 21:39:06 +02:00
Ankit Meel b83ee724a4 Fix T90418: macOS codesign fails with dylib next to executable
Change the dylib folder relative to `Blender` executable to be
the same as before rB652fbc200500497a67bd11d18b786587ba34e3d9 and same
as bpy.so : `@loader_path/../Resources/${BLENDER_VERSION}/lib`
2021-08-10 10:30:55 +05:30
Germano Cavalcante 89014b51f1 Xcode: support cmake options for grouping in folders
The Xcode IDE can also benefit from the options:
- WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS
- WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS

So add suport to these options and also renames them as they are no
longer limited to just Windows and Visual Studio.

Reviewed By: brecht, ankitm

Differential Revision: https://developer.blender.org/D12132
2021-08-05 15:31:41 -03:00
Campbell Barton 604ae5f7b6 Cleanup: tab indentation for CMake / GNUmakefile 2021-08-05 12:03:41 +10:00
Ankit Meel 18d900caca macOS: Fix OpenMP dynamic loader error. 2021-08-04 01:22:27 +05:30
Ankit Meel 652fbc2005 macOS: Portable builds with dynamic libraries.
For Blender.app: dropping libomp.dylib next to Blender executable is
enough for it getting picked up since `@executable_path` is an rpath.

For non-distributed binaries datatoc, makesdna, tests etc, code for
copying libomp.dylib to build folder is removed and replaced by
CMake's rpath option for *build* tree.

For bpy.so, the post build rpath change has also been replaced by CMake
rpath option for *install* tree.

Since -id has been changed in D11748, remove the
`install_name_tool -change ...` command.

Any dylib can just be dropped at `MAC_BLENDER_TARGET_DYLIBS_DIR`
hereafter. Appending dylib path to `CMAKE_BUILD_RPATH` will be needed
for datatoc etc if linked against one (instead of copying the
dylibs around).

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D11997
2021-08-03 20:49:40 +05:30
Brecht Van Lommel eccd8af828 Revert "GHOST/X11: enable EGL"
This is causing issues for some users launching Blender, because EGL indirectly
requires GLVND, which is not installed by default on e.g. Ubuntu.

This reverts commit 0b18a618b8.

Fixes T90374

Ref D12034
2021-08-02 17:19:17 +02:00
Christian Rauch 0b18a618b8 GHOST/X11: enable EGL
This will replace GLX with EGL for X11. GLEW does not support GLX and EGL
at the same time. Most distributions build GLEW with GLX support, so we
have to use the externally provided GLEW and build with EGL support.
This effectively sets WITH_SYSTEM_GLEW to OFF for all Linux configurations.

Differential Revision: https://developer.blender.org/D12034
2021-07-29 17:39:55 +01:00
Ankit Meel a9121640be macOS Cleanup: Remove old version specific code
Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D12021
2021-07-26 18:39:08 +05:30
Ray Molenkamp 7561e3dad0 CMake/win: Fix linker issue with OCIO
In certain CMake configurations it was possible
that OCIO gave linker errors due to it thinking
it was using the shared library rather than the
static library we ship.
2021-06-23 08:45:37 -06:00
Ray Molenkamp d443dcc733 Build/Windows: Preliminary VS 2022 support.
This adds preliminary VS 2022 support, since
there currently is no CMake version that
supports the VS2022 IDE only ninja support
was tested.

IDE support should work without any additional
changes as soon as an updated CMake becomes
available.

As VS2022 appears to keep binary compatibility
with earlier MSVC versions, the current SVN
libraries will work for this version.
2021-06-21 18:11:30 -06:00
Campbell Barton 0c75a98561 CMake: disable TBB when not found 2021-06-16 00:08:34 +10:00
Ray Molenkamp 9df1e0cad5 Fix: Build error with MSVC
rB4f81b4b4ce29 mistakenly left out the changes
to platform_win32.cmake causing a linker error
when WITH_GMP and WITH_TBB_MALLOC_PROXY were on.
2021-06-10 06:50:05 -06:00
Ray Molenkamp bfaf09b5bc Fix T88813: Scalable allocator not used on win10
Due to the way we ship the CRT on windows TBB's
malloc proxy was unable to attach it self to
the memory management functions on windows 10.

This change moves ucrtbase.dll out of the blender.crt
folder and back into the main blender folder to side
step some undesirable behaviour on win10 making TBB
once more able to attach it self.

Having this work again, should give a speed
boost in memory allocation heavy workloads
such as mantaflow.

For details on how this only failed on Win10
see T88813
2021-06-04 17:22:31 -06:00
Ray Molenkamp eb030204f1 windows/deps: Fix TBB build issues.
rB847579b42250 updated the TBB build script
which had some unintended consequences for
windows as the directory layout slightly
changed.

This change adjusts the builder to the new
structure, there are no version/functional
changes.
2021-06-04 09:16:03 -06:00
Christian Rauch d9aae38bc8 GHOST/wayland: get cursor settings via D-Bus 2021-06-03 18:18:27 +01:00
Christian Rauch b5d7fb813f cmake: use absolute path for Wayland libraries 2021-06-03 18:18:27 +01:00
Ray Molenkamp aebeb85fe0 Windows: Clean-up win 8/8.1 API use
For 2.93 we bumped the minimum windows requirement
to windows 8.1, but did not do any clean-up of any
win 8/8.1 API usage we dynamically accessed though
LoadLibrary/GetProcAddress.

This patch bumps _WIN32_WINNT to 0x0603 (win 8.1)
and cleans up any API use that was accessed in a
more convoluted way than necessary

Differential Revision: https://developer.blender.org/D11331

Reviewed by: harley, nicholas_rishel
2021-05-31 08:56:57 -06:00
Ankit Meel 2e7d3ad7b5 macOS build: set minimum deployment target correctly
Make `CMAKE_OSX_DEPLOYMENT_TARGET` independent of buildbot settings and
always set to `OSX_MIN_DEPLOYMENT_TARGET`. That fixes the launch error
on OS older than buildbot's.
Remove unused `MACOSX_DEPLOYMENT_TARGET`.

Fix T88419
Diff D11323
2021-05-20 21:55:58 +05:30
Ankit Meel 1a100d2d78 Cleanup/CMake: tweak messages in platform_apple 2021-04-01 01:13:22 +05:30
Ankit Meel f061de9b3e Cleanup/CMake: warning to status to reduce noise
Correction in e5f0d176d4
2021-04-01 01:12:48 +05:30
Ankit Meel e5f0d176d4 CMake: issue warnings when changing options
Only done in top level CMakeLists, and platform_apple.

Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D10343
2021-03-30 20:28:45 +05:30
Ray Molenkamp f9eaf93d37 MSVC: ASAN support for VS 16.9
This enables ASAN support when used with VS 16.9
enable as usual in cmake with the WITH_COMPILER_ASAN
option, or when using make.bat just tag on `asan'
to the invocation, ie: `make lite 2019 asan`

MSVC: Asan support for 16.9

This enables ASAN support when used with VS 16.9
enable as usual in cmake with the WITH_COMPILER_ASAN
option, or when using make.bat just tag on `asan'
to the invocation, ie: `make lite 2019 asan`

Differential Revision: https://developer.blender.org/D7794
Reviewed By: brecht, sergey
2021-03-29 19:11:17 -06:00
Ankit Meel 77ac67dae4 Cleanup/CMake: remove trailing `/`; whitespace. 2021-03-29 22:24:33 +05:30
Ankit Meel 0ec82477af macOS/bpy: install into site-packages
Reviewed By: #platform_macos, brecht
Maniphest Tasks: T86579
Differential Revision: https://developer.blender.org/D10664
2021-03-27 01:14:45 +05:30
Ankit Meel 2600b27d26 Cleanup/CMake: Fix comment, sort order of options. 2021-03-23 12:11:46 +05:30
Jörg Müller d33339ebf4 Audaspace: add support for PulseAudio on Linux
This adds PulseAudio as audio backend on Linux.
PulseAudio is the main audio engine used on most,
if not all, Linux distributions today.

Ref T86590
2021-03-16 23:21:45 +01:00
Sebastián Barschkis e9e53ff3a6 Cleanup: Removed duplicate slash in macOS SDK path
Cleanup although it's harmless.
2021-03-08 11:55:35 +01:00
Brecht Van Lommel f39143bc2e CMake: reduce Neon related output on Intel platforms
* Only try to find sse2neon if Neon detected
* Only run Neon support test once
2021-03-01 19:43:54 +01:00
Sebastián Barschkis e00a87163c CMake/deps: Adjust OSL shader directory
The location of the shaders changed with OSL 1.11.10. This commit is therefore in addition to D10212.

@sybren With the latest SVN libraries, I am fairly certain there is a "OSL not found" in the CMake output. Can you check on Linux?

@LazyDodo Since you haven't pushed the new OSL libs yet, this should not be a problem on Windows. So this will only be needed whenever those land.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D10552
2021-02-26 21:35:54 +01:00