megamarc / Tilengine

Free 2D graphics engine with raster effects for retro/classic style game development
https://www.tilengine.org
Mozilla Public License 2.0
847 stars 95 forks source link

Build not working on MacOSX with brew #71

Open KanedaFr opened 4 years ago

KanedaFr commented 4 years ago

I was unable to make it works with -framework SDL2 using raw GCC I don't know if it works with XCode but on CLI, no way to do it

To make it works with brew, i had to

nothing on samples/makefile because path to user/local/xxx is already there

HTH

megamarc commented 4 years ago

Hi! I don't know why it doesn't work for you, how your environment is setup. I have little knowledge on apple platform, but AFAIK gcc is not available, everything points to using CLI for XCode, and framework facility is Apple specific, not gcc, that's why it doesn't work. So brew is not required, just use CLI for XCode and SDL2 framework, and it should build. This is how I produce the binaries for itch.io. Let me know.

KanedaFr commented 4 years ago

Hi,

I was unsuccessful at building Tilengine with CLI for XCode and SDL2 Framework. ("SDL2 framework not found" while I installed it from SDL2 package at SDL.org). I already met this problem because of the clang hidden behind CLI for XCode's gcc. Unable to fix it again, I moved to a way I'm using on some others projects : brew.

I saw you did it the same on samples/makefile, so I though it would be easier to use the same method on samples and lib.

If not needed, no problem :)

regards

KanedaFr

Le 31.05.2020 08:43, Marc Palacios Domènech a écrit :

Hi! I don't know why it doesn't work for you, how your environment is setup. I have little knowledge on apple platform, but AFAIK gcc is not available, everything points to using CLI for XCode, and framework facility is Apple specific, not gcc, that's why it doesn't work. So brew is not required, just use CLI for XCode and SDL2 framework, and it should build. This is how I produce the binaries for itch.io. Let me know.

-- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub [1], or unsubscribe [2].

Links:

[1] https://github.com/megamarc/Tilengine/issues/71#issuecomment-636430564 [2] https://github.com/notifications/unsubscribe-auth/AIIBZI3RVOZYEKZPJEB453TRUH377ANCNFSM4NLRNHCQ

RileyTempest commented 3 years ago

I was unable to make it works with -framework SDL2 using raw GCC I don't know if it works with XCode but on CLI, no way to do it

To make it works with brew, i had to

* brew install libpng

* brew install sdl2

* update src/Makefile
  ifeq ($(name),Darwin)
  INCPATH  = ../include **-I/usr/local/include/**
  LIBS = -lpng -lz -lc
  BIN  = **lib**Tilengine.dylib
  LDFLAGS = -dynamiclib **$(shell /usr/local/bin/sdl2-config --libs)**
  LIBPATH = **/usr/local/lib/**
  endif
  ....
  CFLAGS += -I$(INCPATH) **$(shell /usr/local/bin/sdl2-config --cflags)** -std=c99 -O2 -fpic -
  DLIB_EXPORTS
  ....
  $(BIN): $(OBJECTS)
  $(CC) -shared $(OBJECTS) -o $(BIN) $(LIBS) **$(LDFLAGS)** -fvisibility=hidden

nothing on samples/makefile because path to user/local/xxx is already there

HTH

Cheers for this! I had to make some further changes to my makefile but it worked. These are my differences.

ifeq ($(name),Darwin) INCPATH = ../include -I/usr/local/include/ LIBS = -lpng -lz -lc BIN = Tilengine.dylib #removed the 'lib' prefix as the install script wants to copy this filename. LDFLAGS = -dynamiclib $(shell /usr/local/bin/sdl2-config --libs) LIBPATH = ../lib/darwin_x86_64 endif