diff --git a/.vscode/settings.json b/.vscode/settings.json index eb7c70d..452fe18 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "clangd.fallbackFlags": [ - "-I/usr/share/emscripten/cache/sysroot/include/" + "-I/usr/share/emscripten/cache/sysroot/include/", + "-I/usr/lib/emscripten/system/include" ] } \ No newline at end of file diff --git a/client/build.sh b/client/build.sh index eef8fd4..f8e2509 100755 --- a/client/build.sh +++ b/client/build.sh @@ -22,6 +22,7 @@ if [ ! -d $INCLUDE_DIR ]; then tools/curl.sh fi +mkdir -p out COMPILE_CMD="emcc main.c $COMPILER_OPTIONS $EMSCRIPTEN_OPTIONS" echo $COMPILE_CMD $COMPILE_CMD diff --git a/client/tools/all_deps.sh b/client/tools/all_deps.sh new file mode 100755 index 0000000..e6439a9 --- /dev/null +++ b/client/tools/all_deps.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +#build all deps + +mkdir -p build + +OPENSSL_PREFIX=$(realpath build/openssl-wasm) +CJSON_PREFIX=$(realpath build/cjson-wasm) +CURL_PREFIX=$(realpath build/curl-wasm) + +tools/openssl.sh +tools/cjson.sh +tools/curl.sh + +cp -r $OPENSSL_PREFIX/* $CURL_PREFIX +cp -r $CJSON_PREFIX/* $CURL_PREFIX \ No newline at end of file diff --git a/client/tools/cjson.sh b/client/tools/cjson.sh new file mode 100755 index 0000000..b6505f6 --- /dev/null +++ b/client/tools/cjson.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +#compile cjson for use with emscripten + +set -x +set -e + +CORE_COUNT=$(nproc --all) +PREFIX=$(realpath build/cjson-wasm) +mkdir -p $PREFIX + +cd build +rm -rf cjson +git clone -b master --depth=1 https://github.com/DaveGamble/cJSON cjson +cd cjson + +emmake make all +INCLUDE_FILES="cJSON.h cJSON_Utils.h" +LIB_FILES="libcjson.a libcjson_utils.a" + +rm -rf $PREFIX +mkdir -p $PREFIX/include/cjson +mkdir -p $PREFIX/lib +cp $INCLUDE_FILES $PREFIX/include/cjson +cp $LIB_FILES $PREFIX/lib + +cd ../../ \ No newline at end of file