Skip to content

Commit

Permalink
don't use workspace name in crypto3
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyMlashkin committed Sep 20, 2024
1 parent b59ddd9 commit 95865bb
Show file tree
Hide file tree
Showing 56 changed files with 397 additions and 397 deletions.
6 changes: 3 additions & 3 deletions crypto3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ find_package(CM REQUIRED)
include(CMConfig)
include(CMSetupVersion)
cm_workspace(crypto3)
cm_setup_version(VERSION 0.3.0 PREFIX ${CMAKE_WORKSPACE_NAME})
cm_setup_version(VERSION 0.3.0 PREFIX crypto3)

option(BUILD_SHARED_LIBS "Build shared library" FALSE) # TODO: it makes no sense for header-only lib, remove
option(Boost_USE_STATIC_LIBS "Use static libraries for Boost" OFF)
Expand Down Expand Up @@ -72,8 +72,8 @@ if(BUILD_BENCH_TESTS)
add_subdirectory(benchmarks)
endif()

configure_file(${CMAKE_CURRENT_LIST_DIR}/docs/doxygen/${CMAKE_WORKSPACE_NAME}.doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_WORKSPACE_NAME}.doxyfile @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/docs/doxygen/crypto3.doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/crypto3.doxyfile @ONLY)

# Configure package file to be able to import crypto3 headers
# TODO: remove it after resolving cyclical dependencies in crypto3 modules
Expand Down
12 changes: 6 additions & 6 deletions crypto3/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ macro(define_benchmark benchmark)
${Boost_INCLUDE_DIRS})

target_link_libraries(${full_name}
${CMAKE_WORKSPACE_NAME}::random
${CMAKE_WORKSPACE_NAME}::math
${CMAKE_WORKSPACE_NAME}::algebra
${CMAKE_WORKSPACE_NAME}::multiprecision
${CMAKE_WORKSPACE_NAME}::zk
${CMAKE_WORKSPACE_NAME}::benchmark_tools
crypto3::random
crypto3::math
crypto3::algebra
crypto3::multiprecision
crypto3::zk
crypto3::benchmark_tools

Boost::unit_test_framework
Boost::timer
Expand Down
18 changes: 9 additions & 9 deletions crypto3/libs/algebra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
include(CMConfig)
include(CMSetupVersion)

cm_project(algebra WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES ASM C CXX)
cm_project(algebra WORKSPACE_NAME crypto3 LANGUAGES ASM C CXX)

include(CMDeploy)

Expand All @@ -22,23 +22,23 @@ if(STANDARD_EC_INF_POINTS)
add_definitions(-DSTANDARD_EC_INF_POINTS_ENABLED)
endif()

cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})
cm_setup_version(VERSION 0.1.0 PREFIX crypto3_${CURRENT_PROJECT_NAME})

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
add_library(crypto3_${CURRENT_PROJECT_NAME} INTERFACE)

set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
set_target_properties(crypto3_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_include_directories(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
${CMAKE_WORKSPACE_NAME}::multiprecision)
target_link_libraries(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
crypto3::multiprecision)

cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
cm_deploy(TARGETS crypto3_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
NAMESPACE crypto3::)

include(CMTest)
cm_add_test_subdirectory(test)
Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/algebra/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
macro(define_algebra_example name)
add_executable(algebra_${name}_example ${name}.cpp)
target_link_libraries(algebra_${name}_example PRIVATE
${CMAKE_WORKSPACE_NAME}_algebra
crypto3_algebra

$<TARGET_NAME_IF_EXISTS:boost_multiprecision>
)
Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/algebra/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.boost.org/LICENSE_1_0.txt
#---------------------------------------------------------------------------#

cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
cm_test_link_libraries(crypto3_${CURRENT_PROJECT_NAME}

Boost::unit_test_framework
Boost::random)
Expand Down
14 changes: 7 additions & 7 deletions crypto3/libs/benchmark_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
include(CMConfig)
include(CMSetupVersion)

cm_project(benchmark_tools WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES CXX)
cm_project(benchmark_tools WORKSPACE_NAME crypto3 LANGUAGES CXX)

include(CMDeploy)

cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})
cm_setup_version(VERSION 0.1.0 PREFIX crypto3_${CURRENT_PROJECT_NAME})

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
add_library(crypto3_${CURRENT_PROJECT_NAME} INTERFACE)

