Skip to content

Commit

Permalink
build & test cg
Browse files Browse the repository at this point in the history
  • Loading branch information
franziskuskiefer committed Nov 3, 2024
1 parent f341b0d commit 3228e7c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 42 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/s390x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ jobs:
cmake -B build -G"Ninja Multi-Config"
cmake --build build
./build/Debug/ml_kem_test
cd ../cg
cmake -B build -G"Ninja Multi-Config"
cmake --build build
./build/Debug/ml_kem_test
86 changes: 44 additions & 42 deletions libcrux-ml-kem/cg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ if(NOT MSVC)
endif(NOT MSVC)

if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "13.0.0") OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "13.1.6"))
add_compile_options(-Werror -Wframe-larger-than=25344)
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "13.0.0") OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "13.1.6"))
add_compile_options(-Werror -Wframe-larger-than=25344)
endif()

set(CMAKE_COLOR_DIAGNOSTICS "ON")
Expand Down Expand Up @@ -95,48 +95,50 @@ target_link_libraries(sha3_test PRIVATE
)

# --- Benchmarks
FetchContent_Declare(benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.8.4
)
FetchContent_MakeAvailable(benchmark)

add_executable(ml_kem_bench
${PROJECT_SOURCE_DIR}/benches/mlkem768.cc
)
target_link_libraries(ml_kem_bench PRIVATE
benchmark::benchmark
)
if(DEFINED ENV{LIBCRUX_BENCHMARKS})
FetchContent_Declare(benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.8.4
)
FetchContent_MakeAvailable(benchmark)

if(DEFINED ENV{SYMCRYPT_PATH})
message("Symcrypt path: $ENV{SYMCRYPT_PATH}")
add_compile_definitions(LIBCRUX_SYMCRYPT)
target_include_directories(ml_kem_bench PRIVATE $ENV{SYMCRYPT_PATH})
target_link_directories(ml_kem_bench PRIVATE $ENV{SYMCRYPT_PATH}/bin/lib)
target_link_libraries(ml_kem_bench PRIVATE symcrypt)
endif(DEFINED ENV{SYMCRYPT_PATH})
add_executable(ml_kem_bench
${PROJECT_SOURCE_DIR}/benches/mlkem768.cc
)
target_link_libraries(ml_kem_bench PRIVATE
benchmark::benchmark
)

add_executable(ml_kem_keygen
${PROJECT_SOURCE_DIR}/benches/mlkem768_keygen.cc
)
target_link_libraries(ml_kem_keygen PRIVATE
benchmark::benchmark
)
if(DEFINED ENV{SYMCRYPT_PATH})
message("Symcrypt path: $ENV{SYMCRYPT_PATH}")
add_compile_definitions(LIBCRUX_SYMCRYPT)
target_include_directories(ml_kem_bench PRIVATE $ENV{SYMCRYPT_PATH})
target_link_directories(ml_kem_bench PRIVATE $ENV{SYMCRYPT_PATH}/bin/lib)
target_link_libraries(ml_kem_bench PRIVATE symcrypt)
endif(DEFINED ENV{SYMCRYPT_PATH})

add_executable(ml_kem_encaps
${PROJECT_SOURCE_DIR}/benches/mlkem768_encaps.cc
)
target_link_libraries(ml_kem_encaps PRIVATE
benchmark::benchmark
)
add_executable(ml_kem_keygen
${PROJECT_SOURCE_DIR}/benches/mlkem768_keygen.cc
)
target_link_libraries(ml_kem_keygen PRIVATE
benchmark::benchmark
)

if(NOT MSVC)
# We benchmark internal functions here that are inlined and thus not available
# in MSVC.
add_executable(sha3_bench
${PROJECT_SOURCE_DIR}/benches/sha3.cc
add_executable(ml_kem_encaps
${PROJECT_SOURCE_DIR}/benches/mlkem768_encaps.cc
)
target_link_libraries(sha3_bench PRIVATE
target_link_libraries(ml_kem_encaps PRIVATE
benchmark::benchmark
)
endif(NOT MSVC)

if(NOT MSVC)
# We benchmark internal functions here that are inlined and thus not available
# in MSVC.
add_executable(sha3_bench
${PROJECT_SOURCE_DIR}/benches/sha3.cc
)
target_link_libraries(sha3_bench PRIVATE
benchmark::benchmark
)
endif(NOT MSVC)
endif(DEFINED ENV{LIBCRUX_BENCHMARKS})

0 comments on commit 3228e7c

Please sign in to comment.