megamarc / Tilengine

Free 2D graphics engine with raster effects for retro/classic style game development

Home Page:https://www.tilengine.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build not working on MacOSX with brew

KanedaFr opened this issue · comments

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 = libTilengine.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

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.

commented

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