Cycles: new Microfacet-based Hair BSDF with elliptical cross-section support #105600

Merged
Weizhen Huang merged 114 commits from weizhen/blender:microfacet_hair into main 2023-08-18 12:46:20 +02:00
2399 changed files with 47551 additions and 172044 deletions
Showing only changes of commit 04bb899969 - Show all commits

File diff suppressed because it is too large Load Diff

View File

@ -116,7 +116,8 @@ ExternalProject_Add(external_usd
# usd_hydra.diff also included the blender changes and usd_pull_1965 and has been edited to remove those sections.
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd_pull_1965.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd_hydra.diff
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd_hydra.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd_core_profile.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/usd -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${USD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/usd
)

View File

@ -14,14 +14,14 @@ if [ `id -u` -ne 0 ]; then
fi
# Required by: config manager command below to enable powertools.
dnf install 'dnf-command(config-manager)'
dnf -y install 'dnf-command(config-manager)'
# Packages `ninja-build` and `meson` are not available unless CBR or PowerTools repositories are enabled.
# See: https://wiki.rockylinux.org/rocky/repo/#notes-on-unlisted-repositories
dnf config-manager --set-enabled powertools
# Required by: epel-release has the patchelf and rubygem-asciidoctor packages
dnf install epel-release
dnf -y install epel-release
# `yum-config-manager` does not come in the default minimal install,
# so make sure it is installed and available.

View File

@ -75,3 +75,18 @@ index 46e4529..8e86486 100644
return false;
}
diff --git a/src/liboslexec/CMakeLists.txt b/src/liboslexec/CMakeLists.txt
index 6bb0d175..19f13513 100644
--- a/src/liboslexec/CMakeLists.txt
+++ b/src/liboslexec/CMakeLists.txt
@@ -148,7 +148,9 @@ file (GLOB exec_headers "*.h")
file (GLOB compiler_headers "../liboslcomp/*.h")
FLEX_BISON ( osolex.l osogram.y oso lib_src exec_headers )
-FLEX_BISON ( ../liboslcomp/osllex.l ../liboslcomp/oslgram.y osl lib_src compiler_headers )
+if (BUILD_SHARED_LIBS)
+ FLEX_BISON ( ../liboslcomp/osllex.l ../liboslcomp/oslgram.y osl lib_src compiler_headers )
+endif()
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS" )

View File