set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
set_target_properties(crypto3_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_include_directories(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
cm_deploy(TARGETS crypto3_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
NAMESPACE crypto3::)

include(CMTest)
28 changes: 14 additions & 14 deletions crypto3/libs/block/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include(CMConfig)
include(CMDeploy)
include(CMSetupVersion)

cm_project(block WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES C CXX)
cm_project(block WORKSPACE_NAME crypto3 LANGUAGES C CXX)

include(TargetArchitecture)
include(TargetConfiguration)
Expand Down Expand Up @@ -168,43 +168,43 @@ if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_XTEA)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_XTEA)
endif()

cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})
cm_setup_version(VERSION 0.1.0 PREFIX crypto3_${CURRENT_PROJECT_NAME})

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
add_library(crypto3_${CURRENT_PROJECT_NAME} INTERFACE)

set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
set_target_properties(crypto3_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

if(${CMAKE_TARGET_ARCHITECTURE} STREQUAL "x86_64" OR ${CMAKE_TARGET_ARCHITECTURE} STREQUAL "x86")
if(SSE2_FOUND)
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_compile_definitions(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
"${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_NI")
target_compile_options(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE "-maes;-mpclmul;-mssse3")
target_compile_options(crypto3_${CURRENT_PROJECT_NAME} INTERFACE "-maes;-mpclmul;-mssse3")
elseif(SSSE3_FOUND)
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_compile_definitions(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
"${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_SSSE3")
target_compile_options(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE "-maes;-mpclmul;-mssse3")
target_compile_options(crypto3_${CURRENT_PROJECT_NAME} INTERFACE "-maes;-mpclmul;-mssse3")
endif()
elseif(${CMAKE_TARGET_ARCHITECTURE} STREQUAL "armv8" OR ${CMAKE_TARGET_ARCHITECTURE} STREQUAL "arm64")
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_compile_definitions(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
"${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_ARMV8")
elseif(${CMAKE_TARGET_ARCHITECTURE} STREQUAL "ppc64")
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_compile_definitions(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
"${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_POWER8")
endif()

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_link_libraries(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
Boost::container)

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_include_directories(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>

${Boost_INCLUDE_DIRS})

cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
cm_deploy(TARGETS crypto3_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
NAMESPACE crypto3::)

include(CMTest)
cm_add_test_subdirectory(test)
2 changes: 1 addition & 1 deletion crypto3/libs/block/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.boost.org/LICENSE_1_0.txt
#---------------------------------------------------------------------------#

cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
cm_test_link_libraries(crypto3_${CURRENT_PROJECT_NAME}
Boost::unit_test_framework)

macro(define_block_cipher_test name)
Expand Down
16 changes: 8 additions & 8 deletions crypto3/libs/blueprint/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
include(CMConfig)
include(CMSetupVersion)

cm_project(blueprint WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES C CXX)
cm_project(blueprint WORKSPACE_NAME crypto3 LANGUAGES C CXX)

include(CMDeploy)

cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})
cm_setup_version(VERSION 0.1.0 PREFIX crypto3_${CURRENT_PROJECT_NAME})

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
add_library(crypto3_${CURRENT_PROJECT_NAME} INTERFACE)

