Files
mx 60fa5cfeb8 Max/rust sdk stream abstraction (#4743)
* add TcpProxyClient and TcpProxyServer abstractions to SDK 
* add single connection example
* add multi-connection example 
* add simple echo server to `tools/`: used for multi-connection example 
* update FFI toml files: switched to local imports 
* add proxy bindings to `ffi/shared`
* add proxy bindings and example to `ffi/go` 
* add note to `ffi/cpp` about lack of Proxy bindings for the moment
2024-09-24 09:29:46 +00:00

51 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
C_CODE_NAME="main"
PROJECT_NAME="cpp"
clean_artifacts() {
printf "cleaning cargo artifacts \n"
cargo clean
if [ -e "src/${C_CODE_NAME}" ]
then
printf "cleaning compiled C++ \n"
rm src/${C_CODE_NAME}
else
printf "no compiled C++ to clean \n"
fi
}
build_artifacts_and_link() {
cargo build --release &&
cd src/ &&
printf "compiling cpp \n"
g++ -std=c++11 -o main main.cpp -ldl -lpthread -L../../../../target/release -lnym_cpp_ffi -lboost_thread &&
export LD_LIBRARY_PATH=../../../../target/release:$LD_LIBRARY_PATH
# check output for name of rust lib - can be helpful if you've changed e.g. the name of a file and the compilation is failing
# printf "ldd main: \n"
# ldd main
}
if [ $(pwd | awk -F/ '{print $NF}') != ${PROJECT_NAME} ]
then
printf "please run from root dir of project"
exit 1
fi
if [ $# -eq 0 ];
then
build_artifacts_and_link;
./main;
else
arg=$1
if [ "$arg" == "clean" ]; then
clean_artifacts;
build_artifacts_and_link;
./main;
else
printf "unknown optional argument - the only available optional argument is 'clean'"
exit 1
fi
fi