- Implement SynorStorage class for decentralized storage operations including upload, download, pinning, and CAR file management. - Create supporting types and models for storage operations such as UploadOptions, Pin, and StorageConfig. - Implement SynorWallet class for wallet operations including wallet creation, address generation, transaction signing, and balance queries. - Create supporting types and models for wallet operations such as Wallet, Address, and Transaction. - Introduce error handling for both storage and wallet operations.
78 lines
1.8 KiB
CMake
78 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(synor_sdk VERSION 0.1.0 LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# Options
|
|
option(BUILD_SHARED_LIBS "Build shared library" ON)
|
|
option(BUILD_TESTS "Build tests" ON)
|
|
option(BUILD_EXAMPLES "Build examples" ON)
|
|
|
|
# Find dependencies
|
|
find_package(CURL REQUIRED)
|
|
find_package(nlohmann_json 3.11 QUIET)
|
|
|
|
# If nlohmann_json not found, fetch it
|
|
if(NOT nlohmann_json_FOUND)
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
json
|
|
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
|
|
)
|
|
FetchContent_MakeAvailable(json)
|
|
endif()
|
|
|
|
# Library sources
|
|
set(SYNOR_SOURCES
|
|
src/synor_compute.cpp
|
|
src/tensor.cpp
|
|
src/client.cpp
|
|
src/wallet/wallet.cpp
|
|
src/rpc/rpc.cpp
|
|
src/storage/storage.cpp
|
|
)
|
|
|
|
# Create library
|
|
add_library(synor_sdk ${SYNOR_SOURCES})
|
|
|
|
# Alias for backwards compatibility
|
|
add_library(synor_compute ALIAS synor_sdk)
|
|
|
|
target_include_directories(synor_sdk
|
|
PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>
|
|
)
|
|
|
|
target_link_libraries(synor_sdk
|
|
PRIVATE
|
|
CURL::libcurl
|
|
nlohmann_json::nlohmann_json
|
|
)
|
|
|
|
# Set library properties
|
|
set_target_properties(synor_sdk PROPERTIES
|
|
VERSION ${PROJECT_VERSION}
|
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
|
)
|
|
|
|
# Installation
|
|
include(GNUInstallDirs)
|
|
|
|
install(TARGETS synor_sdk
|
|
EXPORT synor_sdk-targets
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
)
|
|
|
|
install(DIRECTORY include/
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
)
|
|
|
|
install(EXPORT synor_sdk-targets
|
|
FILE synor_sdk-targets.cmake
|
|
NAMESPACE synor::
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/synor_sdk
|
|
)
|