Files
p2pool-salvium/external/mx25519/CMakeLists.txt
t1amak 15fecd0e41
Some checks failed
C/C++ CI / build-alpine-static (map[arch:riscv64 branch:latest-stable flags:-ffunction-sections]) (push) Has been cancelled
C/C++ CI / build-alpine-static (map[arch:x86_64 branch:latest-stable flags:-ffunction-sections]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-10 cpp:g++-10 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-11 cpp:g++-11 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-12 cpp:g++-12 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-13 cpp:g++-13 flags: os:ubuntu-24.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-14 cpp:g++-14 flags: os:ubuntu-24.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-9 cpp:g++-9 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu-static-libs (map[flags:-fuse-linker-plugin -ffunction-sections]) (push) Has been cancelled
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-22.04-arm]) (push) Has been cancelled
C/C++ CI / build-ubuntu-riscv64 (map[flags:-fuse-linker-plugin -ffunction-sections os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-windows-msys2 (map[c:clang cxx:clang++ flags:-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled -Wno-attributes]) (push) Has been cancelled
C/C++ CI / build-windows-msys2 (map[c:gcc cxx:g++ flags:-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes -Wno-attributes]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2022 rx:OFF tls:OFF upnp:OFF vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-alpine-static (map[arch:aarch64 branch:latest-stable flags:-ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2022 rx:OFF tls:ON upnp:OFF vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2022 rx:OFF tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2022 rx:ON tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2022 rx:ON tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-macos (push) Has been cancelled
C/C++ CI / build-macos-aarch64 (push) Has been cancelled
C/C++ CI / build-freebsd (map[architecture:x86-64 host:ubuntu-latest name:freebsd version:13.3]) (push) Has been cancelled
C/C++ CI / build-openbsd (map[architecture:x86-64 host:ubuntu-latest name:openbsd version:7.4]) (push) Has been cancelled
clang-tidy / clang-tidy (push) Has been cancelled
Code coverage / coverage (push) Has been cancelled
Microsoft C++ Code Analysis / Analyze (push) Has been cancelled
source-snapshot / source-snapshot (push) Failing after 3s
CodeQL / Analyze (cpp) (push) Failing after 14m7s
cppcheck / cppcheck-ubuntu (push) Failing after 7m20s
Sync test / sync-test-ubuntu-tsan (push) Failing after 12m6s
Sync test / sync-test-ubuntu-msan (push) Failing after 17m56s
Sync test / sync-test-ubuntu-ubsan (push) Failing after 12m18s
Sync test / sync-test-ubuntu-asan (push) Failing after 12m9s
cppcheck / cppcheck-windows (push) Has been cancelled
Sync test / sync-test-macos (map[flags: os:macos-15-intel]) (push) Has been cancelled
Sync test / sync-test-macos (map[flags:-target arm64-apple-macos-11 os:macos-15]) (push) Has been cancelled
Sync test / sync-test-windows-debug-asan (push) Has been cancelled
Sync test / sync-test-windows-leaks (push) Has been cancelled
sync with local changes
2025-12-06 18:34:35 +01:00

97 lines
3.0 KiB
CMake

cmake_minimum_required(VERSION 3.5)
set(MX25519_VERSION 1)
project(mx25519)
set(mx25519_sources
src/portable/scalarmult.c
src/cpu.c
src/impl.c
src/mx25519.c
src/scalar.c)
if(NOT ARCH_ID)
# allow cross compiling
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "")
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCH_ID)
endif()
if(NOT ARM_ID)
set(ARM_ID "${ARCH_ID}")
endif()
if(NOT ARCH)
set(ARCH "default")
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}")
endif()
message(STATUS "Build architecture: ${ARCH_ID}")
# AMD64
if(ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64")
if(MSVC)
enable_language(ASM_MASM)
list(APPEND mx25519_sources src/amd64/scalarmult_masm.asm)
set_property(SOURCE src/amd64/scalarmult_masm.asm PROPERTY LANGUAGE ASM_MASM)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /DRELWITHDEBINFO")
else()
list(APPEND mx25519_sources src/amd64/scalarmult_gnu.S)
set_property(SOURCE src/amd64/scalarmult_gnu.S PROPERTY LANGUAGE C)
set_property(SOURCE src/amd64/scalarmult_gnu.S PROPERTY XCODE_EXPLICIT_FILE_TYPE sourcecode.asm)
endif()
endif()
# ARM64
if(ARM_ID STREQUAL "aarch64" OR ARM_ID STREQUAL "arm64" OR ARM_ID STREQUAL "armv8-a")
list(APPEND mx25519_sources src/arm64/scalarmult.S)
set_property(SOURCE src/arm64/scalarmult.S PROPERTY LANGUAGE C)
set_property(SOURCE src/arm64/scalarmult.S PROPERTY XCODE_EXPLICIT_FILE_TYPE sourcecode.asm)
endif()
set(MX25519_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/include" CACHE STRING "mx25519 include path")
add_library(mx25519 SHARED ${mx25519_sources})
set_property(TARGET mx25519 PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET mx25519 PROPERTY PUBLIC_HEADER include/mx25519.h)
include_directories(mx25519
include/)
target_compile_definitions(mx25519 PRIVATE MX25519_SHARED)
set_target_properties(mx25519 PROPERTIES SOVERSION ${MX25519_VERSION})
add_library(mx25519_static STATIC ${mx25519_sources})
set_property(TARGET mx25519_static PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET mx25519_static PROPERTY PUBLIC_HEADER include/mx25519.h)
include_directories(mx25519_static
include/)
set_target_properties(mx25519_static PROPERTIES OUTPUT_NAME mx25519)
target_compile_definitions(mx25519_static PRIVATE MX25519_STATIC)
add_executable(mx25519-tests
tests/tests.c)
include_directories(mx25519-tests
include/
src/)
target_compile_definitions(mx25519-tests PRIVATE MX25519_STATIC)
target_link_libraries(mx25519-tests
PRIVATE mx25519_static)
set_property(TARGET mx25519-tests PROPERTY POSITION_INDEPENDENT_CODE ON)
add_executable(mx25519-bench
tests/bench.c
src/cpu.c
src/platform.c)
include_directories(mx25519-bench
include/
src/)
target_compile_definitions(mx25519-bench PRIVATE MX25519_STATIC)
target_link_libraries(mx25519-bench
PRIVATE mx25519_static)
set_property(TARGET mx25519-bench PROPERTY POSITION_INDEPENDENT_CODE ON)