@ -0,0 +1,415 @@
diff --git a/pxr/imaging/hdSt/indirectDrawBatch.cpp b/pxr/imaging/hdSt/indirectDrawBatch.cpp
index ec9b224..bf59cdf 100644
--- a/pxr/imaging/hdSt/indirectDrawBatch.cpp
+++ b/pxr/imaging/hdSt/indirectDrawBatch.cpp
@@ -109,11 +109,17 @@ HdSt_IndirectDrawBatch::HdSt_IndirectDrawBatch(
, _allowGpuFrustumCulling(allowGpuFrustumCulling)
, _instanceCountOffset(0)
, _cullInstanceCountOffset(0)
+ , _vao(0)
{
_Init(drawItemInstance);
}
-HdSt_IndirectDrawBatch::~HdSt_IndirectDrawBatch() = default;
+HdSt_IndirectDrawBatch::~HdSt_IndirectDrawBatch()
+{
+ if (_vao) {
+ glDeleteVertexArrays(1, &_vao);
+ }
+}
/*virtual*/
void
@@ -1146,6 +1152,14 @@ HdSt_IndirectDrawBatch::_ExecuteDraw(
state.instancePrimvarBars);
}
+ // OpenGL core profile requries a VAO for binding buffers.
+ if (capabilities->GetCoreProfile()) {
+ if (!_vao) {
+ glCreateVertexArrays(1, &_vao);
+ }
+ glBindVertexArray(_vao);
+ }
+
state.BindResourcesForDrawing(renderPassState, *capabilities);
HdSt_GeometricShaderSharedPtr geometricShader = state.geometricShader;
@@ -1374,6 +1388,15 @@ HdSt_IndirectDrawBatch::_ExecuteFrustumCull(
cullingProgram.GetGeometricShader());
Hgi * hgi = resourceRegistry->GetHgi();
+ HgiCapabilities const *capabilities = hgi->GetCapabilities();
+
+ // OpenGL core profile requries a VAO for binding buffers.
+ if (capabilities->GetCoreProfile()) {
+ if (!_vao) {
+ glCreateVertexArrays(1, &_vao);
+ }
+ glBindVertexArray(_vao);
+ }
HgiGraphicsPipelineSharedPtr const & pso =
_GetCullPipeline(resourceRegistry,
diff --git a/pxr/imaging/hdSt/indirectDrawBatch.h b/pxr/imaging/hdSt/indirectDrawBatch.h
index 44971f5..4292aa3 100644
--- a/pxr/imaging/hdSt/indirectDrawBatch.h
+++ b/pxr/imaging/hdSt/indirectDrawBatch.h
@@ -195,6 +195,8 @@ private:
int _instanceCountOffset;
int _cullInstanceCountOffset;
+
+ uint32_t _vao;
};
diff --git a/pxr/imaging/hdSt/renderPassState.cpp b/pxr/imaging/hdSt/renderPassState.cpp
index da0e4f3..8f87fc1 100644
--- a/pxr/imaging/hdSt/renderPassState.cpp
+++ b/pxr/imaging/hdSt/renderPassState.cpp
@@ -769,7 +769,9 @@ HdStRenderPassState::Bind(HgiCapabilities const &hgiCapabilities)
// If not using GL_MULTISAMPLE, use GL_POINT_SMOOTH to render points as
// circles instead of square.
// XXX Switch points rendering to emit quad with FS that draws circle.
- glEnable(GL_POINT_SMOOTH);
+ if (!hgiCapabilities.GetCoreProfile()) {
+ glEnable(GL_POINT_SMOOTH);
+ }
}
}
@@ -813,7 +815,9 @@ HdStRenderPassState::Unbind(HgiCapabilities const &hgiCapabilities)
}
glEnable(GL_MULTISAMPLE);
- glDisable(GL_POINT_SMOOTH);
+ if (!hgiCapabilities.GetCoreProfile()) {
+ glDisable(GL_POINT_SMOOTH);
+ }
}
void
diff --git a/pxr/imaging/hgi/capabilities.h b/pxr/imaging/hgi/capabilities.h
index ae2ecb4..c86afcb 100644
--- a/pxr/imaging/hgi/capabilities.h
+++ b/pxr/imaging/hgi/capabilities.h
@@ -52,6 +52,11 @@ public:
HGI_API
virtual int GetShaderVersion() const = 0;
+ HGI_API
+ virtual bool GetCoreProfile() const {
+ return false;
+ }
+
HGI_API
size_t GetMaxUniformBlockSize() const {
return _maxUniformBlockSize;
diff --git a/pxr/imaging/hgiGL/blitCmds.cpp b/pxr/imaging/hgiGL/blitCmds.cpp
index ce62f41..20888a1 100644
--- a/pxr/imaging/hgiGL/blitCmds.cpp
+++ b/pxr/imaging/hgiGL/blitCmds.cpp
@@ -136,7 +136,7 @@ HgiGLBlitCmds::_Submit(Hgi* hgi, HgiSubmitWaitType wait)
// Capture OpenGL state before executing the 'ops' and restore it when this
// function ends. We do this defensively because parts of our pipeline may
// not set and restore all relevant gl state.
- HgiGL_ScopedStateHolder openglStateGuard;
+ HgiGL_ScopedStateHolder openglStateGuard(*hgi->GetCapabilities());
HgiGL* hgiGL = static_cast<HgiGL*>(hgi);
HgiGLDevice* device = hgiGL->GetPrimaryDevice();
diff --git a/pxr/imaging/hgiGL/capabilities.cpp b/pxr/imaging/hgiGL/capabilities.cpp
index 8711a62..e11324b 100644
--- a/pxr/imaging/hgiGL/capabilities.cpp
+++ b/pxr/imaging/hgiGL/capabilities.cpp
@@ -57,6 +57,7 @@ static const int _DefaultMaxClipDistances = 8;
HgiGLCapabilities::HgiGLCapabilities()
: _glVersion(0)
, _glslVersion(_DefaultGLSLVersion)
+ , _coreProfile(false)
{
_LoadCapabilities();
}
@@ -131,6 +132,11 @@ HgiGLCapabilities::_LoadCapabilities()
&uniformBufferOffsetAlignment);
_uniformBufferOffsetAlignment = uniformBufferOffsetAlignment;
}
+ if (_glVersion >= 320) {
+ GLint profileMask = 0;
+ glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profileMask);
+ _coreProfile = (profileMask & GL_CONTEXT_CORE_PROFILE_BIT);
+ }
if (_glVersion >= 430) {
GLint maxShaderStorageBlockSize = 0;
glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE,
@@ -259,4 +265,9 @@ HgiGLCapabilities::GetShaderVersion() const {
return _glslVersion;
}
+bool
+HgiGLCapabilities::GetCoreProfile() const {
+ return _coreProfile;
+}
+
PXR_NAMESPACE_CLOSE_SCOPE
diff --git a/pxr/imaging/hgiGL/capabilities.h b/pxr/imaging/hgiGL/capabilities.h
index 3c8f026..2f25b44 100644
--- a/pxr/imaging/hgiGL/capabilities.h
+++ b/pxr/imaging/hgiGL/capabilities.h
@@ -52,6 +52,9 @@ public:
HGIGL_API
int GetShaderVersion() const override;
+ HGIGL_API
+ bool GetCoreProfile() const override;
+
private:
void _LoadCapabilities();
@@ -60,6 +63,9 @@ private:
// GLSL version
int _glslVersion; // 400, 410, ...
+
+ // Core Profile
+ bool _coreProfile;
};
PXR_NAMESPACE_CLOSE_SCOPE
diff --git a/pxr/imaging/hgiGL/graphicsCmds.cpp b/pxr/imaging/hgiGL/graphicsCmds.cpp
index 5e17416..e59ae35 100644
--- a/pxr/imaging/hgiGL/graphicsCmds.cpp
+++ b/pxr/imaging/hgiGL/graphicsCmds.cpp
@@ -249,7 +249,7 @@ HgiGLGraphicsCmds::_Submit(Hgi* hgi, HgiSubmitWaitType wait)
// Capture OpenGL state before executing the 'ops' and restore it when this
// function ends. We do this defensively because parts of our pipeline may
// not set and restore all relevant gl state.
- HgiGL_ScopedStateHolder openglStateGuard;
+ HgiGL_ScopedStateHolder openglStateGuard(*hgi->GetCapabilities());
// Resolve multisample textures
HgiGL* hgiGL = static_cast<HgiGL*>(hgi);
diff --git a/pxr/imaging/hgiGL/graphicsPipeline.cpp b/pxr/imaging/hgiGL/graphicsPipeline.cpp
index 6983dd1..a1c7af7 100644
--- a/pxr/imaging/hgiGL/graphicsPipeline.cpp
+++ b/pxr/imaging/hgiGL/graphicsPipeline.cpp
@@ -42,7 +42,12 @@ HgiGLGraphicsPipeline::HgiGLGraphicsPipeline(
{
}
-HgiGLGraphicsPipeline::~HgiGLGraphicsPipeline() = default;
+HgiGLGraphicsPipeline::~HgiGLGraphicsPipeline()
+{
+ if (_vao) {
+ glDeleteVertexArrays(1, &_vao);
+ }
+}
void
HgiGLGraphicsPipeline::BindPipeline()
@@ -50,6 +55,7 @@ HgiGLGraphicsPipeline::BindPipeline()
if (_vao) {
glBindVertexArray(0);
glDeleteVertexArrays(1, &_vao);
+ _vao = 0;
}
if (!_descriptor.vertexBuffers.empty()) {
@@ -108,6 +114,8 @@ HgiGLGraphicsPipeline::BindPipeline()
glBindVertexArray(_vao);
}
+ const bool coreProfile = _hgi->GetCapabilities()->GetCoreProfile();
+
//
// Depth Stencil State
//
@@ -172,7 +180,9 @@ HgiGLGraphicsPipeline::BindPipeline()
// If not using GL_MULTISAMPLE, use GL_POINT_SMOOTH to render points as
// circles instead of square.
// XXX Switch points rendering to emit quad with FS that draws circle.
- glEnable(GL_POINT_SMOOTH);
+ if (!coreProfile) {
+ glEnable(GL_POINT_SMOOTH);
+ }
}
if (_descriptor.multiSampleState.alphaToCoverageEnable) {
glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
@@ -207,7 +217,7 @@ HgiGLGraphicsPipeline::BindPipeline()
glFrontFace(GL_CCW);
}
- if (_descriptor.rasterizationState.lineWidth != 1.0f) {
+ if (!coreProfile && _descriptor.rasterizationState.lineWidth != 1.0f) {
glLineWidth(_descriptor.rasterizationState.lineWidth);
}
diff --git a/pxr/imaging/hgiGL/scopedStateHolder.cpp b/pxr/imaging/hgiGL/scopedStateHolder.cpp
index 89cd0ac..5c65753 100644
--- a/pxr/imaging/hgiGL/scopedStateHolder.cpp
+++ b/pxr/imaging/hgiGL/scopedStateHolder.cpp
@@ -26,6 +26,7 @@
#include "pxr/imaging/hgiGL/scopedStateHolder.h"
#include "pxr/imaging/hgiGL/conversions.h"
#include "pxr/imaging/hgiGL/diagnostic.h"
+#include "pxr/imaging/hgiGL/hgi.h"
#include "pxr/base/trace/trace.h"
#include "pxr/base/tf/diagnostic.h"
@@ -33,8 +34,10 @@
PXR_NAMESPACE_OPEN_SCOPE
-HgiGL_ScopedStateHolder::HgiGL_ScopedStateHolder()
- : _restoreRenderBuffer(0)
+HgiGL_ScopedStateHolder::HgiGL_ScopedStateHolder(
+ HgiCapabilities const& capabilities)
+ : _coreProfile(capabilities.GetCoreProfile())
+ , _restoreRenderBuffer(0)
, _restoreVao(0)
, _restoreDepthTest(false)
, _restoreDepthWriteMask(false)
@@ -115,7 +118,9 @@ HgiGL_ScopedStateHolder::HgiGL_ScopedStateHolder()
glGetBooleanv(
GL_SAMPLE_ALPHA_TO_ONE,
(GLboolean*)&_restoreSampleAlphaToOne);
- glGetFloatv(GL_LINE_WIDTH, &_lineWidth);
+ if (!_coreProfile) {
+ glGetFloatv(GL_LINE_WIDTH, &_lineWidth);
+ }
glGetBooleanv(GL_CULL_FACE, (GLboolean*)&_cullFace);
glGetIntegerv(GL_CULL_FACE_MODE, &_cullMode);
glGetIntegerv(GL_FRONT_FACE, &_frontFace);
@@ -139,7 +144,9 @@ HgiGL_ScopedStateHolder::HgiGL_ScopedStateHolder()
}
glGetBooleanv(GL_MULTISAMPLE, (GLboolean*)&_restoreMultiSample);
- glGetBooleanv(GL_POINT_SMOOTH, (GLboolean*)&_restorePointSmooth);
+ if (!_coreProfile) {
+ glGetBooleanv(GL_POINT_SMOOTH, (GLboolean*)&_restorePointSmooth);
+ }
HGIGL_POST_PENDING_GL_ERRORS();
#if defined(GL_KHR_debug)
@@ -235,7 +242,9 @@ HgiGL_ScopedStateHolder::~HgiGL_ScopedStateHolder()
_restoreViewport[2], _restoreViewport[3]);
glBindVertexArray(_restoreVao);
glBindRenderbuffer(GL_RENDERBUFFER, _restoreRenderBuffer);
- glLineWidth(_lineWidth);
+ if (!_coreProfile) {
+ glLineWidth(_lineWidth);
+ }
if (_cullFace) {
glEnable(GL_CULL_FACE);
} else {
@@ -285,10 +294,12 @@ HgiGL_ScopedStateHolder::~HgiGL_ScopedStateHolder()
glDisable(GL_MULTISAMPLE);
}
- if (_restorePointSmooth) {
- glEnable(GL_POINT_SMOOTH);
- } else {
- glDisable(GL_POINT_SMOOTH);
+ if (!_coreProfile) {
+ if (_restorePointSmooth) {
+ glEnable(GL_POINT_SMOOTH);
+ } else {
+ glDisable(GL_POINT_SMOOTH);
+ }
}
static const GLuint samplers[8] = {0};
diff --git a/pxr/imaging/hgiGL/scopedStateHolder.h b/pxr/imaging/hgiGL/scopedStateHolder.h
index d006480..be6698e 100644
--- a/pxr/imaging/hgiGL/scopedStateHolder.h
+++ b/pxr/imaging/hgiGL/scopedStateHolder.h
@@ -32,6 +32,7 @@
PXR_NAMESPACE_OPEN_SCOPE
+class HgiCapabilities;
/// \class HgiGLScopedStateHolder
///
@@ -50,7 +51,7 @@ class HgiGL_ScopedStateHolder final
{
public:
HGIGL_API
- HgiGL_ScopedStateHolder();
+ HgiGL_ScopedStateHolder(HgiCapabilities const& capabilities);
HGIGL_API
~HgiGL_ScopedStateHolder();
@@ -59,6 +60,8 @@ private:
HgiGL_ScopedStateHolder& operator=(const HgiGL_ScopedStateHolder&) = delete;
HgiGL_ScopedStateHolder(const HgiGL_ScopedStateHolder&) = delete;
+ bool _coreProfile;
+
int32_t _restoreRenderBuffer;
int32_t _restoreVao;
diff --git a/pxr/imaging/hgiInterop/opengl.cpp b/pxr/imaging/hgiInterop/opengl.cpp
index 683c058..e921c2a 100644
--- a/pxr/imaging/hgiInterop/opengl.cpp
+++ b/pxr/imaging/hgiInterop/opengl.cpp
@@ -110,6 +110,7 @@ HgiInteropOpenGL::HgiInteropOpenGL()
, _fsDepth(0)
, _prgNoDepth(0)
, _prgDepth(0)
+ , _vao(0)
, _vertexBuffer(0)
{
_vs = _CompileShader(_vertexFullscreen, GL_VERTEX_SHADER);
@@ -117,6 +118,7 @@ HgiInteropOpenGL::HgiInteropOpenGL()
_fsDepth = _CompileShader(_fragmentDepthFullscreen, GL_FRAGMENT_SHADER);
_prgNoDepth = _LinkProgram(_vs, _fsNoDepth);
_prgDepth = _LinkProgram(_vs, _fsDepth);
+ glCreateVertexArrays(1, &_vao);
_vertexBuffer = _CreateVertexBuffer();
TF_VERIFY(glGetError() == GL_NO_ERROR);
}
@@ -129,6 +131,7 @@ HgiInteropOpenGL::~HgiInteropOpenGL()
glDeleteProgram(_prgNoDepth);
glDeleteProgram(_prgDepth);
glDeleteBuffers(1, &_vertexBuffer);
+ glDeleteVertexArrays(1, &_vao);
TF_VERIFY(glGetError() == GL_NO_ERROR);
}
@@ -202,10 +205,13 @@ HgiInteropOpenGL::CompositeToInterop(
}
// Get the current array buffer binding state
+ GLint restoreVao = 0;
+ glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &restoreVao);
GLint restoreArrayBuffer = 0;
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &restoreArrayBuffer);
// Vertex attributes
+ glBindVertexArray(_vao);
const GLint locPosition = glGetAttribLocation(prg, "position");
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
glVertexAttribPointer(locPosition, 4, GL_FLOAT, GL_FALSE,
@@ -271,6 +277,7 @@ HgiInteropOpenGL::CompositeToInterop(
glDisableVertexAttribArray(locPosition);
glDisableVertexAttribArray(locUv);
glBindBuffer(GL_ARRAY_BUFFER, restoreArrayBuffer);
+ glBindVertexArray(restoreVao);
if (!blendEnabled) {
glDisable(GL_BLEND);
diff --git a/pxr/imaging/hgiInterop/opengl.h b/pxr/imaging/hgiInterop/opengl.h
index 18840a9..27434ac 100644
--- a/pxr/imaging/hgiInterop/opengl.h
+++ b/pxr/imaging/hgiInterop/opengl.h
@@ -62,6 +62,7 @@ private:
uint32_t _fsDepth;
uint32_t _prgNoDepth;
uint32_t _prgDepth;
+ uint32_t _vao;
uint32_t _vertexBuffer;
};

View File

@ -104,10 +104,14 @@ IF(OSL_FOUND)
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+[0-9]+.*$")
FILE(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MINOR
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+[0-9]+.*$")
FILE(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_PATCH
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_PATCH[ \t]+[0-9]+.*$")
STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+([.0-9]+).*"
"\\1" OSL_LIBRARY_VERSION_MAJOR ${OSL_LIBRARY_VERSION_MAJOR})
STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+([.0-9]+).*"
"\\1" OSL_LIBRARY_VERSION_MINOR ${OSL_LIBRARY_VERSION_MINOR})
STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_PATCH[ \t]+([.0-9]+).*"
"\\1" OSL_LIBRARY_VERSION_PATCH ${OSL_LIBRARY_VERSION_PATCH})
ENDIF()
MARK_AS_ADVANCED(

View File

@ -26,6 +26,7 @@ set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
set(WITH_GMP OFF CACHE BOOL "" FORCE)
set(WITH_HARU OFF CACHE BOOL "" FORCE)
set(WITH_HYDRA OFF CACHE BOOL "" FORCE)
set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE)
@ -55,6 +56,7 @@ set(WITH_OPENIMAGEDENOISE OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_POTRACE OFF CACHE BOOL "" FORCE)
set(WITH_PUGIXML OFF CACHE BOOL "" FORCE)
set(WITH_PULSEAUDIO OFF CACHE BOOL "" FORCE)
@ -71,3 +73,11 @@ if(UNIX AND NOT APPLE)
set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE OFF CACHE BOOL "" FORCE)
endif()
# These should not have any impact but are disabled so they don't
# appear to be enabled in the list of items (which are mostly OFF).
set(WITH_CYCLES_DEVICE_OPTIX OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_EMBREE OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_PATH_GUIDING OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB_BLOSC OFF CACHE BOOL "" FORCE)

