mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
Compare commits
5 Commits
v1.129.895
...
v1.136.909
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54fc2e6d5a | ||
|
|
8301c805b5 | ||
|
|
b5e37cd0db | ||
|
|
052d997930 | ||
|
|
a952acef35 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
name: Check compatibility with minimum cmake version
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CMAKE_VERSION: 3.10.2
|
||||
CMAKE_VERSION: 3.20.0
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
# You should have received a copy of the CC0 Public Domain Dedication along with
|
||||
# this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
|
||||
cmake_minimum_required(VERSION 3.10.2) # version supported by android studio
|
||||
cmake_minimum_required(VERSION 3.20) # C++20 support required
|
||||
project(bgfx)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
|
||||
10
README.md
10
README.md
@@ -99,7 +99,7 @@ bgfx_compile_shaders(
|
||||
```
|
||||
This defines a shaderc command to generate binaries or headers for a number of `TYPE` shaders with `SHADERS` files and `VARYING_DEF` file in the `OUTPUT_DIR` directory. There will be one generated shader for each supported rendering API on this current platform according to the `BGFX_EMBEDDED_SHADER` macro in `bgfx/embedded_shader.h` for headers and in the directory expected by `load_shader` in `bgfx_utils.h`.
|
||||
|
||||
The generated headers will have names in the format of `${RENDERING_API}/${SHADERS}.bin[.h]` where `RENDERING_API` can be `glsl`, `essl`, `spv`, `dx11` and `mtl` depending on the availability of the platform.
|
||||
The generated headers will have names in the format of `${RENDERING_API}/${SHADERS}.bin[.h]` where `RENDERING_API` can be `glsl`, `essl`, `spirv`, `dx11` and `metal` depending on the availability of the platform.
|
||||
|
||||
Adding these `SHADERS` as source files to a target will run `shaderc` at build time and they will rebuild if either the contents of the `SHADERS` or the `VARYING_DEF` change.
|
||||
|
||||
@@ -128,17 +128,17 @@ target_include_directories(myLib ${CMAKE_BINARY_DIR}/include/generated/shaders)
|
||||
// main.cpp
|
||||
#include <glsl/vs.sc.bin.h>
|
||||
#include <essl/vs.sc.bin.h>
|
||||
#include <spv/vs.sc.bin.h>
|
||||
#include <spirv/vs.sc.bin.h>
|
||||
#include <glsl/fs.sc.bin.h>
|
||||
#include <essl/fs.sc.bin.h>
|
||||
#include <spv/fs.sc.bin.h>
|
||||
#include <spirv/fs.sc.bin.h>
|
||||
#if defined(_WIN32)
|
||||
#include <dx11/vs.sc.bin.h>
|
||||
#include <dx11/fs.sc.bin.h>
|
||||
#endif // defined(_WIN32)
|
||||
#if __APPLE__
|
||||
#include <mtl/vs.sc.bin.h>
|
||||
#include <mtl/fs.sc.bin.h>
|
||||
#include <metal/vs.sc.bin.h>
|
||||
#include <metal/fs.sc.bin.h>
|
||||
#endif // __APPLE__
|
||||
|
||||
const bgfx::EmbeddedShader k_vs = BGFX_EMBEDDED_SHADER(vs);
|
||||
|
||||
2
bgfx
2
bgfx
Submodule bgfx updated: b0e9cbd110...d9d99f51ad
2
bimg
2
bimg
Submodule bimg updated: a1a2ae3c12...bf10ffbb3d
2
bx
2
bx
Submodule bx updated: 59d9249854...01cf049f97
2
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
2
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
@@ -84,6 +84,7 @@ file(
|
||||
${SPIRV_TOOLS}/source/util/hex_float.h
|
||||
${SPIRV_TOOLS}/source/util/parse_number.cpp
|
||||
${SPIRV_TOOLS}/source/util/parse_number.h
|
||||
${SPIRV_TOOLS}/source/util/status.h
|
||||
${SPIRV_TOOLS}/source/util/string_utils.cpp
|
||||
${SPIRV_TOOLS}/source/util/string_utils.h
|
||||
${SPIRV_TOOLS}/source/util/timer.h
|
||||
@@ -120,6 +121,7 @@ file(
|
||||
${SPIRV_TOOLS}/source/val/validate_invalid_type.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_layout.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_literals.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_logical_pointers.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_logicals.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_memory.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_memory_semantics.cpp
|
||||
|
||||
@@ -19,22 +19,25 @@ if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT APPLE)
|
||||
set(BGFX_AMALGAMATED_SOURCE ${BGFX_DIR}/src/amalgamated.cpp)
|
||||
else()
|
||||
set(BGFX_AMALGAMATED_SOURCE ${BGFX_DIR}/src/amalgamated.mm)
|
||||
endif()
|
||||
|
||||
# Grab the bgfx source files
|
||||
file(
|
||||
GLOB
|
||||
BGFX_SOURCES
|
||||
${BGFX_DIR}/src/*.cpp
|
||||
${BGFX_DIR}/src/*.mm
|
||||
${BGFX_DIR}/src/*.h
|
||||
${BGFX_DIR}/include/bgfx/*.h
|
||||
${BGFX_DIR}/include/bgfx/c99/*.h
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
file(GLOB BGFX_OBJC_SOURCES ${BGFX_DIR}/src/*.mm)
|
||||
list(APPEND BGFX_SOURCES ${BGFX_OBJC_SOURCES})
|
||||
list(REMOVE_ITEM BGFX_SOURCES ${BGFX_DIR}/src/amalgamated.cpp)
|
||||
set(BGFX_AMALGAMATED_SOURCE ${BGFX_DIR}/src/amalgamated.mm)
|
||||
else()
|
||||
set(BGFX_AMALGAMATED_SOURCE ${BGFX_DIR}/src/amalgamated.cpp)
|
||||
endif()
|
||||
|
||||
if(BGFX_AMALGAMATED)
|
||||
set(BGFX_NOBUILD ${BGFX_SOURCES})
|
||||
list(REMOVE_ITEM BGFX_NOBUILD ${BGFX_AMALGAMATED_SOURCE})
|
||||
@@ -43,8 +46,7 @@ if(BGFX_AMALGAMATED)
|
||||
endforeach()
|
||||
else()
|
||||
# Do not build using amalgamated sources
|
||||
set_source_files_properties(${BGFX_DIR}/src/amalgamated.cpp PROPERTIES HEADER_FILE_ONLY ON)
|
||||
set_source_files_properties(${BGFX_DIR}/src/amalgamated.mm PROPERTIES HEADER_FILE_ONLY ON)
|
||||
set_source_files_properties(${BGFX_AMALGAMATED_SOURCE} PROPERTIES HEADER_FILE_ONLY ON)
|
||||
endif()
|
||||
|
||||
# Create the bgfx target
|
||||
|
||||
@@ -60,6 +60,11 @@ endforeach()
|
||||
|
||||
add_library(bx STATIC ${BX_SOURCES})
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(bx PRIVATE /EHs-c-)
|
||||
target_compile_definitions(bx PRIVATE _HAS_EXCEPTIONS=0)
|
||||
endif()
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bx PROPERTIES FOLDER "bgfx")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user