#!/bin/sh
if [ -e build ]; then
echo "Clean"
rm -rf build/*
fi

CMAKE_OPTS="-DCMAKE_EXPORT_COMPILE_COMMANDS=On"

#

# Options for LIBWEBSOCKET
CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITH_HTTP2=OFF"
CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITH_STATIC=ON"
CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITH_SHARED=OFF"
CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITH_SSL=OFF"

CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITH_LIBUV=ON"
CMAKE_OPTS="$CMAKE_OPTS -DLIBUV_INCLUDE_DIRS=$PWD/../libuv/include/"
CMAKE_OPTS="$CMAKE_OPTS -DLIBUV_LIBRARIES=$PWD/build/lib/"

CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITHOUT_TESTAPPS=ON"
CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITHOUT_TEST_SERVER=ON"
CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=ON"
CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITHOUT_TEST_PING=ON"
CMAKE_OPTS="$CMAKE_OPTS -DLWS_WITHOUT_TEST_CLIENT=ON"

# Options for NATS.c
CMAKE_OPTS="$CMAKE_OPTS -DNATS_BUILD_EXAMPLES=OFF"
CMAKE_OPTS="$CMAKE_OPTS -DNATS_BUILD_STREAMING=OFF"
CMAKE_OPTS="$CMAKE_OPTS -DNATS_BUILD_TLS_USE_OPENSSL_1_1_API=ON" 
CMAKE_OPTS="$CMAKE_OPTS -DNATS_BUILD_WITH_TLS=OFF"
CMAKE_OPTS="$CMAKE_OPTS -DNATS_BUILD_LIB_SHARED=OFF"

cd build
cmake .. $CMAKE_OPTS ..
make
