Skip to content

Commit

Permalink
Merge pull request #56 from Gigamonkey-BSV/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
DanielKrawisz authored Mar 30, 2023
2 parents 02cf2f5 + 2194d27 commit 1ee2ba8
Show file tree
Hide file tree
Showing 56 changed files with 3,401 additions and 3,274 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ cmake-build-debug*/
cmake-build-debug-coverage/
.idea/
.vscode/
test/testSimplyCash.cpp
test/testSimplyCash.cpp
CMakeUserPresets.json
58 changes: 37 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
cmake_minimum_required(VERSION 3.1...3.14)
cmake_minimum_required (VERSION 3.1...3.14)

# Back compatibility for VERSION range
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
if (${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy (VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif ()

project(gigamonkey VERSION 0.0.12
project (gigamonkey VERSION 0.0.13
DESCRIPTION "open-source Bitcoin library in c++"
LANGUAGES CXX)

# Set cmake as import path for Find*.cmake files
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

## Check if GTests is installed. If not, install it

option(PACKAGE_TESTS "Build the tests" ON)
option (PACKAGE_TESTS "Build the tests" ON)

## Enable testing

find_package(data CONFIG REQUIRED)
find_package(Boost CONFIG REQUIRED)
find_package(OpenSSL CONFIG REQUIRED)
find_package(cryptopp CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(gmp CONFIG REQUIRED)

if(PACKAGE_TESTS)
include(CTest)
find_package(GTest REQUIRED)
enable_testing()
add_subdirectory(test)
endif()

add_library(gigamonkey STATIC
if (PACKAGE_TESTS)
include (CTest)
find_package (GTest REQUIRED)
enable_testing ()
add_subdirectory (test)
endif ()

add_library (gigamonkey STATIC

src/sv/random.cpp
src/sv/big_int.cpp
Expand Down Expand Up @@ -88,12 +92,24 @@ add_library(gigamonkey STATIC

)

target_link_libraries(gigamonkey PUBLIC CONAN_PKG::data util CONAN_PKG::boost CONAN_PKG::openssl CONAN_PKG::cryptopp CONAN_PKG::nlohmann_json CONAN_PKG::gmp )

target_include_directories(gigamonkey PUBLIC include)

target_link_libraries(gigamonkey PUBLIC
data::data
util
boost::boost
openssl::openssl
cryptopp::cryptopp
nlohmann_json::nlohmann_json
gmp::gmp )


target_include_directories (gigamonkey PUBLIC include)

# Set C++ version
target_compile_features(gigamonkey PUBLIC cxx_std_20)
set_target_properties(gigamonkey PROPERTIES CXX_EXTENSIONS ON)
target_compile_options(gigamonkey PUBLIC "-fconcepts")
target_compile_features (gigamonkey PUBLIC cxx_std_20)
set_target_properties (gigamonkey PROPERTIES CXX_EXTENSIONS ON)
target_compile_options (gigamonkey PUBLIC "-fconcepts")

install(DIRECTORY include/ DESTINATION include)
install(TARGETS gigamonkey)
62 changes: 31 additions & 31 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from conans import ConanFile, CMake
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from os import environ

class GigamonkeyConan(ConanFile):
class GigamonkeyConan (ConanFile):
name = "gigamonkey"
version = "v0.0.12"
version = "v0.0.14"
license = "Open BSV"
author = "Daniel Krawisz"
url = "https://github.com/Gigamonkey-BSV/Gigamonkey"
Expand All @@ -12,44 +13,43 @@ class GigamonkeyConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
generators = "cmake"
exports_sources = "*"
requires = "boost/1.76.0", "openssl/1.1.1k", "cryptopp/8.5.0", "nlohmann_json/3.10.0", "gmp/6.2.1", "SECP256K1/0.2.0@proofofwork/stable", "data/v0.0.23@proofofwork/stable", "gtest/1.12.1"
exports_sources = "CMakeLists.txt", "include/*", "src/*", "test/*"
requires = "boost/1.80.0", "openssl/1.1.1t", "cryptopp/8.5.0", "nlohmann_json/3.10.0", "gmp/6.2.1", "secp256k1/0.3@proofofwork/stable", "data/v0.0.24@proofofwork/stable", "gtest/1.12.1"

def set_version(self):
def set_version (self):
if "CIRCLE_TAG" in environ:
self.version = environ.get("CIRCLE_TAG")[1:]
self.version = environ.get ("CIRCLE_TAG")[1:]
if "CURRENT_VERSION" in environ:
self.version = environ['CURRENT_VERSION']
else:
self.version = "v0.0.12"
self.version = "v0.0.13"

def config_options(self):
def config_options (self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure_cmake(self):
if "CMAKE_BUILD_CORES_COUNT" in environ:
cmake = CMake(self, parallel=False)
else:
cmake = CMake(self)
cmake.definitions["PACKAGE_TESTS"] = "Off"
cmake.configure()
def configure_cmake (self):
cmake = CMake (self)
cmake.configure(variables={"PACKAGE_TESTS":"Off"})
return cmake

def layout(self):
cmake_layout(self)

def build(self):
cmake = self.configure_cmake()
if "CMAKE_BUILD_CORES_COUNT" in environ:
cmake.build(args=["--", environ.get("CMAKE_BUILD_CORES_COUNT")])
else:
cmake.build()
def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()

def build (self):
cmake = self.configure_cmake ()
cmake.build ()

def package(self):
self.copy("*.h", dst="include", src="include")
self.copy("*.hpp", dst="include", src="include")
self.copy("libgigamonkey.a", src="lib", dst="lib", keep_path=False)
def package (self):
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libdirs = ["lib"] # Default value is 'lib'
self.cpp_info.libs = self.collect_libs()
# self.cpp_info.libs = ["gigamonkey"]
def package_info (self):
# self.cpp_info.libdirs = ["lib"] # Default value is 'lib'
self.cpp_info.libs = ["gigamonkey"]
4 changes: 2 additions & 2 deletions include/gigamonkey/address.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ namespace Gigamonkey::Bitcoin {
pubkey (const secp256k1::pubkey &p) : secp256k1::pubkey {p} {}

explicit pubkey (string_view s) : secp256k1::pubkey {} {
ptr<bytes> hex = encoding::hex::read(s);
if (hex != nullptr) {
maybe<bytes> hex = encoding::hex::read(s);
if (bool (hex)) {
this->resize (hex->size ());
std::copy (hex->begin (), hex->end (), this->begin ());
};
Expand Down
Loading

0 comments on commit 1ee2ba8

Please sign in to comment.