diff --git a/native/cpp/CommonCpp/CMakeLists.txt b/native/cpp/CommonCpp/CMakeLists.txt --- a/native/cpp/CommonCpp/CMakeLists.txt +++ b/native/cpp/CommonCpp/CMakeLists.txt @@ -8,6 +8,7 @@ add_subdirectory(Tools) add_subdirectory(grpc) add_subdirectory(NativeModules) +add_subdirectory(CryptoTools) target_link_libraries(client comm-modules-internal @@ -19,4 +20,7 @@ tunnelbroker ) +target_link_libraries(comm-cryptotools + comm-tools + ) diff --git a/native/cpp/CommonCpp/CryptoTools/CMakeLists.txt b/native/cpp/CommonCpp/CryptoTools/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/native/cpp/CommonCpp/CryptoTools/CMakeLists.txt @@ -0,0 +1,56 @@ +project(comm-cryptotools) +cmake_minimum_required(VERSION 3.4) + +include(GNUInstallDirs) + +set(CRYPTO_HDRS + "include/comm/CryptoTools/CryptoModule.h" + "include/comm/CryptoTools/Persist.h" + "include/comm/CryptoTools/Session.h" + "include/comm/CryptoTools/Tools.h" + ) + +set(CRYPTO_SRCS + "src/CryptoModule.cpp" + "src/Session.cpp" + "src/Tools.cpp" + ) + +add_library(comm-cryptotools + ${CRYPTO_HDRS} + ${CRYPTO_SRCS} +) + +find_package(Olm) + +target_link_libraries(comm-cryptotools + Olm + ) + +# reference local directory when building, use installation path when installing +target_include_directories(comm-cryptotools + PUBLIC + $ + $ +) + +install(TARGETS comm-cryptotools EXPORT comm-cryptotools-export + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT comm-cryptotools + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-cryptotools + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-cryptotools +) + +install(FILES ${TOOLS_HDRS} DESTINATION include/comm/Tools) + +# For development purposes, can point cmake to this directory if doing development +export(TARGETS comm-cryptotools + NAMESPACE comm-cryptotools:: + FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/comm-cryptotools/comm-cryptotools-targets.cmake +) + +# For installation +install(EXPORT comm-cryptotools-export + FILE comm-cryptotools-targets.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/comm-cryptotools + NAMESPACE comm-cryptotools:: +) diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.h b/native/cpp/CommonCpp/CryptoTools/include/comm/CryptoTools/CryptoModule.h rename from native/cpp/CommonCpp/CryptoTools/CryptoModule.h rename to native/cpp/CommonCpp/CryptoTools/include/comm/CryptoTools/CryptoModule.h diff --git a/native/cpp/CommonCpp/CryptoTools/Persist.h b/native/cpp/CommonCpp/CryptoTools/include/comm/CryptoTools/Persist.h rename from native/cpp/CommonCpp/CryptoTools/Persist.h rename to native/cpp/CommonCpp/CryptoTools/include/comm/CryptoTools/Persist.h diff --git a/native/cpp/CommonCpp/CryptoTools/Session.h b/native/cpp/CommonCpp/CryptoTools/include/comm/CryptoTools/Session.h rename from native/cpp/CommonCpp/CryptoTools/Session.h rename to native/cpp/CommonCpp/CryptoTools/include/comm/CryptoTools/Session.h diff --git a/native/cpp/CommonCpp/CryptoTools/Tools.h b/native/cpp/CommonCpp/CryptoTools/include/comm/CryptoTools/Tools.h rename from native/cpp/CommonCpp/CryptoTools/Tools.h rename to native/cpp/CommonCpp/CryptoTools/include/comm/CryptoTools/Tools.h --- a/native/cpp/CommonCpp/CryptoTools/Tools.h +++ b/native/cpp/CommonCpp/CryptoTools/include/comm/CryptoTools/Tools.h @@ -1,5 +1,7 @@ #pragma once +#include +#include #include #include "olm/olm.h" diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/src/CryptoModule.cpp rename from native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp rename to native/cpp/CommonCpp/CryptoTools/src/CryptoModule.cpp --- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp +++ b/native/cpp/CommonCpp/CryptoTools/src/CryptoModule.cpp @@ -1,6 +1,8 @@ -#include "CryptoModule.h" -#include "PlatformSpecificTools.h" -#include "olm/session.hh" +#include +#include +#include + +#include namespace comm { namespace crypto { diff --git a/native/cpp/CommonCpp/CryptoTools/Session.cpp b/native/cpp/CommonCpp/CryptoTools/src/Session.cpp rename from native/cpp/CommonCpp/CryptoTools/Session.cpp rename to native/cpp/CommonCpp/CryptoTools/src/Session.cpp --- a/native/cpp/CommonCpp/CryptoTools/Session.cpp +++ b/native/cpp/CommonCpp/CryptoTools/src/Session.cpp @@ -1,5 +1,7 @@ -#include "Session.h" -#include "PlatformSpecificTools.h" +#include +#include + +#include namespace comm { namespace crypto { diff --git a/native/cpp/CommonCpp/CryptoTools/Tools.cpp b/native/cpp/CommonCpp/CryptoTools/src/Tools.cpp rename from native/cpp/CommonCpp/CryptoTools/Tools.cpp rename to native/cpp/CommonCpp/CryptoTools/src/Tools.cpp --- a/native/cpp/CommonCpp/CryptoTools/Tools.cpp +++ b/native/cpp/CommonCpp/CryptoTools/src/Tools.cpp @@ -1,5 +1,5 @@ -#include "Tools.h" -#include "PlatformSpecificTools.h" +#include +#include #include