1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00
hyperrogue/Makefile.mac
Arthur O'Dwyer db3e5d1009 Minor fixes for Mac and MinGW.
Eliminate a format-string warning by using less template magic:
https://stackoverflow.com/questions/12573968/how-to-use-gccs-printf-format-attribute-with-c11-variadic-templates

Fix one `%Ld` in `rogueviz.cpp` that should have been `%lld`.

Rename `savepng.c` into `savepng.cpp` so that we don't have to care about
the system's C compiler; it builds fine using the same C++ options as
HyperRogue itself.

Figure out how to get `-DCAP_PNG` and `-DCAP_ROGUEVIZ` working on Mac,
and document them.
Assume that roughly the same things should also work on MinGW.

Consistency on `STDSIZE`, even though it doesn't suffice for C++17 conformance.
It *almost* suffices; the one place where Clang still complains even with
`-std=c++17 -DSTDSIZE -Wno-sign-compare` is here:

    ./fieldpattern.cpp:757:51: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list
          [-Wc++11-narrowing]
          ex.primes.emplace_back(primeinfo{nextprime, size(fp.matrices) / S7, (bool) fp.wsquare});
                                                      ^~~~~~~~~~~~~~~~~~~~~~

So, we fix that up too, in this patch.
2018-06-16 23:20:50 -07:00

52 lines
1.3 KiB
Makefile

# This Makefile works for Mac OS X (El Capitan).
#
# Run "brew install sdl" to install SDL in /usr/local.
# Run "brew install sdl_gfx".
# Run "brew install sdl_mixer".
# Run "brew install sdl_ttf".
# Run "make -f Makefile.mac" to build HyperRogue as ./hyper.
CXXFLAGS += -std=c++11 -march=native -DMAC
CXXFLAGS += -W -Wall -Wextra -pedantic
CXXFLAGS += -Wno-format-pedantic -Wno-unused-parameter -Wno-missing-field-initializers -Wno-vla-extension
CXXFLAGS += -I/usr/local/include
CXXFLAGS += ${EXTRA_CXXFLAGS}
LDFLAGS += -L/usr/local/lib
OBJS = hyper.o
ifeq (a,b)
# Enable PNG screenshots. Requires "brew install libpng".
CXXFLAGS += -DCAP_PNG
LDFLAGS += -lpng
OBJS += savepng.o
else
CXXFLAGS += -DCAP_PNG=0
endif
ifeq (a,b)
# Enable RogueViz.
CXXFLAGS += -DCAP_ROGUEVIZ
endif
hyper: $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) $(LDFLAGS) -lSDL -lSDLMain -lSDL_gfx -lSDL_mixer -lSDL_ttf -framework AppKit -framework OpenGL -o hyper
hyper.o: *.cpp language-data.cpp
$(CXX) $(CXXFLAGS) -O2 -c hyper.cpp
langen: langen.cpp language-??.cpp language-ptbr.cpp
$(CXX) $(CXXFLAGS) -O0 -Wno-embedded-directive langen.cpp -o langen
language-data.cpp: langen
./langen > language-data.cpp
savepng.o: savepng.cpp
$(CXX) $(CXXFLAGS) -O2 -c savepng.cpp
.PHONY: clean
clean:
rm -f hyper hyper.o langen language-data.cpp savepng.o