Page MenuHomePhabricator

D4299.id14300.diff
No OneTemporary

D4299.id14300.diff

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
@@ -28,3 +28,7 @@
comm-grpc
comm-client
)
+
+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
+ "CryptoModule.h"
+ "Persist.h"
+ "Session.h"
+ "Tools.h"
+ )
+
+set(CRYPTO_SRCS
+ "CryptoModule.cpp"
+ "Session.cpp"
+ "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
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+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/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.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
--- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
@@ -1,6 +1,8 @@
-#include "CryptoModule.h"
-#include "PlatformSpecificTools.h"
-#include "olm/session.hh"
+#include <CryptoTools/CryptoModule.h>
+#include <Tools/PlatformSpecificTools.h>
+#include <olm/session.hh>
+
+#include <stdexcept>
namespace comm {
namespace crypto {
diff --git a/native/cpp/CommonCpp/CryptoTools/Session.cpp b/native/cpp/CommonCpp/CryptoTools/Session.cpp
--- a/native/cpp/CommonCpp/CryptoTools/Session.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/Session.cpp
@@ -1,5 +1,7 @@
-#include "Session.h"
-#include "PlatformSpecificTools.h"
+#include <CryptoTools/Session.h>
+#include <Tools/PlatformSpecificTools.h>
+
+#include <stdexcept>
namespace comm {
namespace crypto {
diff --git a/native/cpp/CommonCpp/CryptoTools/Tools.h b/native/cpp/CommonCpp/CryptoTools/Tools.h
--- a/native/cpp/CommonCpp/CryptoTools/Tools.h
+++ b/native/cpp/CommonCpp/CryptoTools/Tools.h
@@ -1,5 +1,7 @@
#pragma once
+#include <cstdint>
+#include <string>
#include <vector>
#include "olm/olm.h"
diff --git a/native/cpp/CommonCpp/CryptoTools/Tools.cpp b/native/cpp/CommonCpp/CryptoTools/Tools.cpp
--- a/native/cpp/CommonCpp/CryptoTools/Tools.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/Tools.cpp
@@ -1,5 +1,5 @@
-#include "Tools.h"
-#include "PlatformSpecificTools.h"
+#include <CryptoTools/Tools.h>
+#include <Tools/PlatformSpecificTools.h>
#include <string>

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 5:44 AM (15 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2583148
Default Alt Text
D4299.id14300.diff (3 KB)

Event Timeline