Commit Graph

2654 Commits

Author SHA1 Message Date
Ray Molenkamp f637b47064 MSVC: Enable clang-tidy analyser
This enables the use of clang-tidy in the VS IDE.

To use it:

1 - Enable WITH_CLANG_TIDY in your cmake configuration
2 - From the Analyse pull down menu select Run Code Analysis on...

The analyser is currently not enabled by default on build
given it is quite slow and there are quite a few problems
it reports that we still need to deal with.
2020-12-03 11:00:58 -07:00
Sebastián Barschkis f8d1378b84 Deps: Additional changes for PugiXML on macOS
This commit expands the Windows-specific code in rBdca9aa0053f7 and Linux-specific code in rB33b7d53df08a.

It also fixes a capitalization issue in FindPugiXML.cmake
2020-12-02 15:18:05 +01:00
Sergey Sharybin 1176591574 Codesign: Allo non-zero exit code for signtool on Windows 2020-12-01 17:16:48 +01:00
Sybren A. Stüvel 33b7d53df0 Deps: Add PugiXML as an official dependency
PugiXML was historically shipped hidden embedded into OIIO, the Grease
Pencil team had a requirement for an XML library recently so pugi seems
like a natural choice since it's not really a 'new' library, we just
turn an implicit dependency into an explicit one.

This commit expands the Windows-specific code in rBdca9aa0053f7 to
include Linux. macOS support will be handled in a later commit.

NOTE: run `cmake -U'*PUGIXML*' .` in the build directory to ensure CMake
finds PugiXML in the new location.

For details see D8628
2020-12-01 16:25:51 +01:00
Ray Molenkamp 83c872085d Windows/Ninja: allow parameters for rebuild.cmd
The windows build leaves a convenience helper script
in the build folder called, rebuild.cmd. This change
passes any parameters you give rebuild.cmd to ninja
so you can easily pass it additional parameters without
having to edit the batch file manually.
2020-11-30 08:22:50 -07:00
Ray Molenkamp dca9aa0053 Deps: PugiXML 1.10
This separates out PugiXML that was previously
bundled by OIIO.

As this linux/mac libs are not available
this commit only contains the builder and windows
changes, and the option to enable pugixml is
guarded by a platform if, this can be removed
once all platforms have committed the svn libs.

For details see D8628
2020-11-29 14:01:33 -07:00
Rebecca Dengate 13c820d87b CMake/macOS: Use custom LIBDIR if set on CLI
Reviewed By: ankitm
Maniphest Tasks: T83174
Differential Revision: https://developer.blender.org/D9664
2020-11-29 13:34:33 +05:30
Sybren A. Stüvel 781429a8b0 Cleanup: clearer marking of what was changed in GTestAddTests.cmake
Replace `Blender` with `BLENDER` so that it's more clearly a marker, and
not just the name.

No functional changes.
2020-11-26 13:05:46 +01:00
Stefan Werner 0062b34e94 macOS: Patch OpenImageIO's ustring for ARM.
OpenImageIO's ustring makes assumptions about the interals of
std::string which aren't true on macOS/ARM. A patch for OpenImageIO
addresses this for macOS/ARM builds only, at the expense of potentially
duplicated allocations of strings.
2020-11-26 12:22:56 +01:00
Stefan Werner 05f410dd84 macOS: Added new location for Homebrew.
The build script for macOS dependencies expects to find bison provided
by Homebrew under /usr/local. Since the default install location for
Homebrew changes on macOS/ARM, the script now looks at the host
architecture and switches to /opt/homebrew on Macs with Apple Silicon.
2020-11-26 11:30:53 +01:00
Ankit Meel 1318eaf166 Cleanup: CMake: use string(APPEND..), not set(..)
Left out in {rB7f28a99dd5a57216fb477d844ae1fec5510ad5d5}
2020-11-23 16:34:17 +05:30
Ankit Meel 36426b0a68 CMake/macOS: Replace -Xlinker with -Wl.
Causes link issues on Xcode's "New Build System" which was introduced
in Xcode 10 and is default on Xcode 12.
https://devtalk.blender.org/t/16273

Differential Revision: https://developer.blender.org/D9624
Reviewed by: brecht, #platform_macos
2020-11-23 16:34:17 +05:30
Sergey Sharybin a2e00236d0 Revert "Codesign: Versioning code to support older branches"
This reverts commit 9d172f007e.

