Compare commits

...

3 Commits

Author SHA1 Message Date
BodgeMaster ca150d0f05 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.
2023-01-16 08:05:26 +01:00
BodgeMaster f7a6bdd119 setupenv: Cygwin workaround: Check for CMake on Windows 2023-01-16 08:02:05 +01:00
BodgeMaster 3d4049bc39 doc: Add Windows-specific notes 2023-01-16 08:00:35 +01:00
4 changed files with 66 additions and 16 deletions

View File

@ -18,7 +18,9 @@ Immediate goals:
- [x] decode and encode data
## Project Setup Instructions
## Working with the project
WINDOWS USERS READ THIS: [Windows-specific notes](doc/windows.md)
### Prerequisites:

47
doc/windows.md Normal file
View File

@ -0,0 +1,47 @@
# Notes for Windows Users
FOSS-VG is focused on development on UNIX-like systems for UNIX-like systems.
The development environment is built in a way that requires UNIX tools.
There are two options to deal with this on Windows:
1) Use Cygwin to get a UNIX-like environment on Windows.
This is the option to choose if you want to develop FOSS-VG on Windows.
Working on FOSS-VG on Cygwin is pretty much the same as on other
operating systems with the exception that special care needs to be taken
setting up the development environment.
2) Use the `windows` branch.
This is the option to use when just building on Windows.
Might need some fixing up to actually work properly.
Don't commit new code to that branch as it cannot be merged back into master.
Merging from the `windows` branch into master would break master for all other
operating systems.
# Using Cygwin
The build system has special provisions built-in to deal with the Windows-iness
of Cygwin environments. But it still needs some specific setup to work properly.
When getting the prerequisites set up, make sure to install CMake on Windows,
NOT on Cygwin. CMake is used for dependencies that aren't easy to build
on Cygwin, therefore they are built on Windows.
You will also need MinGW tools on Windows that CMake can use to build the
dependencies. In case they aren't in your PATH variable, you can use the
`.localenv.bashrc` to automatically add them when loading the development
environment like so:
```sh
PATH=$PATH:/cygdrive/c/path/to/your/mingw/bin
```
Note that the mingw tools are added to the end of the path variable so they
don't override Cygwin's programs in regular use.
# Using the `windows` Branch
Good luck.
It's currently not actively being maintained as only building FOSS-VG is not
a task that is commonly needed.
This will probably change when Windows-only builds have to be performed
regularly.

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

View File

@ -94,11 +94,20 @@ else
MISSING_DEPS=1
fi
if command -v cmake > /dev/null 2>&1; then
true
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
if PATH=$(echo $PATH | sed 's/:/\n/g' | grep cygdrive | tr '\n' ':') command -v cmake > /dev/null 2>&1; then
true
else
echo "WARNING: \`cmake\` needs to be installed on Windows directly to build downloaded dependencies."
MISSING_DEPS=1
fi
else
echo "WARNING: \`cmake\` is needed to build downloaded dependencies."
MISSING_DEPS=1
if command -v cmake > /dev/null 2>&1; then
true
else
echo "WARNING: \`cmake\` is needed to build downloaded dependencies."
MISSING_DEPS=1
fi
fi
if [ -z "$CXX" ]; then