# SPDX-License-Identifier: Apache-2.0

if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
    add_definitions(-DTARGET_ARM64)
    add_definitions(-DRADIX_64)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
    add_definitions(-DTARGET_ARM)
    add_definitions(-DRADIX_32)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
    add_definitions(-DTARGET_AMD64)
    add_definitions(-DRADIX_64)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "i386" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686")
    add_definitions(-DTARGET_X86)
    add_definitions(-DRADIX_32)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(s390x.*|S390X.*)")
    add_definitions(-DTARGET_S390X)
    add_definitions(-DTARGET_BIG_ENDIAN)
    add_definitions(-DRADIX_64)
else()
    add_definitions(-DTARGET_OTHER)
    add_definitions(-DRADIX_64)
    message("Warning: system architecture not detected, defaulting to 64 bit")
endif()

if (UNIX)
    add_definitions(-DTARGET_OS_UNIX)
else()
    add_definitions(-DTARGET_OS_OTHER)
endif()

set(C_OPT_FLAGS "")

if ((NOT DEFINED SQISIGN_BUILD_TYPE))
  set(SQISIGN_BUILD_TYPE opt)
endif()

if ((NOT DEFINED SQISIGN_TEST_REPS))
  set(SQISIGN_TEST_REPS 1000)
endif()
