blender/build_files/build_environment/cmake/blosc.cmake
Jonas Holzman 828d6d1a01 Deps: Linux: Fix Blosc build errors with GCC 15
The issue comes from GCC 15 now defaulting to C23[^1]. Fixed by
enforcing the previous C17 standard. This issue has been fixed upstream
in c-blosc commit 774f6a0[^2], but hasn't made it to a release yet.

[^1]: https://gcc.gnu.org/gcc-15/porting_to.html
[^2]: 774f6a0eba

Pull Request: https://projects.blender.org/blender/blender/pulls/156772
2026-04-02 17:08:39 +02:00

45 lines
1.2 KiB
CMake

# SPDX-FileCopyrightText: 2012-2022 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(BLOSC_EXTRA_ARGS
-DBUILD_TESTS=OFF
-DBUILD_BENCHMARKS=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DThreads_FOUND=1
-DPTHREAD_LIBS=${LIBDIR}/pthreads/lib/pthreadVC3.lib
-DPTHREAD_INCLUDE_DIR=${LIBDIR}/pthreads/inc
-DDEACTIVATE_SNAPPY=ON
-DDEACTIVATE_ZLIB=ON
-DDEACTIVATE_ZSTD=ON
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
# Fix for building with GCC 15, which defaults to C23. Fixed in main in the c-blosc repo, remove on upgrade.
# See commit: https://github.com/Blosc/c-blosc/commit/774f6a0ebaa0c617f7f13ccf6bc89d17eba04654
-DCMAKE_C_STANDARD=17
)
ExternalProject_Add(external_blosc
URL file://${PACKAGE_DIR}/${BLOSC_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${BLOSC_HASH_TYPE}=${BLOSC_HASH}
PREFIX ${BUILD_DIR}/blosc
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIBDIR}/blosc
${DEFAULT_CMAKE_FLAGS}
${BLOSC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/blosc
)
if(WIN32)
add_dependencies(
external_blosc
external_pthreads
)
endif()
if(APPLE)
harvest(external_blosc blosc/lib openvdb/lib "*.a")
endif()