mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
Compare commits
111 Commits
v1.118.839
...
v1.136.913
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eda300c870 | ||
|
|
fc0cada1eb | ||
|
|
fbe794fa4c | ||
|
|
12dcf5f74c | ||
|
|
5a19118dec | ||
|
|
6a35cc27ed | ||
|
|
4ae9b3209b | ||
|
|
cbd0e09dd9 | ||
|
|
f104e89b0e | ||
|
|
54fc2e6d5a | ||
|
|
8301c805b5 | ||
|
|
b5e37cd0db | ||
|
|
052d997930 | ||
|
|
a952acef35 | ||
|
|
dddc79f2ee | ||
|
|
fbf0903e50 | ||
|
|
5f3f4f2972 | ||
|
|
bd755d6c91 | ||
|
|
e8a92ffbbe | ||
|
|
657dd62551 | ||
|
|
36a0d1d8d0 | ||
|
|
cf79284dad | ||
|
|
06144dcb9b | ||
|
|
3b5115516c | ||
|
|
ef0ed485c5 | ||
|
|
2c33050257 | ||
|
|
b12eb2882a | ||
|
|
1139067c7d | ||
|
|
b135fa3d77 | ||
|
|
9af6a48ce0 | ||
|
|
f531516396 | ||
|
|
94184872a8 | ||
|
|
4ceffda6de | ||
|
|
8defeece11 | ||
|
|
5b8c8b9057 | ||
|
|
de5f4544ef | ||
|
|
85b9f3cf5f | ||
|
|
79e4993ca5 | ||
|
|
0211a63b99 | ||
|
|
1156dcc725 | ||
|
|
c2b7416a58 | ||
|
|
c0ce1388cc | ||
|
|
19cb98d40b | ||
|
|
701d84c222 | ||
|
|
5940bb7cf8 | ||
|
|
2fcbf437f2 | ||
|
|
d7f59648a8 | ||
|
|
e8db646d2c | ||
|
|
e12aba94c7 | ||
|
|
8dcc50e992 | ||
|
|
011e8efe23 | ||
|
|
871eed8f8a | ||
|
|
2f0e950b8f | ||
|
|
26af75d78b | ||
|
|
1f65bfcb44 | ||
|
|
875927a712 | ||
|
|
f46699bb4a | ||
|
|
6a8aba37ff | ||
|
|
38de01cd8a | ||
|
|
560dcb227e | ||
|
|
b3dae62c95 | ||
|
|
a1a7828ab0 | ||
|
|
11810052be | ||
|
|
688224d5f0 | ||
|
|
3c1f8bac82 | ||
|
|
ec52497189 | ||
|
|
1925f436e7 | ||
|
|
b208d0c37b | ||
|
|
b5041def8e | ||
|
|
29b62260f6 | ||
|
|
4cfb204f26 | ||
|
|
715b2a2c67 | ||
|
|
9d8213645b | ||
|
|
376cdd9205 | ||
|
|
9ad4a8a69a | ||
|
|
398b09ef17 | ||
|
|
0fc04361c8 | ||
|
|
f5afee9379 | ||
|
|
16ae1476f0 | ||
|
|
c2eb5368fa | ||
|
|
86fa198254 | ||
|
|
84f51c4f0f | ||
|
|
fab7c74fa9 | ||
|
|
b520b4686c | ||
|
|
dd8b8db87b | ||
|
|
cbb7c340ba | ||
|
|
2a53415f03 | ||
|
|
7d89f8ee50 | ||
|
|
487fa0c63b | ||
|
|
9670cf4f43 | ||
|
|
0ab856a9dc | ||
|
|
73a2b12c5e | ||
|
|
4e42ca1ef5 | ||
|
|
aaf627f912 | ||
|
|
13fda4c089 | ||
|
|
a6e266e326 | ||
|
|
d671412cca | ||
|
|
907dc5fbd7 | ||
|
|
a0f928864f | ||
|
|
fad617f66f | ||
|
|
fba0379121 | ||
|
|
a6cfe968a5 | ||
|
|
0479a929a7 | ||
|
|
e5fea62b02 | ||
|
|
0a11910c2a | ||
|
|
1c31493614 | ||
|
|
fb50e78e49 | ||
|
|
cf8b57e65c | ||
|
|
38d11732c7 | ||
|
|
b6c4027d20 | ||
|
|
086fccf3a8 |
2
.github/CODEOWNERS
vendored
Normal file
2
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
* @bwrsandman
|
||||
* @jsm174
|
||||
5
.github/dependabot.yml
vendored
5
.github/dependabot.yml
vendored
@@ -4,3 +4,8 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
groups:
|
||||
# Name of the group
|
||||
submodules:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
89
.github/workflows/ci.yml
vendored
89
.github/workflows/ci.yml
vendored
@@ -1,4 +1,3 @@
|
||||
# https://github.com/openblack/bgfx.cmake/blob/master/.github/workflows/ci.yml
|
||||
name: CI
|
||||
|
||||
on:
|
||||
@@ -7,10 +6,41 @@ on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
# Indicates the CMake build directory where project files and binaries are being produced.
|
||||
CMAKE_BUILD_DIR: ${{ github.workspace }}/build/
|
||||
|
||||
jobs:
|
||||
job:
|
||||
minimum-cmake-version:
|
||||
name: Check compatibility with minimum cmake version
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CMAKE_VERSION: 3.20.0
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
|
||||
- uses: lukka/get-cmake@latest
|
||||
with:
|
||||
cmakeVersion: ${{ env.CMAKE_VERSION }}
|
||||
- name: Check cmake version
|
||||
run: |
|
||||
cmake --version | grep ${{ env.CMAKE_VERSION }}
|
||||
- name: Test config
|
||||
# old way of configuring a build directory
|
||||
run: |
|
||||
mkdir -p "${{ env.CMAKE_BUILD_DIR }}"
|
||||
cd "${{ env.CMAKE_BUILD_DIR }}"
|
||||
cmake ${{ github.workspace }} -GNinja -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
native:
|
||||
name: ${{ matrix.os }} ${{ matrix.cc }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: minimum-cmake-version
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -23,22 +53,17 @@ jobs:
|
||||
cc: clang
|
||||
cxx: clang++
|
||||
- os: macos-latest
|
||||
|
||||
env:
|
||||
# Indicates the CMake build directory where project files and binaries are being produced.
|
||||
CMAKE_BUILD_DIR: ${{ github.workspace }}/build/
|
||||
|
||||
CC: ${{ matrix.cc }}
|
||||
CXX: ${{ matrix.cxx }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y libgl1-mesa-dev
|
||||
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
|
||||
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
|
||||
@@ -55,4 +80,46 @@ jobs:
|
||||
# Build the whole project with Ninja (which is spawn by CMake).
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}"
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}"
|
||||
|
||||
# Build the examples which are excluded from all
|
||||
- name: Build examples
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target examples
|
||||
|
||||
cross-android:
|
||||
name: cross-android
|
||||
runs-on: ubuntu-latest
|
||||
needs: minimum-cmake-version
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
|
||||
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
|
||||
- uses: lukka/get-cmake@latest
|
||||
|
||||
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
# Run CMake to generate Ninja project files
|
||||
- name: Generate project files
|
||||
run: |
|
||||
cmake -B "${{ env.CMAKE_BUILD_DIR }}" -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake
|
||||
|
||||
# Build the whole project with Ninja (which is spawn by CMake).
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}"
|
||||
|
||||
# Build the examples which are excluded from all
|
||||
- name: Build examples
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target examples
|
||||
|
||||
10
.github/workflows/format.yml
vendored
10
.github/workflows/format.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
name: cmake-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
if: startsWith(github.event_name, 'pull_request')
|
||||
- name: Format CMake files
|
||||
id: cmake-format
|
||||
uses: PuneetMatharu/cmake-format-lint-action@main
|
||||
uses: PuneetMatharu/cmake-format-lint-action@v1.0.6
|
||||
with:
|
||||
args: --config-files .cmake-format.py --check
|
||||
# Run only if a PR and cmake-format has failed
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
needs: cmake-format-check
|
||||
if: always() && startsWith(github.event_name, 'pull_request') && needs.cmake-format-check.result == 'failure'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
@@ -40,12 +40,12 @@ jobs:
|
||||
if: startsWith(github.event_name, 'pull_request')
|
||||
- name: Format CMake files
|
||||
id: cmake-format
|
||||
uses: PuneetMatharu/cmake-format-lint-action@v1.0.0
|
||||
uses: PuneetMatharu/cmake-format-lint-action@v1.0.6
|
||||
with:
|
||||
args: --config-files .cmake-format.py --in-place
|
||||
- run: |
|
||||
git diff > cmake-format.patch
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: formatting-fix-${{github.sha}}
|
||||
path: cmake-format.patch
|
||||
|
||||
106
.github/workflows/release.yml
vendored
106
.github/workflows/release.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
sha: ${{ steps.version.outputs.sha }}
|
||||
tag: ${{ steps.version.outputs.tag }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
@@ -29,9 +29,9 @@ jobs:
|
||||
BGFX_CMAKE_REVISION=$(git rev-list HEAD --count)
|
||||
SHA=$(cd bgfx && git rev-parse HEAD)
|
||||
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}"
|
||||
echo "revision=${BGFX_REVISION}" >> $GITHUB_OUTPUT
|
||||
echo "sha=${SHA}" >> $GITHUB_OUTPUT
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
name: ${{ matrix.os }}
|
||||
@@ -51,13 +51,13 @@ jobs:
|
||||
CMAKE_INSTALL_DIR: ${{ github.workspace }}/install/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y libgl1-mesa-dev
|
||||
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
|
||||
- uses: lukka/get-cmake@latest
|
||||
@@ -75,12 +75,12 @@ jobs:
|
||||
# Run CMake to generate project files
|
||||
- name: Generate project files
|
||||
run: |
|
||||
cmake -B "${{ env.CMAKE_BUILD_DIR }}" -DCMAKE_INSTALL_PREFIX="${{ env.CMAKE_INSTALL_DIR }}" -DCMAKE_DEBUG_POSTFIX=d -DBGFX_BUILD_EXAMPLES=OFF -DBGFX_BUILD_TOOLS=ON -DBGFX_INSTALL=ON -DBGFX_AMALGAMATED=ON -DCMAKE_BUILD_TYPE=Release
|
||||
cmake -B "${{ env.CMAKE_BUILD_DIR }}" "-DCMAKE_INSTALL_PREFIX=${{ env.CMAKE_INSTALL_DIR }}" -DCMAKE_DEBUG_POSTFIX=d -DBGFX_BUILD_EXAMPLES=OFF -DBGFX_BUILD_TOOLS=ON -DBGFX_INSTALL=ON -DBGFX_AMALGAMATED=ON -DCMAKE_BUILD_TYPE=Release
|
||||
# Build the install targets
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target install --config Release
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.os }}
|
||||
path: ${{ github.workspace }}/install/
|
||||
@@ -90,11 +90,89 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ version, build ]
|
||||
if: github.repository == 'bkaradzic/bgfx.cmake' && github.event_name == 'push'
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Create Release
|
||||
uses: actions/create-release@v1
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
tag_name: ${{ needs.version.outputs.tag }}
|
||||
release_name: ${{ needs.version.outputs.tag }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
path: src/bgfx.cmake
|
||||
- run: |
|
||||
find src/bgfx.cmake -name ".git*" -exec rm -rf {} +
|
||||
find src/bgfx.cmake -name ".editorconfig" -delete
|
||||
rm src/bgfx.cmake/.cmake-format.py
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: windows-latest
|
||||
path: ${{ github.workspace }}/install/windows/bgfx.cmake
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ubuntu-latest
|
||||
path: ${{ github.workspace }}/install/linux/bgfx.cmake
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: macos-latest
|
||||
path: ${{ github.workspace }}/install/macos/bgfx.cmake
|
||||
- name: Create Source Zip
|
||||
uses: thedoctor0/zip-release@0.7.6
|
||||
with:
|
||||
type: 'zip'
|
||||
filename: 'bgfx.cmake.${{ needs.version.outputs.tag }}.zip'
|
||||
directory: 'src'
|
||||
path: 'bgfx.cmake'
|
||||
- name: Create Source Tar
|
||||
uses: thedoctor0/zip-release@0.7.6
|
||||
with:
|
||||
type: 'tar'
|
||||
filename: 'bgfx.cmake.${{ needs.version.outputs.tag }}.tar.gz'
|
||||
directory: 'src'
|
||||
path: 'bgfx.cmake'
|
||||
- name: Create Windows Zip
|
||||
uses: thedoctor0/zip-release@0.7.6
|
||||
with:
|
||||
type: 'zip'
|
||||
filename: 'bgfx.cmake.binary.windows.${{ needs.version.outputs.tag }}.zip'
|
||||
directory: 'install/windows'
|
||||
path: 'bgfx.cmake'
|
||||
- name: Create Windows Tar
|
||||
uses: thedoctor0/zip-release@0.7.6
|
||||
with:
|
||||
type: 'tar'
|
||||
filename: 'bgfx.cmake.binary.windows.${{ needs.version.outputs.tag }}.tar.gz'
|
||||
directory: 'install/windows'
|
||||
path: 'bgfx.cmake'
|
||||
- name: Create Linux Zip
|
||||
uses: thedoctor0/zip-release@0.7.6
|
||||
with:
|
||||
type: 'zip'
|
||||
filename: 'bgfx.cmake.binary.linux.${{ needs.version.outputs.tag }}.zip'
|
||||
directory: 'install/linux'
|
||||
path: 'bgfx.cmake'
|
||||
- name: Create Linux Tar
|
||||
uses: thedoctor0/zip-release@0.7.6
|
||||
with:
|
||||
type: 'tar'
|
||||
filename: 'bgfx.cmake.binary.linux.${{ needs.version.outputs.tag }}.tar.gz'
|
||||
directory: 'install/linux'
|
||||
path: 'bgfx.cmake'
|
||||
- name: Create MacOS Zip
|
||||
uses: thedoctor0/zip-release@0.7.6
|
||||
with:
|
||||
type: 'zip'
|
||||
filename: 'bgfx.cmake.binary.macos.${{ needs.version.outputs.tag }}.zip'
|
||||
directory: 'install/macos'
|
||||
path: 'bgfx.cmake'
|
||||
- name: Create MacOS Tar
|
||||
uses: thedoctor0/zip-release@0.7.6
|
||||
with:
|
||||
type: 'tar'
|
||||
filename: 'bgfx.cmake.binary.macos.${{ needs.version.outputs.tag }}.tar.gz'
|
||||
directory: 'install/macos'
|
||||
path: 'bgfx.cmake'
|
||||
- name: Create Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ needs.version.outputs.tag }}
|
||||
artifacts: "src/bgfx.cmake.${{ needs.version.outputs.tag }}.zip,src/bgfx.cmake.${{ needs.version.outputs.tag }}.tar.gz,install/*/*.${{ needs.version.outputs.tag }}.zip,install/*/*.${{ needs.version.outputs.tag }}.tar.gz"
|
||||
generateReleaseNotes: true
|
||||
|
||||
102
CMakeLists.txt
102
CMakeLists.txt
@@ -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.6)
|
||||
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 14)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
@@ -22,10 +22,6 @@ if(APPLE AND NOT XCODE)
|
||||
set(CMAKE_CXX_FLAGS "-ObjC++")
|
||||
endif()
|
||||
|
||||
if(MSVC AND (MSVC_VERSION GREATER_EQUAL 1914))
|
||||
add_compile_options("/Zc:__cplusplus")
|
||||
endif()
|
||||
|
||||
include(CMakeDependentOption)
|
||||
|
||||
option(BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF)
|
||||
@@ -38,19 +34,25 @@ cmake_dependent_option(BGFX_BUILD_TOOLS_GEOMETRY "Build bgfx geometry tools." ON
|
||||
cmake_dependent_option(BGFX_BUILD_TOOLS_TEXTURE "Build bgfx texture tools." ON BGFX_BUILD_TOOLS OFF)
|
||||
set(BGFX_TOOLS_PREFIX "" CACHE STRING "Prefix name to add to name of tools (to avoid clashes)")
|
||||
option(BGFX_BUILD_EXAMPLES "Build bgfx examples." ON)
|
||||
cmake_dependent_option(
|
||||
BGFX_BUILD_EXAMPLE_COMMON "Build bgfx example-common project." OFF "NOT BGFX_BUILD_EXAMPLES;NOT BGFX_BUILD_TOOLS"
|
||||
ON
|
||||
)
|
||||
option(BGFX_BUILD_TESTS "Build bgfx tests." OFF)
|
||||
option(BGFX_INSTALL "Create installation target." ON)
|
||||
cmake_dependent_option(
|
||||
BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF "BGFX_INSTALL;BGFX_BUILD_EXAMPLES" OFF
|
||||
)
|
||||
cmake_dependent_option(BGFX_WITH_WAYLAND "Use Wayland backend." ON "CMAKE_SYSTEM_NAME STREQUAL Linux" OFF)
|
||||
option(BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON)
|
||||
option(BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON)
|
||||
cmake_dependent_option(BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON "NOT CMAKE_SYSTEM_NAME STREQUAL Emscripten" OFF)
|
||||
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_property(CACHE BGFX_LIBRARY_TYPE PROPERTY STRINGS "STATIC" "SHARED")
|
||||
|
||||
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")
|
||||
@@ -71,11 +73,7 @@ if(BGFX_CMAKE_USER_SCRIPT)
|
||||
include(${BGFX_CMAKE_USER_SCRIPT})
|
||||
endif()
|
||||
|
||||
set_property(CACHE BGFX_LIBRARY_TYPE PROPERTY STRINGS STATIC SHARED)
|
||||
|
||||
if(BGFX_LIBRARY_TYPE MATCHES "SHARED")
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
if(BGFX_BUILD_TESTS)
|
||||
enable_testing()
|
||||
@@ -97,6 +95,10 @@ elseif(NOT IS_ABSOLUTE "${BGFX_DIR}")
|
||||
get_filename_component(BGFX_DIR "${BGFX_DIR}" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH "${BX_DIR}" BX_DIR)
|
||||
file(TO_CMAKE_PATH "${BIMG_DIR}" BIMG_DIR)
|
||||
file(TO_CMAKE_PATH "${BGFX_DIR}" BGFX_DIR)
|
||||
|
||||
# sets project version from api ver / git rev
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cmake)
|
||||
if(BGFX_BUILD_TOOLS AND BGFX_CUSTOM_TARGETS)
|
||||
@@ -104,10 +106,6 @@ if(BGFX_BUILD_TOOLS AND BGFX_CUSTOM_TARGETS)
|
||||
set_target_properties(tools PROPERTIES FOLDER "bgfx/tools")
|
||||
endif()
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bx)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bimg)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bgfx)
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@@ -123,7 +121,13 @@ if(BGFX_INSTALL)
|
||||
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||
set(namespace "${PROJECT_NAME}::")
|
||||
endif()
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bx)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bimg)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bgfx)
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
# Include module with fuction 'write_basic_package_version_file'
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
@@ -157,77 +161,11 @@ if(BGFX_INSTALL)
|
||||
|
||||
install(FILES ${BGFX_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/licences/${PROJECT_NAME})
|
||||
|
||||
install(
|
||||
TARGETS bgfx
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
INCLUDES
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
if(NOT BGFX_LIBRARY_TYPE MATCHES "SHARED")
|
||||
install(
|
||||
TARGETS bimg bx
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
INCLUDES
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
endif()
|
||||
if(BGFX_CONFIG_RENDERER_WEBGPU)
|
||||
install(
|
||||
TARGETS webgpu
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
INCLUDES
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# install headers (this should be done as a target probably... ^)
|
||||
install(DIRECTORY ${BX_DIR}/include/bx ${BX_DIR}/include/compat ${BX_DIR}/include/tinystl
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
install(DIRECTORY ${BIMG_DIR}/include/bimg DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
install(DIRECTORY ${BGFX_DIR}/include/bgfx DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
# header required for shader compilation
|
||||
install(FILES ${BGFX_DIR}/src/bgfx_shader.sh ${BGFX_DIR}/src/bgfx_compute.sh
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/bgfx"
|
||||
)
|
||||
|
||||
# install tools
|
||||
if(BGFX_CMAKE_USER_SCRIPT)
|
||||
install(FILES ${BGFX_CMAKE_USER_SCRIPT} DESTINATION "${config_install_dir}")
|
||||
endif()
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/bgfxToolUtils.cmake DESTINATION "${config_install_dir}")
|
||||
if(BGFX_BUILD_TOOLS_BIN2C)
|
||||
install(TARGETS bin2c EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
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()
|
||||
|
||||
# install examples
|
||||
if(BGFX_BUILD_EXAMPLES AND BGFX_INSTALL_EXAMPLES)
|
||||
install(DIRECTORY ${BGFX_DIR}/examples/runtime/ DESTINATION examples)
|
||||
foreach(EXAMPLE ${BGFX_EXAMPLES})
|
||||
install(TARGETS example-${EXAMPLE} DESTINATION examples)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Config
|
||||
# * <prefix>/lib/cmake/bgfx/bgfxConfig.cmake
|
||||
|
||||
41
README.md
41
README.md
@@ -48,8 +48,9 @@ Adding these `INPUT_FILE` as source files to a target will run `bin2c` at build
|
||||
#### Examples: Generating an image as a header
|
||||
```cmake
|
||||
bgfx_compile_binary_to_header(
|
||||
INPUT_FILE image.png
|
||||
INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/image.png
|
||||
OUTPUT_FILE ${CMAKE_BINARY_DIR}/include/generated/images/image.png.h
|
||||
ARRAY_NAME image_bytes
|
||||
)
|
||||
add_library(myLib image.png)
|
||||
target_include_directories(myLib ${CMAKE_BINARY_DIR}/include/generated/images)
|
||||
@@ -58,6 +59,7 @@ target_include_directories(myLib ${CMAKE_BINARY_DIR}/include/generated/images)
|
||||
```cpp
|
||||
// main.cpp
|
||||
#include <image.png.h>
|
||||
// You now have access to a static const uint8_t or char array named image_bytes
|
||||
```
|
||||
|
||||
### `bgfx_compile_texture`
|
||||
@@ -84,35 +86,38 @@ bgfx_compile_texture(
|
||||
)
|
||||
```
|
||||
|
||||
### `bgfx_compile_shader_to_header`
|
||||
### `bgfx_compile_shaders`
|
||||
Add a build rule for a `*.sc` shader to the generated build system using shaderc.
|
||||
```cmake
|
||||
bgfx_compile_shader_to_header(
|
||||
bgfx_compile_shaders(
|
||||
TYPE VERTEX|FRAGMENT|COMPUTE
|
||||
SHADERS filenames
|
||||
VARYING_DEF filename
|
||||
OUTPUT_DIR directory
|
||||
[AS_HEADERS]
|
||||
)
|
||||
```
|
||||
This defines a shaderc command to generate 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`.
|
||||
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 `${SHADERS}.${RENDERING_API}.bin.h` where `RENDERING_API` can be `glsl`, `essl`, `spv`, `dx9`, `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.
|
||||
|
||||
#### Examples: Generating shaders as headers
|
||||
```cmake
|
||||
bgfx_compile_shader_to_header(
|
||||
bgfx_compile_shaders(
|
||||
TYPE VERTEX
|
||||
SHADERS vs.sc
|
||||
VARYING_DEF varying.def.sc
|
||||
OUTPUT_DIR ${CMAKE_BINARY_DIR}/include/generated/shaders
|
||||
AS_HEADERS
|
||||
)
|
||||
bgfx_compile_shader_to_header(
|
||||
bgfx_compile_shaders(
|
||||
TYPE FRAGMENT
|
||||
SHADERS fs.sc
|
||||
VARYING_DEF ${CMAKE_SOURCE_DIR}/varying.def.sc
|
||||
OUTPUT_DIR ${CMAKE_BINARY_DIR}/include/generated/shaders
|
||||
AS_HEADERS
|
||||
)
|
||||
|
||||
add_library(myLib main.cpp vs.sc fs.sc)
|
||||
@@ -121,21 +126,19 @@ target_include_directories(myLib ${CMAKE_BINARY_DIR}/include/generated/shaders)
|
||||
|
||||
```cpp
|
||||
// main.cpp
|
||||
#include <vs.sc.glsl.bin.h>
|
||||
#include <vs.sc.essl.bin.h>
|
||||
#include <vs.sc.spv.bin.h>
|
||||
#include <fs.sc.glsl.bin.h>
|
||||
#include <fs.sc.essl.bin.h>
|
||||
#include <fs.sc.spv.bin.h>
|
||||
#include <glsl/vs.sc.bin.h>
|
||||
#include <essl/vs.sc.bin.h>
|
||||
#include <spirv/vs.sc.bin.h>
|
||||
#include <glsl/fs.sc.bin.h>
|
||||
#include <essl/fs.sc.bin.h>
|
||||
#include <spirv/fs.sc.bin.h>
|
||||
#if defined(_WIN32)
|
||||
#include <vs.sc.dx9.bin.h>
|
||||
#include <vs.sc.dx11.bin.h>
|
||||
#include <fs.sc.dx9.bin.h>
|
||||
#include <fs.sc.dx11.bin.h>
|
||||
#include <dx11/vs.sc.bin.h>
|
||||
#include <dx11/fs.sc.bin.h>
|
||||
#endif // defined(_WIN32)
|
||||
#if __APPLE__
|
||||
#include <vs.sc.mtl.bin.h>
|
||||
#include <fs.sc.mtl.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: 5f435ea56b...011ede6b42
2
bimg
2
bimg
Submodule bimg updated: 1af90543ca...a0204c79f9
2
bx
2
bx
Submodule bx updated: aed1086c48...36ad6131f4
@@ -9,28 +9,23 @@ list(GET BGFX_INCLUDE_PATH 0 BGFX_INCLUDE_PATH_1) # bgfx::bgfx exports include d
|
||||
set(BGFX_SHADER_INCLUDE_PATH ${BGFX_INCLUDE_PATH_1}/bgfx)
|
||||
|
||||
# If cross compiling, we need a host-compatible version of shaderc to compile shaders
|
||||
if(@CMAKE_CROSSCOMPILING@)
|
||||
macro(_bgfx_crosscompile_use_host_tool TOOL_NAME)
|
||||
if(NOT TARGET bgfx::${TOOL_NAME})
|
||||
find_program(
|
||||
${TOOL_NAME}_EXECUTABLE REQUIRED
|
||||
NAMES bgfx-${TOOL_NAME} ${TOOL_NAME}
|
||||
PATHS /usr/bin #
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/packages/bgfx_x64-linux/tools/bgfx
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/packages/bgfx_x64-windows/tools/bgfx
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/packages/bgfx_x64-osx/tools/bgfx
|
||||
)
|
||||
add_executable(bgfx::${TOOL_NAME} IMPORTED)
|
||||
set_target_properties(bgfx::${TOOL_NAME} PROPERTIES IMPORTED_LOCATION "${${TOOL_NAME}_EXECUTABLE}")
|
||||
endif()
|
||||
endmacro()
|
||||
macro(_bgfx_crosscompile_use_host_tool TOOL_NAME)
|
||||
if(NOT TARGET bgfx::${TOOL_NAME})
|
||||
find_program(
|
||||
${TOOL_NAME}_EXECUTABLE
|
||||
NAMES bgfx-${TOOL_NAME} ${TOOL_NAME}
|
||||
PATHS @BGFX_ADDITIONAL_TOOL_PATHS@ /usr/bin
|
||||
)
|
||||
add_executable(bgfx::${TOOL_NAME} IMPORTED)
|
||||
set_target_properties(bgfx::${TOOL_NAME} PROPERTIES IMPORTED_LOCATION "${${TOOL_NAME}_EXECUTABLE}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
_bgfx_crosscompile_use_host_tool(bin2c)
|
||||
_bgfx_crosscompile_use_host_tool(texturec)
|
||||
_bgfx_crosscompile_use_host_tool(shaderc)
|
||||
_bgfx_crosscompile_use_host_tool(texturev)
|
||||
_bgfx_crosscompile_use_host_tool(geometryv)
|
||||
endif()
|
||||
_bgfx_crosscompile_use_host_tool(bin2c)
|
||||
_bgfx_crosscompile_use_host_tool(texturec)
|
||||
_bgfx_crosscompile_use_host_tool(shaderc)
|
||||
_bgfx_crosscompile_use_host_tool(texturev)
|
||||
_bgfx_crosscompile_use_host_tool(geometryv)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/bgfxToolUtils.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
||||
|
||||
30
cmake/bgfx/3rdparty/fcpp.cmake
vendored
30
cmake/bgfx/3rdparty/fcpp.cmake
vendored
@@ -16,7 +16,20 @@ endif()
|
||||
|
||||
set(FCPP_DIR ${BGFX_DIR}/3rdparty/fcpp)
|
||||
|
||||
add_library(fcpp STATIC)
|
||||
file(
|
||||
GLOB
|
||||
FCPP_SOURCES
|
||||
${FCPP_DIR}/*.h
|
||||
${FCPP_DIR}/cpp1.c
|
||||
${FCPP_DIR}/cpp2.c
|
||||
${FCPP_DIR}/cpp3.c
|
||||
${FCPP_DIR}/cpp4.c
|
||||
${FCPP_DIR}/cpp5.c
|
||||
${FCPP_DIR}/cpp6.c
|
||||
${FCPP_DIR}/cpp6.c
|
||||
)
|
||||
|
||||
add_library(fcpp STATIC ${FCPP_SOURCES})
|
||||
|
||||
target_compile_definitions(
|
||||
fcpp
|
||||
@@ -32,21 +45,6 @@ set_target_properties(fcpp PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(fcpp PUBLIC ${FCPP_DIR})
|
||||
|
||||
file(
|
||||
GLOB
|
||||
FCPP_SOURCES
|
||||
${FCPP_DIR}/*.h
|
||||
${FCPP_DIR}/cpp1.c
|
||||
${FCPP_DIR}/cpp2.c
|
||||
${FCPP_DIR}/cpp3.c
|
||||
${FCPP_DIR}/cpp4.c
|
||||
${FCPP_DIR}/cpp5.c
|
||||
${FCPP_DIR}/cpp6.c
|
||||
${FCPP_DIR}/cpp6.c
|
||||
)
|
||||
|
||||
target_sources(fcpp PRIVATE ${FCPP_SOURCES})
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(
|
||||
fcpp
|
||||
|
||||
28
cmake/bgfx/3rdparty/glsl-optimizer.cmake
vendored
28
cmake/bgfx/3rdparty/glsl-optimizer.cmake
vendored
@@ -16,20 +16,6 @@ endif()
|
||||
|
||||
set(GLSL_OPTIMIZER ${BGFX_DIR}/3rdparty/glsl-optimizer)
|
||||
|
||||
add_library(glsl-optimizer STATIC)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(glsl-optimizer PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
glsl-optimizer
|
||||
PUBLIC ${GLSL_OPTIMIZER}/include #
|
||||
${GLSL_OPTIMIZER}/src/glsl #
|
||||
PRIVATE ${GLSL_OPTIMIZER}/src #
|
||||
${GLSL_OPTIMIZER}/src/mesa #
|
||||
${GLSL_OPTIMIZER}/src/mapi #
|
||||
)
|
||||
|
||||
file(
|
||||
GLOB
|
||||
GLSL_OPTIMIZER_SOURCES
|
||||
@@ -193,7 +179,19 @@ file(
|
||||
${GLSL_OPTIMIZER}/src/util/ralloc.h
|
||||
)
|
||||
|
||||
target_sources(glsl-optimizer PRIVATE ${GLSL_OPTIMIZER_SOURCES})
|
||||
add_library(glsl-optimizer STATIC ${GLSL_OPTIMIZER_SOURCES})
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(glsl-optimizer PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
glsl-optimizer
|
||||
PUBLIC ${GLSL_OPTIMIZER}/include #
|
||||
${GLSL_OPTIMIZER}/src/glsl #
|
||||
PRIVATE ${GLSL_OPTIMIZER}/src #
|
||||
${GLSL_OPTIMIZER}/src/mesa #
|
||||
${GLSL_OPTIMIZER}/src/mapi #
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_definitions(
|
||||
|
||||
43
cmake/bgfx/3rdparty/glslang.cmake
vendored
43
cmake/bgfx/3rdparty/glslang.cmake
vendored
@@ -17,27 +17,6 @@ endif()
|
||||
set(GLSLANG ${BGFX_DIR}/3rdparty/glslang)
|
||||
set(SPIRV_TOOLS ${BGFX_DIR}/3rdparty/spirv-tools)
|
||||
|
||||
add_library(glslang STATIC)
|
||||
|
||||
target_compile_definitions(
|
||||
glslang
|
||||
PRIVATE #
|
||||
ENABLE_OPT=1 # spriv-tools
|
||||
ENABLE_HLSL=1 #
|
||||
)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(glslang PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
glslang
|
||||
PUBLIC ${GLSLANG} #
|
||||
${GLSLANG}/glslang/Public #
|
||||
PRIVATE ${GLSLANG}/.. #
|
||||
${SPIRV_TOOLS}/include #
|
||||
${SPIRV_TOOLS}/source #
|
||||
)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
GLSLANG_SOURCES
|
||||
@@ -62,4 +41,24 @@ else()
|
||||
list(FILTER GLSLANG_SOURCES EXCLUDE REGEX "glslang/OSDependent/Windows/.*.h")
|
||||
endif()
|
||||
|
||||
target_sources(glslang PRIVATE ${GLSLANG_SOURCES})
|
||||
add_library(glslang STATIC ${GLSLANG_SOURCES})
|
||||
|
||||
target_compile_definitions(
|
||||
glslang
|
||||
PRIVATE #
|
||||
ENABLE_OPT=1 # spriv-tools
|
||||
ENABLE_HLSL=1 #
|
||||
)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(glslang PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
glslang
|
||||
PUBLIC ${GLSLANG}
|
||||
${GLSLANG}/glslang/Public
|
||||
${GLSLANG}/glslang/Include
|
||||
PRIVATE ${GLSLANG}/..
|
||||
${SPIRV_TOOLS}/include
|
||||
${SPIRV_TOOLS}/source
|
||||
)
|
||||
|
||||
30
cmake/bgfx/3rdparty/spirv-cross.cmake
vendored
30
cmake/bgfx/3rdparty/spirv-cross.cmake
vendored
@@ -16,21 +16,6 @@ endif()
|
||||
|
||||
set(SPIRV_CROSS ${BGFX_DIR}/3rdparty/spirv-cross)
|
||||
|
||||
add_library(spirv-cross STATIC)
|
||||
|
||||
target_compile_definitions(spirv-cross PRIVATE SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(spirv-cross PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
spirv-cross #
|
||||
PUBLIC #
|
||||
${SPIRV_CROSS} #
|
||||
PRIVATE #
|
||||
${SPIRV_CROSS}/include #
|
||||
)
|
||||
|
||||
file(
|
||||
GLOB
|
||||
SPIRV_CROSS_SOURCES
|
||||
@@ -59,4 +44,17 @@ file(
|
||||
${SPIRV_CROSS}/spirv_reflect.hpp
|
||||
)
|
||||
|
||||
target_sources(spirv-cross PRIVATE ${SPIRV_CROSS_SOURCES})
|
||||
add_library(spirv-cross STATIC ${SPIRV_CROSS_SOURCES})
|
||||
|
||||
target_compile_definitions(spirv-cross PRIVATE SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(spirv-cross PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
spirv-cross #
|
||||
PUBLIC #
|
||||
${SPIRV_CROSS} #
|
||||
PRIVATE #
|
||||
${SPIRV_CROSS}/include #
|
||||
)
|
||||
|
||||
40
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
40
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
@@ -17,20 +17,6 @@ endif()
|
||||
set(SPIRV_HEADERS ${BGFX_DIR}/3rdparty/spirv-headers)
|
||||
set(SPIRV_TOOLS ${BGFX_DIR}/3rdparty/spirv-tools)
|
||||
|
||||
add_library(spirv-opt STATIC)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(spirv-opt PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
spirv-opt
|
||||
PUBLIC ${SPIRV_TOOLS}/include #
|
||||
PRIVATE ${SPIRV_TOOLS} #
|
||||
${SPIRV_TOOLS}/include/generated #
|
||||
${SPIRV_TOOLS}/source #
|
||||
${SPIRV_HEADERS}/include #
|
||||
)
|
||||
|
||||
file(
|
||||
GLOB
|
||||
SPIRV_OPT_SOURCES
|
||||
@@ -84,16 +70,21 @@ file(
|
||||
${SPIRV_TOOLS}/source/spirv_validator_options.h
|
||||
${SPIRV_TOOLS}/source/table.cpp
|
||||
${SPIRV_TOOLS}/source/table.h
|
||||
${SPIRV_TOOLS}/source/table2.cpp
|
||||
${SPIRV_TOOLS}/source/table2.h
|
||||
${SPIRV_TOOLS}/source/text.cpp
|
||||
${SPIRV_TOOLS}/source/text.h
|
||||
${SPIRV_TOOLS}/source/text_handler.cpp
|
||||
${SPIRV_TOOLS}/source/text_handler.h
|
||||
${SPIRV_TOOLS}/source/to_string.cpp
|
||||
${SPIRV_TOOLS}/source/to_string.h
|
||||
${SPIRV_TOOLS}/source/util/bit_vector.cpp
|
||||
${SPIRV_TOOLS}/source/util/bit_vector.h
|
||||
${SPIRV_TOOLS}/source/util/bitutils.h
|
||||
${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
|
||||
@@ -122,12 +113,16 @@ file(
|
||||
${SPIRV_TOOLS}/source/val/validate_execution_limitations.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_extensions.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_function.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_graph.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_group.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_id.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_image.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_instruction.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_interfaces.cpp
|
||||
${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
|
||||
@@ -138,10 +133,25 @@ file(
|
||||
${SPIRV_TOOLS}/source/val/validate_primitives.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_ray_query.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_ray_tracing.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_ray_tracing_reorder.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_scopes.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_small_type_uses.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_tensor.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_tensor_layout.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_type.cpp
|
||||
${SPIRV_TOOLS}/source/val/validation_state.cpp
|
||||
)
|
||||
|
||||
target_sources(spirv-opt PRIVATE ${SPIRV_OPT_SOURCES})
|
||||
add_library(spirv-opt STATIC ${SPIRV_OPT_SOURCES})
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(spirv-opt PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
spirv-opt
|
||||
PUBLIC ${SPIRV_TOOLS}/include #
|
||||
PRIVATE ${SPIRV_TOOLS} #
|
||||
${SPIRV_TOOLS}/include/generated #
|
||||
${SPIRV_TOOLS}/source #
|
||||
${SPIRV_HEADERS}/include #
|
||||
)
|
||||
|
||||
98
cmake/bgfx/3rdparty/tint.cmake
vendored
Normal file
98
cmake/bgfx/3rdparty/tint.cmake
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
# bgfx.cmake - bgfx building in cmake
|
||||
# Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com>
|
||||
#
|
||||
# To the extent possible under law, the author(s) have dedicated all copyright
|
||||
# and related and neighboring rights to this software to the public domain
|
||||
# worldwide. This software is distributed without any warranty.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
if(TARGET tint)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(TINT_DIR ${BGFX_DIR}/3rdparty/dawn)
|
||||
set(SPIRV_HEADERS ${BGFX_DIR}/3rdparty/spirv-headers)
|
||||
set(SPIRV_TOOLS ${BGFX_DIR}/3rdparty/spirv-tools)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
TINT_SOURCES
|
||||
${TINT_DIR}/src/tint/utils/*.cc
|
||||
${TINT_DIR}/src/tint/utils/*.h
|
||||
${TINT_DIR}/src/tint/lang/core/*.cc
|
||||
${TINT_DIR}/src/tint/lang/core/*.h
|
||||
${TINT_DIR}/src/tint/lang/null/*.cc
|
||||
${TINT_DIR}/src/tint/lang/null/*.h
|
||||
${TINT_DIR}/src/tint/lang/spirv/*.cc
|
||||
${TINT_DIR}/src/tint/lang/spirv/*.h
|
||||
${TINT_DIR}/src/tint/lang/wgsl/*.cc
|
||||
${TINT_DIR}/src/tint/lang/wgsl/*.h
|
||||
${TINT_DIR}/src/tint/api/*.cc
|
||||
${TINT_DIR}/src/tint/api/*.h
|
||||
)
|
||||
|
||||
add_library(tint STATIC ${TINT_SOURCES})
|
||||
|
||||
set_target_properties(tint PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
tint
|
||||
PUBLIC ${TINT_DIR}
|
||||
${TINT_DIR}/src/tint
|
||||
PRIVATE ${TINT_DIR}/third_party/protobuf/src
|
||||
${TINT_DIR}/third_party/abseil-cpp
|
||||
${SPIRV_TOOLS}
|
||||
${SPIRV_TOOLS}/include
|
||||
${SPIRV_TOOLS}/include/generated
|
||||
${SPIRV_HEADERS}/include
|
||||
)
|
||||
|
||||
target_compile_definitions(
|
||||
tint
|
||||
PRIVATE TINT_BUILD_GLSL_WRITER=0
|
||||
TINT_BUILD_HLSL_WRITER=0
|
||||
TINT_BUILD_MSL_WRITER=0
|
||||
TINT_BUILD_NULL_WRITER=0
|
||||
TINT_BUILD_SPV_READER=1
|
||||
TINT_BUILD_SPV_WRITER=0
|
||||
TINT_BUILD_WGSL_READER=0
|
||||
TINT_BUILD_WGSL_WRITER=1
|
||||
TINT_ENABLE_IR_VALIDATION=0
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(
|
||||
tint
|
||||
PRIVATE TINT_BUILD_IS_LINUX=0
|
||||
TINT_BUILD_IS_MAC=0
|
||||
TINT_BUILD_IS_WIN=1
|
||||
)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(
|
||||
tint
|
||||
PRIVATE TINT_BUILD_IS_LINUX=0
|
||||
TINT_BUILD_IS_MAC=1
|
||||
TINT_BUILD_IS_WIN=0
|
||||
)
|
||||
else()
|
||||
target_compile_definitions(
|
||||
tint
|
||||
PRIVATE TINT_BUILD_IS_LINUX=1
|
||||
TINT_BUILD_IS_MAC=0
|
||||
TINT_BUILD_IS_WIN=0
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(
|
||||
tint
|
||||
PRIVATE "/Zc:preprocessor"
|
||||
)
|
||||
endif()
|
||||
15
cmake/bgfx/3rdparty/webgpu.cmake
vendored
15
cmake/bgfx/3rdparty/webgpu.cmake
vendored
@@ -24,4 +24,17 @@ target_include_directories(
|
||||
INTERFACE $<BUILD_INTERFACE:${BGFX_DIR}/3rdparty/webgpu/include>
|
||||
)
|
||||
|
||||
set_target_properties(webgpu PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
# These properties are not allowed on interface
|
||||
# set_target_properties(webgpu PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
|
||||
if(BGFX_INSTALL AND BGFX_CONFIG_RENDERER_WEBGPU)
|
||||
install(
|
||||
TARGETS webgpu
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
INCLUDES
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -12,9 +12,6 @@ include(bgfx.cmake)
|
||||
include(3rdparty/meshoptimizer.cmake)
|
||||
include(3rdparty/dear-imgui.cmake)
|
||||
|
||||
include(shared.cmake)
|
||||
include(examples.cmake)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE)
|
||||
include(texturev.cmake)
|
||||
endif()
|
||||
@@ -29,5 +26,9 @@ if(BGFX_BUILD_TOOLS_SHADER)
|
||||
include(3rdparty/glsl-optimizer.cmake)
|
||||
include(3rdparty/fcpp.cmake)
|
||||
include(3rdparty/webgpu.cmake)
|
||||
include(3rdparty/tint.cmake)
|
||||
include(shaderc.cmake)
|
||||
endif()
|
||||
|
||||
include(shared.cmake)
|
||||
include(examples.cmake)
|
||||
|
||||
@@ -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
|
||||
@@ -85,6 +87,11 @@ if(NOT ${BGFX_CONFIG_DEFAULT_MAX_ENCODERS} STREQUAL "")
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BGFX_WITH_WAYLAND)
|
||||
target_compile_definitions(bgfx PRIVATE "WL_EGL_PLATFORM=1")
|
||||
target_link_libraries(bgfx PRIVATE wayland-egl)
|
||||
endif()
|
||||
|
||||
set(BGFX_CONFIG_OPTIONS "")
|
||||
list(
|
||||
APPEND
|
||||
@@ -206,3 +213,22 @@ if(XCODE)
|
||||
${BGFX_DIR}/src/renderer_vk.cpp PROPERTIES LANGUAGE OBJCXX XCODE_EXPLICIT_FILE_TYPE sourcecode.cpp.objcpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
install(
|
||||
TARGETS bgfx
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
INCLUDES
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
|
||||
install(DIRECTORY ${BGFX_DIR}/include/bgfx DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
# header required for shader compilation
|
||||
install(FILES ${BGFX_DIR}/src/bgfx_shader.sh ${BGFX_DIR}/src/bgfx_compute.sh
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/bgfx"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -19,13 +19,10 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
string(SUBSTRING "${FILENAME}" 0 2 TYPE)
|
||||
if("${TYPE}" STREQUAL "fs")
|
||||
set(TYPE "FRAGMENT")
|
||||
set(D3D_PREFIX "ps")
|
||||
elseif("${TYPE}" STREQUAL "vs")
|
||||
set(TYPE "VERTEX")
|
||||
set(D3D_PREFIX "vs")
|
||||
elseif("${TYPE}" STREQUAL "cs")
|
||||
set(TYPE "COMPUTE")
|
||||
set(D3D_PREFIX "cs")
|
||||
else()
|
||||
set(TYPE "")
|
||||
endif()
|
||||
@@ -34,34 +31,23 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
set(COMMON FILE ${FILE} ${TYPE} INCLUDES ${BGFX_DIR}/src)
|
||||
set(OUTPUTS "")
|
||||
set(OUTPUTS_PRETTY "")
|
||||
set(OUTPUT_FILES "")
|
||||
set(COMMANDS "")
|
||||
|
||||
if(WIN32)
|
||||
# dx9
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
set(DX9_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/dx9/${FILENAME}.bin)
|
||||
_bgfx_shaderc_parse(
|
||||
DX9 ${COMMON} WINDOWS
|
||||
PROFILE ${D3D_PREFIX}_3_0
|
||||
O 3
|
||||
OUTPUT ${DX9_OUTPUT}
|
||||
)
|
||||
list(APPEND OUTPUTS "DX9")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}DX9, ")
|
||||
endif()
|
||||
|
||||
# dx11
|
||||
set(DX11_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/dx11/${FILENAME}.bin)
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
_bgfx_shaderc_parse(
|
||||
DX11 ${COMMON} WINDOWS
|
||||
PROFILE ${D3D_PREFIX}_5_0
|
||||
PROFILE s_5_0
|
||||
O 3
|
||||
OUTPUT ${DX11_OUTPUT}
|
||||
)
|
||||
else()
|
||||
_bgfx_shaderc_parse(
|
||||
DX11 ${COMMON} WINDOWS
|
||||
PROFILE ${D3D_PREFIX}_5_0
|
||||
PROFILE s_5_0
|
||||
O 1
|
||||
OUTPUT ${DX11_OUTPUT}
|
||||
)
|
||||
@@ -81,7 +67,7 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
# essl
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
set(ESSL_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/essl/${FILENAME}.bin)
|
||||
_bgfx_shaderc_parse(ESSL ${COMMON} ANDROID OUTPUT ${ESSL_OUTPUT})
|
||||
_bgfx_shaderc_parse(ESSL ${COMMON} ANDROID PROFILE 100_es OUTPUT ${ESSL_OUTPUT})
|
||||
list(APPEND OUTPUTS "ESSL")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}ESSL, ")
|
||||
endif()
|
||||
@@ -89,7 +75,7 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
# glsl
|
||||
set(GLSL_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/glsl/${FILENAME}.bin)
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
_bgfx_shaderc_parse(GLSL ${COMMON} LINUX PROFILE 120 OUTPUT ${GLSL_OUTPUT})
|
||||
_bgfx_shaderc_parse(GLSL ${COMMON} LINUX PROFILE 140 OUTPUT ${GLSL_OUTPUT})
|
||||
else()
|
||||
_bgfx_shaderc_parse(GLSL ${COMMON} LINUX PROFILE 430 OUTPUT ${GLSL_OUTPUT})
|
||||
endif()
|
||||
@@ -101,14 +87,18 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
set(SPIRV_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/spirv/${FILENAME}.bin)
|
||||
_bgfx_shaderc_parse(SPIRV ${COMMON} LINUX PROFILE spirv OUTPUT ${SPIRV_OUTPUT})
|
||||
list(APPEND OUTPUTS "SPIRV")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}SPIRV")
|
||||
set(OUTPUT_FILES "")
|
||||
set(COMMANDS "")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}SPIRV, ")
|
||||
endif()
|
||||
|
||||
# wgsl
|
||||
set(WGSL_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/wgsl/${FILENAME}.bin)
|
||||
_bgfx_shaderc_parse(WGSL ${COMMON} LINUX PROFILE wgsl OUTPUT ${WGSL_OUTPUT})
|
||||
list(APPEND OUTPUTS "WGSL")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}WGSL")
|
||||
|
||||
foreach(OUT ${OUTPUTS})
|
||||
list(APPEND OUTPUT_FILES ${${OUT}_OUTPUT})
|
||||
list(APPEND COMMANDS COMMAND "$<TARGET_FILE:shaderc>" ${${OUT}})
|
||||
list(APPEND COMMANDS COMMAND "bgfx::shaderc" ${${OUT}})
|
||||
get_filename_component(OUT_DIR ${${OUT}_OUTPUT} DIRECTORY)
|
||||
file(MAKE_DIRECTORY ${OUT_DIR})
|
||||
endforeach()
|
||||
@@ -152,24 +142,87 @@ function(add_example ARG_NAME)
|
||||
target_link_libraries(
|
||||
example-${ARG_NAME} PUBLIC bgfx bx bimg bimg_decode ${DEAR_IMGUI_LIBRARIES} ${MESHOPTIMIZER_LIBRARIES}
|
||||
)
|
||||
|
||||
if(BGFX_WITH_WAYLAND)
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_WAYLAND=1)
|
||||
endif()
|
||||
|
||||
if(BGFX_WITH_GLFW)
|
||||
find_package(glfw3 REQUIRED)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC glfw)
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_GLFW)
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_GLFW=1)
|
||||
elseif(BGFX_WITH_SDL)
|
||||
find_package(SDL2 REQUIRED)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC ${SDL2_LIBRARIES})
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_SDL)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_SDL=1)
|
||||
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC X11)
|
||||
endif()
|
||||
else()
|
||||
if(BGFX_INSTALL_EXAMPLES)
|
||||
add_executable(example-${ARG_NAME} WIN32 ${SOURCES})
|
||||
else()
|
||||
add_executable(example-${ARG_NAME} WIN32 EXCLUDE_FROM_ALL ${SOURCES})
|
||||
|
||||
if(ANDROID)
|
||||
target_include_directories(example-${ARG_NAME} PRIVATE ${BGFX_DIR}/3rdparty/native_app_glue)
|
||||
target_link_libraries(example-${ARG_NAME} INTERFACE android EGL GLESv2)
|
||||
endif()
|
||||
target_link_libraries(example-${ARG_NAME} example-common)
|
||||
|
||||
if(BGFX_BUILD_EXAMPLES)
|
||||
if(IOS OR WIN32)
|
||||
# on iOS we need to build a bundle so have to copy the data rather than symlink
|
||||
# and on windows we can't create symlinks
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${BGFX_DIR}/examples/runtime/
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>
|
||||
)
|
||||
else()
|
||||
# For everything else symlink some folders into our output directory
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/font
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/font
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/images
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/images
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/meshes
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/meshes
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/shaders
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/shaders
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/text
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/text
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/textures
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/textures
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else()
|
||||
if(ANDROID)
|
||||
add_library(example-${ARG_NAME} SHARED ${SOURCES})
|
||||
else()
|
||||
add_executable(example-${ARG_NAME} WIN32 ${SOURCES})
|
||||
endif()
|
||||
if(NOT BGFX_INSTALL_EXAMPLES)
|
||||
set_property(TARGET example-${ARG_NAME} PROPERTY EXCLUDE_FROM_ALL ON)
|
||||
endif()
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC example-common)
|
||||
configure_debugging(example-${ARG_NAME} WORKING_DIR ${BGFX_DIR}/examples/runtime)
|
||||
if(MSVC)
|
||||
set_target_properties(example-${ARG_NAME} PROPERTIES LINK_FLAGS "/ENTRY:\"mainCRTStartup\"")
|
||||
@@ -189,8 +242,10 @@ function(add_example ARG_NAME)
|
||||
endif()
|
||||
endif()
|
||||
target_compile_definitions(
|
||||
example-${ARG_NAME} PRIVATE "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_FORMAT_MACROS"
|
||||
"-DENTRY_CONFIG_IMPLEMENT_MAIN=1"
|
||||
example-${ARG_NAME}
|
||||
PRIVATE "-D_CRT_SECURE_NO_WARNINGS" #
|
||||
"-D__STDC_FORMAT_MACROS" #
|
||||
"-DENTRY_CONFIG_IMPLEMENT_MAIN=1" #
|
||||
)
|
||||
|
||||
# Configure shaders
|
||||
@@ -216,42 +271,6 @@ function(add_example ARG_NAME)
|
||||
|
||||
# Directory name
|
||||
set_target_properties(example-${ARG_NAME} PROPERTIES FOLDER "bgfx/examples")
|
||||
|
||||
if(IOS OR WIN32)
|
||||
# on iOS we need to build a bundle so have to copy the data rather than symlink
|
||||
# and on windows we can't create symlinks
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} COMMAND ${CMAKE_COMMAND} -E copy_directory ${BGFX_DIR}/examples/runtime/
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>
|
||||
)
|
||||
else()
|
||||
# For everything else symlink some folders into our output directory
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/font
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/font
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/images
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/images
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/meshes
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/meshes
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/shaders
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/shaders
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/text
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/text
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/textures
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/textures
|
||||
)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# Build all examples target
|
||||
@@ -261,17 +280,19 @@ if(BGFX_CUSTOM_TARGETS)
|
||||
endif()
|
||||
|
||||
# Add common library for examples
|
||||
add_example(
|
||||
common
|
||||
COMMON
|
||||
DIRECTORIES
|
||||
${BGFX_DIR}/examples/common/debugdraw
|
||||
${BGFX_DIR}/examples/common/entry
|
||||
${BGFX_DIR}/examples/common/font
|
||||
${BGFX_DIR}/examples/common/imgui
|
||||
${BGFX_DIR}/examples/common/nanovg
|
||||
${BGFX_DIR}/examples/common/ps
|
||||
)
|
||||
if(BGFX_BUILD_EXAMPLE_COMMON)
|
||||
add_example(
|
||||
common
|
||||
COMMON
|
||||
DIRECTORIES
|
||||
${BGFX_DIR}/examples/common/debugdraw
|
||||
${BGFX_DIR}/examples/common/entry
|
||||
${BGFX_DIR}/examples/common/font
|
||||
${BGFX_DIR}/examples/common/imgui
|
||||
${BGFX_DIR}/examples/common/nanovg
|
||||
${BGFX_DIR}/examples/common/ps
|
||||
)
|
||||
endif()
|
||||
|
||||
# Only add examples if set, otherwise we still need exmaples common for tools
|
||||
if(BGFX_BUILD_EXAMPLES)
|
||||
@@ -330,4 +351,11 @@ if(BGFX_BUILD_EXAMPLES)
|
||||
foreach(EXAMPLE ${BGFX_EXAMPLES})
|
||||
add_example(${EXAMPLE})
|
||||
endforeach()
|
||||
|
||||
if(BGFX_INSTALL_EXAMPLES)
|
||||
install(DIRECTORY ${BGFX_DIR}/examples/runtime/ DESTINATION examples)
|
||||
foreach(EXAMPLE ${BGFX_EXAMPLES})
|
||||
install(TARGETS example-${EXAMPLE} DESTINATION examples)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include "@BGFX_DIR@/src/shader.cpp"
|
||||
#include "@BGFX_DIR@/src/shader_dx9bc.cpp"
|
||||
#include "@BGFX_DIR@/src/shader_dxbc.cpp"
|
||||
#include "@BGFX_DIR@/src/shader_spirv.cpp"
|
||||
#include "@BGFX_DIR@/src/shader_spirv.cpp"
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
# 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/>.
|
||||
|
||||
add_executable(geometryc)
|
||||
|
||||
# Grab the geometryc source files
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
@@ -19,8 +17,8 @@ file(
|
||||
#
|
||||
${MESHOPTIMIZER_SOURCES}
|
||||
)
|
||||
add_executable(geometryc ${GEOMETRYC_SOURCES})
|
||||
|
||||
target_sources(geometryc PRIVATE ${GEOMETRYC_SOURCES})
|
||||
target_include_directories(geometryc PRIVATE ${MESHOPTIMIZER_INCLUDE_DIR})
|
||||
target_link_libraries(geometryc PRIVATE bx bgfx-vertexlayout ${MESHOPTIMIZER_LIBRARIES})
|
||||
target_compile_definitions(geometryc PRIVATE "-D_CRT_SECURE_NO_WARNINGS")
|
||||
@@ -29,10 +27,17 @@ set_target_properties(
|
||||
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}geometryc #
|
||||
)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_GEOMETRY AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools geometryc)
|
||||
if(BGFX_BUILD_TOOLS_GEOMETRY)
|
||||
add_executable(bgfx::geometryc ALIAS geometryc)
|
||||
if(BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools geometryc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
set_target_properties(geometryc PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER geometryc)
|
||||
endif()
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
install(TARGETS geometryc EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
@@ -8,15 +8,18 @@
|
||||
# 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/>.
|
||||
|
||||
add_executable(geometryv)
|
||||
|
||||
# Grab the geometryv source files
|
||||
file(GLOB_RECURSE GEOMETRYV_SOURCES #
|
||||
${BGFX_DIR}/tools/geometryv/*
|
||||
)
|
||||
|
||||
target_sources(geometryv PRIVATE ${GEOMETRYV_SOURCES})
|
||||
target_link_libraries(geometryv example-common)
|
||||
if(ANDROID)
|
||||
add_library(geometryv SHARED ${GEOMETRYV_SOURCES})
|
||||
else()
|
||||
add_executable(geometryv ${GEOMETRYV_SOURCES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(geometryv PRIVATE example-common)
|
||||
set_target_properties(
|
||||
geometryv PROPERTIES FOLDER "bgfx/tools" #
|
||||
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}geometryv #
|
||||
@@ -26,8 +29,14 @@ if(BGFX_BUILD_TOOLS_GEOMETRY AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools geometryv)
|
||||
endif()
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
if(ANDROID)
|
||||
set_property(TARGET geometryv PROPERTY PREFIX "")
|
||||
elseif(EMSCRIPTEN)
|
||||
target_link_options(geometryv PRIVATE -sMAX_WEBGL_VERSION=2)
|
||||
elseif(IOS)
|
||||
set_target_properties(geometryv PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER geometryv)
|
||||
endif()
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
install(TARGETS geometryv EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
@@ -8,28 +8,17 @@
|
||||
# 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/>.
|
||||
|
||||
add_executable(shaderc)
|
||||
|
||||
#target_include_directories(
|
||||
# shaderc
|
||||
# PRIVATE
|
||||
# ${BIMG_DIR}/include #
|
||||
# ${GLSL_OPTIMIZER}/include #
|
||||
# ${GLSL_OPTIMIZER}/src/mesa #
|
||||
# ${GLSL_OPTIMIZER}/src/mapi #
|
||||
# ${GLSL_OPTIMIZER}/src/glsl #
|
||||
#)
|
||||
|
||||
target_link_libraries(
|
||||
shaderc
|
||||
PRIVATE bx
|
||||
bgfx-vertexlayout
|
||||
fcpp
|
||||
glslang
|
||||
glsl-optimizer
|
||||
spirv-opt
|
||||
spirv-cross
|
||||
# Grab the shaderc source files
|
||||
file(
|
||||
GLOB
|
||||
SHADERC_SOURCES #
|
||||
${BGFX_DIR}/tools/shaderc/*.cpp #
|
||||
${BGFX_DIR}/tools/shaderc/*.h #
|
||||
${BGFX_DIR}/src/shader* #
|
||||
)
|
||||
|
||||
add_executable(shaderc ${SHADERC_SOURCES})
|
||||
|
||||
target_link_libraries(
|
||||
shaderc
|
||||
PRIVATE bx
|
||||
@@ -41,29 +30,42 @@ target_link_libraries(
|
||||
spirv-opt
|
||||
spirv-cross
|
||||
webgpu
|
||||
tint
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
shaderc
|
||||
PRIVATE ${BGFX_DIR}/3rdparty/dawn
|
||||
${BGFX_DIR}/3rdparty/dawn/src
|
||||
)
|
||||
|
||||
if(UNIX
|
||||
AND NOT APPLE
|
||||
AND NOT EMSCRIPTEN
|
||||
AND NOT ANDROID
|
||||
)
|
||||
target_include_directories(
|
||||
shaderc
|
||||
PRIVATE ${BGFX_DIR}/3rdparty/directx-headers/include/directx
|
||||
${BGFX_DIR}/3rdparty/directx-headers/include
|
||||
${BGFX_DIR}/3rdparty/directx-headers/include/wsl/stubs
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BGFX_AMALGAMATED)
|
||||
target_link_libraries(shaderc PRIVATE bgfx-shader)
|
||||
endif()
|
||||
|
||||
# Grab the shaderc source files
|
||||
file(
|
||||
GLOB
|
||||
SHADERC_SOURCES #
|
||||
${BGFX_DIR}/tools/shaderc/*.cpp #
|
||||
${BGFX_DIR}/tools/shaderc/*.h #
|
||||
${BGFX_DIR}/src/shader* #
|
||||
)
|
||||
|
||||
target_sources(shaderc PRIVATE ${SHADERC_SOURCES})
|
||||
|
||||
set_target_properties(
|
||||
shaderc PROPERTIES FOLDER "bgfx/tools" #
|
||||
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}shaderc #
|
||||
)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_SHADER AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools shaderc)
|
||||
if(BGFX_BUILD_TOOLS_SHADER)
|
||||
add_executable(bgfx::shaderc ALIAS shaderc)
|
||||
if(BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools shaderc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
@@ -71,3 +73,7 @@ if(ANDROID)
|
||||
elseif(IOS)
|
||||
set_target_properties(shaderc PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER shaderc)
|
||||
endif()
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
install(TARGETS shaderc EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
@@ -8,14 +8,17 @@
|
||||
# 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/>.
|
||||
|
||||
add_executable(texturev)
|
||||
|
||||
# Grab the texturev source files
|
||||
file(GLOB_RECURSE TEXTUREV_SOURCES #
|
||||
${BGFX_DIR}/tools/texturev/*
|
||||
)
|
||||
|
||||
target_sources(texturev PRIVATE ${TEXTUREV_SOURCES})
|
||||
if(ANDROID)
|
||||
add_library(texturev SHARED ${TEXTUREV_SOURCES})
|
||||
else()
|
||||
add_executable(texturev ${TEXTUREV_SOURCES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(texturev PRIVATE example-common)
|
||||
set_target_properties(
|
||||
texturev PROPERTIES FOLDER "bgfx/tools" #
|
||||
@@ -26,8 +29,14 @@ if(BGFX_BUILD_TOOLS_TEXTURE AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools texturev)
|
||||
endif()
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
if(ANDROID)
|
||||
set_property(TARGET texturev PROPERTY PREFIX "")
|
||||
elseif(EMSCRIPTEN)
|
||||
target_link_options(texturev PRIVATE -sMAX_WEBGL_VERSION=2)
|
||||
elseif(IOS)
|
||||
set_target_properties(texturev PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER texturev)
|
||||
endif()
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
install(TARGETS texturev EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,17 +14,6 @@ if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(bimg STATIC)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bimg PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
bimg PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/include>$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
PRIVATE ${ASTC_ENCODER_INCLUDE_DIR} #
|
||||
${MINIZ_INCLUDE_DIR} #
|
||||
)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
BIMG_SOURCES
|
||||
@@ -36,7 +25,16 @@ file(
|
||||
${MINIZ_SOURCES}
|
||||
)
|
||||
|
||||
target_sources(bimg PRIVATE ${BIMG_SOURCES})
|
||||
add_library(bimg STATIC ${BIMG_SOURCES})
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bimg PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
bimg PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/include>$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
PRIVATE ${ASTC_ENCODER_INCLUDE_DIR} #
|
||||
${MINIZ_INCLUDE_DIR} #
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
bimg
|
||||
@@ -44,3 +42,16 @@ target_link_libraries(
|
||||
${ASTC_ENCODER_LIBRARIES} #
|
||||
${MINIZ_LIBRARIES} #
|
||||
)
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
install(
|
||||
TARGETS bimg
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
INCLUDES
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
install(DIRECTORY ${BIMG_DIR}/include/bimg DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
endif()
|
||||
|
||||
@@ -14,7 +14,17 @@ if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(bimg_decode STATIC)
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
BIMG_DECODE_SOURCES #
|
||||
${BIMG_DIR}/include/* #
|
||||
${BIMG_DIR}/src/image_decode.* #
|
||||
#
|
||||
${LOADPNG_SOURCES} #
|
||||
${MINIZ_SOURCES} #
|
||||
)
|
||||
|
||||
add_library(bimg_decode STATIC ${BIMG_DECODE_SOURCES})
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bimg_decode PROPERTIES FOLDER "bgfx")
|
||||
@@ -26,18 +36,6 @@ target_include_directories(
|
||||
${TINYEXR_INCLUDE_DIR} #
|
||||
)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
BIMG_DECODE_SOURCES #
|
||||
${BIMG_DIR}/include/* #
|
||||
${BIMG_DIR}/src/image_decode.* #
|
||||
#
|
||||
${LOADPNG_SOURCES} #
|
||||
${MINIZ_SOURCES} #
|
||||
)
|
||||
|
||||
target_sources(bimg_decode PRIVATE ${BIMG_DECODE_SOURCES})
|
||||
|
||||
target_link_libraries(
|
||||
bimg_decode
|
||||
PUBLIC bx #
|
||||
@@ -45,3 +43,15 @@ target_link_libraries(
|
||||
${MINIZ_LIBRARIES} #
|
||||
${TINYEXR_LIBRARIES} #
|
||||
)
|
||||
|
||||
if(BGFX_INSTALL AND NOT BGFX_LIBRARY_TYPE MATCHES "SHARED")
|
||||
install(
|
||||
TARGETS bimg_decode
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
INCLUDES
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -85,3 +85,15 @@ foreach(flag "-Wno-class-memaccess" "-Wno-deprecated-copy")
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(BGFX_INSTALL AND NOT BGFX_LIBRARY_TYPE MATCHES "SHARED")
|
||||
install(
|
||||
TARGETS bimg_encode
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
INCLUDES
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -8,23 +8,25 @@
|
||||
# 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/>.
|
||||
|
||||
add_executable(texturec)
|
||||
|
||||
# Grab the texturec source files
|
||||
file(GLOB_RECURSE TEXTUREC_SOURCES #
|
||||
${BIMG_DIR}/tools/texturec/*.cpp #
|
||||
${BIMG_DIR}/tools/texturec/*.h #
|
||||
)
|
||||
|
||||
target_sources(texturec PRIVATE ${TEXTUREC_SOURCES})
|
||||
add_executable(texturec ${TEXTUREC_SOURCES})
|
||||
|
||||
target_link_libraries(texturec PRIVATE bimg_decode bimg_encode bimg)
|
||||
set_target_properties(
|
||||
texturec PROPERTIES FOLDER "bgfx/tools" #
|
||||
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}texturec #
|
||||
)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools texturec)
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE)
|
||||
add_executable(bgfx::texturec ALIAS texturec)
|
||||
if(BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools texturec)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
@@ -32,3 +34,7 @@ if(ANDROID)
|
||||
elseif(IOS)
|
||||
set_target_properties(texturec PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER texturec)
|
||||
endif()
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
install(TARGETS texturec EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
@@ -15,8 +15,6 @@ if(BGFX_BUILD_TOOLS_BIN2C)
|
||||
endif()
|
||||
|
||||
if(BGFX_BUILD_TESTS)
|
||||
add_executable(bx_test)
|
||||
target_compile_definitions(bx_test PRIVATE CATCH_AMALGAMATED_CUSTOM_MAIN)
|
||||
file(
|
||||
GLOB
|
||||
BX_TEST_SOURCES #
|
||||
@@ -25,11 +23,11 @@ if(BGFX_BUILD_TESTS)
|
||||
${BX_DIR}/tests/*.h #
|
||||
${BX_DIR}/tests/dbg.* #
|
||||
)
|
||||
target_sources(bx_test PRIVATE ${BX_TEST_SOURCES})
|
||||
add_executable(bx_test ${BX_TEST_SOURCES})
|
||||
target_compile_definitions(bx_test PRIVATE CATCH_AMALGAMATED_CUSTOM_MAIN)
|
||||
target_link_libraries(bx_test PRIVATE bx)
|
||||
add_test(NAME bx.test COMMAND bx_test)
|
||||
|
||||
add_executable(bx_bench)
|
||||
file(
|
||||
GLOB
|
||||
BX_BENCH_SOURCES #
|
||||
@@ -37,7 +35,7 @@ if(BGFX_BUILD_TESTS)
|
||||
${BX_DIR}/tests/*_bench.h #
|
||||
${BX_DIR}/tests/dbg.* #
|
||||
)
|
||||
target_sources(bx_bench PRIVATE ${BX_BENCH_SOURCES})
|
||||
add_executable(bx_bench ${BX_BENCH_SOURCES})
|
||||
target_link_libraries(bx_bench PRIVATE bx)
|
||||
add_test(NAME bx.bench COMMAND bx_bench)
|
||||
endif()
|
||||
|
||||
@@ -8,23 +8,25 @@
|
||||
# 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/>.
|
||||
|
||||
add_executable(bin2c)
|
||||
|
||||
# Grab the bin2c source files
|
||||
file(GLOB_RECURSE BIN2C_SOURCES #
|
||||
${BX_DIR}/tools/bin2c/*.cpp #
|
||||
${BX_DIR}/tools/bin2c/*.h #
|
||||
)
|
||||
|
||||
target_sources(bin2c PRIVATE ${BIN2C_SOURCES})
|
||||
add_executable(bin2c ${BIN2C_SOURCES})
|
||||
|
||||
target_link_libraries(bin2c PRIVATE bx)
|
||||
set_target_properties(
|
||||
bin2c PROPERTIES FOLDER "bgfx/tools" #
|
||||
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}bin2c #
|
||||
)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_BIN2C AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools bin2c)
|
||||
if(BGFX_BUILD_TOOLS_BIN2C)
|
||||
add_executable(bgfx::bin2c ALIAS bin2c)
|
||||
if(BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools bin2c)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
@@ -32,3 +34,7 @@ if(ANDROID)
|
||||
elseif(IOS)
|
||||
set_target_properties(bin2c PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER bin2c)
|
||||
endif()
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
install(TARGETS bin2c EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
@@ -16,32 +16,6 @@ endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
add_library(bx STATIC)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bx PROPERTIES FOLDER "bgfx")
|
||||
|
||||
# Build system specific configurations
|
||||
if(MINGW)
|
||||
set(BX_COMPAT_PLATFORM mingw)
|
||||
elseif(WIN32)
|
||||
set(BX_COMPAT_PLATFORM msvc)
|
||||
elseif(APPLE) # APPLE is technically UNIX... ORDERING MATTERS!
|
||||
set(BX_COMPAT_PLATFORM osx)
|
||||
elseif(UNIX)
|
||||
set(BX_COMPAT_PLATFORM linux)
|
||||
endif()
|
||||
|
||||
# Add include directory of bx
|
||||
target_include_directories(
|
||||
bx
|
||||
PUBLIC $<BUILD_INTERFACE:${BX_DIR}/include> #
|
||||
$<BUILD_INTERFACE:${BX_DIR}/3rdparty> #
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> #
|
||||
$<BUILD_INTERFACE:${BX_DIR}/include/compat/${BX_COMPAT_PLATFORM}> #
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/compat/${BX_COMPAT_PLATFORM}> #
|
||||
)
|
||||
|
||||
# Grab the bx source files
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
@@ -84,8 +58,36 @@ foreach(BX_SRC ${BX_NOBUILD})
|
||||
set_source_files_properties(${BX_SRC} PROPERTIES HEADER_FILE_ONLY ON)
|
||||
endforeach()
|
||||
|
||||
# Add sources to the project
|
||||
target_sources(bx PRIVATE ${BX_SOURCES})
|
||||
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")
|
||||
|
||||
# Build system specific configurations
|
||||
if(MINGW)
|
||||
set(BX_COMPAT_PLATFORM mingw)
|
||||
elseif(WIN32)
|
||||
set(BX_COMPAT_PLATFORM msvc)
|
||||
elseif(APPLE) # APPLE is technically UNIX... ORDERING MATTERS!
|
||||
set(BX_COMPAT_PLATFORM osx)
|
||||
elseif(UNIX)
|
||||
set(BX_COMPAT_PLATFORM linux)
|
||||
endif()
|
||||
|
||||
# Add include directory of bx
|
||||
target_include_directories(
|
||||
bx
|
||||
PUBLIC $<BUILD_INTERFACE:${BX_DIR}/include> #
|
||||
$<BUILD_INTERFACE:${BX_DIR}/3rdparty> #
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> #
|
||||
$<BUILD_INTERFACE:${BX_DIR}/include/compat/${BX_COMPAT_PLATFORM}> #
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/bx/compat/${BX_COMPAT_PLATFORM}> #
|
||||
)
|
||||
|
||||
# All configurations
|
||||
target_compile_definitions(bx PUBLIC "BX_CONFIG_DEBUG=$<IF:$<CONFIG:Debug>,1,$<BOOL:${BX_CONFIG_DEBUG}>>")
|
||||
@@ -95,7 +97,7 @@ target_compile_definitions(bx PUBLIC "__STDC_CONSTANT_MACROS")
|
||||
|
||||
target_compile_features(bx PUBLIC cxx_std_14)
|
||||
# (note: see bx\scripts\toolchain.lua for equivalent compiler flag)
|
||||
target_compile_options(bx PUBLIC $<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>)
|
||||
target_compile_options(bx PUBLIC $<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus /Zc:preprocessor>)
|
||||
|
||||
# Link against psapi on Windows
|
||||
if(WIN32)
|
||||
@@ -123,3 +125,19 @@ endif()
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bx PROPERTIES FOLDER "bgfx")
|
||||
|
||||
if(BGFX_INSTALL)
|
||||
install(
|
||||
TARGETS bx
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
)
|
||||
# We will make sure tinystl and compat are not installed in /usr/include
|
||||
install(DIRECTORY "${BX_DIR}/include/bx" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
install(DIRECTORY "${BX_DIR}/include/compat/${BX_COMPAT_PLATFORM}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/bx/compat"
|
||||
)
|
||||
install(DIRECTORY "${BX_DIR}/include/tinystl" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/bx")
|
||||
endif()
|
||||
|
||||
@@ -23,7 +23,7 @@ execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" -C bgfx rev-list --count HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_REV_COUNT
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
|
||||
)
|
||||
|
||||
# read version(100) from bgfx.idl
|
||||
|
||||
Reference in New Issue
Block a user