From b4724d2b76324f54d9fc2d33d8581416a9da07f6 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Tue, 18 Jun 2024 21:56:56 +0200 Subject: [PATCH] Fixes to build under arm32 ( raspberry pi on 32bit debian). Signed-off-by: JosepMaJAZ --- CMakeLists.txt | 9 +++++++-- cmake/arch-detect.cmake | 9 ++++++++- src/codegen/codegen.cmake | 16 +++++++--------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf18a76a..110b5f15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,13 @@ if(${PCEM_CPU_TYPE} STREQUAL "i386") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") endif() -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -mstackrealign -fno-strict-aliasing") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -mstackrealign -fno-strict-aliasing") +if(${PCEM_CPU_TYPE} MATCHES "arm.*") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -fno-strict-aliasing") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -fno-strict-aliasing") +else() + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -mstackrealign -fno-strict-aliasing") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -mstackrealign -fno-strict-aliasing") +endif() set(PCEM_VERSION_STRING "vNext" CACHE STRING "PCem Version String") set(PCEM_DISPLAY_ENGINE "wxWidgets" CACHE STRING "PCem Display Engine") diff --git a/cmake/arch-detect.cmake b/cmake/arch-detect.cmake index a43026a2..753d22c3 100644 --- a/cmake/arch-detect.cmake +++ b/cmake/arch-detect.cmake @@ -1,9 +1,15 @@ set(archdetect_c_code " #if defined(__arm__) || defined(__TARGET_ARCH_ARM) - #if defined(__ARM_ARCH_7__) \\ + #if defined(__ARM_ARCH_8__) \\ + || defined(__ARM_ARCH_8A__) \\ + || (defined(__ARM_ARCH) && __ARM_ARCH >= 8) \\ + || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 8) + #error cmake_ARCH armv8 + #elif defined(__ARM_ARCH_7__) \\ || defined(__ARM_ARCH_7A__) \\ || defined(__ARM_ARCH_7R__) \\ || defined(__ARM_ARCH_7M__) \\ + || (defined(__ARM_ARCH) && __ARM_ARCH >= 7) \\ || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) #error cmake_ARCH armv7 #elif defined(__ARM_ARCH_6__) \\ @@ -13,6 +19,7 @@ set(archdetect_c_code " || defined(__ARM_ARCH_6K__) \\ || defined(__ARM_ARCH_6ZK__) \\ || defined(__ARM_ARCH_6M__) \\ + || (defined(__ARM_ARCH) && __ARM_ARCH >= 6) \\ || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6) #error cmake_ARCH armv6 #elif defined(__ARM_ARCH_5TEJ__) \\ diff --git a/src/codegen/codegen.cmake b/src/codegen/codegen.cmake index c164f938..204f6321 100644 --- a/src/codegen/codegen.cmake +++ b/src/codegen/codegen.cmake @@ -106,14 +106,6 @@ if(${PCEM_CPU_TYPE} STREQUAL "i386") ) endif() -if(${PCEM_CPU_TYPE} STREQUAL "arm") - set(PCEM_SRC ${PCEM_SRC} - codegen/arm32/codegen_backend_arm.c - codegen/arm32/codegen_backend_arm_ops.c - codegen/arm32/codegen_backend_arm_uops.c - ) -endif() - if(${PCEM_CPU_TYPE} STREQUAL "arm64") set(PCEM_SRC ${PCEM_SRC} codegen/arm64/codegen_backend_arm64.c @@ -121,4 +113,10 @@ if(${PCEM_CPU_TYPE} STREQUAL "arm64") codegen/arm64/codegen_backend_arm64_ops.c codegen/arm64/codegen_backend_arm64_uops.c ) -endif() \ No newline at end of file +elseif(${PCEM_CPU_TYPE} MATCHES "armv.*") + set(PCEM_SRC ${PCEM_SRC} + codegen/arm32/codegen_backend_arm.c + codegen/arm32/codegen_backend_arm_ops.c + codegen/arm32/codegen_backend_arm_uops.c + ) +endif()