From 5fb8161e0dc7f7dba101fa5abfd0e0389f65495e Mon Sep 17 00:00:00 2001 From: Link4Electronics Date: Sun, 4 Jan 2026 23:33:20 -0300 Subject: [PATCH] TestBigEndian got deprecated, so better endian check (#514) * TestBigEndian got deprecated with this and the patch for BRender-v1.3.2 repo this matter should be done now. * Update minimum required CMake version to 3.20 --------- Co-authored-by: Dethrace Engineering Department <78985374+dethrace-labs@users.noreply.github.com> --- CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e86658c..0465004d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.20) if(NOT DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo" FORCE) @@ -15,7 +15,6 @@ endif() include(CheckCCompilerFlag) include(CMakeDependentOption) -include(TestBigEndian) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION") file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" DETHRACE_VERSION) @@ -86,7 +85,16 @@ function(add_compile_flags_if_supported TARGET) endforeach() endfunction() -test_big_endian(IS_BIGENDIAN) +if(CMAKE_C_BYTE_ORDER STREQUAL "BIG_ENDIAN") + set(WORDS_BIGENDIAN TRUE) + add_definitions(-DBR_ENDIAN_BIG=1 -DBR_ENDIAN_LITTLE=0) +elseif(CMAKE_C_BYTE_ORDER STREQUAL "LITTLE_ENDIAN") + set(WORDS_BIGENDIAN FALSE) + add_definitions(-DBR_ENDIAN_BIG=0 -DBR_ENDIAN_LITTLE=1) +else() + set(WORDS_BIGENDIAN FALSE) + message(WARNING "Endianness could not be determined.") +endif() set(count_sdl_platforms 0)