Added cmake for builds.

This commit is contained in:
Ravin Perera
2019-10-08 19:00:37 +05:30
parent 22a140c543
commit 7864784d65
4 changed files with 36 additions and 10 deletions

6
.gitignore vendored
View File

@@ -4,4 +4,8 @@
.*.sw?
.DS_Store
build/**
.vscode/**
.vscode/**
Makefile
CMakeCache.txt
cmake_install.cmake
CMakeFiles/**

21
CMakeLists.txt Normal file
View File

@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.2)
add_definitions("-std=c++17")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build)
add_executable(hpcore
src/main.cpp
src/conf.cpp
src/crypto.cpp
src/proc.cpp
src/shared.cpp
src/usr/usr.cpp
src/shared.cpp
)
target_link_libraries(hpcore
libsodium.a
libboost_system.a
libboost_filesystem.a
)

View File

@@ -40,13 +40,18 @@ Following Instructions are based on Boost [getting started](https://www.boost.or
This will update your library cache and avoid potential issues when running your compiled C++ program which links to newly installed libraries.
#### Install CMAKE
If you use apt, run `sudo apt install cmake`
Or follow [this](https://cmake.org/install/)
#### Build and run Hot Pocket
1. navigate to hotpocket repo root.
2. Run `make`
3. Run `./build/hpcore new ~/mycontract`. This will initialize a new contract directory `mycontract` in your home directory.
4. Take a look at `~/mycontract/cfg/hp.cfg`. This is your new contract config file. You can modify it according to your contract hosting requirements.
5. Optional: Run `./build/hpcore rekey ~/mycontract` to generate new public/private key pair.
6. Run `./build/hpcore run ~/mycontract` to run your smart contract (to do).
1. Run `cmake .` (You only have to do this once)
1. Run `make`
1. Run `./build/hpcore new ~/mycontract`. This will initialize a new contract directory `mycontract` in your home directory.
1. Take a look at `~/mycontract/cfg/hp.cfg`. This is your new contract config file. You can modify it according to your contract hosting requirements.
1. Optional: Run `./build/hpcore rekey ~/mycontract` to generate new public/private key pair.
1. Run `./build/hpcore run ~/mycontract` to run your smart contract (to do).
## Code structure
Code is divided into subsystems via namespaces. Some subsystems mentioned here are yet to be introduced.

View File

@@ -1,4 +0,0 @@
all:
mkdir -p build
g++ src/*.cpp src/usr/*.cpp -lsodium -lboost_system -lboost_filesystem -std=c++17 -o build/hpcore
echo 'build successful, binary in '`pwd`'/build/hpcore'