Build system: Get sockpp to build on Cygwin
This is probably not the last time this issue needs attention as it *builds* on Cygwin with these workarounds, but it doesn’t *work* on Cygwin...windows
parent
63e1749ad1
commit
3cc91ae33d
|
@ -1,11 +0,0 @@
|
||||||
set(CMAKE_SYSTEM_NAME Windows)
|
|
||||||
set(WIN32 true)
|
|
||||||
set(UNIX false)
|
|
||||||
|
|
||||||
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
|
||||||
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
|
|
||||||
|
|
||||||
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
|
@ -93,12 +93,22 @@ echo "done"
|
||||||
echo ">>> Building sockpp... "
|
echo ">>> Building sockpp... "
|
||||||
pushd dependencies/sockpp-0.7.1/ >/dev/null 2>&1
|
pushd dependencies/sockpp-0.7.1/ >/dev/null 2>&1
|
||||||
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
|
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
|
||||||
echo "Adding cygwin workaound for building sockpp."
|
echo "Adding Cygwin workaound for building sockpp."
|
||||||
cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=$PROJECT_BASE_DIR/.mingw-cross.cmake -DSOCKPP_BUILD_SHARED=ON -DSOCKPP_BUILD_STATIC=OFF
|
|
||||||
|
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
|
||||||
else
|
else
|
||||||
cmake -Bbuild .
|
cmake -Bbuild .
|
||||||
|
cmake --build build
|
||||||
fi
|
fi
|
||||||
cmake --build build
|
|
||||||
popd >/dev/null 2>&1
|
popd >/dev/null 2>&1
|
||||||
|
|
||||||
echo ">>> Cleaning up..."
|
echo ">>> Cleaning up..."
|
||||||
|
|
Loading…
Reference in New Issue