Skip to content

Commit

Permalink
cmake: Make runbench/runtest optional
Browse files Browse the repository at this point in the history
  • Loading branch information
xdustinface authored and hoffmang9 committed Mar 9, 2021
1 parent 7995e3d commit 2213db5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ ENDIF()
project(BLS)

set(BUILD_BLS_PYTHON_BINDINGS 1 CACHE INTEGER "")
set(BUILD_BLS_TESTS 1 CACHE INTEGER "")
set(BUILD_BLS_BENCHMARKS 1 CACHE INTEGER "")

message(STATUS "Build python bindings: ${BUILD_BLS_PYTHON_BINDINGS}")
message(STATUS "Build tests: ${BUILD_BLS_TESTS}")
message(STATUS "Build benchmarks: ${BUILD_BLS_BENCHMARKS}")

# Add path for custom modules
set(CMAKE_MODULE_PATH
Expand Down
25 changes: 16 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ include_directories(
${INCLUDE_DIRECTORIES}
${relic_SOURCE_DIR}/include
${relic_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/../contrib/catch
)

if (GMP_FOUND)
Expand Down Expand Up @@ -86,13 +85,21 @@ install(DIRECTORY ${relic_BINARY_DIR}/include/ DESTINATION include/chiabls)
install(FILES ${includes} DESTINATION include/chiabls)
install(FILES ${C_LIB} DESTINATION lib)

add_executable(runtest test.cpp)
add_executable(runbench test-bench.cpp)
if (BUILD_BLS_TESTS)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../contrib/catch)
add_executable(runtest test.cpp)
if (SODIUM_FOUND)
target_link_libraries(runtest blstmp relic_s sodium)
else()
target_link_libraries(runtest blstmp relic_s)
endif()
endif()

if (SODIUM_FOUND)
target_link_libraries(runtest blstmp relic_s sodium)
target_link_libraries(runbench blstmp relic_s sodium)
else()
target_link_libraries(runtest blstmp relic_s)
target_link_libraries(runbench blstmp relic_s)
if (BUILD_BLS_BENCHMARKS)
add_executable(runbench test-bench.cpp)
if (SODIUM_FOUND)
target_link_libraries(runbench blstmp relic_s sodium)
else()
target_link_libraries(runbench blstmp relic_s)
endif()
endif()

0 comments on commit 2213db5

Please sign in to comment.