View File

@ -232,7 +232,10 @@ function(blender_user_header_search_paths
# _ALL_INCS is a space-separated string of file paths in quotes.
string(APPEND _ALL_INCS " \"${_ABS_INC}\"")
endforeach()
set_target_properties(${name} PROPERTIES XCODE_ATTRIBUTE_USER_HEADER_SEARCH_PATHS "${_ALL_INCS}")
set_target_properties(
${name} PROPERTIES
XCODE_ATTRIBUTE_USER_HEADER_SEARCH_PATHS "${_ALL_INCS}"
)
endif()
endfunction()
@ -296,11 +299,18 @@ macro(add_cc_flags_custom_test
string(TOUPPER ${name} _name_upper)
if(DEFINED CMAKE_C_FLAGS_${_name_upper})
message(STATUS "Using custom CFLAGS: CMAKE_C_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
message(
STATUS
"Using custom CFLAGS: "
"CMAKE_C_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
string(APPEND CMAKE_C_FLAGS " ${CMAKE_C_FLAGS_${_name_upper}}" ${ARGV1})
endif()
if(DEFINED CMAKE_CXX_FLAGS_${_name_upper})
message(STATUS "Using custom CXXFLAGS: CMAKE_CXX_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
message(
STATUS
"Using custom CXXFLAGS: "
"CMAKE_CXX_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\""
)
string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS_${_name_upper}}" ${ARGV1})
endif()
unset(_name_upper)
@ -468,7 +478,10 @@ function(blender_add_test_suite)
--test-release-dir "${_test_release_dir}"
)
if(WIN32)
set_tests_properties(${ARGS_SUITE_NAME} PROPERTIES ENVIRONMENT "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/;$ENV{PATH}")
set_tests_properties(
${ARGS_SUITE_NAME} PROPERTIES
ENVIRONMENT "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/;$ENV{PATH}"
)
endif()
unset(_test_release_dir)
endfunction()
@ -610,13 +623,25 @@ endfunction()
# Platform specific linker flags for targets.
function(setup_platform_linker_flags
target)
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${PLATFORM_LINKFLAGS}")
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " ${PLATFORM_LINKFLAGS_RELEASE}")
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " ${PLATFORM_LINKFLAGS_DEBUG}")
set_property(
TARGET ${target} APPEND_STRING PROPERTY
LINK_FLAGS " ${PLATFORM_LINKFLAGS}"
)
set_property(
TARGET ${target} APPEND_STRING PROPERTY
LINK_FLAGS_RELEASE " ${PLATFORM_LINKFLAGS_RELEASE}"
)
set_property(
TARGET ${target} APPEND_STRING PROPERTY
LINK_FLAGS_DEBUG " ${PLATFORM_LINKFLAGS_DEBUG}"
)
get_target_property(target_type ${target} TYPE)
if(target_type STREQUAL "EXECUTABLE")
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${PLATFORM_LINKFLAGS_EXECUTABLE}")
set_property(
TARGET ${target} APPEND_STRING PROPERTY
LINK_FLAGS " ${PLATFORM_LINKFLAGS_EXECUTABLE}"
)
endif()
endfunction()
@ -712,20 +737,34 @@ endmacro()
macro(remove_cc_flag
_flag)
foreach(flag ${ARGV})
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
set(_flag_vars
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
foreach(_flag ${ARGV})
foreach(_var ${_flag_vars})
# Expands to an expression like:
# `string(REGEX REPLACE "${_flag}" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")`
cmake_language(
EVAL CODE
"string(REGEX REPLACE \"\$\{_flag\}\" \"\" ${_var} \"\$\{${_var}\}\")"
)
endforeach()
endforeach()
unset(flag)
unset(_flag)
unset(_flag_vars)
unset(_var)
endmacro()
@ -821,9 +860,9 @@ macro(remove_strict_c_flags_file
foreach(_SOURCE ${ARGV})
if(CMAKE_COMPILER_IS_GNUCC OR
(CMAKE_C_COMPILER_ID MATCHES "Clang"))
set_source_files_properties(${_SOURCE}
PROPERTIES
COMPILE_FLAGS "${C_REMOVE_STRICT_FLAGS}"
set_source_files_properties(
${_SOURCE} PROPERTIES
COMPILE_FLAGS "${C_REMOVE_STRICT_FLAGS}"
)
endif()
if(MSVC)
@ -839,9 +878,9 @@ macro(remove_strict_cxx_flags_file
foreach(_SOURCE ${ARGV})
if(CMAKE_COMPILER_IS_GNUCC OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set_source_files_properties(${_SOURCE}
PROPERTIES
COMPILE_FLAGS "${CXX_REMOVE_STRICT_FLAGS}"
set_source_files_properties(
${_SOURCE} PROPERTIES
COMPILE_FLAGS "${CXX_REMOVE_STRICT_FLAGS}"
)
endif()
if(MSVC)
@ -867,7 +906,7 @@ macro(remove_cc_flag_unsigned_char)
endif()
endmacro()
function(ADD_CHECK_C_COMPILER_FLAG
function(ADD_CHECK_C_COMPILER_FLAG_IMPL
_CFLAGS
_CACHE_VAR
_FLAG
@ -884,7 +923,7 @@ function(ADD_CHECK_C_COMPILER_FLAG
endif()
endfunction()
function(ADD_CHECK_CXX_COMPILER_FLAG
function(ADD_CHECK_CXX_COMPILER_FLAG_IMPL
_CXXFLAGS
_CACHE_VAR
_FLAG
@ -901,6 +940,34 @@ function(ADD_CHECK_CXX_COMPILER_FLAG
endif()
endfunction()
function(ADD_CHECK_C_COMPILER_FLAGS _CFLAGS)
# Iterate over pairs & check each.
set(cache_var "")
foreach(arg ${ARGN})
if(cache_var)
ADD_CHECK_C_COMPILER_FLAG_IMPL("${_CFLAGS}" "${cache_var}" "${arg}")
set(cache_var "")
else()
set(cache_var "${arg}")
endif()
endforeach()
set(${_CFLAGS} "${${_CFLAGS}}" PARENT_SCOPE)
endfunction()
function(ADD_CHECK_CXX_COMPILER_FLAGS _CXXFLAGS)
# Iterate over pairs & check each.
set(cache_var "")
foreach(arg ${ARGN})
if(cache_var)
ADD_CHECK_CXX_COMPILER_FLAG_IMPL("${_CXXFLAGS}" "${cache_var}" "${arg}")
set(cache_var "")
else()
set(cache_var "${arg}")
endif()
endforeach()
set(${_CXXFLAGS} "${${_CXXFLAGS}}" PARENT_SCOPE)
endfunction()
function(get_blender_version)
# extracts header vars and defines them in the parent scope:
#
@ -916,11 +983,23 @@ function(get_blender_version)
${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender_version.h.done
)
file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h _contents REGEX "^#define[ \t]+BLENDER_.*$")
file(
STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h
_contents REGEX "^#define[ \t]+BLENDER_.*$"
)
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION[ \t]+([0-9]+).*" "\\1" _out_version "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" _out_version_patch "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CYCLE[ \t]+([a-z]+).*" "\\1" _out_version_cycle "${_contents}")
string(
REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION[ \t]+([0-9]+).*" "\\1"
_out_version "${_contents}"
)
string(
REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_PATCH[ \t]+([0-9]+).*" "\\1"
_out_version_patch "${_contents}"
)
string(
REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CYCLE[ \t]+([a-z]+).*" "\\1"
_out_version_cycle "${_contents}"
)
if(NOT ${_out_version} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION")
@ -1114,8 +1193,8 @@ function(data_to_c_simple_icons
${_icon_files}
datatoc_icon
datatoc
# could be an arg but for now we only create icons depending on UI_icons.h
${CMAKE_SOURCE_DIR}/source/blender/editors/include/UI_icons.h
# could be an arg but for now we only create icons depending on UI_icons.hh
${CMAKE_SOURCE_DIR}/source/blender/editors/include/UI_icons.hh
)
set_source_files_properties(${_file_from} ${_file_to} PROPERTIES GENERATED TRUE)
@ -1151,7 +1230,10 @@ function(svg_to_png
add_custom_command(
OUTPUT ${_file_to}
COMMAND ${INKSCAPE_EXE} ${_file_from} --export-dpi=${dpi} --without-gui --export-png=${_file_to}
COMMAND ${INKSCAPE_EXE}
${_file_from} --export-dpi=${dpi} --without-gui --export-png=${_file_to}
DEPENDS ${_file_from} ${INKSCAPE_EXE}
)
else()
@ -1177,8 +1259,13 @@ function(msgfmt_simple
add_custom_command(
OUTPUT ${_file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
COMMAND ${CMAKE_COMMAND} -E env ${PLATFORM_ENV_BUILD} "$<TARGET_FILE:msgfmt>" ${_file_from} ${_file_to}
COMMAND ${CMAKE_COMMAND} -E
make_directory ${_file_to_path}
COMMAND ${CMAKE_COMMAND} -E
env ${PLATFORM_ENV_BUILD} "$<TARGET_FILE:msgfmt>" ${_file_from} ${_file_to}
DEPENDS msgfmt ${_file_from})
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
@ -1186,7 +1273,7 @@ endfunction()
function(find_python_package
package
relative_include_dir
relative_inc_dir
)
string(TOUPPER ${package} _upper_package)
@ -1237,19 +1324,20 @@ function(find_python_package
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/vendor-packages/${package}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/vendor-packages/${package}', "
"\n"
"The 'WITH_PYTHON_INSTALL_${_upper_package}' option will be ignored when installing Python.\n"
"The 'WITH_PYTHON_INSTALL_${_upper_package}' option will be ignored "
"when installing Python.\n"
"The build will be usable, only add-ons that depend on this package won't be functional."
)
set(WITH_PYTHON_INSTALL_${_upper_package} OFF PARENT_SCOPE)
else()
message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'")
if(NOT "${relative_include_dir}" STREQUAL "")
set(_relative_include_dir "${package}/${relative_include_dir}")
if(NOT "${relative_inc_dir}" STREQUAL "")
set(_relative_inc_dir "${package}/${relative_inc_dir}")
unset(PYTHON_${_upper_package}_INCLUDE_DIRS CACHE)
find_path(PYTHON_${_upper_package}_INCLUDE_DIRS
NAMES
"${_relative_include_dir}"
"${_relative_inc_dir}"
HINTS
"${PYTHON_LIBPATH}/"
"${PYTHON_LIBPATH}/python${PYTHON_VERSION}/"
@ -1260,31 +1348,35 @@ function(find_python_package
"vendor-packages/"
NO_DEFAULT_PATH
DOC
"Path to python site-packages or dist-packages containing '${package}' module header files"
"\
Path to python site-packages or dist-packages containing '${package}' module header files"
)
mark_as_advanced(PYTHON_${_upper_package}_INCLUDE_DIRS)
if(NOT EXISTS "${PYTHON_${_upper_package}_INCLUDE_DIRS}")
message(WARNING
"Python package '${package}' include dir path could not be found in:\n"
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/vendor-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/vendor-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${_relative_inc_dir}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/${_relative_inc_dir}', "
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${_relative_inc_dir}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${_relative_inc_dir}', "
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/vendor-packages/${_relative_inc_dir}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/vendor-packages/${_relative_inc_dir}', "
"\n"
"The 'WITH_PYTHON_${_upper_package}' option will be disabled.\n"
"The build will be usable, only add-ons that depend on this package won't be functional."
"The build will be usable, only add-ons that depend on this package "
"won't be functional."
)
set(WITH_PYTHON_${_upper_package} OFF PARENT_SCOPE)
else()
set(_temp "${PYTHON_${_upper_package}_INCLUDE_DIRS}/${package}/${relative_include_dir}")
set(_temp "${PYTHON_${_upper_package}_INCLUDE_DIRS}/${package}/${relative_inc_dir}")
unset(PYTHON_${_upper_package}_INCLUDE_DIRS CACHE)
set(PYTHON_${_upper_package}_INCLUDE_DIRS "${_temp}"
CACHE PATH "Path to the include directory of the ${package} module")
message(STATUS "${package} include files found at '${PYTHON_${_upper_package}_INCLUDE_DIRS}'")
message(STATUS
"${package} include files found at '${PYTHON_${_upper_package}_INCLUDE_DIRS}'"
)
endif()
endif()
endif()
@ -1309,10 +1401,22 @@ macro(openmp_delayload
else()
set(OPENMP_DLL_NAME "vcomp140")
endif()
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib")
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
set_property(
TARGET ${projectname} APPEND_STRING PROPERTY
LINK_FLAGS_RELEASE " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib"
)
set_property(
TARGET ${projectname} APPEND_STRING PROPERTY
LINK_FLAGS_DEBUG " /DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib"
)
set_property(
TARGET ${projectname} APPEND_STRING PROPERTY
LINK_FLAGS_RELWITHDEBINFO " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib"
)
set_property(
TARGET ${projectname} APPEND_STRING PROPERTY
LINK_FLAGS_MINSIZEREL " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib"
)
endif()
endif()
endmacro()
@ -1343,7 +1447,12 @@ macro(set_and_warn_library_found
endmacro()
macro(without_system_libs_begin)
set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
set(CMAKE_IGNORE_PATH
"${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}"
"${CMAKE_SYSTEM_INCLUDE_PATH}"
"${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}"
"${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}"
)
endmacro()
macro(without_system_libs_end)
@ -1372,7 +1481,13 @@ macro(windows_install_shared_manifest)
set(options OPTIONAL DEBUG RELEASE ALL)
set(oneValueArgs)
set(multiValueArgs FILES)
cmake_parse_arguments(WINDOWS_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
cmake_parse_arguments(
WINDOWS_INSTALL
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN}
)
# If none of the options are set assume ALL.
unset(WINDOWS_CONFIGURATIONS)
if(NOT WINDOWS_INSTALL_ALL AND
@ -1399,15 +1514,17 @@ macro(windows_install_shared_manifest)
if(WINDOWS_INSTALL_RELEASE)
list(APPEND WINDOWS_SHARED_MANIFEST_RELEASE ${WINDOWS_INSTALL_FILES})
endif()
install(FILES ${WINDOWS_INSTALL_FILES}
CONFIGURATIONS ${WINDOWS_CONFIGURATIONS}
DESTINATION "./blender.shared"
install(
FILES ${WINDOWS_INSTALL_FILES}
DESTINATION "./blender.shared"
CONFIGURATIONS ${WINDOWS_CONFIGURATIONS}
)
else()
# Python module without manifest.
install(FILES ${WINDOWS_INSTALL_FILES}
CONFIGURATIONS ${WINDOWS_CONFIGURATIONS}
DESTINATION "./bpy"
install(
FILES ${WINDOWS_INSTALL_FILES}
DESTINATION "./bpy"
CONFIGURATIONS ${WINDOWS_CONFIGURATIONS}
)
endif()
endmacro()
@ -1416,13 +1533,23 @@ macro(windows_generate_manifest)
set(options)
set(oneValueArgs OUTPUT NAME)
set(multiValueArgs FILES)
cmake_parse_arguments(WINDOWS_MANIFEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
cmake_parse_arguments(
WINDOWS_MANIFEST
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN}
)
set(MANIFEST_LIBS "")
foreach(lib ${WINDOWS_MANIFEST_FILES})
get_filename_component(filename ${lib} NAME)
set(MANIFEST_LIBS "${MANIFEST_LIBS} <file name=\"${filename}\"/>\n")
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.manifest.in ${WINDOWS_MANIFEST_OUTPUT} @ONLY)
configure_file(
${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.manifest.in
${WINDOWS_MANIFEST_OUTPUT}
@ONLY
)
endmacro()
macro(windows_generate_shared_manifest)

View File

@ -65,8 +65,14 @@ endif()
set(CMAKE_FIND_FRAMEWORK NEVER)
# Optionally use system Python if PYTHON_ROOT_DIR is specified.
if(WITH_PYTHON AND (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
find_package(PythonLibsUnix REQUIRED)
if(WITH_PYTHON)
if(WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR)
find_package(PythonLibsUnix REQUIRED)
endif()
else()
# Python executable is needed as part of the build-process,
# note that building without Python is quite unusual.
find_program(PYTHON_EXECUTABLE "python3")
endif()
# Prefer lib directory paths
@ -127,8 +133,10 @@ if(WITH_CODEC_SNDFILE)
unset(_sndfile_VORBISENC_LIBRARY)
endif()
if(WITH_PYTHON AND NOT (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
find_package(PythonLibsUnix REQUIRED)
if(WITH_PYTHON)
if(NOT (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
find_package(PythonLibsUnix REQUIRED)
endif()
endif()
if(WITH_FFTW3)

View File

@ -181,6 +181,10 @@ Proceeding with PYTHON_SITE_PACKAGES install target, you have been warned!"
unset(_is_prefix)
endif()
endif()
else()
# Python executable is needed as part of the build-process,
# note that building without Python is quite unusual.
find_program(PYTHON_EXECUTABLE "python3")
endif()
if(WITH_IMAGE_OPENEXR)

View File

@ -517,25 +517,29 @@ if(WITH_JACK)
set(JACK_LIBRARIES optimized ${LIBDIR}/jack/lib/libjack.lib debug ${LIBDIR}/jack/lib/libjack_d.lib)
endif()
set(_PYTHON_VERSION "3.10")
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${_PYTHON_VERSION})
# Python executable is needed as part of the build-process,
# note that building without Python is quite unusual.
set(PYTHON_EXECUTABLE ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python$<$<CONFIG:Debug>:_d>.exe)
if(WITH_PYTHON)
# Cache version for make_bpy_wheel.py to detect.
unset(PYTHON_VERSION CACHE)
set(PYTHON_VERSION "3.10" CACHE STRING "Python version")
set(PYTHON_VERSION "${_PYTHON_VERSION}" CACHE STRING "Python version")
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
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)
set(PYTHON_EXECUTABLE ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python$<$<CONFIG:Debug>:_d>.exe)
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)
unset(_PYTHON_VERSION_NO_DOTS)
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_LIBRARIES debug "${PYTHON_LIBRARY_DEBUG}" optimized "${PYTHON_LIBRARY}" )
endif()
unset(_PYTHON_VERSION)
unset(_PYTHON_VERSION_NO_DOTS)
if(NOT WITH_WINDOWS_FIND_MODULES)
# even if boost is off, we still need to install the dlls when we use our lib folder since
@ -857,10 +861,14 @@ if(WITH_CYCLES AND WITH_CYCLES_OSL)
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+[0-9]+.*$")
file(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MINOR
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+[0-9]+.*$")
file(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_PATCH
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_PATCH[ \t]+[0-9]+.*$")
string(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+([.0-9]+).*"
"\\1" OSL_LIBRARY_VERSION_MAJOR ${OSL_LIBRARY_VERSION_MAJOR})
string(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+([.0-9]+).*"
"\\1" OSL_LIBRARY_VERSION_MINOR ${OSL_LIBRARY_VERSION_MINOR})
string(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_PATCH[ \t]+([.0-9]+).*"
"\\1" OSL_LIBRARY_VERSION_PATCH ${OSL_LIBRARY_VERSION_PATCH})
endif()
if(WITH_CYCLES AND WITH_CYCLES_EMBREE)