Add Windows cross-platform support alongside Linux

Replace POSIX-specific socket and process APIs with portable
abstractions so the project builds on both Windows and Linux.

- Add include/network/net_platform.hpp: Winsock2/POSIX socket
  abstraction (socket types, non-blocking, error handling,
  WSAStartup lifecycle)
- Add include/platform/process.hpp: CreateProcess/fork+exec
  abstraction for spawning ffplay subprocesses
- Update network module (tcp_socket, world_socket) to use
  portable socket helpers instead of raw POSIX calls
- Update audio module (music_manager, footstep_manager,
  activity_sound_manager) to use portable process helpers
  instead of fork/exec/kill/waitpid
- Replace hardcoded /tmp/ paths with std::filesystem::temp_directory_path()
- Link ws2_32 and SDL2main on Windows in CMakeLists.txt
This commit is contained in:
Kelsi 2026-02-03 22:24:17 -08:00
parent dd126c6e4b
commit 6bf3fa4ed4
14 changed files with 416 additions and 186 deletions

View file

@ -158,6 +158,10 @@ set(WOWEE_HEADERS
include/network/socket.hpp
include/network/packet.hpp
include/network/tcp_socket.hpp
include/network/world_socket.hpp
include/network/net_platform.hpp
include/platform/process.hpp
include/auth/auth_handler.hpp
include/auth/auth_opcodes.hpp
@ -240,6 +244,15 @@ target_link_libraries(wowee PRIVATE
Threads::Threads
)
# Platform-specific libraries
if(WIN32)
target_link_libraries(wowee PRIVATE ws2_32)
# SDL2main provides WinMain entry point on Windows
if(TARGET SDL2::SDL2main)
target_link_libraries(wowee PRIVATE SDL2::SDL2main)
endif()
endif()
# Link StormLib if found
if(STORMLIB_LIBRARY AND STORMLIB_INCLUDE_DIR)
target_link_libraries(wowee PRIVATE ${STORMLIB_LIBRARY})