Need help with bgfx.cmake?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

282 Stars 168 Forks Other 137 Commits 14 Opened issues

Description Independently maintained CMake build scripts for bgfx. Released under public domain.

Services available


Need anything else?

Contributors list

New Fork:


Build Status

This repo contains a bunch of cmake files that can be used to build bgfx with CMake.


git clone
cd bgfx.cmake
git submodule init
git submodule update
mkdir build
cd build
cmake ..

If downloading via zip (instead of using git submodules) manually download bx, bimg and bgfx and copy them into the root directory, or locate them via BXDIR, BIMGDIR and BGFX_DIR CMake variables.

How To Use

This project is setup to be included a few different ways. To include bgfx source code in your project simply use addsubdirectory to include this project. To build bgfx binaries build the INSTALL target (or "make install"). The installed files will be in the directory specified by CMAKEINSTALL_PREFIX which I recommend you set to "./install" so it will export to your build directory. Note you may want to build install on both Release and Debug configurations.


  • No outside dependencies besides bx, bimg, bgfx, and CMake.
  • Tested on Visual Studio 2015, Xcode, gcc 5.4, clang 3.8.
  • Compiles bgfx, tools & examples.
  • Detects shader modifications and automatically rebuilds them for all examples.

Does this work with latest bx/bgfx/bimg?

Probably! This project needs to be updated if a dependency is added or the bgfx build system changes. The bgfx repository is very active but these types of changes are rare. New examples have to be added manually as well, but not doing so will merely result in that example not showing up and won't break anything else. If pulling latest causes issues, be sure to manually reconfigure CMake as the glob patterns may need to be refreshed (the use of glob patterns in CMake is generally discouraged but in this project it helps to ensure upwards compatibilty with newer bgfx updates).


  • Support Native Client.
  • Support Windows Phone.
  • Fix iOS builds. #85
  • More configuration. #12
  • Add files as shader dependencies.
  • Combined examples.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.