Compare commits

...

14 Commits

Author SHA1 Message Date
dependabot[bot]
4ea31fd36f build(deps): bump bimg from 85109d7 to 1af9054
Bumps [bimg](https://github.com/bkaradzic/bimg) from `85109d7` to `1af9054`.
- [Release notes](https://github.com/bkaradzic/bimg/releases)
- [Commits](85109d7cdb...1af90543ca)

---
updated-dependencies:
- dependency-name: bimg
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-03 21:09:18 -05:00
Sandy Carter
4ea7d23eb2 3rdparty: prefix bgfx- to lib names to avoid conflicts 2023-01-03 21:09:01 -05:00
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
Sandy
2d7b0296f6 Use commit count for tag
In the case where the cmake package has been updated but bgfx submodules
haven't it is more informative to have the commit count than the sha.
2022-12-03 13:58:25 -05:00
dependabot[bot]
a59e0a63ae build(deps): bump bx from 20efa22 to aed1086
Bumps [bx](https://github.com/bkaradzic/bx) from `20efa22` to `aed1086`.
- [Release notes](https://github.com/bkaradzic/bx/releases)
- [Commits](20efa22f18...aed1086c48)

---
updated-dependencies:
- dependency-name: bx
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-02 17:35:52 -05:00
dependabot[bot]
671c819e85 build(deps): bump bgfx from 6a03a1e to 66de825
Bumps [bgfx](https://github.com/bkaradzic/bgfx) from `6a03a1e` to `66de825`.
- [Release notes](https://github.com/bkaradzic/bgfx/releases)
- [Commits](6a03a1ec5e...66de825e6f)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-02 17:35:46 -05:00
dependabot[bot]
c825dcf256 build(deps): bump bimg from 225dad7 to 85109d7
Bumps [bimg](https://github.com/bkaradzic/bimg) from `225dad7` to `85109d7`.
- [Release notes](https://github.com/bkaradzic/bimg/releases)
- [Commits](225dad7441...85109d7cdb)

---
updated-dependencies:
- dependency-name: bimg
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-02 17:35:38 -05:00
loanselot
916f26e1b6 Merge pull request #160 from Hyreos/patch-1
Prevent the script from trying to install tools that have been disabled
2022-11-28 16:18:22 +03:00
Hyreos
4e42ae2ae0 Prevent the script from trying to install tools that have been disabled
This commit fixes the issue of install failing if you disable any of the tools due to missing targets.
2022-11-20 17:23:21 -03:00
Johannes Schäufele
52feec47f5 bgfx: Add bgfx limits config options 2022-11-04 17:30:48 -04:00
loanselot
cf77d7c6d7 Merge pull request #159 from bkaradzic/dependabot/submodules/bgfx-6a03a1e
build(deps): bump bgfx from `f6a1289` to `6a03a1e`
2022-11-02 00:48:54 +03:00
dependabot[bot]
3e7f1fe200 build(deps): bump bgfx from f6a1289 to 6a03a1e
Bumps [bgfx](https://github.com/bkaradzic/bgfx) from `f6a1289` to `6a03a1e`.
- [Release notes](https://github.com/bkaradzic/bgfx/releases)
- [Commits](f6a1289dbc...6a03a1ec5e)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-01 16:03:17 +00:00
24 changed files with 169 additions and 68 deletions

View File

@@ -25,11 +25,11 @@ jobs:
- id: version
run: |
API_VERSION=$(grep -Eo "BGFX_API_VERSION UINT32_C\([0-9]+\)" bgfx/include/bgfx/defines.h | grep -Eo "[0-9]+" | tail -1)
REVISION=$(cd bgfx && git rev-list HEAD --count)
BGFX_REVISION=$(cd bgfx && git rev-list HEAD --count)
BGFX_CMAKE_REVISION=$(git rev-list HEAD --count)
SHA=$(cd bgfx && git rev-parse HEAD)
SHA7="${GITHUB_SHA::7}"
TAG="v1.${API_VERSION}.${REVISION}-${SHA7}"
echo "::set-output name=revision::${REVISION}"
TAG="v1.${API_VERSION}.${BGFX_REVISION}-${BGFX_CMAKE_REVISION}"
echo "::set-output name=revision::${BGFX_REVISION}"
echo "::set-output name=sha::${SHA}"
echo "::set-output name=tag::${TAG}"

View File

@@ -25,24 +25,39 @@ 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" )
set( BGFX_LIBRARY_TYPE "STATIC" CACHE STRING "Linking type for library" )
set( BGFX_CONFIG_DEFAULT_MAX_ENCODERS "" CACHE STRING "Specify default maximum encoder count (multithreaded only)" )
set( BGFX_CONFIG_MAX_DRAW_CALLS "" CACHE STRING "Specify maximum draw calls" )
set( BGFX_CONFIG_MAX_VIEWS "" CACHE STRING "Specify maximum view count (should be a power of two)" )
set( BGFX_CONFIG_MAX_FRAME_BUFFERS "" CACHE STRING "Specify maximum frame buffers" )
set( BGFX_CONFIG_MAX_VERTEX_LAYOUTS "" CACHE STRING "Specify maximum vertex layouts" )
set( BGFX_CONFIG_MAX_VERTEX_BUFFERS "" CACHE STRING "Specify maximum vertex buffer count" )
set( BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS "" CACHE STRING "Specify maximum dynamic vertex buffer count" )
set( BGFX_CONFIG_MAX_INDEX_BUFFERS "" CACHE STRING "Specify maximum index buffer count" )
set( BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS "" CACHE STRING "Specify maximum dynamic index buffer count" )
set( BGFX_CONFIG_MAX_TEXTURES "" CACHE STRING "Specify maximum texture count" )
set( BGFX_CONFIG_MAX_TEXTURE_SAMPLERS "" CACHE STRING "Specify maximum texture samplers" )
set( BGFX_CONFIG_MAX_SHADERS "" CACHE STRING "Specify shader count" )
set( BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM "" CACHE STRING "Specify maximum program count as 2^(program bits)" )
set_property( CACHE BGFX_LIBRARY_TYPE PROPERTY STRINGS STATIC SHARED )
if( BGFX_LIBRARY_TYPE MATCHES "SHARED" )
@@ -166,21 +181,27 @@ if( BGFX_INSTALL )
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/bgfxToolUtils.cmake
DESTINATION "${config_install_dir}")
if( BGFX_BUILD_TOOLS )
install( TARGETS shaderc
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
install( TARGETS geometryc
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
install( TARGETS geometryv
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
install( TARGETS texturec
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
install( TARGETS texturev
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
if (BGFX_BUILD_TOOLS_SHADER)
install( TARGETS shaderc
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
endif()
if (BGFX_BUILD_TOOLS_GEOMETRY)
install( TARGETS geometryc
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
install( TARGETS geometryv
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
endif()
if (BGFX_BUILD_TOOLS_TEXTURE)
install( TARGETS texturec
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
install( TARGETS texturev
EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${CMAKE_INSTALL_BINDIR}" )
endif()
endif()
# install examples

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).

2
bgfx

Submodule bgfx updated: f6a1289dbc...66de825e6f

2
bimg

Submodule bimg updated: 225dad7441...1af90543ca

2
bx

Submodule bx updated: 20efa22f18...aed1086c48

View File

@@ -25,4 +25,6 @@ target_include_directories( astc-encoder
$<BUILD_INTERFACE:${BIMG_DIR}/3rdparty>
$<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/astc-encoder>
$<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/astc-encoder/include> )
set_target_properties( astc-encoder PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( astc-encoder
PROPERTIES
FOLDER "bgfx/3rdparty" )

View File

@@ -18,4 +18,7 @@ add_library( dear-imgui STATIC EXCLUDE_FROM_ALL ${dear_IMGUI_SOURCES} )
target_compile_definitions( dear-imgui PRIVATE "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_FORMAT_MACROS" )
target_include_directories( dear-imgui PUBLIC ${BGFX_DIR}/3rdparty )
target_link_libraries( dear-imgui PUBLIC bx )
set_target_properties( dear-imgui PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( dear-imgui
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -16,4 +16,7 @@ file( GLOB EDTAA3_SOURCES ${BIMG_DIR}/3rdparty/edtaa3/*.cpp ${BIMG_DIR}/3rdparty
add_library( edtaa3 STATIC ${EDTAA3_SOURCES} )
target_include_directories( edtaa3 PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty> )
set_target_properties( edtaa3 PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( edtaa3
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -16,4 +16,7 @@ file( GLOB ETC1_SOURCES ${BIMG_DIR}/3rdparty/etc1/*.cpp ${BIMG_DIR}/3rdparty/etc
add_library( etc1 STATIC ${ETC1_SOURCES} )
target_include_directories( etc1 PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty> )
set_target_properties( etc1 PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( etc1
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -16,5 +16,8 @@ file( GLOB ETC2_SOURCES ${BIMG_DIR}/3rdparty/etc2/*.cpp ${BIMG_DIR}/3rdparty/etc
add_library( etc2 STATIC ${ETC2_SOURCES} )
target_include_directories( etc2 PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty> )
set_target_properties( etc2 PROPERTIES FOLDER "bgfx/3rdparty" )
target_link_libraries( etc2 PUBLIC bx )
target_link_libraries( etc2 PUBLIC bx )
set_target_properties( etc2
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -28,5 +28,8 @@ if( MSVC )
set_target_properties( fcpp PROPERTIES COMPILE_FLAGS "/W0" )
endif()
set_target_properties( fcpp PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( fcpp
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )
set_source_files_properties( ${BGFX_DIR}/3rdparty/fcpp/usecpp.c PROPERTIES HEADER_FILE_ONLY ON )

View File

@@ -84,4 +84,7 @@ elseif(APPLE)
-Wno-deprecated-register
)
endif()
set_target_properties( glsl-optimizer PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( glsl-optimizer
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -40,7 +40,10 @@ target_include_directories( glslang PUBLIC
${BGFX_DIR}/3rdparty
)
set_target_properties( glslang PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( glslang
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )
if( MSVC )
target_compile_options( glslang PRIVATE
@@ -95,4 +98,4 @@ endif()
target_compile_definitions( glslang PRIVATE
ENABLE_OPT=1
ENABLE_HLSL=1
)
)

View File

@@ -16,4 +16,7 @@ file( GLOB IQA_SOURCES ${BIMG_DIR}/3rdparty/iqa/source/*.c ${BIMG_DIR}/3rdparty/
add_library( iqa STATIC ${IQA_SOURCES} )
target_include_directories( iqa PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/iqa/include> )
set_target_properties( iqa PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( iqa
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -16,4 +16,7 @@ file( GLOB SQUISH_SOURCES ${BIMG_DIR}/3rdparty/libsquish/*.cpp ${BIMG_DIR}/3rdpa
add_library( squish STATIC ${SQUISH_SOURCES} )
target_include_directories( squish PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty> )
set_target_properties( squish PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( squish
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -16,4 +16,7 @@ file( GLOB MESHOPTIMIZER_SOURCES ${BGFX_DIR}/3rdparty/meshoptimizer/src/*.cpp ${
add_library( meshoptimizer STATIC ${MESHOPTIMIZER_SOURCES} )
target_include_directories( meshoptimizer PUBLIC ${BGFX_DIR}/3rdparty )
set_target_properties( meshoptimizer PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( meshoptimizer
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -32,5 +32,8 @@ target_include_directories( nvtt
PUBLIC
$<BUILD_INTERFACE:${BIMG_DIR}/3rdparty>
$<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/nvtt> )
set_target_properties( nvtt PROPERTIES FOLDER "bgfx/3rdparty" )
target_link_libraries( nvtt PUBLIC bx )
target_link_libraries( nvtt PUBLIC bx )
set_target_properties( nvtt
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -16,4 +16,7 @@ file( GLOB PVRTC_SOURCES ${BIMG_DIR}/3rdparty/pvrtc/*.cpp ${BIMG_DIR}/3rdparty/p
add_library( pvrtc STATIC ${PVRTC_SOURCES} )
target_include_directories( pvrtc PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty> )
set_target_properties( pvrtc PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( pvrtc
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -35,4 +35,7 @@ if( MSVC )
)
endif()
set_target_properties( spirv-cross PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( spirv-cross
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -55,4 +55,7 @@ else()
endif()
endif()
set_target_properties( spirv-tools PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( spirv-tools
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -6,4 +6,7 @@ file( GLOB_RECURSE TINYEXR_SOURCES ${BIMG_DIR}/3rdparty/tinyexr/*.c ${BIMG_DIR}/
add_library( tinyexr STATIC ${TINYEXR_SOURCES} )
target_include_directories( tinyexr PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty> $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/tinyexr/deps/miniz> )
set_target_properties( tinyexr PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( tinyexr
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

View File

@@ -28,4 +28,7 @@ target_include_directories( webgpu
$<BUILD_INTERFACE:${BGFX_DIR}/3rdparty/webgpu/include>
)
# set_target_properties( webgpu PROPERTIES FOLDER "bgfx/3rdparty" )
set_target_properties( webgpu
PROPERTIES
FOLDER "bgfx/3rdparty"
PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-" )

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)
@@ -68,6 +69,33 @@ if( NOT ${BGFX_OPENGLES_VERSION} STREQUAL "" )
target_compile_definitions( bgfx PRIVATE BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION=${BGFX_OPENGLES_VERSION} )
endif()
if( NOT ${BGFX_CONFIG_DEFAULT_MAX_ENCODERS} STREQUAL "" )
target_compile_definitions( bgfx
PUBLIC
"BGFX_CONFIG_DEFAULT_MAX_ENCODERS=$<IF:$<BOOL:${BGFX_CONFIG_MULTITHREADED}>,${BGFX_CONFIG_DEFAULT_MAX_ENCODERS},1>" )
endif()
set(BGFX_CONFIG_OPTIONS "")
list(APPEND BGFX_CONFIG_OPTIONS
"BGFX_CONFIG_MAX_DRAW_CALLS"
"BGFX_CONFIG_MAX_VIEWS"
"BGFX_CONFIG_MAX_FRAME_BUFFERS"
"BGFX_CONFIG_MAX_VERTEX_LAYOUTS"
"BGFX_CONFIG_MAX_VERTEX_BUFFERS"
"BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS"
"BGFX_CONFIG_MAX_INDEX_BUFFERS"
"BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS"
"BGFX_CONFIG_MAX_TEXTURES"
"BGFX_CONFIG_MAX_TEXTURE_SAMPLERS"
"BGFX_CONFIG_MAX_SHADERS"
"BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM"
)
foreach(BGFX_CONFIG_OPTION IN LISTS BGFX_CONFIG_OPTIONS)
if( NOT ${${BGFX_CONFIG_OPTION}} STREQUAL "" )
target_compile_definitions( bgfx PUBLIC "${BGFX_CONFIG_OPTION}=${${BGFX_CONFIG_OPTION}}" )
endif()
endforeach()
# Special Visual Studio Flags
if( MSVC )
target_compile_definitions( bgfx PRIVATE "_CRT_SECURE_NO_WARNINGS" )
@@ -76,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}>"
)