Got a second thought and remembered why it was not done in the first place.
The issue here is that the server needs to communicate codesign result back
and that must happen within the new protocol. So if the client talks old
protocol it is possible to receieve data from it, but is not possible to
communicate result back to it.
2020-11-13 11:35:04 +01:00
Sergey Sharybin 9d172f007e Codesign: Versioning code to support older branches
Turns out it is easier to have suboptimal versioning code on the server
side than to deal with branches where changes are to be merged into.
2020-11-13 09:49:02 +01:00
Patrick Mours a8f1bea590 Fix NanoVDB not being enabled/disabled correctly in CMake profiles
This caused warnings when e.g. building the lite profile because NanoVDB was not disabled, but
OpenVDB was. This Fixes this by setting the "WITH_NANOVDB" flag too.
2020-11-12 12:49:12 +01:00
Sergey Sharybin fb4113defb Codesign: Report codesign errors from server to worker
Pass codesign errors (if any) from codesign buildbot server to the
buildbot worker, so that the latter one can abort build process if
the error happens. This solves issues when non-properly-notarized
DMG package gets uploaded to the buildbot website.
2020-11-12 10:12:56 +01:00
Bastien Montagne 5b5ec0a2e9 Fix T82521: Bump OpenImageIO minimum version 1.8 > 2.2.1 for install_deps.sh
Since rB6fdcca8de64cd70f, we need at least OpenImageIO 2.1.12 to build
Blender.
2020-11-11 15:10:01 +01:00
Ray Molenkamp 86bdd2acc6 Windows: Fix build issue with VCPKG
For blender we disable VCPKG to prevent it from picking
up the wrong libraries from VCPKG rather than our lib folder
some of the cycles tests needed this to link correctly.

reported by @alef on chat
2020-11-10 13:23:55 -07:00
Bastien Montagne 01c7a94cdd install_deps: fix a typo in argument handling of new nanovdb option.
Spotted by  Patrick Mours (@pmoursnv), thanks!
2020-11-10 14:11:13 +01:00
Bastien Montagne 716b7a60df install_deps: add support for NanoVDB.
re T81454.
2020-11-09 19:08:01 +01:00
Bastien Montagne cdb1da6bf6 Install_deps: update URLS for OpenVDB repo/sources. 2020-11-09 19:08:01 +01:00
Sybren A. Stüvel 88926375a0 Clang-Tidy: error out when executable not found
Stop with an error when the Clang-Tidy executable cannot be found.

Without this check, CMake will happily report "Found Clang-Tidy" but with
the fallback version (0, 0, 0), when `CLANG_TIDY_EXECUTABLE` points to a
non-existing executable.
2020-11-06 18:08:25 +01:00
Campbell Barton 9762a0992b CMake: configue_file() to pass strings for build-info
Using configue_file(..) would have avoided the breakage from
1daa3c3f0a, caused by buildinfo not properly escaping quotes.

Rely on CMake to escaping strings instead using configure_file().
2020-11-06 17:26:29 +11:00
Campbell Barton 2bd8f7e059 Cleanup: use string APPEND/PREPEND
Replace 'set' with 'string(APPEND/PREPEND ...)'.
This avoids duplicating the variable name.
2020-11-06 12:32:54 +11:00
Campbell Barton 43a2494058 CMake: add path_ensure_trailing_slash utility macro 2020-11-04 15:59:55 +11:00
Ankit Meel f109b63431 Merge branch 'blender-v2.91-release' into master 2020-11-04 01:58:10 +05:30
Ankit Meel 8f2ebcf93f macOS: find Jack framework in system directories
Until it is decided whether to ship JACK with pre-compiled libraries,
search for the same in system directories.

Ref T79261
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D9436
2020-11-04 01:53:33 +05:30
Patrick Mours c26ad42ea4 Simplify and enable NanoVDB dependency installation
Changes NanoVDB to be a standalone dependency that is independent of the OpenVDB one.
It works by downloading the "feature/nanovdb" branch of OpenVDB, but using the NanoVDB
CMake in the "nanovdb" subdirectory. Since it is header-only, only the install target is used.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9383
2020-10-29 17:02:12 +01:00
Ankit Meel 8c04337231 Merge branch 'blender-v2.91-release' into master 2020-10-28 21:18:55 +05:30
Ankit Meel fc6a1f44d2 macOS: use -fno-strict-aliasing for all build types.
The old code was added in {rBbaa4a9c7d4dd}

