setup_project: Build sockpp on Windows

This still has its issues but at least it's reasonable to assume that the built library works.
Now, it's a question of figuring out how to link against it because I haven't gotten that to work yet.
cygwin
BodgeMaster 2023-01-16 08:03:41 +01:00
parent f7a6bdd119
commit ca150d0f05
1 changed files with 3 additions and 11 deletions

View File

@ -95,18 +95,10 @@ pushd dependencies/sockpp-0.7.1/ >/dev/null 2>&1
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
echo "Adding Cygwin workaound for building sockpp."
for FILE in "$(find ./ -type f)"; do
sed -i -e 's/_WIN32/PLEASE_DO_NOT_DEFINE_THIS_MACRO/g' $FILE
done
mv ./include/sockpp/socket.h ./include/sockpp/socket.h_original
echo '#include <sys/time.h>
#include "socket.h_original"' > ./include/sockpp/socket.h
sed -i -e 's/SO_REUSEPORT/SO_REUSEADDR/g' ./src/acceptor.cpp
CFLAGS="-D_XOPEN_SOURCE=700" CXXFLAGS="-D_XOPEN_SOURCE=700" cmake -Bbuild
CFLAGS="-D_XOPEN_SOURCE=700" CXXFLAGS="-D_XOPEN_SOURCE=700" cmake --build build
PATH=$(echo $PATH | sed 's/:/\n/g' | grep cygdrive | tr '\n' ':') cmake -G "MinGW Makefiles" -DSOCKPP_BUILD_SHARED=ON -DSOCKPP_BUILD_STATIC=OFF -B build .
PATH=$(echo $PATH | sed 's/:/\n/g' | grep cygdrive | tr '\n' ':') cmake --build build
else
cmake -Bbuild .
cmake -B build .
cmake --build build
fi
popd >/dev/null 2>&1