zenorogue / hyperrogue

A SDL roguelike in a non-euclidean world
GNU General Public License v2.0
569 stars 72 forks source link

No longer builds when CAP_PNG=0 #107

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
$ make -f Makefile.simple 
./langen > language-data.cpp
./makeh classes.cpp locations.cpp hyperpoint.cpp geometry.cpp goldberg.cpp init.cpp floorshapes.cpp cell.cpp multi.cpp shmup.cpp pattern2.cpp mapeditor.cpp graph.cpp textures.cpp hprint.cpp language.cpp util.cpp complex.cpp *.cpp > autohdr.h
c++ -O2 -std=c++11 -DMAC -I/usr/local/include -march=native -W -Wall -Wextra -Werror -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-unknown-warning-option -DCAP_GLEW=0 -DCAP_PNG=0    -c hyper.cpp -o hyper.o
In file included from hyper.cpp:83:
./mapeditor.cpp:2330:26: error: use of undeclared identifier 'texture'
          if(!holdmouse) texture::config.data.undoLock();
                         ^

This happens on Mac if you don't pass HYPERROGUE_USE_PNG=1. Because without CAP_PNG, there's no CAP_TEXTURE, and without CAP_TEXTURE there's no namespace texture.

The TravisCI matrix does not test CAP_PNG=0. I would be happy to submit a PR to add a couple CAP_PNG=0 builds to the test matrix; alternatively, I would be happy to submit a PR to make -DCAP_PNG=1 mandatory and eliminate all the conditionals that depend on it.

Quuxplusone commented 4 years ago

Orthogonal but minor: It would be nice to add a commit hook, or some check in makeh, or something, that would fail the build whenever it saw #ifdef CAP_FOO anywhere, or #ifndef CAP_FOO outside of "sysconfig.h". The directives #if CAP_FOO and #ifdef CAP_FOO do different things when -DCAP_FOO=0.

diff --git a/complex2.cpp b/complex2.cpp
index e861c827..11c490b2 100644
--- a/complex2.cpp
+++ b/complex2.cpp
@@ -8,7 +8,7 @@
  */

 #include "hyper.h"
-#ifdef CAP_COMPLEX2
+#if CAP_COMPLEX2

 namespace hr {
Quuxplusone commented 4 years ago

I just tried building with -DCAP_RUG=0 (failed) and with -DCAP_GL=0 and -DISMINI=1 (both failed with really confusing error messages). Some fruits of that labor are in #108.

Quuxplusone commented 4 years ago

@zenorogue : Have you seen the build failures in https://travis-ci.org/github/zenorogue/hyperrogue/jobs/687775577 ? They look like real issues to me.