While the hotfix committed in {rB2ddecfffc3d3a3a1db4ae45e8665ca} fixed
the id_management test, the correct reason was found at
https://bugs.llvm.org/show_bug.cgi?id=47984

This matches the behavior on Linux.
2020-10-28 20:53:32 +05:30
Brecht Van Lommel e79154de73 Fix build error Python module build and Embree on macOS
Setting the stack size only works for executables, for shared libraries
the host application controls it.
2020-10-22 18:03:18 +02:00
Ray Molenkamp 43e4d6e5b1 CMake/Windows: Compile GMP library as fat library 2020-10-20 13:04:53 -06:00
Sergey Sharybin 1c08ab4535 CMake: Compile GMP library as fat library
The idea behind this is to compile all versions of functions,
and let the library to pick the best at runtime.

Attempting to fix T81835
2020-10-20 16:18:59 +02:00
Bastien Montagne 580fe9f5f8 Fix (unreported) install_deps: wrong version number for llvm in some cases.
Version reported by package manager is not always satisfying (on Debian
testing currently e.g. `llvm-dev` is reported as `9.0`, when exact one
is actually `9.0.1`, this break CMake build of Blender then).

Just use version reported by `llvm-config` instead, when using
distribution packages.
2020-10-20 12:52:17 +02:00
Ankit Meel 4fb67ae809 CMake/macOS: use system OpenAL for the time being.
Revert part of {rB83124856d05ee4da605ab247e6}
2020-10-19 22:05:56 +05:30
Ankit Meel 83124856d0 Cmake/macOS: strictly disallow searching in frameworks
This is a stricter version of the change made in
{rBbb872b25f219d1a9bc2446228b6dc}

Cmake must never look into Frameworks when the system
library guards (`without_system_libs_begin`/`without_system_libs_end`)
are present.

OpenAL didn't follow this and OpenAL.framework in Xcode would be used.
The Cmake's `FindOpenAL.cmake` looks for both library (in this case,
the .framework file), and include dir.
Precompiled libraries don't contain the former. So `find_package`
cannot be used, or it becomes the hack that {rBb2c707747da9} removed.
So hardcode the include dir path, and other variables.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9267
2020-10-19 18:47:35 +05:30
Ankit Meel bb872b25f2 CMake/macOS: Search for headers in Frameworks last.
https://devtalk.blender.org/t/libpng-version-mismatch/15799/

By default, `CMAKE_FIND_FRAMEWORK` is `FIRST`.

CMake searches headers and libraries separately. So library is found
in LIBDIR, and headers like those in Mono are detected before the
headers in LIBDIR, and we get a version mismatch.

So set the priority of Frameworks to `LAST`.

https://gitlab.kitware.com/cmake/cmake/-/issues/18921
https://gitlab.kitware.com/cmake/cmake/-/issues/16427

{rBbac91956ae97} tried to fix the same issue, but it didn't work.
It's fine to keep the changes made there, just removing the comment
that may give false sense of security.
2020-10-16 13:41:29 +05:30
Ankit Meel 3ffe65a7fb CMake/macOS: Restore TIFF's optional status.
{rB1f6b7387ad01}
2020-10-16 13:41:26 +05:30
Ankit Meel bac91956ae CMake/macOS: set package_ROOT for PNG, JPEG, TIFF
https://devtalk.blender.org/t/libpng-version-mismatch/15799/

In this case, CMake finds libraries in `LIBDIR`, but picks headers from
`/Library/Frameworks/` (Mono framework).

CMP0074 is already enabled, so use it.
2020-10-15 18:49:45 +05:30
Eric Cosky dd3b047f8b Windows/CMake:Support BLENDER_USER_SCRIPTS in IDE
This diff adds support for respecting the `BLENDER_USER_SCRIPTS`
environment variable when setting up the IDE environment.

Previously the scripts from the users profile folder were always
used even when this variable was set, leading to the possibility
of the wrong scripts being visible in the IDE.

Differential Revision: https://developer.blender.org/D9189
Reviewed By: Ray Molenkamp
2020-10-13 08:45:22 -06:00
Patrick Mours 3bb3b26c8f Cycles: Add CUDA 11 build support
With this patch the build system checks whether the "CUDA10_NVCC_EXECUTABLE" CMake
variable is set and if so will use that to build sm_30 kernels. Similarily for sm_8x kernels it
checks "CUDA11_NVCC_EXECUTABLE". All other kernels are built using the default CUDA
toolkit. This makes it possible to use either the CUDA 10 or CUDA 11 toolkit by default and
only selectively use the other for the kernels where its a hard requirement.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9179
2020-10-13 15:15:44 +02:00
Ankit Meel 666485f38c CMake/macOS: find ZLib before setting CMAKE_PREFIX_PATH
https://devtalk.blender.org/t/building-blender-on-macos-fails/15756/

