Browse Source

cmake architecture detection improved

master
mrolinek 7 years ago
committed by Johan Pascal
parent
commit
e8193b1c96
3 changed files with 17 additions and 7 deletions
  1. +15
    -5
      src/CMakeLists.txt
  2. +1
    -1
      src/curve25519/CMakeLists.txt
  3. +1
    -1
      src/ed448goldilocks/CMakeLists.txt

+ 15
- 5
src/CMakeLists.txt View File

@@ -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_P25519 arch_ref64)
set(TARGET_ARCH_DIR_P448 arch_ref64)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") # is an arm 32 bits, TODO: detect neon features?
message("Target architecture is arm32 no NEON")
set(TARGET_ARCH_DIR arch_arm_32)
set(TARGET_ARCH_DIR_P25519 arch_32) # nothing specific for arm32 on p25519
set(TARGET_ARCH_DIR_P448 arch_arm_32)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") # is an arm 32 bits
if (NOT ${CMAKE_ANDROID_ARCH_ABI} STREQUAL "armeabi") # arm <= 5.0 does not support instructions from the lib, keep arch_32
if(${ANDROID_ARM_NEON})
message("Target architecture is arm32 NEON")
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
message("Target architecture is general purpose 32bits")
endif()


+ 1
- 1
src/curve25519/CMakeLists.txt View File

@@ -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)

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)

+ 1
- 1
src/ed448goldilocks/CMakeLists.txt View File

@@ -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)

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)

Loading…
Cancel
Save