Following instructions should work on Mac, Linux (Ubuntu 20.04) and Windows.
-
On Linux:
-
Install the compiler:
sudo apt install build-essential git cmake ninja-build
-
Install Conan.
-
Set the right C++ ABI for Conan:
conan profile new default --detect conan profile update settings.compiler.libcxx=libstdc++11 default
-
-
On Windows:
-
Install Visual Studio and Git for Windows.
Run all commands from a command prompt that has access to Visual Studio and Git. This can be accomplished by using the "Native Tools Command Prompt" shortcut installed by Visual Studio on the Start Menu.
-
Install Conan.
-
-
On Mac:
-
Install the compiler:
xcode-select —install
-
Install build dependencies:
brew install git cmake ninja pkg-config
-
Install Conan.
-
Set the right config for Conan:
conan profile new default --detect conan config set general.revisions_enabled=True
-
Modify
conanfile.txt
(Only for Mac M1):- Change
boost:without_math=True
. - Add
rocksdb:enable_sse = False
underrocksdb:shared = True
.
- Change
-
While Conan will be building and installing packages, you might want to go for a ☕ (or lunch), as this will probably take a bit.
conan remote add nemtech https://catapult.jfrog.io/artifactory/api/conan/ngl-conan
git clone https://github.com/symbol/catapult-client.git
cd catapult-client
mkdir _build && cd _build
conan install .. --build missing
NOTE: Make sure to use the correct
PYTHON_EXECUTABLE
path! Python3 is required for the build to produce some header files. If Python3 cannot be found you won't notice until more than one hour into the build process because of some missing headers. You can find your Python3 path by runningwhere python3
.
-
Generate project files for Visual Studio 2019:
cmake -G "Visual Studio 16 2019" -A x64 -DUSE_CONAN=ON -DPYTHON_EXECUTABLE:FILEPATH=X:/python3x/python.exe ..
-
Generate project files for Visual Studio 2017:
cmake -G "Visual Studio 15 2017 Win64" -DUSE_CONAN=ON -DPYTHON_EXECUTABLE:FILEPATH=X:/python3x/python.exe ..
-
Build:
cmake --build . --target publish msbuild /p:Configuration=RelWithDebInfo /p:Platform=x64 ALL_BUILD.vcxproj
After building successfully, the tools in
_build\bin
are ready to use. All runtime dependencies have been copied into the same folder so Windows will find them. -
Verify:
Check that the tools are working correctly by running:
bin\catapult.tools.address --help
-
Build:
cmake -DUSE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -G Ninja .. ninja publish ninja -j4
Once the build finishes successfully, the tools in
_build/bin
are ready to use. However, the dependencies in_build/deps
must be accessible so make sure to add this folder to theLD_LIBRARY_PATH
environment variable (Linux) orDYLD_LIBRARY_PATH
(Mac).One way of doing this is by running this from the
_build
directory:export LD_LIBRARY_PATH=$PWD/deps
You will need to run this line every new session, unless you add it at the end of your
~/.bashrc
or~/.profile
files. -
Install (Optional):
The catapult tools can be made available globally by running:
sudo ninja install
NOTE: You can change the default installation location by passing
-DCMAKE_INSTALL_PREFIX=...
tocmake
in the Build step. In this case you might not requiresudo
. -
Verify:
Check that the tools are working correctly by running:
bin/catapult.tools.address --help