Compare commits

...

66 Commits

Author SHA1 Message Date
Jimmy Lord
d7f59648a8 ew option to allow "example-common" project to not be included in build. (#225)
* Added a new option to allow "example-common" project to not be included in build.

* Set BGFX_BUILD_EXAMPLE_COMMON as a dependent option, it will be set ON if either tools or examples are included in the build, OFF otherwise.

* cmake format

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: Sandy <bwrsandman@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-18 20:42:20 -04:00
dependabot[bot]
e8db646d2c build(deps): bump the submodules group with 2 updates
Bumps the submodules group with 2 updates: [bgfx](https://github.com/bkaradzic/bgfx) and [bx](https://github.com/bkaradzic/bx).


Updates `bgfx` from `0244cc4` to `57d8a08`
- [Commits](0244cc4af2...57d8a0838b)

Updates `bx` from `3072cf3` to `34ba9c7`
- [Commits](3072cf37df...34ba9c7a5c)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 21:44:55 -04:00
dependabot[bot]
e12aba94c7 build(deps): bump the submodules group with 3 updates
Bumps the submodules group with 3 updates: [bgfx](https://github.com/bkaradzic/bgfx), [bx](https://github.com/bkaradzic/bx) and [bimg](https://github.com/bkaradzic/bimg).


Updates `bgfx` from `56ad576` to `0244cc4`
- [Commits](56ad576dcd...0244cc4af2)

Updates `bx` from `dc3bf29` to `3072cf3`
- [Commits](dc3bf2990e...3072cf37df)

Updates `bimg` from `0903ea2` to `e9fa0ce`
- [Commits](0903ea21d5...e9fa0ceff2)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bimg
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 13:19:46 -04:00
dependabot[bot]
8dcc50e992 build(deps): bump the submodules group with 3 updates
Bumps the submodules group with 3 updates: [bgfx](https://github.com/bkaradzic/bgfx), [bx](https://github.com/bkaradzic/bx) and [bimg](https://github.com/bkaradzic/bimg).


Updates `bgfx` from `d9e1845` to `56ad576`
- [Commits](d9e184501f...56ad576dcd)

Updates `bx` from `e5d5d0b` to `dc3bf29`
- [Commits](e5d5d0b7c6...dc3bf2990e)

Updates `bimg` from `daedacc` to `0903ea2`
- [Commits](daedacc877...0903ea21d5)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bimg
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-01 23:36:37 -05:00
dependabot[bot]
011e8efe23 build(deps): bump the submodules group with 3 updates
Bumps the submodules group with 3 updates: [bgfx](https://github.com/bkaradzic/bgfx), [bx](https://github.com/bkaradzic/bx) and [bimg](https://github.com/bkaradzic/bimg).


Updates `bgfx` from `03a2c26` to `d9e1845`
- [Commits](03a2c26457...d9e184501f)

Updates `bx` from `03fd6f4` to `e5d5d0b`
- [Commits](03fd6f4771...e5d5d0b7c6)

Updates `bimg` from `678b750` to `daedacc`
- [Commits](678b750128...daedacc877)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bimg
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 12:15:14 -05:00
dependabot[bot]
871eed8f8a build(deps): bump the submodules group with 3 updates
Bumps the submodules group with 3 updates: [bgfx](https://github.com/bkaradzic/bgfx), [bx](https://github.com/bkaradzic/bx) and [bimg](https://github.com/bkaradzic/bimg).


Updates `bgfx` from `5de37d0` to `03a2c26`
- [Commits](5de37d0e22...03a2c26457)

Updates `bx` from `be3e348` to `03fd6f4`
- [Commits](be3e348eb2...03fd6f4771)

Updates `bimg` from `6c4d188` to `678b750`
- [Commits](6c4d1888eb...678b750128)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bimg
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-02 05:42:25 +01:00
Zone.N
2f0e950b8f Remove dx9 shader compilation option 2023-12-02 09:08:29 -05:00
dependabot[bot]
26af75d78b build(deps): bump the submodules group with 3 updates
Bumps the submodules group with 3 updates: [bgfx](https://github.com/bkaradzic/bgfx), [bx](https://github.com/bkaradzic/bx) and [bimg](https://github.com/bkaradzic/bimg).


Updates `bgfx` from `66b020e` to `5de37d0`
- [Commits](66b020e939...5de37d0e22)

Updates `bx` from `610b8e4` to `be3e348`
- [Commits](610b8e4df1...be3e348eb2)

Updates `bimg` from `dce2c35` to `6c4d188`
- [Commits](dce2c35a49...6c4d1888eb)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bimg
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-02 09:08:29 -05:00
dependabot[bot]
1f65bfcb44 build(deps): bump the submodules group with 3 updates
Bumps the submodules group with 3 updates: [bgfx](https://github.com/bkaradzic/bgfx), [bx](https://github.com/bkaradzic/bx) and [bimg](https://github.com/bkaradzic/bimg).


Updates `bgfx` from `3e5bfb8` to `66b020e`
- [Commits](3e5bfb81b6...66b020e939)

Updates `bx` from `16c5569` to `610b8e4`
- [Commits](16c55699c1...610b8e4df1)

Updates `bimg` from `ab96ba9` to `dce2c35`
- [Commits](ab96ba9dda...dce2c35a49)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bimg
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-03 11:16:06 -04:00
Sandy Carter
875927a712 _bgfx_shaderc_parse: Must have profile specified. 2023-10-01 18:44:37 -04:00
dependabot[bot]
f46699bb4a build(deps): bump the submodules group with 3 updates
Bumps the submodules group with 3 updates: [bgfx](https://github.com/bkaradzic/bgfx), [bx](https://github.com/bkaradzic/bx) and [bimg](https://github.com/bkaradzic/bimg).


Updates `bgfx` from `98f16cd` to `3e5bfb8`
- [Commits](98f16cd125...3e5bfb81b6)

Updates `bx` from `198cd12` to `16c5569`
- [Commits](198cd120e4...16c55699c1)

Updates `bimg` from `ec02df8` to `ab96ba9`
- [Commits](ec02df824a...ab96ba9dda)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bimg
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 18:44:37 -04:00
dependabot[bot]
6a8aba37ff build(deps): bump the submodules group with 1 update
Bumps the submodules group with 1 update: [bgfx](https://github.com/bkaradzic/bgfx).

- [Commits](8b6a6bdf0e...98f16cd125)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 08:02:07 -04:00
dependabot[bot]
38de01cd8a build(deps): bump the submodules group with 2 updates (#214)
* build(deps): bump the submodules group with 2 updates

Bumps the submodules group with 2 updates: [bgfx](https://github.com/bkaradzic/bgfx) and [bx](https://github.com/bkaradzic/bx).


Updates `bgfx` from `e2c5b1d` to `8b6a6bd`
- [Commits](e2c5b1d3e1...8b6a6bdf0e)

Updates `bx` from `96748d9` to `198cd12`
- [Commits](96748d9a58...198cd120e4)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update to c++17

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sandy <bwrsandman@gmail.com>
2023-08-01 14:36:58 -04:00
Sandy Carter
560dcb227e always run _bgfx_crosscompile_use_host_tool 2023-07-15 20:05:35 -04:00
Sandy Carter
b3dae62c95 Don't fail if installed from build without tools 2023-07-15 20:05:35 -04:00
Sandy Carter
a1a7828ab0 Fix the way headers are installed
Fix missing bx headers when compiling SHARED
Fix compat and tinystl being installed in include root
Move submodule specific installs to their respecive config files.
2023-07-14 23:28:00 -04:00
Sandy
11810052be Add missing ARRAY_NAME to bin2c example 2023-07-14 15:42:10 -04:00
dependabot[bot]
688224d5f0 build(deps): bump the submodules group with 2 updates
Bumps the submodules group with 2 updates: [bgfx](https://github.com/bkaradzic/bgfx) and [bx](https://github.com/bkaradzic/bx).


Updates `bgfx` from `e7e75e4` to `e2c5b1d`
- [Commits](e7e75e4bff...e2c5b1d3e1)

Updates `bx` from `7ac95d5` to `96748d9`
- [Commits](7ac95d5131...96748d9a58)

---
updated-dependencies:
- dependency-name: bgfx
  dependency-type: direct:production
  dependency-group: submodules
- dependency-name: bx
  dependency-type: direct:production
  dependency-group: submodules
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-06 21:26:04 -04:00
Sandy Carter
3c1f8bac82 add @bwrsandman as default reviewer 2023-07-06 20:26:35 -04:00
Sandy Carter
ec52497189 dependabot: Add groups, a beta feature 2023-07-06 20:15:50 -04:00
Sandy Carter
1925f436e7 dependabot: Add groups, a beta feature 2023-07-06 20:14:42 -04:00
Sandy Carter
b208d0c37b release: Fix typo in file directory 2023-06-11 09:09:45 -04:00
Sandy Carter
b5041def8e release: Isolate source from binaries 2023-06-11 08:29:30 -04:00
Sandy Carter
29b62260f6 Improve release archive names and structure 2023-06-11 08:11:49 -04:00
Sandy Carter
4cfb204f26 Use commas to separate artefacts 2023-06-11 07:25:09 -04:00
Sandy Carter
715b2a2c67 Debug artifact location 2023-06-11 06:26:34 -04:00
Sandy Carter
9d8213645b Fix artifact grepping 2023-06-11 05:40:26 -04:00
Sandy Carter
376cdd9205 fix typo in linux 2023-06-11 05:00:01 -04:00
Sandy Carter
9ad4a8a69a Compress repo folder 2023-06-11 04:19:43 -04:00
Sandy Carter
398b09ef17 Fix tar exclusion 2023-06-10 22:27:17 -04:00
Sandy Carter
0fc04361c8 fix directory 2023-06-10 21:46:04 -04:00
Sandy Carter
f5afee9379 Add built binaries to assets 2023-06-10 21:45:02 -04:00
Sandy Carter
16ae1476f0 Zip submodules 2023-06-10 20:55:21 -04:00
Sandy Carter
c2eb5368fa Auto generate release notes 2023-06-10 20:39:51 -04:00
Sandy Carter
86fa198254 Fix set output deprecation 2023-06-10 20:04:57 -04:00
Sandy Carter
84f51c4f0f update checkout action 2023-06-10 20:01:12 -04:00
Sandy Carter
fab7c74fa9 Release using submodules 2023-06-10 19:56:13 -04:00
Sandy Carter
b520b4686c Use ncipollo/release-action to release version
actions/create-release is no longer maintained
2023-06-10 19:16:59 -04:00
dependabot[bot]
dd8b8db87b build(deps): bump bgfx from 2902951 to e7e75e4 (#203) 2023-06-09 21:13:16 +00:00
dependabot[bot]
cbb7c340ba build(deps): bump bx from c5593ad to 7ac95d5
Bumps [bx](https://github.com/bkaradzic/bx) from `c5593ad` to `7ac95d5`.
- [Commits](c5593ad749...7ac95d5131)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-09 16:36:09 -04:00
dependabot[bot]
2a53415f03 build(deps): bump bgfx from 538c9a0 to 2902951 (#196) 2023-05-12 16:44:15 +00:00
Hristo Stamenov
7d89f8ee50 Fix setting the outputs correctly after the for loop since it was overriding the value for each shader. 2023-05-12 12:00:45 -04:00
Hristo Stamenov
487fa0c63b Refactored the conditions a bit 2023-05-02 00:55:01 -04:00
Hristo Iliev
9670cf4f43 Improvments on the shader compiler utility
The custom command didn't recognize bgfx::shaderc and the generator expression seems bettter. I also added an include option since it might be important to be able to define those.

Added changes to each of the cmake files to make sure bgfx:: is defined

Also add an output variable name parameter.

Co-Authored-By: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-02 00:55:01 -04:00
dependabot[bot]
0ab856a9dc build(deps): bump bgfx from 6f36b4f to 538c9a0
Bumps [bgfx](https://github.com/bkaradzic/bgfx) from `6f36b4f` to `538c9a0`.
- [Release notes](https://github.com/bkaradzic/bgfx/releases)
- [Commits](6f36b4fb3a...538c9a05eb)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-27 21:59:34 -04:00
dependabot[bot]
73a2b12c5e build(deps): bump bx from fa1411e to 4e67e34
Bumps [bx](https://github.com/bkaradzic/bx) from `fa1411e` to `4e67e34`.
- [Release notes](https://github.com/bkaradzic/bx/releases)
- [Commits](fa1411e4aa...4e67e34c4b)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-27 21:59:24 -04:00
Sandy Carter
4e42ca1ef5 Bump up minimum cmake version to 3.10.2 2023-02-19 09:04:28 -05:00
Sandy Carter
aaf627f912 cmake: test minimum cmake version 2023-02-19 09:04:28 -05:00
Sandy Carter
13fda4c089 install: Move install(TARGET) calls to target scope
CMake prior to 3.13 require  to be done in the same directory they were created
2023-02-19 09:04:28 -05:00
Sandy Carter
a6e266e326 Fix uses of sourceless exe/lib declarations
The feature to add targets without sources was added in cmake 3.11, in order to
be compatible with 3.6 and 3.11, target_sources call was removed
2023-02-19 09:04:28 -05:00
Sandy Carter
d671412cca webgpu: remove folder property 2023-02-19 09:04:28 -05:00
Sandy Carter
907dc5fbd7 Export bimg_encode and bimg_decode 2023-02-11 09:44:45 -05:00
Sandy Carter
a0f928864f version: remove newline from version number 2023-02-11 09:44:28 -05:00
Francis Hart
fad617f66f Ensure BX_DIR is converted to cmake style path
When using the BX_DIR, BIMG_DIR, and BGFX_DIR options to cmake, the
pathnames need to be converted to cmake style path. This ensures the
paths do not have mixed directory separators later on in the build,
which can cause build failures.
2023-02-11 09:44:13 -05:00
dependabot[bot]
fba0379121 build(deps): bump bgfx from bea82a1 to 6f36b4f
Bumps [bgfx](https://github.com/bkaradzic/bgfx) from `bea82a1` to `6f36b4f`.
- [Release notes](https://github.com/bkaradzic/bgfx/releases)
- [Commits](bea82a1343...6f36b4fb3a)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-09 19:58:33 -05:00
Jamil Halabi
a6cfe968a5 Updated to the latest bgfx 2023-01-22 09:31:31 -05:00
Sandy Carter
0479a929a7 example: Fix for android 2023-01-22 08:38:49 -05:00
Sandy Carter
e5fea62b02 tests: Enable tools tests on android 2023-01-22 08:38:49 -05:00
Sandy Carter
0a11910c2a actions: Add android cross compile test 2023-01-22 08:38:49 -05:00
Sandy Carter
1c31493614 Set -fPIC always 2023-01-21 22:43:28 -05:00
Sandy Carter
fb50e78e49 examples: Only copy assets once 2023-01-21 18:16:45 -05:00
Sandy Carter
cf8b57e65c Fix -fPIC for static 2023-01-21 18:16:45 -05:00
Sandy Carter
38d11732c7 ci: test building examples 2023-01-21 18:16:45 -05:00
Sandy Carter
b6c4027d20 examples: Bump gssl version to 140 for vs and fs 2023-01-21 18:16:45 -05:00
npnp
086fccf3a8 Removed D3D_PREFIX and changed profile values to match the current version of shaderc 2023-01-21 18:16:45 -05:00
Sandy Carter
034462fd2a Add option to prefix tool names to avoid conflicts
For example the shaderc is used by dawn and an installation might want to
prefix bgfx's shaderc with bgfx-shaderc
2023-01-21 16:05:46 -05:00
33 changed files with 1230 additions and 990 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1 @@
* @bwrsandman

View File

@@ -4,3 +4,8 @@ updates:
directory: "/"
schedule:
interval: "monthly"
groups:
# Name of the group
submodules:
patterns:
- "*"

View File

@@ -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.10.2
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt install -y libgl1-mesa-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,18 +53,13 @@ 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@v3
with:
submodules: recursive
submodules: recursive
- name: Install Linux dependencies
run: |
sudo apt-get update
@@ -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@v3
with:
submodules: recursive
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt install -y libgl1-mesa-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

View File

@@ -18,7 +18,7 @@ jobs:
sha: ${{ steps.version.outputs.sha }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
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,7 +51,7 @@ jobs:
CMAKE_INSTALL_DIR: ${{ github.workspace }}/install/
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Linux dependencies
@@ -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@v3
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@v3
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@v3
with:
name: windows-latest
path: ${{ github.workspace }}/install/windows/bgfx.cmake
- uses: actions/download-artifact@v3
with:
name: ubuntu-latest
path: ${{ github.workspace }}/install/linux/bgfx.cmake
- uses: actions/download-artifact@v3
with:
name: macos-latest
path: ${{ github.workspace }}/install/macos/bgfx.cmake
- name: Create Source Zip
uses: thedoctor0/zip-release@0.7.1
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.1
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.1
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.1
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.1
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.1
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.1
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.1
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

View File

@@ -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.10.2) # version supported by android studio
project(bgfx)
cmake_policy(SET CMP0054 NEW)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
@@ -36,7 +36,12 @@ cmake_dependent_option(BGFX_BUILD_TOOLS_BIN2C "Build bx binary to c converter."
cmake_dependent_option(BGFX_BUILD_TOOLS_SHADER "Build bgfx shader tools." ON BGFX_BUILD_TOOLS OFF)
cmake_dependent_option(BGFX_BUILD_TOOLS_GEOMETRY "Build bgfx geometry tools." ON BGFX_BUILD_TOOLS OFF)
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(
@@ -50,6 +55,7 @@ option(BGFX_CONFIG_DEBUG_ANNOTATION "Enable gfx debug annotations (default: on i
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")
@@ -70,11 +76,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()
@@ -96,6 +98,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)
@@ -103,10 +109,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)
@@ -122,7 +124,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)
@@ -156,77 +164,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

View File

@@ -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`

2
bgfx

Submodule bgfx updated: 5f435ea56b...57d8a0838b

2
bimg

Submodule bimg updated: 1af90543ca...e9fa0ceff2

2
bx

Submodule bx updated: aed1086c48...34ba9c7a5c

View File

@@ -9,28 +9,26 @@ 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 /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()
_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@")

View File

@@ -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

View File

@@ -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(

View File

@@ -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,23 @@ 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 #
PRIVATE ${GLSLANG}/.. #
${SPIRV_TOOLS}/include #
${SPIRV_TOOLS}/source #
)

View File

@@ -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 #
)

View File

@@ -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
@@ -138,10 +124,23 @@ 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_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 #
)

View File

@@ -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()

View File

@@ -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()
@@ -31,3 +28,6 @@ if(BGFX_BUILD_TOOLS_SHADER)
include(3rdparty/webgpu.cmake)
include(shaderc.cmake)
endif()
include(shared.cmake)
include(examples.cmake)

View File

@@ -206,3 +206,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()

View File

@@ -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()
@@ -36,32 +33,19 @@ function(add_bgfx_shader FILE FOLDER)
set(OUTPUTS_PRETTY "")
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 +65,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 +73,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()
@@ -108,7 +92,7 @@ function(add_bgfx_shader FILE FOLDER)
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()
@@ -160,16 +144,68 @@ function(add_example ARG_NAME)
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)
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} 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()
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 +225,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 +254,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 +263,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 +334,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()

View File

@@ -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"

View File

@@ -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,17 +17,27 @@ 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")
set_target_properties(geometryc PROPERTIES FOLDER "bgfx/tools")
set_target_properties(
geometryc PROPERTIES FOLDER "bgfx/tools" #
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()

View File

@@ -8,23 +8,35 @@
# 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)
set_target_properties(geometryv PROPERTIES FOLDER "bgfx/tools")
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 #
)
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()

View File

@@ -8,17 +8,16 @@
# 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)
# Grab the shaderc source files
file(
GLOB
SHADERC_SOURCES #
${BGFX_DIR}/tools/shaderc/*.cpp #
${BGFX_DIR}/tools/shaderc/*.h #
${BGFX_DIR}/src/shader* #
)
#target_include_directories(
# shaderc
# PRIVATE
# ${BIMG_DIR}/include #
# ${GLSL_OPTIMIZER}/include #
# ${GLSL_OPTIMIZER}/src/mesa #
# ${GLSL_OPTIMIZER}/src/mapi #
# ${GLSL_OPTIMIZER}/src/glsl #
#)
add_executable(shaderc ${SHADERC_SOURCES})
target_link_libraries(
shaderc
@@ -46,21 +45,16 @@ 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* #
set_target_properties(
shaderc PROPERTIES FOLDER "bgfx/tools" #
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}shaderc #
)
target_sources(shaderc PRIVATE ${SHADERC_SOURCES})
set_target_properties(geometryc PROPERTIES FOLDER "bgfx/tools")
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)
@@ -68,3 +62,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()

View File

@@ -8,23 +8,35 @@
# 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")
set_target_properties(
texturev PROPERTIES FOLDER "bgfx/tools" #
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}texturev #
)
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

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -8,20 +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})
target_link_libraries(texturec PRIVATE bimg_decode bimg_encode bimg)
set_target_properties(texturec PROPERTIES FOLDER "bgfx/tools")
add_executable(texturec ${TEXTUREC_SOURCES})
if(BGFX_BUILD_TOOLS_TEXTURE AND BGFX_CUSTOM_TARGETS)
add_dependencies(tools texturec)
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)
add_executable(bgfx::texturec ALIAS texturec)
if(BGFX_CUSTOM_TARGETS)
add_dependencies(tools texturec)
endif()
endif()
if(ANDROID)
@@ -29,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()

View File

@@ -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()

View File

@@ -8,20 +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})
target_link_libraries(bin2c PRIVATE bx)
set_target_properties(bin2c PROPERTIES FOLDER "bgfx/tools")
add_executable(bin2c ${BIN2C_SOURCES})
if(BGFX_BUILD_TOOLS_BIN2C AND BGFX_CUSTOM_TARGETS)
add_dependencies(tools bin2c)
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)
add_executable(bgfx::bin2c ALIAS bin2c)
if(BGFX_CUSTOM_TARGETS)
add_dependencies(tools bin2c)
endif()
endif()
if(ANDROID)
@@ -29,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()

View File

@@ -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,31 @@ 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})
# 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}>>")
@@ -123,3 +120,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()

View File

@@ -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