Convert build system from premake to CMake and add GitHub Actions CI#143
Merged
Conversation
- CMakeLists.txt replaces premake5.lua: sodium static lib, netcode static library, all examples/harnesses, and the unit test runner (test.cpp with NETCODE_ENABLE_TESTS, output name "test" since CTest reserves the target name). Matches the premake config: NETCODE_DEBUG/NETCODE_RELEASE defines, fast math, static MSVC runtime, ws2_32/iphlpapi on Windows, .S files excluded as before. - CI builds and runs unit tests for Debug and Release on Linux x64 (ubuntu-24.04), macOS Apple Silicon (macos-15) and Windows x64 (windows-2025). - BUILDING.md rewritten for CMake; vendored sodium means nothing to install. - .gitignore: exempt CMakeLists.txt from the *.txt rule, ignore build dirs. Note: CMake Release defines NDEBUG (premake did not), so netcode_assert now compiles out in Release builds. Debug CI covers the asserts-on configuration. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sodium/ is now an amalgamated sodium.h + sodium.c pair instead of 182 per-file sources. See sodium/NOTES.md for how the amalgamation is generated and validated. CMake updated accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
client_server_socket_connect_to advances virtual time in a busy loop while pumping real sockets, so virtual timeouts (connect token expiry, connection request timeout) could expire before the OS delivered a single loopback packet. Failed on the macOS Release CI runner. Sleep 10ms per iteration so real packet delivery keeps pace with virtual time. Also in this commit (small API hardening): - netcode_parse_address: ports are now validated (all digits, <= 65535) instead of silently truncating through atoi + uint16_t cast. New tests. - netcode_client_send_packet / netcode_server_send_packet reject zero-byte payloads with an error log. The receiver already dropped them on the wire, so previously they silently vanished. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…s continue - State up front that the library is single-threaded by design and not thread safe (global state, no internal synchronization). - The netcode_assert macro no longer calls exit(1) after invoking the assert handler. The default handler still breaks into the debugger and exits, so default behavior is unchanged, but a custom handler may now return and continue execution. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sodiumstatic lib,netcodestatic library, all examples/harnesses (client,server,client_server,soak,profile), and the unit test runner (netcode_test, output nametest— CTest reserves the bare target name).NETCODE_DEBUG/NETCODE_RELEASEper config, fast math (-ffast-math//fp:fast), static MSVC runtime,ws2_32/iphlpapion Windows, sodium warning suppressions, and the.Sassembly files remain excluded (the premake gmake build never compiled them either).!CMakeLists.txtexception for the*.txtrule, ignorebuild*/.Behavior note
premake's release config did not define
NDEBUG, sonetcode_assertwas live in release builds. CMake Release definesNDEBUGby convention, so asserts compile out in Release. The test suite'scheckmacro is independent ofNDEBUG; Debug CI covers the asserts-on configuration.Test plan
🤖 Generated with Claude Code