chiark / gitweb /
Migrate to a CMake-based build system.
authorSimon Tatham <anakin@pobox.com>
Mon, 29 Mar 2021 17:23:11 +0000 (18:23 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 29 Mar 2021 18:02:23 +0000 (19:02 +0100)
commitcc7f5503dc8f4ddf468e080a73028c83d1196e83
tree10e17f66ff5a417f8ce9cf23d0f926380c2a6957
parent72b28b5e71b05e7775d14b1e3e2e00b82af4d87a
Migrate to a CMake-based build system.

This completely removes the old system of mkfiles.pl + Recipe + .R
files that I used to manage the various per-platform makefiles and
other build scripts in this code base. In its place is a
CMakeLists.txt setup, which is still able to compile for Linux,
Windows, MacOS, NestedVM and Emscripten.

The main reason for doing this is because mkfiles.pl was a horrible
pile of unmaintainable cruft. It was hard to keep up to date (e.g.
didn't reliably support the latest Visual Studio project files); it
was so specific to me that nobody else could maintain it (or was even
interested in trying, and who can blame them?), and it wasn't even
easy to _use_ if you weren't me. And it didn't even produce very good
makefiles.

In fact I've been wanting to hurl mkfiles.pl in the bin for years, but
was blocked by CMake not quite being able to support my clang-cl based
system for cross-compiling for Windows on Linux. But CMake 3.20 was
released this month and fixes the last bug in that area (it had to do
with preprocessing of .rc files), so now I'm unblocked!

CMake is not perfect, but it's better at mkfiles.pl's job than
mkfiles.pl was, and it has the great advantage that lots of other
people already know about it.

Other advantages of the CMake system:

 - Easier to build with. At least for the big three platforms, it's
   possible to write down a list of build commands that's actually the
   same everywhere ("cmake ." followed by "cmake --build ."). There's
   endless scope for making your end-user cmake commands more fancy
   than that, for various advantages, but very few people _have_ to.

 - Less effort required to add a new puzzle. You just add a puzzle()
   statement to the top-level CMakeLists.txt, instead of needing to
   remember eight separate fiddly things to put in the .R file. (Look
   at the reduction in CHECKLST.txt!)

 - The 'unfinished' subdirectory is now _built_ unconditionally, even
   if the things in it don't go into the 'make install' target. So
   they won't bit-rot in future.

 - Unix build: unified the old icons makefile with the main build, so
   that each puzzle builds without an icon, runs to build its icon,
   then relinks with it.

 - Windows build: far easier to switch back and forth between debug
   and release than with the old makefiles.

 - MacOS build: CMake has its own .dmg generator, which is surely
   better thought out than my ten-line bodge.

 - net reduction in the number of lines of code in the code base. In
   fact, that's still true _even_ if you don't count the deletion of
   mkfiles.pl itself - that script didn't even have the virtue of
   allowing everything else to be done exceptionally concisely.
82 files changed:
.gitignore
Buildscr
CHECKLST.txt
CMakeLists.txt [new file with mode: 0644]
README
Recipe [deleted file]
blackbox.R [deleted file]
bridges.R [deleted file]
cmake/glob-symlinks.py [new file with mode: 0755]
cmake/nestedvm-toolchain.cmake [new file with mode: 0644]
cmake/platforms/emscripten.cmake [new file with mode: 0644]
cmake/platforms/nestedvm.cmake [new file with mode: 0644]
cmake/platforms/osx.cmake [new file with mode: 0644]
cmake/platforms/unix.cmake [new file with mode: 0644]
cmake/platforms/windows.cmake [new file with mode: 0644]
cmake/setup.cmake [new file with mode: 0644]
cmake/testbuild.c [new file with mode: 0644]
cmake/windows-dummy-toolchain.cmake [new file with mode: 0644]
configure.ac [deleted file]
cube.R [deleted file]
devel.but
dominosa.R [deleted file]
emccx.json [deleted file]
fifteen.R [deleted file]
filling.R [deleted file]
flip.R [deleted file]
flood.R [deleted file]
galaxies.R [deleted file]
guess.R [deleted file]
icons/Makefile [deleted file]
icons/cicon.pl
icons/crop.sh
icons/icon.pl
icons/icons.cmake [new file with mode: 0644]
icons/screenshot.sh [deleted file]
icons/square.pl
inertia.R [deleted file]
keen.R [deleted file]
lightup.R [deleted file]
list.c [new file with mode: 0644]
loopy.R [deleted file]
magnets.R [deleted file]
makedist.sh [deleted file]
map.R [deleted file]
mines.R [deleted file]
mkauto.sh [deleted file]
mkfiles.pl [deleted file]
net.R [deleted file]
netslide.R [deleted file]
noicon.rc [deleted file]
nullgame.R [deleted file]
osx.m
osx/Info.plist [moved from osx-info.plist with 100% similarity]
osx/Puzzles.icns [moved from osx.icns with 100% similarity]
palisade.R [deleted file]
pattern.R [deleted file]
pearl.R [deleted file]
pegs.R [deleted file]
puzzles.rc [moved from puzzles.rc2 with 82% similarity]
range.R [deleted file]
rect.R [deleted file]
samegame.R [deleted file]
signpost.R [deleted file]
singles.R [deleted file]
sixteen.R [deleted file]
slant.R [deleted file]
solo.R [deleted file]
tents.R [deleted file]
towers.R [deleted file]
tracks.R [deleted file]
twiddle.R [deleted file]
undead.R [deleted file]
unequal.R [deleted file]
unfinished/CMakeLists.txt [new file with mode: 0644]
unfinished/README
unfinished/group.R [deleted file]
unfinished/separate.R [deleted file]
unfinished/slide.R [deleted file]
unfinished/sokoban.R [deleted file]
unruly.R [deleted file]
untangle.R [deleted file]
webpage.pl