Merge pull request #330 from mmicko/master

FreeBSD compile support
This commit is contained in:
Branimir Karadžić 2015-04-10 08:06:40 -07:00
commit 393a7311ee
5 changed files with 79 additions and 49 deletions

114
makefile
View file

@ -4,16 +4,22 @@
#
UNAME := $(shell uname)
ifeq ($(UNAME),$(filter $(UNAME),Linux Darwin))
ifeq ($(UNAME),$(filter $(UNAME),Linux Darwin FreeBSD GNU/kFreeBSD))
ifeq ($(UNAME),$(filter $(UNAME),Darwin))
OS=darwin
else
ifeq ($(UNAME),$(filter $(UNAME),FreeBSD GNU/kFreeBSD))
OS=bsd
else
OS=linux
endif
endif
else
OS=windows
endif
$(info $(OS))
GENIE=../bx/tools/bin/$(OS)/genie
all:
@ -26,6 +32,7 @@ all:
$(GENIE) --with-tools --with-shared-lib --gcc=osx gmake
$(GENIE) --with-tools --with-shared-lib --xcode=osx xcode4
$(GENIE) --with-tools --with-shared-lib --xcode=ios xcode4
$(GENIE) --with-shared-lib --gcc=freebsd gmake
$(GENIE) --gcc=android-arm gmake
$(GENIE) --gcc=android-mips gmake
@ -41,69 +48,81 @@ all:
.build/projects/gmake-android-arm:
$(GENIE) --gcc=android-arm gmake
android-arm-debug: .build/projects/gmake-android-arm
make -R -C .build/projects/gmake-android-arm config=debug
$(MAKE) -R -C .build/projects/gmake-android-arm config=debug
android-arm-release: .build/projects/gmake-android-arm
make -R -C .build/projects/gmake-android-arm config=release
$(MAKE) -R -C .build/projects/gmake-android-arm config=release
android-arm: android-arm-debug android-arm-release
.build/projects/gmake-android-mips:
$(GENIE) --gcc=android-mips gmake
android-mips-debug: .build/projects/gmake-android-mips
make -R -C .build/projects/gmake-android-mips config=debug
$(MAKE) -R -C .build/projects/gmake-android-mips config=debug
android-mips-release: .build/projects/gmake-android-mips
make -R -C .build/projects/gmake-android-mips config=release
$(MAKE) -R -C .build/projects/gmake-android-mips config=release
android-mips: android-mips-debug android-mips-release
.build/projects/gmake-android-x86:
$(GENIE) --gcc=android-x86 gmake
android-x86-debug: .build/projects/gmake-android-x86
make -R -C .build/projects/gmake-android-x86 config=debug
$(MAKE) -R -C .build/projects/gmake-android-x86 config=debug
android-x86-release: .build/projects/gmake-android-x86
make -R -C .build/projects/gmake-android-x86 config=release
$(MAKE) -R -C .build/projects/gmake-android-x86 config=release
android-x86: android-x86-debug android-x86-release
.build/projects/gmake-asmjs:
$(GENIE) --gcc=asmjs gmake
asmjs-debug: .build/projects/gmake-asmjs
make -R -C .build/projects/gmake-asmjs config=debug
$(MAKE) -R -C .build/projects/gmake-asmjs config=debug
asmjs-release: .build/projects/gmake-asmjs
make -R -C .build/projects/gmake-asmjs config=release
$(MAKE) -R -C .build/projects/gmake-asmjs config=release
asmjs: asmjs-debug asmjs-release
.build/projects/gmake-linux:
$(GENIE) --with-tools --with-shared-lib --gcc=linux-gcc gmake
linux-debug32: .build/projects/gmake-linux
make -R -C .build/projects/gmake-linux config=debug32
$(MAKE) -R -C .build/projects/gmake-linux config=debug32
linux-release32: .build/projects/gmake-linux
make -R -C .build/projects/gmake-linux config=release32
$(MAKE) -R -C .build/projects/gmake-linux config=release32
linux-debug64: .build/projects/gmake-linux
make -R -C .build/projects/gmake-linux config=debug64
$(MAKE) -R -C .build/projects/gmake-linux config=debug64
linux-release64: .build/projects/gmake-linux
make -R -C .build/projects/gmake-linux config=release64
$(MAKE) -R -C .build/projects/gmake-linux config=release64
linux: linux-debug32 linux-release32 linux-debug64 linux-release64
.build/projects/gmake-freebsd:
$(GENIE) --with-tools --with-shared-lib --gcc=freebsd gmake
freebsd-debug32: .build/projects/gmake-freebsd
$(MAKE) -R -C .build/projects/gmake-freebsd config=debug32
freebsd-release32: .build/projects/gmake-freebsd
$(MAKE) -R -C .build/projects/gmake-freebsd config=release32
freebsd-debug64: .build/projects/gmake-freebsd
$(MAKE) -R -C .build/projects/gmake-freebsd config=debug64
freebsd-release64: .build/projects/gmake-freebsd
$(MAKE) -R -C .build/projects/gmake-freebsd config=release64
freebsd: freebsd-debug32 freebsd-release32 freebsd-debug64 freebsd-release64
.build/projects/gmake-mingw-gcc:
$(GENIE) --with-tools --with-shared-lib --gcc=mingw-gcc gmake
mingw-gcc-debug32: .build/projects/gmake-mingw-gcc
make -R -C .build/projects/gmake-mingw-gcc config=debug32
$(MAKE) -R -C .build/projects/gmake-mingw-gcc config=debug32
mingw-gcc-release32: .build/projects/gmake-mingw-gcc
make -R -C .build/projects/gmake-mingw-gcc config=release32
$(MAKE) -R -C .build/projects/gmake-mingw-gcc config=release32
mingw-gcc-debug64: .build/projects/gmake-mingw-gcc
make -R -C .build/projects/gmake-mingw-gcc config=debug64
$(MAKE) -R -C .build/projects/gmake-mingw-gcc config=debug64
mingw-gcc-release64: .build/projects/gmake-mingw-gcc
make -R -C .build/projects/gmake-mingw-gcc config=release64
$(MAKE) -R -C .build/projects/gmake-mingw-gcc config=release64
mingw-gcc: mingw-gcc-debug32 mingw-gcc-release32 mingw-gcc-debug64 mingw-gcc-release64
.build/projects/gmake-mingw-clang:
$(GENIE) --gcc=mingw-clang gmake
mingw-clang-debug32: .build/projects/gmake-mingw-clang
make -R -C .build/projects/gmake-mingw-clang config=debug32
$(MAKE) -R -C .build/projects/gmake-mingw-clang config=debug32
mingw-clang-release32: .build/projects/gmake-mingw-clang
make -R -C .build/projects/gmake-mingw-clang config=release32
$(MAKE) -R -C .build/projects/gmake-mingw-clang config=release32
mingw-clang-debug64: .build/projects/gmake-mingw-clang
make -R -C .build/projects/gmake-mingw-clang config=debug64
$(MAKE) -R -C .build/projects/gmake-mingw-clang config=debug64
mingw-clang-release64: .build/projects/gmake-mingw-clang
make -R -C .build/projects/gmake-mingw-clang config=release64
$(MAKE) -R -C .build/projects/gmake-mingw-clang config=release64
mingw-clang: mingw-clang-debug32 mingw-clang-release32 mingw-clang-debug64 mingw-clang-release64
.build/projects/vs2008:
@ -130,69 +149,69 @@ vs2008: vs2008-debug32 vs2008-release32 vs2008-debug64 vs2008-release64
.build/projects/gmake-nacl:
$(GENIE) --gcc=nacl gmake
nacl-debug32: .build/projects/gmake-nacl
make -R -C .build/projects/gmake-nacl config=debug32
$(MAKE) -R -C .build/projects/gmake-nacl config=debug32
nacl-release32: .build/projects/gmake-nacl
make -R -C .build/projects/gmake-nacl config=release32
$(MAKE) -R -C .build/projects/gmake-nacl config=release32
nacl-debug64: .build/projects/gmake-nacl
make -R -C .build/projects/gmake-nacl config=debug64
$(MAKE) -R -C .build/projects/gmake-nacl config=debug64
nacl-release64: .build/projects/gmake-nacl
make -R -C .build/projects/gmake-nacl config=release64
$(MAKE) -R -C .build/projects/gmake-nacl config=release64
nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64
.build/projects/gmake-nacl-arm:
$(GENIE) --gcc=nacl-arm gmake
nacl-arm-debug: .build/projects/gmake-nacl-arm
make -R -C .build/projects/gmake-nacl-arm config=debug
$(MAKE) -R -C .build/projects/gmake-nacl-arm config=debug
nacl-arm-release: .build/projects/gmake-nacl-arm
make -R -C .build/projects/gmake-nacl-arm config=release
$(MAKE) -R -C .build/projects/gmake-nacl-arm config=release
nacl-arm: nacl-arm-debug32 nacl-arm-release32
.build/projects/gmake-pnacl:
$(GENIE) --gcc=pnacl gmake
pnacl-debug: .build/projects/gmake-pnacl
make -R -C .build/projects/gmake-pnacl config=debug
$(MAKE) -R -C .build/projects/gmake-pnacl config=debug
pnacl-release: .build/projects/gmake-pnacl
make -R -C .build/projects/gmake-pnacl config=release
$(MAKE) -R -C .build/projects/gmake-pnacl config=release
pnacl: pnacl-debug pnacl-release
.build/projects/gmake-osx:
$(GENIE) --with-tools --with-shared-lib --gcc=osx gmake
osx-debug32: .build/projects/gmake-osx
make -C .build/projects/gmake-osx config=debug32
$(MAKE) -C .build/projects/gmake-osx config=debug32
osx-release32: .build/projects/gmake-osx
make -C .build/projects/gmake-osx config=release32
$(MAKE) -C .build/projects/gmake-osx config=release32
osx-debug64: .build/projects/gmake-osx
make -C .build/projects/gmake-osx config=debug64
$(MAKE) -C .build/projects/gmake-osx config=debug64
osx-release64: .build/projects/gmake-osx
make -C .build/projects/gmake-osx config=release64
$(MAKE) -C .build/projects/gmake-osx config=release64
osx: osx-debug32 osx-release32 osx-debug64 osx-release64
.build/projects/gmake-ios-arm:
$(GENIE) --gcc=ios-arm gmake
ios-arm-debug: .build/projects/gmake-ios-arm
make -R -C .build/projects/gmake-ios-arm config=debug
$(MAKE) -R -C .build/projects/gmake-ios-arm config=debug
ios-arm-release: .build/projects/gmake-ios-arm
make -R -C .build/projects/gmake-ios-arm config=release
$(MAKE) -R -C .build/projects/gmake-ios-arm config=release
ios-arm: ios-arm-debug ios-arm-release
.build/projects/gmake-ios-simulator:
$(GENIE) --gcc=ios-simulator gmake
ios-simulator-debug: .build/projects/gmake-ios-simulator
make -R -C .build/projects/gmake-ios-simulator config=debug
$(MAKE) -R -C .build/projects/gmake-ios-simulator config=debug
ios-simulator-release: .build/projects/gmake-ios-simulator
make -R -C .build/projects/gmake-ios-simulator config=release
$(MAKE) -R -C .build/projects/gmake-ios-simulator config=release
ios-simulator: ios-simulator-debug ios-simulator-release
.build/projects/gmake-rpi:
$(GENIE) --gcc=rpi gmake
rpi-debug: .build/projects/gmake-rpi
make -R -C .build/projects/gmake-rpi config=debug
$(MAKE) -R -C .build/projects/gmake-rpi config=debug
rpi-release: .build/projects/gmake-rpi
make -R -C .build/projects/gmake-rpi config=release
$(MAKE) -R -C .build/projects/gmake-rpi config=release
rpi: rpi-debug rpi-release
rebuild-shaders:
make -R -C examples rebuild
$(MAKE) -R -C examples rebuild
analyze:
cppcheck src/
@ -211,7 +230,7 @@ clean:
SILENT ?= @
UNAME := $(shell uname)
ifeq ($(UNAME),$(filter $(UNAME),Linux Darwin))
ifeq ($(UNAME),$(filter $(UNAME),Linux Darwin FreeBSD GNU/kFreeBSD))
ifeq ($(UNAME),$(filter $(UNAME),Darwin))
OS=darwin
BUILD_PROJECT_DIR=gmake-osx
@ -220,6 +239,14 @@ BUILD_TOOLS_CONFIG=release64
BUILD_TOOLS_SUFFIX=Release
EXE=
else
ifeq ($(UNAME),$(filter $(UNAME),FreeBSD GNU/kFreeBSD))
OS=bsd
BUILD_PROJECT_DIR=gmake-freebsd
BUILD_OUTPUT_DIR=freebsd64_gcc
BUILD_TOOLS_CONFIG=release64
BUILD_TOOLS_SUFFIX=Release
EXE=
else
OS=linux
BUILD_PROJECT_DIR=gmake-linux
BUILD_OUTPUT_DIR=linux64_gcc
@ -227,6 +254,7 @@ BUILD_TOOLS_CONFIG=release64
BUILD_TOOLS_SUFFIX=Release
EXE=
endif
endif
else
OS=windows
BUILD_PROJECT_DIR=gmake-mingw-gcc
@ -237,11 +265,11 @@ EXE=.exe
endif
tools/bin/$(OS)/shaderc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
$(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG)
$(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG)
$(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
tools/bin/$(OS)/geometryc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
$(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f geometryc.make config=$(BUILD_TOOLS_CONFIG)
$(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f geometryc.make config=$(BUILD_TOOLS_CONFIG)
$(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
tools: tools/bin/$(OS)/shaderc$(EXE) tools/bin/$(OS)/geometryc$(EXE)

View file

@ -134,7 +134,7 @@ function exampleProject(_name)
"glfw3"
}
configuration { "linux" }
configuration { "linux or freebsd" }
links {
"Xrandr",
"Xinerama",
@ -274,7 +274,7 @@ function exampleProject(_name)
kind "ConsoleApp"
targetextension ".bc"
configuration { "linux-*" }
configuration { "linux-* or freebsd" }
links {
"X11",
"GL",

View file

@ -33,7 +33,7 @@ namespace bgfx
{
g_bgfxEaglLayer = _layer;
}
#elif BX_PLATFORM_LINUX
#elif BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
void* g_bgfxX11Display;
uint32_t g_bgfxX11Window;
void* g_bgfxGLX;

View file

@ -221,7 +221,7 @@ namespace bgfx
extern ::ANativeWindow* g_bgfxAndroidWindow;
#elif BX_PLATFORM_IOS
extern void* g_bgfxEaglLayer;
#elif BX_PLATFORM_LINUX
#elif BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
extern void* g_bgfxX11Display;
extern uint32_t g_bgfxX11Window;
extern void* g_bgfxGLX;

View file

@ -10,6 +10,7 @@
|| BX_PLATFORM_ANDROID \
|| BX_PLATFORM_EMSCRIPTEN \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_FREEBSD \
|| BX_PLATFORM_QNX \
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_WINDOWS \
@ -23,6 +24,7 @@
#define BGFX_USE_GL_DYNAMIC_LIB (0 \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_FREEBSD \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_WINDOWS \
)
@ -34,7 +36,7 @@
# define GL_ARB_shader_objects // OSX collsion with GLhandleARB in gltypes.h
# endif // BX_PLATFORM_OSX
# else
# if BX_PLATFORM_LINUX
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
# define GL_PROTOTYPES
# define GL_GLEXT_LEGACY
# include <GL/gl.h>
@ -584,7 +586,7 @@ typedef uint64_t GLuint64;
# include "glcontext_ppapi.h"
#elif BX_PLATFORM_WINDOWS
# include <windows.h>
#elif BX_PLATFORM_LINUX
#elif BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
# include "glcontext_glx.h"
#elif BX_PLATFORM_OSX
# include "glcontext_nsgl.h"