From fd128d24c67f3890cf6588b2511c74c60e61c009 Mon Sep 17 00:00:00 2001 From: Tokarak <63452145+Tokarak@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:09:59 +0100 Subject: [PATCH 1/5] Fix MacOS-silicon compile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the right Homebrew prefix — not hard-coded any more. --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ea56c282..68e947d4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # This Makefile works for Mac OS X (El Capitan), MinGW, and Linux. # # For Mac OS X: -# Run "brew install sdl" to install SDL in /usr/local. +# Run "brew install sdl" to install SDL in $(HOMEBREW_PREFIX). # Run "brew install sdl_gfx". # Run "brew install sdl_mixer". # Run "brew install sdl_ttf". @@ -13,7 +13,7 @@ # Run "make" to build HyperRogue as ./hyperrogue.exe. # # For Ubuntu Linux: -# Run "sudo apt-get install libsdl-dev" to install SDL in /usr/local. +# Run "sudo apt-get install libsdl-dev" to install SDL in $(HOMEBREW_PREFIX). # Run "make" to build HyperRogue as ./hyperrogue. @@ -68,9 +68,10 @@ ifeq (${OS},mingw) endif ifeq (${OS},osx) - CXXFLAGS_EARLY += -DMAC -I/usr/local/include + HOMEBREW_PREFIX := $(shell brew --prefix) + CXXFLAGS_EARLY += -DMAC -I$(HOMEBREW_PREFIX)/include EXE_EXTENSION := - LDFLAGS_EARLY += -L/usr/local/lib + LDFLAGS_EARLY += -L$(HOMEBREW_PREFIX)/lib LDFLAGS_GL := -framework AppKit -framework OpenGL LDFLAGS_GLEW := -lGLEW LDFLAGS_PNG := -lpng From aa78aacdf3f2a75f6f40db273e1da7857fe5ff28 Mon Sep 17 00:00:00 2001 From: Tokarak <63452145+Tokarak@users.noreply.github.com> Date: Wed, 17 Apr 2024 08:49:17 +0100 Subject: [PATCH 2/5] Update MacOS Makefile comments to match README Also fix an unintentially modified Linux comment in parrent commit --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 68e947d4..4acf1b66 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,20 @@ # This Makefile works for Mac OS X (El Capitan), MinGW, and Linux. # # For Mac OS X: -# Run "brew install sdl" to install SDL in $(HOMEBREW_PREFIX). -# Run "brew install sdl_gfx". -# Run "brew install sdl_mixer". -# Run "brew install sdl_ttf". +# Run `brew install sdl12-compat sdl_gfx sdl_mixer sdl_ttf glew` # Run "make" to build HyperRogue as ./hyperrogue. # +# As a workaround to a build error, macOS users will have +# to manually edit `$(brew --prefix)/include/SDL/SDL_gfxPrimitives.h` at +# line 38 to use quote include. +# # For MSYS2 and MinGW-w64: # You might need to run commands such as "pacman -S mingw-w64-x86_64-SDL" # to install SDL and other required libraries. # Run "make" to build HyperRogue as ./hyperrogue.exe. # # For Ubuntu Linux: -# Run "sudo apt-get install libsdl-dev" to install SDL in $(HOMEBREW_PREFIX). +# Run "sudo apt-get install libsdl-dev" to install SDL in /usr/local. # Run "make" to build HyperRogue as ./hyperrogue. From 45db9977a0543700e943d6217f5772fa93e0dcaa Mon Sep 17 00:00:00 2001 From: Tokarak <63452145+Tokarak@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:16:55 +0100 Subject: [PATCH 3/5] Fix SDL include from sdl_gfx Resolves #332; for MacOS only. --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4acf1b66..5c9a2c0a 100644 --- a/Makefile +++ b/Makefile @@ -4,10 +4,6 @@ # Run `brew install sdl12-compat sdl_gfx sdl_mixer sdl_ttf glew` # Run "make" to build HyperRogue as ./hyperrogue. # -# As a workaround to a build error, macOS users will have -# to manually edit `$(brew --prefix)/include/SDL/SDL_gfxPrimitives.h` at -# line 38 to use quote include. -# # For MSYS2 and MinGW-w64: # You might need to run commands such as "pacman -S mingw-w64-x86_64-SDL" # to install SDL and other required libraries. @@ -70,7 +66,7 @@ endif ifeq (${OS},osx) HOMEBREW_PREFIX := $(shell brew --prefix) - CXXFLAGS_EARLY += -DMAC -I$(HOMEBREW_PREFIX)/include + CXXFLAGS_EARLY += -DMAC -I$(HOMEBREW_PREFIX)/include -I$(HOMEBREW_PREFIX)/include/SDL EXE_EXTENSION := LDFLAGS_EARLY += -L$(HOMEBREW_PREFIX)/lib LDFLAGS_GL := -framework AppKit -framework OpenGL From 2659d08b78590a082fb83ce9589c093b247e2934 Mon Sep 17 00:00:00 2001 From: Tokarak <63452145+Tokarak@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:23:40 +0100 Subject: [PATCH 4/5] Add message about using glew and libpng to Makefile --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5c9a2c0a..d1d47ed4 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,15 @@ # This Makefile works for Mac OS X (El Capitan), MinGW, and Linux. +# +# Environmental vairables: +# If you want to build with Glew, set +# HYPERROGUE_USE_GLEW=1 +# If you want to use libpng, set +# HYPERROGUE_USE_PNG=1 # # For Mac OS X: -# Run `brew install sdl12-compat sdl_gfx sdl_mixer sdl_ttf glew` -# Run "make" to build HyperRogue as ./hyperrogue. +# Run `brew install sdl12-compat sdl_gfx sdl_mixer sdl_ttf` +# Run `brew install glew libpng` to install the optional dependencies +# Run `make` to build HyperRogue as `./hyperrogue`. # # For MSYS2 and MinGW-w64: # You might need to run commands such as "pacman -S mingw-w64-x86_64-SDL" From d0d4b24f91744943fa0487a536296400ab6db5ac Mon Sep 17 00:00:00 2001 From: Tokarak <63452145+Tokarak@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:27:02 +0100 Subject: [PATCH 5/5] Update README.md with up-to-date build info --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a1b2bc0d..6ad2951a 100644 --- a/README.md +++ b/README.md @@ -62,15 +62,13 @@ On Linux with apt-get: On macOS with Homebrew: -```brew install sdl sdl_ttf sdl_gfx sdl_mixer glew``` - -macOS users might also have to edit /usr/local/include/SDL/SDL_gfxPrimitives.h at line 38 to use quote include. +```brew install sdl sdl_ttf sdl_gfx sdl_mixer glew libpng``` ### Building HyperRogue from source ### ``` git clone https://github.com/zenorogue/hyperrogue.git hyperrogue cd hyperrogue -make +HYPERROGUE_USE_GLEW=1 HYPERROGUE_USE_PNG=1 make ``` The `mymake` program builds HyperRogue in parts. It takes longer than the method shown above, but it uses significantly less memory during compilation, and when you change something, `mymake` will only recompile the changed file.