In some cases, CMake finds the Zlib supplied with OpenCollada
pre-compiled libraries, and not the system one.
2020-10-13 16:34:43 +05:30
Ankit Meel c68338ee89 CMake/macOS/OpenMP: copy the library near tests.
For multi-config generators, tests are in `bin/tests/<config>` folder.
and OpenMP cannot be found at `@executable_path/../Resources/lib`.
So create that folder and put the library there to be used by tests.

It is not ideal to copy the library around. When minimum CMake version
is changed to 3.12, FindOpenMP by CMake can be used for this whole
block of code. Then a nice rpath based solution can be used.
2020-10-10 19:31:03 +05:30
Ankit Meel c735aca42e CMake/macOS/OpenMP: allow use of LLVM-Clang with OpenMP.
The "Apple" part is guaranteed by the platform file.
"Clang" is enough to differentiate it from other compilers.

Came across this due to the custom built LLVM toolchain I'm using.
2020-10-10 16:28:42 +05:30
Ankit Meel 50ffcf12b2 Cleanup: CMake/macOS: remove boost from OIIO libs.
Introduced by me in {rB1f6b7387ad0177c1dec9bb83b7}.
2020-10-09 20:39:58 +05:30
Bastien Montagne e340f943f5 Fix (unreported) install_deps: broken compilation of OIDN.
When OIDN version was bumped recently the required dependency to build
it (ISPC) was not updated accordingly.
2020-10-09 17:07:16 +02:00
Andreas Bergmeier 9aef0283a0 install_deps: Do not request elevated rights when creating directory in owned directory.
This only creates elevated directory when necessary.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D1596
2020-10-09 17:05:03 +02:00
Ankit Meel 1f6b7387ad CMake/macOS: Remove _LIBPATH, avoid link_directories.
After tests were bundled in a single executable and cycles and libmv
created their own tests, the warnings on macOS have gone over 800.
The reason is setting `*_LIBRARIES` to names of the libraries
and later using `link_directories` to link them properly.

https://cmake.org/cmake/help/latest/command/link_directories.html

> Note This command is rarely necessary and should be avoided where
> there are other choices. Prefer to pass full absolute paths to
> libraries where possible, since this ensures the correct library
> will always be linked. The find_library() command provides the
> full path, which can generally be used directly in calls to
> target_link_libraries().

Warnings like the following popup for every target/executable,
for every library it links to.
```
ld: warning: directory not found for option
'-L/Users/me/blender-build/blender/../lib/darwin/jpeg/lib/Debug'
```

The patch completes a step towards removing `link_directories` as
mentioned in TODO at several places.
The patch uses absolute paths to link libraries and removes
all `*_LIBPATH`s except `PYTHON_LIBPATH` from
`platform_apple.cmake` file. (The corner case where it's used seems
like dead code. Python is no longer shipped with that file structure.)

Also, unused code for LLVM-3.4 has been removed.
Also, guards to avoid searching libraries in system directories have
been added.

`APPLE` platform now no longer needs `setup_libdirs`,
`cycles_link_directories`, and `link_directories`.
The number of warnings now is less than 100, most of them being
deprecation ones in dependencies.

This patch depended on {rBb746179d0add}, {rB2fdbe4d05011},
{rB402a4cadba49} and {rBd7f482f88ecb}.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8855
2020-10-09 19:41:58 +05:30
Andreas Bergmeier 2a39b6d4d1 Cleanup: spelling
Ref D9138
2020-10-09 18:08:38 +11:00
Patrick Mours 3df90de6c2 Cycles: Add NanoVDB support for rendering volumes
NanoVDB is a platform-independent sparse volume data structure that makes it possible to
use OpenVDB volumes on the GPU. This patch uses it for volume rendering in Cycles,
replacing the previous usage of dense 3D textures.

Since it has a big impact on memory usage and performance and changes the OpenVDB
branch used for the rest of Blender as well, this is not enabled by default yet, which will
happen only after 2.82 was branched off. To enable it, build both dependencies and Blender
itself with the "WITH_NANOVDB" CMake option.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8794
2020-10-05 15:03:30 +02:00