mirrored from https://projects.blender.org/blender/blender.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: support building with musl libc
Instead of using macros like GLIBC we can use the CMake build systems internal functions to check if some header or functions are present on the running system's libc. Add ./build_files/cmake/have_features.cmake to add checks for platform features which can be used to set defines for source files that require them. Reviewed By: campbellbarton Ref D15696
- Loading branch information
1 parent
0a84cc6
commit f197b1a
Showing
10 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
# Copyright 2022 Blender Foundation. All rights reserved. | ||
|
||
# This file is used to test the system for headers & symbols. | ||
# Variables should use the `HAVE_` prefix. | ||
# Defines should use the same name as the CMAKE variable. | ||
|
||
include(CheckSymbolExists) | ||
|
||
# Used for: `intern/guardedalloc/intern/mallocn_intern.h`. | ||
# Function `malloc_stats` is only available on GLIBC, | ||
# so check that before defining `HAVE_MALLOC_STATS`. | ||
check_symbol_exists(malloc_stats "malloc.h" HAVE_MALLOC_STATS_H) | ||
|
||
# Used for: `source/creator/creator_signals.c`. | ||
# The function `feenableexcept` is not present non-GLIBC systems, | ||
# hence we need to check if it's available in the `fenv.h` file. | ||
set(HAVE_FEENABLEEXCEPT OFF) | ||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
check_symbol_exists(feenableexcept "fenv.h" HAVE_FEENABLEEXCEPT) | ||
endif() | ||
|
||
# Used for: `source/blender/blenlib/intern/system.c`. | ||
# `execinfo` is not available on non-GLIBC systems (at least not on MUSL-LIBC), | ||
# so check the presence of the header before including it and using the it for back-trace. | ||
set(HAVE_EXECINFO_H OFF) | ||
if(NOT MSVC) | ||
include(CheckIncludeFiles) | ||
check_include_files("execinfo.h" HAVE_EXECINFO_H) | ||
if(HAVE_EXECINFO_H) | ||
add_definitions(-DHAVE_EXECINFO_H) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters