From d6e434d0de6fb23383e173b95642eec7042820a3 Mon Sep 17 00:00:00 2001 From: Caitlin Ross Date: Tue, 22 Feb 2022 16:15:25 -0500 Subject: [PATCH] move EncryptionOperator to plugins dir --- CMakeLists.txt | 8 ++++- cmake/DetectOptions.cmake | 10 ++++++ .../operator => cmake}/FindSodium.cmake | 0 cmake/adios2-config-common.cmake.in | 5 +++ examples/plugins/operator/CMakeLists.txt | 9 ------ plugins/CMakeLists.txt | 16 ++++++++++ .../EncryptionOperator.cpp | 0 .../operator => plugins}/EncryptionOperator.h | 0 testing/install/CMakeLists.txt | 5 ++- .../install/EncryptionOperator/CMakeLists.txt | 32 +++++++++++++++++++ .../{plugin => EnginePlugin}/CMakeLists.txt | 25 --------------- 11 files changed, 74 insertions(+), 36 deletions(-) rename {examples/plugins/operator => cmake}/FindSodium.cmake (100%) create mode 100644 plugins/CMakeLists.txt rename {examples/plugins/operator => plugins}/EncryptionOperator.cpp (100%) rename {examples/plugins/operator => plugins}/EncryptionOperator.h (100%) create mode 100644 testing/install/EncryptionOperator/CMakeLists.txt rename testing/install/{plugin => EnginePlugin}/CMakeLists.txt (58%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b4802916e..b7f0f44a1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,6 +161,7 @@ adios_option(Fortran "Enable support for Fortran bindings" AUTO) adios_option(SysVShMem "Enable support for SysV Shared Memory IPC on *NIX" AUTO) adios_option(Profiling "Enable support for profiling" AUTO) adios_option(Endian_Reverse "Enable support for Little/Big Endian Interoperability" AUTO) +adios_option(Sodium "Enable support for Sodium for encryption" AUTO) include(${PROJECT_SOURCE_DIR}/cmake/DetectOptions.cmake) if(ADIOS2_HAVE_CUDA) @@ -221,7 +222,7 @@ endif() set(ADIOS2_CONFIG_OPTS - BP5 DataMan DataSpaces HDF5 HDF5_VOL MHS SST CUDA Fortran MPI Python Blosc BZip2 LIBPRESSIO MGARD PNG SZ ZFP DAOS IME O_DIRECT SysVShMem ZeroMQ Profiling Endian_Reverse + BP5 DataMan DataSpaces HDF5 HDF5_VOL MHS SST CUDA Fortran MPI Python Blosc BZip2 LIBPRESSIO MGARD PNG SZ ZFP DAOS IME O_DIRECT SysVShMem ZeroMQ Profiling Endian_Reverse Sodium ) GenerateADIOSHeaderConfig(${ADIOS2_CONFIG_OPTS}) @@ -286,6 +287,11 @@ add_subdirectory(source) #------------------------------------------------------------------------------# add_subdirectory(bindings) +#------------------------------------------------------------------------------# +# Plugins +#------------------------------------------------------------------------------# +add_subdirectory(plugins) + #------------------------------------------------------------------------------# # Examples #------------------------------------------------------------------------------# diff --git a/cmake/DetectOptions.cmake b/cmake/DetectOptions.cmake index 18e15695a5..4aae71c5ca 100644 --- a/cmake/DetectOptions.cmake +++ b/cmake/DetectOptions.cmake @@ -403,6 +403,16 @@ if(ADIOS2_USE_Endian_Reverse STREQUAL ON) set(ADIOS2_HAVE_Endian_Reverse TRUE) endif() +# Sodium for EncryptionOperator +if(ADIOS2_USE_Sodium STREQUAL AUTO) + find_package(Sodium) +elseif(ADIOS2_USE_Sodium) + find_package(Sodium REQUIRED) +endif() +if(Sodium_FOUND) + set(ADIOS2_HAVE_Sodium TRUE) +endif() + # Multithreading find_package(Threads REQUIRED) diff --git a/examples/plugins/operator/FindSodium.cmake b/cmake/FindSodium.cmake similarity index 100% rename from examples/plugins/operator/FindSodium.cmake rename to cmake/FindSodium.cmake diff --git a/cmake/adios2-config-common.cmake.in b/cmake/adios2-config-common.cmake.in index 1f5ec2c4bf..aeab8558e1 100644 --- a/cmake/adios2-config-common.cmake.in +++ b/cmake/adios2-config-common.cmake.in @@ -127,6 +127,11 @@ if(NOT @BUILD_SHARED_LIBS@) find_dependency(HDF5 COMPONENTS C) endif() + set(ADIOS2_HAVE_Sodium @ADIOS2_HAVE_Sodium@) + if(ADIOS2_HAVE_Sodium) + find_dependency(Sodium) + endif() + adios2_add_thirdparty_target(pugixml) set(ADIOS2_USE_EXTERNAL_PUGIXML @ADIOS2_USE_EXTERNAL_PUGIXML@) if(ADIOS2_USE_EXTERNAL_PUGIXML) diff --git a/examples/plugins/operator/CMakeLists.txt b/examples/plugins/operator/CMakeLists.txt index b11e256abf..8881bb8f16 100644 --- a/examples/plugins/operator/CMakeLists.txt +++ b/examples/plugins/operator/CMakeLists.txt @@ -2,15 +2,6 @@ # Distributed under the OSI-approved Apache License, Version 2.0. See # accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# - -list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}) -find_package(Sodium 1.8 REQUIRED) - -add_library(EncryptionOperator - EncryptionOperator.cpp -) -target_link_libraries(EncryptionOperator adios2::cxx11 adios2_core sodium) - add_executable(exampleOperatorPlugin_write examplePluginOperator_write.cpp ) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt new file mode 100644 index 0000000000..b115218c0f --- /dev/null +++ b/plugins/CMakeLists.txt @@ -0,0 +1,16 @@ +#------------------------------------------------------------------------------# +# Distributed under the OSI-approved Apache License, Version 2.0. See +# accompanying file Copyright.txt for details. +#------------------------------------------------------------------------------# + +if(ADIOS2_HAVE_Sodium) + add_library(EncryptionOperator + EncryptionOperator.cpp + ) + target_link_libraries(EncryptionOperator adios2_core sodium) + install(TARGETS EncryptionOperator EXPORT adios2Exports + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT adios2_core-runtime + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT adios2_core-libraries NAMELINK_COMPONENT adios2_core-development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT adios2_core-development +) +endif() diff --git a/examples/plugins/operator/EncryptionOperator.cpp b/plugins/EncryptionOperator.cpp similarity index 100% rename from examples/plugins/operator/EncryptionOperator.cpp rename to plugins/EncryptionOperator.cpp diff --git a/examples/plugins/operator/EncryptionOperator.h b/plugins/EncryptionOperator.h similarity index 100% rename from examples/plugins/operator/EncryptionOperator.h rename to plugins/EncryptionOperator.h diff --git a/testing/install/CMakeLists.txt b/testing/install/CMakeLists.txt index 9f4e5cf599..d94dd3ba88 100644 --- a/testing/install/CMakeLists.txt +++ b/testing/install/CMakeLists.txt @@ -110,4 +110,7 @@ if(NOT WIN32) endif() endif() -add_install_cmake_test(plugin) +add_install_cmake_test(EnginePlugin) +if(ADIOS2_HAVE_Sodium) + add_install_cmake_test(EncryptionOperator) +endif() diff --git a/testing/install/EncryptionOperator/CMakeLists.txt b/testing/install/EncryptionOperator/CMakeLists.txt new file mode 100644 index 0000000000..ed4fae524b --- /dev/null +++ b/testing/install/EncryptionOperator/CMakeLists.txt @@ -0,0 +1,32 @@ +#------------------------------------------------------------------------------# +# Distributed under the OSI-approved Apache License, Version 2.0. See +# accompanying file Copyright.txt for details. +#------------------------------------------------------------------------------# + +cmake_minimum_required(VERSION 3.6) +project(adios_operator_plugin_test CXX) +enable_testing() + +find_package(adios2 REQUIRED) + +option(BUILD_SHARED_LIBS "build shared libs" ON) + +set(ENV{ADIOS2_PLUGIN_PATH} "${adios2_DIR}/../../") + +#---------- Operator Plugin Tests + +# add write test +add_executable(adios_plugin_operator_write_test + ../../../examples/plugins/operator/examplePluginOperator_write.cpp +) +target_link_libraries(adios_plugin_operator_write_test adios2::cxx11) +add_test(NAME adios_plugin_operator_write_test COMMAND adios_plugin_operator_write_test) + +# add read test +add_executable(adios_plugin_operator_read_test + ../../../examples/plugins/operator/examplePluginOperator_read.cpp +) +target_link_libraries(adios_plugin_operator_read_test adios2::cxx11) +add_test(NAME adios_plugin_operator_read_test COMMAND adios_plugin_operator_read_test) +set_tests_properties(adios_plugin_operator_read_test PROPERTIES + DEPENDS adios_plugin_operator_write_test) diff --git a/testing/install/plugin/CMakeLists.txt b/testing/install/EnginePlugin/CMakeLists.txt similarity index 58% rename from testing/install/plugin/CMakeLists.txt rename to testing/install/EnginePlugin/CMakeLists.txt index 6a0615cb2a..9f03aa09a1 100644 --- a/testing/install/plugin/CMakeLists.txt +++ b/testing/install/EnginePlugin/CMakeLists.txt @@ -39,28 +39,3 @@ add_test(NAME adios_plugin_engine_read_test COMMAND adios_plugin_engine_read_tes set_tests_properties(adios_plugin_engine_read_test PROPERTIES DEPENDS adios_plugin_engine_write_test) -#---------- Operator Plugin Tests - -list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/../../../examples/plugins/operator) -find_package(Sodium 1.8 REQUIRED) - -add_library(EncryptionOperator - ../../../examples/plugins/operator/EncryptionOperator.cpp -) -target_link_libraries(EncryptionOperator adios2::cxx11 adios2::core sodium) - -# add write test -add_executable(adios_plugin_operator_write_test - ../../../examples/plugins/operator/examplePluginOperator_write.cpp -) -target_link_libraries(adios_plugin_operator_write_test adios2::cxx11) -add_test(NAME adios_plugin_operator_write_test COMMAND adios_plugin_operator_write_test) - -# add read test -add_executable(adios_plugin_operator_read_test - ../../../examples/plugins/operator/examplePluginOperator_read.cpp -) -target_link_libraries(adios_plugin_operator_read_test adios2::cxx11) -add_test(NAME adios_plugin_operator_read_test COMMAND adios_plugin_operator_read_test) -set_tests_properties(adios_plugin_operator_read_test PROPERTIES - DEPENDS adios_plugin_operator_write_test)