Skip to content

CMake build system update and -Wextra signed/size compare warnings fix - #198

Open
lndpj wants to merge 9 commits into
phoboslab:masterfrom
lndpj:master
Open

CMake build system update and -Wextra signed/size compare warnings fix#198
lndpj wants to merge 9 commits into
phoboslab:masterfrom
lndpj:master

Conversation

@lndpj

@lndpj lndpj commented Aug 1, 2026

Copy link
Copy Markdown

Changes

  • fix signed compare warnings
  • fix size compare warnings
  • turn off unused warnings
  • rename CMakeLists.txt target wipeout to wipegame to avoid directory/file conflicts and be consistent with Makefile
  • add Release/ReleaseStrip/Debug build type support
  • support compiler frontend variants like GNU/Clang/MSVC
  • support cross compiling
  • change SDL2::Main to SDL2::SDL2main
  • remove cmake/FindSDL2.cmake
  • add IPO/LTO support
  • support compiler specific optimizations like tree vectorize and openmp
  • remove executable permission for *.c/*.h

New command line example

cmake ../wipeout-rewrite/ -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=ReleaseStrip
-- The C compiler identification is Clang 22.1.8
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib/llvm/22/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Build type: ReleaseStrip
-- Linux x86_64 Clang/GNU SDL2 GL => Linux x86_64 Clang/GNU SDL2 GL
-- Using IPO/LTO.
-- Found OpenGL: /usr/lib64/libOpenGL.so
-- Found GLEW: /usr/include (found version "2.2.0")
-- Found ALSA: /usr/lib64/libasound.so (found version "1.2.16.1")
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /usr/src/games/wipeout-rewrite/build

@lndpj
lndpj force-pushed the master branch 2 times, most recently from 7e73e43 to 038eabf Compare August 1, 2026 16:19
@lndpj lndpj changed the title fix signed/size warnings and turn off unused CMake build system update and signed/size compare warnings fix Aug 1, 2026
@phoboslab

Copy link
Copy Markdown
Owner

I don't care much about the cmake changes (I don't use it), but happy to merge if you can explain in a bit more detail why these changes are necessary, what they do/improve and the platform(s) you tested this on. This also needs an update of the instructions in README.md.

Not a fan of the int -> size_t dance, and using uint32_t unnecessarily. This whole commit is just meaningless busywork, imho. Also, not sure if/why your compiler was complaining, but ftell() returns a signed value. Getting this "correct" seems pointless.

@lndpj

lndpj commented Aug 1, 2026

Copy link
Copy Markdown
Author

Supporting CMAKE_COMPILER_FRONTEND_VARIANT is necessary in order to use different compiler options, platforms and cross compiling targets.

Testbed

OS: Gentoo Linux x86_64 7.1.5-gentoo 
CPU: Intel i7-9750H (12) @ 4.500GHz 
GPU: Intel CoffeeLake-H GT2 [UHD Graphics 630] 
GPU: NVIDIA GeForce RTX 2060 Mobile 
Memory: 4100MiB / 15250MiB
Compiler: gcc-16-snapshot, clang-22.1.8

The warnings are related to -Wextra. Add it to Makefile C_FLAGS and you should get the compiler output.

@lndpj lndpj changed the title CMake build system update and signed/size compare warnings fix CMake build system update and -Wextra signed/size compare warnings fix Aug 1, 2026
@phoboslab

Copy link
Copy Markdown
Owner

Do you have the means to test your changes on Windows? That was the reason to have cmake here in the first place...

The warnings are related to -Wextra. Add it to Makefile C_FLAGS and you should get the compiler output.

But I don't want those. That's why there's no -Wextra in the Makefile :)

@lndpj

lndpj commented Aug 1, 2026

Copy link
Copy Markdown
Author

Do you have the means to test your changes on Windows? That was the reason to have cmake here in the first place...

No, I've added support for the MSVC compiler frontend. Maybe adding an action test script to your project might help.
MinGW/MSYS2 should work too with GNU/Clang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants