Added PNaCl build support.

This commit is contained in:
bkaradzic 2012-12-08 15:24:51 -08:00
parent 11a05e8cd7
commit 0ebfe75db3
4 changed files with 41 additions and 5 deletions

View File

@ -7,6 +7,7 @@ all:
premake --file=premake/premake4.lua vs2008 premake --file=premake/premake4.lua vs2008
premake --file=premake/premake4.lua vs2010 premake --file=premake/premake4.lua vs2010
premake --file=premake/premake4.lua --gcc=nacl gmake premake --file=premake/premake4.lua --gcc=nacl gmake
premake --file=premake/premake4.lua --gcc=pnacl gmake
premake --file=premake/premake4.lua --gcc=mingw gmake premake --file=premake/premake4.lua --gcc=mingw gmake
premake --file=premake/premake4.lua --gcc=linux gmake premake --file=premake/premake4.lua --gcc=linux gmake
premake --file=premake/premake4.lua --gcc=emscripten gmake premake --file=premake/premake4.lua --gcc=emscripten gmake
@ -42,6 +43,11 @@ nacl-release64:
make -C .build/projects/gmake-nacl config=release64 make -C .build/projects/gmake-nacl config=release64
nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64 nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64
pnacl-debug:
make -C .build/projects/gmake-pnacl config=debug64
pnacl-release:
make -C .build/projects/gmake-pnacl config=release64
docs: docs:
# doxygen premake/bgfx.doxygen # doxygen premake/bgfx.doxygen
markdown README.md > .build/docs/readme.html markdown README.md > .build/docs/readme.html

View File

@ -47,4 +47,4 @@ project "bgfx"
BGFX_DIR .. "src/**.bin.h", BGFX_DIR .. "src/**.bin.h",
} }
-- copyLib() copyLib()

View File

@ -25,7 +25,8 @@ newoption {
{ "emscripten", "Emscripten" }, { "emscripten", "Emscripten" },
{ "linux", "Linux" }, { "linux", "Linux" },
{ "mingw", "MinGW" }, { "mingw", "MinGW" },
{ "nacl", "Google Native Client" }, { "nacl", "Native Client" },
{ "pnacl", "Native Client - PNaCl" },
} }
} }
@ -36,7 +37,7 @@ BGFX_DIR = (path.getabsolute("..") .. "/")
local BGFX_BUILD_DIR = (BGFX_DIR .. ".build/") local BGFX_BUILD_DIR = (BGFX_DIR .. ".build/")
local BGFX_THIRD_PARTY_DIR = (BGFX_DIR .. "3rdparty/") local BGFX_THIRD_PARTY_DIR = (BGFX_DIR .. "3rdparty/")
BX_DIR = (BGFX_DIR .. "/../../bx/") BX_DIR = (BGFX_DIR .. "../bx/")
local XEDK = os.getenv("XEDK") local XEDK = os.getenv("XEDK")
if not XEDK then XEDK = "<you must install XBOX SDK>" end if not XEDK then XEDK = "<you must install XBOX SDK>" end
@ -92,6 +93,18 @@ if _ACTION == "gmake" then
premake.gcc.ar = "$(NACL)/bin/x86_64-nacl-ar" premake.gcc.ar = "$(NACL)/bin/x86_64-nacl-ar"
location (BGFX_BUILD_DIR .. "projects/" .. _ACTION .. "-nacl") location (BGFX_BUILD_DIR .. "projects/" .. _ACTION .. "-nacl")
end end
if "pnacl" == _OPTIONS["gcc"] then
if not os.getenv("PNACL") then
print("Set PNACL enviroment variables.")
end
premake.gcc.cc = "$(PNACL)/bin/pnacl-clang"
premake.gcc.cxx = "$(PNACL)/bin/pnacl-clang++"
premake.gcc.ar = "$(PNACL)/bin/pnacl-ar"
location (BGFX_BUILD_DIR .. "projects/" .. _ACTION .. "-pnacl")
end
end end
flags { flags {
@ -248,6 +261,23 @@ configuration { "x64", "nacl" }
libdirs { BGFX_THIRD_PARTY_DIR .. "lib/nacl-x64" } libdirs { BGFX_THIRD_PARTY_DIR .. "lib/nacl-x64" }
linkoptions { "-melf64_nacl" } linkoptions { "-melf64_nacl" }
configuration { "pnacl" }
defines { "_BSD_SOURCE=1", "_POSIX_C_SOURCE=199506", "_XOPEN_SOURCE=600", "__native_client__", "__LITTLE_ENDIAN__" }
includedirs { BX_DIR .. "include/compat/nacl" }
buildoptions {
"-std=c++0x",
"-U__STRICT_ANSI__",
"-fno-stack-protector",
"-fdiagnostics-show-option",
"-Wunused-value",
"-fdata-sections",
"-ffunction-sections",
}
targetdir (BGFX_BUILD_DIR .. "pnacl" .. "/bin")
objdir (BGFX_BUILD_DIR .. "pnacl" .. "/obj")
libdirs { BGFX_THIRD_PARTY_DIR .. "lib/pnacl" }
includedirs { "$(PNACL)/sysroot/include" }
configuration { "Xbox360" } configuration { "Xbox360" }
targetdir (BGFX_BUILD_DIR .. "xbox360" .. "/bin") targetdir (BGFX_BUILD_DIR .. "xbox360" .. "/bin")
objdir (BGFX_BUILD_DIR .. "xbox360" .. "/obj") objdir (BGFX_BUILD_DIR .. "xbox360" .. "/obj")

View File

@ -135,8 +135,8 @@ namespace bgfx
PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8, PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
PP_GRAPHICS3DATTRIB_SAMPLES, 0, PP_GRAPHICS3DATTRIB_SAMPLES, 0,
PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0,
PP_GRAPHICS3DATTRIB_WIDTH, _width, PP_GRAPHICS3DATTRIB_WIDTH, int32_t(_width),
PP_GRAPHICS3DATTRIB_HEIGHT, _height, PP_GRAPHICS3DATTRIB_HEIGHT, int32_t(_height),
PP_GRAPHICS3DATTRIB_NONE PP_GRAPHICS3DATTRIB_NONE
}; };