Build system: Make things (kinda) work on Windows

This will need additional work, I just cba to do it as it’s irrelevant rn
windows
BodgeMaster 2023-01-16 04:58:30 +01:00
parent cac0fd47ef
commit 2609342198
2 changed files with 8 additions and 27 deletions

View File

@ -92,23 +92,10 @@ 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
echo "Adding Cygwin workaound for building sockpp."
for FILE in "$(find ./ -type f)"; do cmake -G "MinGW Makefiles" -Bbuild .
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
cmake -Bbuild .
cmake --build build cmake --build build
fi
popd >/dev/null 2>&1 popd >/dev/null 2>&1
echo ">>> Cleaning up..." echo ">>> Cleaning up..."

View File

@ -13,7 +13,7 @@
# version 3 along with this program. # version 3 along with this program.
# If not, see https://www.gnu.org/licenses/agpl-3.0.en.html # If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
echo ">>> Loading shell environment for FOSS-VG development..." echo ">>> Loading Windows-specific shell environment for FOSS-VG development..."
export PROJECT_BASE_DIR="$( cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )" export PROJECT_BASE_DIR="$( cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
echo "Project base directory is $PROJECT_BASE_DIR" echo "Project base directory is $PROJECT_BASE_DIR"
@ -42,18 +42,12 @@ function build {
echo "Added aliases and functions." echo "Added aliases and functions."
export PATH="$PROJECT_BASE_DIR/bin:$PROJECT_BASE_DIR/bin/tools:$PROJECT_BASE_DIR/scripts/tools:$PATH" export PATH="$PROJECT_BASE_DIR/bin:$PROJECT_BASE_DIR/bin/tools:$PROJECT_BASE_DIR/scripts/tools:$PATH"
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
echo "Adding Cygwin workaound for library path."
export PATH="$PROJECT_BASE_DIR/bin/lib:$PATH"
fi
echo "PATH is $PATH"
if [ -z "$LD_LIBRARY_PATH" ]; then # Windows workaround:
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib # Windows doesn't have LD_LIBRARY_PATH and searches for libraries on PATH instead.
else export PATH="$PROJECT_BASE_DIR/bin/lib:$PATH"
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib:"$LD_LIBRARY_PATH"
fi echo "PATH is $PATH"
echo "LD_LIBRARY_PATH is $LD_LIBRARY_PATH"
echo ">>> Checking for dependencies..." echo ">>> Checking for dependencies..."
MISSING_DEPS=0 MISSING_DEPS=0