Compare commits

...

3 Commits

Author SHA1 Message Date
Sandy
03ae29e5bd Update README.md 2022-12-03 13:59:33 -05:00
Sandy Carter
cfc015871f Properly export when making shared library
Fixes using a dll in windows
2022-12-03 13:59:15 -05:00
Sandy Carter
54aaa9103d Add BGFX_CONFIG_DEBUG_ANNOTATION option
Disable for WindowsStore (UWP)
2022-12-03 13:59:05 -05:00
3 changed files with 30 additions and 26 deletions

View File

@@ -25,19 +25,20 @@ if (MSVC AND (MSVC_VERSION GREATER_EQUAL 1914))
add_compile_options("/Zc:__cplusplus")
endif()
option( BGFX_BUILD_TOOLS "Build bgfx tools." ON )
option( BGFX_BUILD_TOOLS_SHADER "Build bgfx shader tools." ON )
option( BGFX_BUILD_TOOLS_GEOMETRY "Build bgfx geometry tools." ON )
option( BGFX_BUILD_TOOLS_TEXTURE "Build bgfx texture tools." ON )
option( BGFX_BUILD_EXAMPLES "Build bgfx examples." ON )
option( BGFX_INSTALL "Create installation target." ON )
option( BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF )
option( BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON )
option( BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF )
option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF )
option( BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON )
option( BGFX_CONFIG_RENDERER_WEBGPU "Enables the webgpu renderer" OFF )
option( BX_CONFIG_DEBUG "Log debug messages (default: on in debug)" OFF )
option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF )
option( BX_CONFIG_DEBUG "Log debug messages (default: on in debug)" OFF )
option( BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF )
option( BGFX_BUILD_TOOLS "Build bgfx tools." ON )
option( BGFX_BUILD_TOOLS_SHADER "Build bgfx shader tools." ON )
option( BGFX_BUILD_TOOLS_GEOMETRY "Build bgfx geometry tools." ON )
option( BGFX_BUILD_TOOLS_TEXTURE "Build bgfx texture tools." ON )
option( BGFX_BUILD_EXAMPLES "Build bgfx examples." ON )
option( BGFX_INSTALL "Create installation target." ON )
option( BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF )
option( BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON )
option( BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON )
option( BGFX_CONFIG_RENDERER_WEBGPU "Enable the webgpu renderer" OFF )
option( BGFX_CONFIG_DEBUG_ANNOTATION "Enable gfx debug annotations (default: on in debug)" OFF )
set( BGFX_OPENGL_VERSION "" CACHE STRING "Specify minimum opengl version" )
set( BGFX_OPENGLES_VERSION "" CACHE STRING "Specify minimum OpenGL ES version" )

View File

@@ -1,37 +1,38 @@
bgfx.cmake
===================
==========
[![Build Status](https://github.com/bkaradzic/bgfx.cmake/workflows/Release/badge.svg)](https://github.com/bkaradzic/bgfx.cmake/workflows/Release/badge.svg)
**NOTE: This port only made to be used as C++ library, some features (such as bindings, examples) might not work! Please use original repo with GENie instead.**
**NOTE: This port only made to be used as C++ library, some features (such as bindings) might not work! For those features, please use original repo with GENie instead.**
This repo contains a bunch of cmake files that can be used to build bgfx with CMake.
This repo contains cmake configuration files that can be used to build bgfx with CMake.
Building
-------------
---
```bash
git clone https://github.com/bkaradzic/bgfx.cmake.git
cd bgfx.cmake
git submodule init
git submodule update
mkdir build
cd build
cmake ..
cmake -S. -Bcmake-build # $CMakeOptions
cmake --build cmake-build
```
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 `BX_DIR`, `BIMG_DIR` 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 add_subdirectory 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 `CMAKE_INSTALL_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.
----------
This project is setup to be included a few different ways. To include bgfx source code in your project simply use add_subdirectory 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 `CMAKE_INSTALL_PREFIX` which we 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.
Features
-------------
--------
* No outside dependencies besides bx, bimg, bgfx, and CMake.
* Tested on Visual Studio 2015, Xcode, gcc 5.4, clang 3.8.
* Tested on
* Windows, OSX, Linux, Android, UWP, Emscripten (experimental)
* VSCode, Visual Studio, Xcode, gcc, clang.
* 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).

View File

@@ -44,6 +44,7 @@ if(BGFX_LIBRARY_TYPE STREQUAL STATIC)
add_library( bgfx STATIC ${BGFX_SOURCES} )
else()
add_library( bgfx SHARED ${BGFX_SOURCES} )
target_compile_definitions( bgfx PUBLIC BGFX_SHARED_LIB_BUILD=1 )
endif()
if(BGFX_CONFIG_RENDERER_WEBGPU)
@@ -103,7 +104,8 @@ endif()
# Add debug config required in bx headers since bx is private
target_compile_definitions(bgfx
PUBLIC
"BX_CONFIG_DEBUG=$<IF:$<CONFIG:Debug>,1,$<BOOL:${BX_CONFIG_DEBUG}>>"
"BX_CONFIG_DEBUG=$<OR:$<CONFIG:Debug>,$<BOOL:${BX_CONFIG_DEBUG}>>"
"BGFX_CONFIG_DEBUG_ANNOTATION=$<AND:$<NOT:$<STREQUAL:${CMAKE_SYSTEM_NAME},WindowsStore>>,$<OR:$<CONFIG:Debug>,$<BOOL:${BGFX_CONFIG_DEBUG_ANNOTATION}>>>"
"BGFX_CONFIG_MULTITHREADED=$<BOOL:${BGFX_CONFIG_MULTITHREADED}>"
)