From e68d22d779c49fc19c5465b658365598181d221d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 1 Feb 2015 10:26:09 +0100 Subject: [PATCH] Added building of BGFX library (nw) --- makefile | 5 ++- src/lib/lib.mak | 82 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index c7922e99b90..b243a01bd09 100644 --- a/makefile +++ b/makefile @@ -797,6 +797,9 @@ LIBS += -lsqlite3 SQLITE3_LIB = endif +# add BGFX library +BGFX_LIB = $(OBJ)/libbgfx.a + # add PortMidi MIDI library ifeq ($(BUILD_MIDILIB),1) INCPATH += -I$(SRC)/lib/portmidi @@ -926,7 +929,7 @@ $(sort $(OBJDIRS)): ifndef EXECUTABLE_DEFINED -EMULATOROBJLIST = $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBBUS) $(LIBOPTIONAL) $(LIBEMU) $(LIBDASM) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(JPEG_LIB) $(FLAC_LIB) $(7Z_LIB) $(FORMATS_LIB) $(LUA_LIB) $(SQLITE3_LIB) $(WEB_LIB) $(ZLIB) $(LIBOCORE) $(MIDI_LIB) $(RESFILE) +EMULATOROBJLIST = $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBBUS) $(LIBOPTIONAL) $(LIBEMU) $(LIBDASM) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(JPEG_LIB) $(FLAC_LIB) $(7Z_LIB) $(FORMATS_LIB) $(LUA_LIB) $(SQLITE3_LIB) $(WEB_LIB) $(BGFX_LIB) $(ZLIB) $(LIBOCORE) $(MIDI_LIB) $(RESFILE) ifeq ($(TARGETOS),emscripten) EMULATOROBJ = $(EMULATOROBJLIST:.a=.bc) diff --git a/src/lib/lib.mak b/src/lib/lib.mak index 9867c6459dc..2b6d5215601 100644 --- a/src/lib/lib.mak +++ b/src/lib/lib.mak @@ -33,6 +33,12 @@ OBJDIRS += \ $(LIBOBJ)/mongoose \ $(LIBOBJ)/jsoncpp \ $(LIBOBJ)/sqlite3 \ + $(LIBOBJ)/bgfx \ + $(LIBOBJ)/bgfx/common \ + $(LIBOBJ)/bgfx/common/entry \ + $(LIBOBJ)/bgfx/common/font \ + $(LIBOBJ)/bgfx/common/imgui \ + $(LIBOBJ)/bgfx/common/nanovg \ #------------------------------------------------- # utility library objects @@ -594,3 +600,79 @@ endif $(LIBOBJ)/sqlite3/sqlite3.o: $(3RDPARTY)/sqlite3/sqlite3.c | $(OSPREBUILD) @echo Compiling $<... $(CC) $(CDEFS) $(CONLYFLAGS) -Wno-bad-function-cast -I$(3RDPARTY)/sqlite3 $(SQLITE3_FLAGS) -c $< -o $@ + +#------------------------------------------------- +# BGFX library objects +#------------------------------------------------- + +BGFXOBJS = \ + $(LIBOBJ)/bgfx/bgfx.o \ + $(LIBOBJ)/bgfx/glcontext_egl.o \ + $(LIBOBJ)/bgfx/glcontext_glx.o \ + $(LIBOBJ)/bgfx/glcontext_ppapi.o \ + $(LIBOBJ)/bgfx/glcontext_wgl.o \ + $(LIBOBJ)/bgfx/image.o \ + $(LIBOBJ)/bgfx/renderer_d3d12.o \ + $(LIBOBJ)/bgfx/renderer_d3d11.o \ + $(LIBOBJ)/bgfx/renderer_d3d9.o \ + $(LIBOBJ)/bgfx/renderer_gl.o \ + $(LIBOBJ)/bgfx/renderer_null.o \ + $(LIBOBJ)/bgfx/renderdoc.o \ + $(LIBOBJ)/bgfx/vertexdecl.o \ + $(LIBOBJ)/bgfx/common/bgfx_utils.o \ + $(LIBOBJ)/bgfx/common/bounds.o \ + $(LIBOBJ)/bgfx/common/camera.o \ + $(LIBOBJ)/bgfx/common/cube_atlas.o \ + $(LIBOBJ)/bgfx/common/font/font_manager.o \ + $(LIBOBJ)/bgfx/common/font/text_buffer_manager.o \ + $(LIBOBJ)/bgfx/common/font/text_metrics.o \ + $(LIBOBJ)/bgfx/common/font/utf8.o \ + $(LIBOBJ)/bgfx/common/imgui/imgui.o \ + $(LIBOBJ)/bgfx/common/nanovg/nanovg.o \ + $(LIBOBJ)/bgfx/common/nanovg/nanovg_bgfx.o \ +# $(LIBOBJ)/bgfx/common/entry/cmd.o \ +# $(LIBOBJ)/bgfx/common/entry/dbg.o \ +# $(LIBOBJ)/bgfx/common/entry/entry.o \ +# $(LIBOBJ)/bgfx/common/entry/entry_android.o \ +# $(LIBOBJ)/bgfx/common/entry/entry_asmjs.o \ +# $(LIBOBJ)/bgfx/common/entry/entry_linux.o \ +# $(LIBOBJ)/bgfx/common/entry/entry_nacl.o \ +# $(LIBOBJ)/bgfx/common/entry/entry_qnx.o \ +# $(LIBOBJ)/bgfx/common/entry/entry_sdl.o \ +# $(LIBOBJ)/bgfx/common/entry/entry_windows.o \ +# $(LIBOBJ)/bgfx/common/entry/input.o \ + +$(OBJ)/libbgfx.a: $(BGFXOBJS) + +BGFXINC = -I$(3RDPARTY)/bgfx/include -I$(3RDPARTY)/bgfx/3rdparty -I$(3RDPARTY)/bx/include -I$(3RDPARTY)/bgfx/3rdparty/khronos +ifdef MSVC_BUILD + BGFXINC += -I$(3RDPARTY)/bx/include/compat/msvc +else + ifeq ($(TARGETOS),win32) + BGFXINC += -I$(3RDPARTY)/bx/include/compat/mingw + endif + ifeq ($(TARGETOS),freebsd) + BGFXINC += -I$(3RDPARTY)/bx/include/compat/freebsd + endif + ifeq ($(TARGETOS),macosx) + BGFXINC += -I$(3RDPARTY)/bx/include/compat/osx + endif +endif + +ifeq ($(TARGETOS),win32) +BGFXINC += -I$(3RDPARTY)/dxsdk/Include +ifeq ($(PTR64),1) +BGFXINC += -L$(3RDPARTY)/dxsdk/lib/x64 -D_WIN32_WINNT=0x601 +else +BGFXINC += -L$(3RDPARTY)/dxsdk/lib/x86 -D_WIN32_WINNT=0x601 +endif +endif + +$(LIBOBJ)/bgfx/%.o: $(3RDPARTY)/bgfx/src/%.cpp | $(OSPREBUILD) + @echo Compiling $<... + $(CC) $(CDEFS) $(CCOMFLAGS) $(BGFXINC) -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -c $< -o $@ + +$(LIBOBJ)/bgfx/common/%.o: $(3RDPARTY)/bgfx/examples/common/%.cpp | $(OSPREBUILD) + @echo Compiling $<... + $(CC) $(CDEFS) $(CCOMFLAGS) $(BGFXINC) -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -c $< -o $@ +