This repo contains a bunch of cmake files that can be used to build bgfx with CMake.
git clone --recurse-submodules https://github.com/openblack/bgfx.cmake.git
cd bgfx.cmake
cmake -B build
You can either use bgfx.cmake to create an install target or include it directly in your CMake project.
You can build an install target using CMake consisting of binaries that can be added using find_package in your projects.
cmake -B build -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_DEBUG_POSTFIX=d -DBGFX_BUILD_EXAMPLES=OFF -DBGFX_BUILD_TOOLS=ON -DBGFX_INSTALL=ON
cmake --build build --target install --config Debug
cmake --build build --target install --config Release
This repo can be included in your own project directly through CMake, this is useful for development:
add_subdirectory(bgfx.cmake)