set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
set_target_properties(crypto3_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_include_directories(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_link_libraries(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
${Boost_LIBRARIES}
)

cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
cm_deploy(TARGETS crypto3_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
NAMESPACE crypto3::)

include(CMTest)
cm_add_test_subdirectory(test)
Expand Down
16 changes: 8 additions & 8 deletions crypto3/libs/blueprint/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ macro(define_blueprint_example name)

add_executable(${full_example_name} ${name}.cpp)
target_link_libraries(${full_example_name} PRIVATE
${CMAKE_WORKSPACE_NAME}_blueprint

${CMAKE_WORKSPACE_NAME}::algebra
${CMAKE_WORKSPACE_NAME}::math
${CMAKE_WORKSPACE_NAME}::block
${CMAKE_WORKSPACE_NAME}::hash
${CMAKE_WORKSPACE_NAME}::multiprecision
${CMAKE_WORKSPACE_NAME}::zk
crypto3_blueprint

crypto3::algebra
crypto3::math
crypto3::block
crypto3::hash
crypto3::multiprecision
crypto3::zk

${Boost_LIBRARIES})
set_target_properties(${full_example_name} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED TRUE)
Expand Down
20 changes: 10 additions & 10 deletions crypto3/libs/codec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@ include(CMConfig)
include(CMDeploy)
include(CMSetupVersion)

cm_project(codec WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES C CXX)
cm_project(codec WORKSPACE_NAME crypto3 LANGUAGES C CXX)

option(CRYPTO3_CODEC_BASE58 "Build unit tests" TRUE)

set(BUILD_WITH_CONFIGURATION_FILE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE STRING "Directory for build.hpp lookup")

cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})
cm_setup_version(VERSION 0.1.0 PREFIX crypto3_${CURRENT_PROJECT_NAME})

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
add_library(crypto3_${CURRENT_PROJECT_NAME} INTERFACE)

if(CRYPTO3_CODEC_BASE58)
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE CRYPTO3_CODEC_BASE58)
target_compile_definitions(crypto3_${CURRENT_PROJECT_NAME} INTERFACE CRYPTO3_CODEC_BASE58)
endif()

set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
set_target_properties(crypto3_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
$<$<BOOL:${CRYPTO3_CODEC_BASE58}>:${CMAKE_WORKSPACE_NAME}::multiprecision>
target_link_libraries(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
$<$<BOOL:${CRYPTO3_CODEC_BASE58}>:crypto3::multiprecision>

Boost::container)

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_include_directories(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>

${Boost_INCLUDE_DIRS})

cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
cm_deploy(TARGETS crypto3_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
NAMESPACE crypto3::)

# Some tests failed, so we are turning off tests for this submodule for now.
# include(CMTest)
Expand Down
4 changes: 2 additions & 2 deletions crypto3/libs/codec/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

include(CMTest)

cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
${CMAKE_WORKSPACE_NAME}::multiprecision
cm_test_link_libraries(crypto3_${CURRENT_PROJECT_NAME}
crypto3::multiprecision

Boost::unit_test_framework)

Expand Down
18 changes: 9 additions & 9 deletions crypto3/libs/containers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,33 @@ include(CMSetupVersion)
include(CMDeploy)
include(CMSetupVersion)

cm_project(containers WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME})
cm_project(containers WORKSPACE_NAME crypto3)

option(BUILD_DOXYGEN_DOCS "Build with configuring Doxygen documentation compiler" TRUE)

set(DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_LIST_DIR}/docs" CACHE STRING "Specify doxygen output directory")

cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})
cm_setup_version(VERSION 0.1.0 PREFIX crypto3_${CURRENT_PROJECT_NAME})

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
add_library(crypto3_${CURRENT_PROJECT_NAME} INTERFACE)

set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
set_target_properties(crypto3_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_link_libraries(crypto3_${CURRENT_PROJECT_NAME} INTERFACE

${CMAKE_WORKSPACE_NAME}::algebra
${CMAKE_WORKSPACE_NAME}::hash
crypto3::algebra
crypto3::hash

Boost::container)

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
target_include_directories(crypto3_${CURRENT_PROJECT_NAME} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>"

${Boost_INCLUDE_DIRS})

cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INCLUDE include NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
cm_deploy(TARGETS crypto3_${CURRENT_PROJECT_NAME} INCLUDE include NAMESPACE crypto3::)

cm_add_test_subdirectory(test)

Expand Down
6 changes: 3 additions & 3 deletions crypto3/libs/containers/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include"

macro(define_containers_example example)
get_filename_component(test_name ${example} NAME)
set(target_name ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}_${test_name}_example)
set(target_name crypto3_${CURRENT_PROJECT_NAME}_${test_name}_example)

add_executable(${target_name} ${example}.cpp)
target_link_libraries(${target_name} PRIVATE
${CMAKE_WORKSPACE_NAME}::algebra
${CMAKE_WORKSPACE_NAME}::hash
crypto3::algebra
crypto3::hash
Boost::container)
set_target_properties(${target_name} PROPERTIES CXX_STANDARD 17)
endmacro()
Expand Down
Loading

0 comments on commit 95865bb

Please sign in to comment.