I hade some fun last night trying to build Urho3D from source and use statically linked in my project. Sine I am pretty new on Mac OS X and clang for few reasons does not fall in my favourite compilers category (GCC and Linux is in my Hearth forever) . Hoverer, because I started to use Mac and did not wanted to make dual boot Linux on it (pain…), I needed to sort out the compilation on clang.
I tried to make simple sample project and compile from scratch. After some tinkering around I came up with this, dirty, but simple sample. I hope you find it useful:
SRCTOP=…
BINDIR=$(SRCTOP)/Bin
PROGRAM=my-urho3d-using-program
CXX=clang++
Urho3D_INC_DIRS=-I/Users/<…>/GameDev/Urho3D/build/include/Urho3D
ThirdthParty_INC_DIRS=-I/Users/<…>/GameDev/Urho3D/build/include/Urho3D/ThirdParty
Urho3D_LIB_DIRS=-L/Users/<…>/GameDev/Urho3D/build/lib
ThirdthParty_LIB_DIRS=-L/opt/X11/lib
LIB_DIRS=$(Urho3D_LIB_DIRS) $(ThirdthParty_LIB_DIRS)
LIBS=-lUrho3D -lGL
INCLUDE_DIRS=$(Urho3D_INC_DIRS) $(ThirdthParty_INC_DIRS)
CXX_FLAGS=-std=c++11
FRAMEWORKS=-framework Cocoa -framework IOKit -framework AudioUnit -framework CoreAudio -framework ForceFeedback -framework Carbon
SOURCES= MyApplication.cpp
all:
-mkdir -p $(BINDIR)
-$(CXX) $(CXX_FLAGS) $(FRAMEWORKS) $(INCLUDE_DIRS) $(LIB_DIRS) $(LIBS) $(SOURCES) -o $(BINDIR)/$(PROGRAM)
clean:
-rm $(BINDIR)/$(PROGRAM)