CFD library for Go.
This library is development kit for crypto finance application. Useful when developing applications for cryptocurrencies.
attention: Cgo can only be used on the make
platform.
(Recommended to use wsl(Windows Subsystem for Linux), because it can be cumbersome.)
download and install files.
# xcode cli tools
xcode-select --install
# install dependencies using Homebrew
brew install cmake go
# install dependencies using APT package Manager
apt-get install -y build-essential golang cmake
cmake version 3.14.2 or lower, download from website and install cmake.
go version 1.11 or lower, get golang.org/dl/go1.12
or higher.
# recommend out of source build
mkdir build && cd $_
# configure & build
cmake .. -DENABLE_SHARED=on -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=off -DENABLE_JS_WRAPPER=off -DENABLE_CAPI=on -DTARGET_RPATH=/usr/local/lib/
make
cd ..
go mod download
go build
cmake .. (CMake options) -DENABLE_JS_WRAPPER=off
-DENABLE_ELEMENTS
: Enable functionalies for elements sidechain. [ON/OFF] (default:ON)-DENABLE_SHARED
: Enable building a shared library. [ON/OFF] (default:OFF)-DENABLE_TESTS
: Enable building a testing codes. If enables this option, builds testing framework submodules(google test) automatically. [ON/OFF] (default:ON)-DCMAKE_BUILD_TYPE=Release
: Enable release build.-DCMAKE_BUILD_TYPE=Debug
: Enable debug build.-DCFDCORE_DEBUG=on
: Enable cfd debug mode and loggings log files. [ON/OFF] (default:OFF)On Linux or MacOS, can use install / uninstall.
On Windows, can use releases asset
.
The fastest and easiest way. Target is amd64(x86_64) only.
(cleanup)
./tools/cmake_cleanup.sh
sudo ./tools/cleanup_install_files.sh
(download)
wget https://github.com/cryptogarageinc/cfd-go/releases/download/v0.3.2/cfdgo-v0.3.2-ubuntu2004-gcc-x86_64.zip
(unzip)
sudo unzip -q cfdgo-v0.3.2-ubuntu2004-gcc-x86_64.zip -d /
c:/usr/local
directory.c:/usr/local
directory.install for /usr/local/lib
.
Attention: Currently, there is a problem with ExternalProject, so a problem occurs when performing update processing. Please perform cleanup when building before installation.
(cleanup)
./tools/cmake_cleanup.sh
sudo ./tools/cleanup_install_files.sh
(build)
mkdir build && cd build && cmake .. -DENABLE_SHARED=on -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=off -DENABLE_JS_WRAPPER=off -DENABLE_CAPI=on -DTARGET_RPATH=/usr/local/lib && make
(install by using makefile)
cd build && sudo make install
(install by using ninja)
cd build && sudo ninja install
cmake version is 3.15 or higher: cmake --install build
Target is amd64(x86_64) only.
(cleanup)
./tools/cmake_cleanup.sh
sudo ./tools/cleanup_install_files.sh
(download)
wget https://github.com/cryptogarageinc/cfd-go/releases/download/v0.3.2/cfdgo-v0.3.2-ubuntu2004-gcc-x86_64.zip
(unzip)
sudo unzip -q cfdgo-v0.3.2-ubuntu2004-gcc-x86_64.zip -d /
(uninstall by using makefile)
cd build && sudo make uninstall
(uninstall by using ninja)
cd build && sudo ninja uninstall
(uninstall by using script)
sudo ./tools/cleanup_install_files.sh
Once, clone this repository.
Build & install cfd-go(and dependencies).
Modify go.mod
file adding cfd-go as go moudle
go.mod
require (
github.com/cryptogarageinc/cfd-go v0.3.2
...
)
Reference github commit:
require (
github.com/cryptogarageinc/cfd-go v1.0.0-0.20191205091101-a48a6a8b1a24
...
)
(version format: UnknownVersionTag-UtcDate-CommitHash)
Download cfd-go module
go mod download
test file is cfdgo_test.go
. Execute by the following method.
shell script or bat file
(linux/macos)
./go_test.sh
(Windows)
.\go_test.bat
go command (linux/macos)
LD_LIBRARY_PATH=./build/Release go test
attention: At first, install swig and set PATH.
(linux/macos)
./tools/gen_swig.sh
(Windows)
.\tools\gen_swig.bat
use by makefile:
make
(windows)
mingw32-make
make generate
(windows)
mingw32-make generate
docker-compose run swig
docker-compose run formatter
(Windows)
.\go_coverage.bat
(Ubuntu / MacOS)
./go_coverage.sh
Git repository connections default to HTTPS.
However, depending on the connection settings of GitHub, you may only be able to connect via SSH.
As a countermeasure, forcibly establish SSH connection by setting CFD_CMAKE_GIT_SSH=1
in the environment variable.
Windows: (On the command line. Or set from the system setting screen.)
set CFD_CMAKE_GIT_SSH=1
MacOS & Linux(Ubuntu):
export CFD_CMAKE_GIT_SSH=1
Depending on your git environment, you may get the following error when checking out external:
Performing update step for 'libwally-core-download'
Current branch cmake_build is up to date.
No stash entries found.
No stash entries found.
No stash entries found.
CMake Error at /workspace/cfd-core/build/external/libwally-core/download/libwally-core-download-prefix/tmp/libwally-core-download-gitupdate.cmake:133 (message):
Failed to unstash changes in:
'/workspace/cfd-core/external/libwally-core/'.
You will have to resolve the conflicts manually
This phenomenon is due to the git update
related command.
Please set an environment variable that skips update processing.
Windows: (On the command line. Or set from the system setting screen.)
set CFD_CMAKE_GIT_SKIP_UPDATE=1
MacOS & Linux(Ubuntu):
export CFD_CMAKE_GIT_SKIP_UPDATE=1