Commit e8193b1c authored by mrolinek's avatar mrolinek Committed by Johan Pascal

cmake architecture detection improved

parent 792fe29a
...@@ -42,11 +42,21 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arch64") # shall be arm64 bits, stick ...@@ -42,11 +42,21 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arch64") # shall be arm64 bits, stick
set(TARGET_ARCH_DIR arch_ref64) set(TARGET_ARCH_DIR arch_ref64)
set(TARGET_ARCH_DIR_P25519 arch_ref64) set(TARGET_ARCH_DIR_P25519 arch_ref64)
set(TARGET_ARCH_DIR_P448 arch_ref64) set(TARGET_ARCH_DIR_P448 arch_ref64)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") # is an arm 32 bits, TODO: detect neon features? elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") # is an arm 32 bits
message("Target architecture is arm32 no NEON") if (NOT ${CMAKE_ANDROID_ARCH_ABI} STREQUAL "armeabi") # arm <= 5.0 does not support instructions from the lib, keep arch_32
set(TARGET_ARCH_DIR arch_arm_32) if(${ANDROID_ARM_NEON})
set(TARGET_ARCH_DIR_P25519 arch_32) # nothing specific for arm32 on p25519 message("Target architecture is arm32 NEON")
set(TARGET_ARCH_DIR_P448 arch_arm_32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon") # build with neon flag
set(TARGET_ARCH_DIR arch_neon)
set(TARGET_ARCH_DIR_P25519 arch_32) # nothing specific for neon on p25519
set(TARGET_ARCH_DIR_P448 arch_neon)
else(${ANDROID_ARM_NEON})
message("Target architecture is arm32 no NEON")
set(TARGET_ARCH_DIR arch_arm_32)
set(TARGET_ARCH_DIR_P25519 arch_32) # nothing specific for arch_arm on p25519
set(TARGET_ARCH_DIR_P448 arch_arm_32)
endif(${ANDROID_ARM_NEON})
endif (NOT ${CMAKE_ANDROID_ARCH_ABI} STREQUAL "armeabi")
else() # nothing picked yet, stick to the else() # nothing picked yet, stick to the
message("Target architecture is general purpose 32bits") message("Target architecture is general purpose 32bits")
endif() endif()
......
...@@ -26,5 +26,5 @@ SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/curve25519/eddsa.c PROPERTIES GENE ...@@ -26,5 +26,5 @@ SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/curve25519/eddsa.c PROPERTIES GENE
SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/src/curve25519/decaf_tables.c PROPERTIES GENERATED 1) SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/src/curve25519/decaf_tables.c PROPERTIES GENERATED 1)
add_library(CURVE25519 OBJECT ${CURVE25519_SOURCE_FILES_C}) add_library(CURVE25519 OBJECT ${CURVE25519_SOURCE_FILES_C})
add_dependencies(CURVE25519 generatedCode) add_dependencies(CURVE25519 generatedCode p25519)
set_target_properties(CURVE25519 PROPERTIES POSITION_INDEPENDENT_CODE True) set_target_properties(CURVE25519 PROPERTIES POSITION_INDEPENDENT_CODE True)
...@@ -26,5 +26,5 @@ SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/ed448goldilocks/eddsa.c PROPERTIES ...@@ -26,5 +26,5 @@ SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/ed448goldilocks/eddsa.c PROPERTIES
SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/src/ed448goldilocks/decaf_tables.c PROPERTIES GENERATED 1) SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/src/ed448goldilocks/decaf_tables.c PROPERTIES GENERATED 1)
add_library(CURVE448 OBJECT ${CURVE448_SOURCE_FILES_C}) add_library(CURVE448 OBJECT ${CURVE448_SOURCE_FILES_C})
add_dependencies(CURVE448 generatedCode) add_dependencies(CURVE448 generatedCode p448)
set_target_properties(CURVE448 PROPERTIES POSITION_INDEPENDENT_CODE True) set_target_properties(CURVE448 PROPERTIES POSITION_INDEPENDENT_CODE True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment