Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate thirdparty refactoring #52

Merged
merged 5 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ Testing
# Autogenerated Tooling
.build.Debug
cmake-build-*/
.cache

# Testing residuals
CRDT.Datastore.TEST.unit/
CRDT.Datastore.TEST/
CRDT.Datastore.TEST/
16 changes: 8 additions & 8 deletions build/Android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
cmake_minimum_required(VERSION 3.12)

# --------------------------------------------------------
# if on Linux system, build the Android executables
if(NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
message(FATAL_ERROR "${CMAKE_HOST_SYSTEM_NAME} host system name does not match Linux for Android cross compiling - Please select the correct folder for configuring project")
endif()
cmake_minimum_required(VERSION 3.15)

# --------------------------------------------------------
# Set cross compiling settings
Expand Down Expand Up @@ -53,6 +47,9 @@ if(NOT EXISTS ${CMAKE_TOOLCHAIN_FILE})
message(FATAL_ERROR "Android NDK toolchain file ${CMAKE_TOOLCHAIN_FILE} not found")
endif()

set(Boost_COMPILER "clang")


# --------------------------------------------------------
# Project
project(SuperGenius C CXX)
Expand All @@ -71,7 +68,10 @@ set(ABI_SUBFOLDER_NAME "/${ANDROID_ABI}")

# --------------------------------------------------------
# Set host system protoc executable path
set(PROTOC_EXECUTABLE "${THIRDPARTY_BUILD_DIR}/protobuf/bin/protoc")

message("executable ${THIRDPARTY_DIR}/build/${CMAKE_HOST_SYSTEM_NAME}/${CMAKE_BUILD_TYPE}/protobuf/${ANDROID_ABI}")
set(PROTOC_EXECUTABLE "${THIRDPARTY_DIR}/build/${CMAKE_HOST_SYSTEM_NAME}/${CMAKE_BUILD_TYPE}/protobuf/${ANDROID_ABI}/bin/protoc")
#set(PROTOC_EXECUTABLE "${THIRDPARTY_BUILD_DIR}/protobuf/bin/protoc")

# --------------------------------------------------------
# Allow multiple definitions
Expand Down
10 changes: 10 additions & 0 deletions build/CommonBuildParameters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ set(GTest_INCLUDE_DIR "${_THIRDPARTY_BUILD_DIR}/GTest/include")
find_package(GTest CONFIG REQUIRED)
include_directories(${GTest_INCLUDE_DIR})

# absl
if(NOT DEFINED absl_DIR)
set(absl_DIR "${_THIRDPARTY_BUILD_DIR}/grpc/lib/cmake/absl")
endif()

# utf8_range
if(NOT DEFINED utf8_range_DIR)
set(utf8_range_DIR "${_THIRDPARTY_BUILD_DIR}/grpc/lib/cmake/utf8_range")
endif()

# --------------------------------------------------------
# Set config of protobuf project
if(NOT DEFINED Protobuf_DIR)
Expand Down
13 changes: 3 additions & 10 deletions build/CommonCompilerOptions.CMake
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,12 @@ include(${PROJECT_ROOT}/build/CompilationFlags.cmake)

# Common compile options

# This is a workaround that should be removed once we update Boost.
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-enum-constexpr-conversion)
endif()

# OS specific compile options
if(EXISTS "${PROJECT_ROOT}/cmake/compile_option_by_platform/${CMAKE_SYSTEM_NAME}.cmake")
print("add compile option: ${PROJECT_ROOT}/cmake/compile_option_by_platform/${CMAKE_SYSTEM_NAME}.cmake")
include("${PROJECT_ROOT}/cmake/compile_option_by_platform/${CMAKE_SYSTEM_NAME}.cmake")
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# This is a workaround and must be removed once we update Boost past 1.80
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")

if(NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}")
Expand Down Expand Up @@ -79,6 +69,9 @@ if(NOT DEFINED THIRDPARTY_BUILD_DIR)
print("Setting third party build directory default")
get_filename_component(BUILD_PLATFORM_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(THIRDPARTY_BUILD_DIR "${THIRDPARTY_DIR}/build/${BUILD_PLATFORM_NAME}/${CMAKE_BUILD_TYPE}")
if (DEFINED ANDROID_ABI)
set(THIRDPARTY_BUILD_DIR "${THIRDPARTY_BUILD_DIR}/${ANDROID_ABI}")
endif()
endif()

set(_THIRDPARTY_BUILD_DIR "${THIRDPARTY_BUILD_DIR}")
Expand Down
10 changes: 8 additions & 2 deletions example/AsyncFile/MNNExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,15 @@ int main(int argc, char **argv)
for (int i = 0; i < file_names.size(); i++)
{
std::cout << "LoadASync: " << file_names[i] << std::endl;
auto data = FileManager::GetInstance().LoadASync(file_names[i], false, true, ioc, [](const int& status)
auto data = FileManager::GetInstance().LoadASync(file_names[i], false, true, ioc, [](const sgns::AsyncError::CustomResult& status)
{
std::cout << "status: " << status << std::endl;
if (status.has_value())
{
std::cout << "Success: " << status.value().message << std::endl;
}
else {
std::cout << "Error: " << status.error() << std::endl;
}
}, [](std::shared_ptr<std::pair<std::vector<std::string>, std::vector<std::vector<char>>>> buffers)
{
std::cout << "Final Callback" << std::endl;
Expand Down
5 changes: 5 additions & 0 deletions example/mnn_chunkprocess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ if(APPLE)
${PLATFORM_SPECIFIC_FRAMEWORKS}
${XCFRAMEWORK_PATH}
)
elseif(ANDROID)
find_library( log-lib log )
target_link_libraries(mnn_chunkprocess PRIVATE
${log-lib}
)
endif()

target_link_libraries(mnn_chunkprocess PRIVATE
Expand Down
20 changes: 16 additions & 4 deletions example/processing_mnn/processing_mnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ std::vector<uint8_t> GetImageByCID(std::string cid)
FileManager::GetInstance().InitializeSingletons();
string fileURL = "https://ipfs.filebase.io/ipfs/" + cid + "/settings.json";
std::cout << "FILE URLL: " << fileURL << std::endl;
auto data = FileManager::GetInstance().LoadASync(fileURL, false, false, ioc, [ioc](const int& status)
auto data = FileManager::GetInstance().LoadASync(fileURL, false, false, ioc, [ioc](const sgns::AsyncError::CustomResult& status)
{
std::cout << "status: " << status << std::endl;
if (status.has_value())
{
std::cout << "Success: " << status.value().message << std::endl;
}
else {
std::cout << "Error: " << status.error() << std::endl;
}
}, [ioc, &mainbuffers](std::shared_ptr<std::pair<std::vector<std::string>, std::vector<std::vector<char>>>> buffers)
{
std::cout << "Final Callback" << std::endl;
Expand Down Expand Up @@ -101,9 +107,15 @@ std::vector<uint8_t> GetImageByCID(std::string cid)
//Get Actual Image
string imageUrl = "https://ipfs.filebase.io/ipfs/" + cid + "/" + inputImage;
std::vector<char> imageData;
auto data2 = FileManager::GetInstance().LoadASync(imageUrl, false, false, ioc, [ioc](const int& status)
auto data2 = FileManager::GetInstance().LoadASync(imageUrl, false, false, ioc, [ioc](const sgns::AsyncError::CustomResult& status)
{
std::cout << "status: " << status << std::endl;
if (status.has_value())
{
std::cout << "Success: " << status.value().message << std::endl;
}
else {
std::cout << "Error: " << status.error() << std::endl;
}
}, [ioc, &imageData](std::shared_ptr<std::pair<std::vector<std::string>, std::vector<std::vector<char>>>> buffers)
{
std::cout << "Final Callback" << std::endl;
Expand Down
20 changes: 18 additions & 2 deletions src/account/GeniusNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,15 @@ namespace sgns
string fileURL = "https://ipfs.filebase.io/ipfs/" + cid + "/settings.json";
std::cout << "FILE URLL: " << fileURL << std::endl;
auto data = FileManager::GetInstance().LoadASync(
fileURL, false, false, ioc, [ioc]( const int &status ) { std::cout << "status: " << status << std::endl; },
fileURL, false, false, ioc, [ioc](const sgns::AsyncError::CustomResult& status) {
if (status.has_value())
{
std::cout << "Success: " << status.value().message << std::endl;
}
else {
std::cout << "Error: " << status.error() << std::endl;
}
},
[ioc, &mainbuffers](
std::shared_ptr<std::pair<std::vector<std::string>, std::vector<std::vector<char>>>> buffers )
{
Expand Down Expand Up @@ -344,7 +352,15 @@ namespace sgns
string imageUrl = "https://ipfs.filebase.io/ipfs/" + cid + "/" + inputImage;
std::vector<char> imageData;
auto data2 = FileManager::GetInstance().LoadASync(
imageUrl, false, false, ioc, [ioc]( const int &status ) { std::cout << "status: " << status << std::endl; },
imageUrl, false, false, ioc, [ioc](const sgns::AsyncError::CustomResult& status) {
if (status.has_value())
{
std::cout << "Success: " << status.value().message << std::endl;
}
else {
std::cout << "Error: " << status.error() << std::endl;
}
},
[ioc,
&imageData]( std::shared_ptr<std::pair<std::vector<std::string>, std::vector<std::vector<char>>>> buffers )
{
Expand Down
8 changes: 4 additions & 4 deletions src/crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ add_library(ed25519_types
set_target_properties(ed25519_types PROPERTIES PUBLIC_HEADER "ed25519_types.hpp")
target_link_libraries(ed25519_types
blob
sgns::ed25519
)
iroha::ed25519
)
supergenius_install(ed25519_types)

add_library(vrf_provider
Expand Down Expand Up @@ -75,9 +75,9 @@ target_link_libraries(secp256k1_provider PUBLIC
PUBLIC OpenSSL::SSL
blob
buffer
secp256k1::secp256k1
libsecp256k1::secp256k1
scale
)
)
supergenius_install(
secp256k1_provider
)
Expand Down
3 changes: 1 addition & 2 deletions src/crypto/secp256k1/secp256k1_provider_impl.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "crypto/secp256k1/secp256k1_provider_impl.hpp"

#include <secp256k1_recovery.h>
#include "secp256k1_recovery.h"

namespace sgns::crypto {

Expand Down
20 changes: 16 additions & 4 deletions src/processing/impl/processing_core_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,15 @@ namespace sgns::processing
FileManager::GetInstance().InitializeSingletons();
string fileURL = "https://ipfs.filebase.io/ipfs/" + cid + "/settings.json";
std::cout << "FILE URLL: " << fileURL << std::endl;
auto data = FileManager::GetInstance().LoadASync(fileURL, false, false, ioc, [ioc, this](const int& status)
auto data = FileManager::GetInstance().LoadASync(fileURL, false, false, ioc, [ioc, this](const sgns::AsyncError::CustomResult& status)
{
std::cout << "status: " << status << std::endl;
if (status.has_value())
{
std::cout << "Success: " << status.value().message << std::endl;
}
else {
std::cout << "Error: " << status.error() << std::endl;
}
}, [ioc, &mainbuffers, this](std::shared_ptr<std::pair<std::vector<std::string>, std::vector<std::vector<char>>>> buffers)
{
std::cout << "Final Callback" << std::endl;
Expand Down Expand Up @@ -171,9 +177,15 @@ namespace sgns::processing
void ProcessingCoreImpl::GetSubCidForProc(std::shared_ptr<boost::asio::io_context> ioc,std::string url, std::shared_ptr<std::pair<std::vector<std::string>, std::vector<std::vector<char>>>>& results)
{
//std::pair<std::vector<std::string>, std::vector<std::vector<char>>> results;
auto modeldata = FileManager::GetInstance().LoadASync(url, false, false, ioc, [this](const int& status)
auto modeldata = FileManager::GetInstance().LoadASync(url, false, false, ioc, [this](const sgns::AsyncError::CustomResult& status)
{
std::cout << "status: " << status << std::endl;
if (status.has_value())
{
std::cout << "Success: " << status.value().message << std::endl;
}
else {
std::cout << "Error: " << status.error() << std::endl;
}
}, [&results, this](std::shared_ptr<std::pair<std::vector<std::string>, std::vector<std::vector<char>>>> buffers)
{
results->first.insert(results->first.end(), buffers->first.begin(), buffers->first.end());
Expand Down
Loading