CMake: Add build option to disable experimental features

This adds an option `WITH_EXPERIMENTAL_FEATURES` which is `ON` by default.
Sometimes it's usefull to be able to turn off all experimental features
during development for testing purposes. This option is still enforced to be
`OFF` for release cycles other than `alpha`.

Pull Request: https://projects.blender.org/blender/blender/pulls/118513
This commit is contained in:
Falk David 2024-02-21 09:57:40 +01:00 committed by Falk David
parent c409f2f7c6
commit 543194db70
3 changed files with 9 additions and 2 deletions

View File

@ -781,8 +781,10 @@ if(WIN32)
option(WITH_TBB_MALLOC_PROXY "Enable the TBB malloc replacement" ON)
endif()
option(WITH_EXPERIMENTAL_FEATURES "Enable experimental features" ON)
# This should be turned off when Blender enter beta/rc/release
if("${BLENDER_VERSION_CYCLE}" STREQUAL "alpha")
if("${BLENDER_VERSION_CYCLE}" STREQUAL "alpha" AND WITH_EXPERIMENTAL_FEATURES)
set(WITH_EXPERIMENTAL_FEATURES ON)
else()
set(WITH_EXPERIMENTAL_FEATURES OFF)

View File

@ -133,3 +133,7 @@ if(WITH_GTESTS)
)
blender_add_test_suite_lib(blenloader "${TEST_SRC}" "${INC}" "${INC_SYS}" "${TEST_LIB}")
endif()
if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_EXPERIMENTAL_FEATURES)
endif()

View File

@ -953,10 +953,11 @@ void BLO_sanitize_experimental_features_userpref_blend(UserDef *userdef)
*
* At that time master already has its version bumped so its user preferences
* are not touched by these settings. */
#ifdef WITH_EXPERIMENTAL_FEATURES
if (BKE_blender_version_is_alpha()) {
return;
}
#endif
MEMSET_STRUCT_AFTER(&userdef->experimental, 0, SANITIZE_AFTER_HERE);
}