mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
Compare commits
37 Commits
v1.118.839
...
v1.118.839
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c31493614 | ||
|
|
fb50e78e49 | ||
|
|
cf8b57e65c | ||
|
|
38d11732c7 | ||
|
|
b6c4027d20 | ||
|
|
086fccf3a8 | ||
|
|
034462fd2a | ||
|
|
7da3b0ed77 | ||
|
|
b89e3acb3b | ||
|
|
ba2948e099 | ||
|
|
10501b78f4 | ||
|
|
8d130b923d | ||
|
|
eb5a7d5f07 | ||
|
|
1e2f0ce9aa | ||
|
|
052734d07a | ||
|
|
95a0a20a01 | ||
|
|
c1640a666b | ||
|
|
850c227403 | ||
|
|
2f2b00cc05 | ||
|
|
6f741542d9 | ||
|
|
e2c9bd0254 | ||
|
|
edb0b19c6f | ||
|
|
32508a2289 | ||
|
|
4f4e484333 | ||
|
|
067672c661 | ||
|
|
4a1f7581a6 | ||
|
|
03b690a4ab | ||
|
|
1c7ef2d48f | ||
|
|
03951e805c | ||
|
|
422e7cf0f8 | ||
|
|
9c1607365f | ||
|
|
576c2b9694 | ||
|
|
99537daccd | ||
|
|
e9b0bb3b6c | ||
|
|
d50eec41c1 | ||
|
|
34d0f372b1 | ||
|
|
87180e3b7e |
108
.cmake-format.py
108
.cmake-format.py
@@ -4,38 +4,82 @@
|
||||
with section("parse"):
|
||||
|
||||
# Specify structure for custom cmake functions
|
||||
additional_commands = { 'compile_shader_to_header': { 'kwargs': { 'OUTPUT_DIR': 1,
|
||||
'SHADERS': '+',
|
||||
'TYPE': 1,
|
||||
'VARYING_DEF': 1},
|
||||
'pargs': {'flags': [], 'nargs': '*'}},
|
||||
'get_profile_ext': {'pargs': {'nargs': 2}},
|
||||
'shaderc_parse': { 'kwargs': { 'BIN2C': 1,
|
||||
'DEFINES': '+',
|
||||
'FILE': 1,
|
||||
'INCLUDES': '+',
|
||||
'O': 1,
|
||||
'OUTPUT': 1,
|
||||
'PROFILE': 1,
|
||||
'VARYINGDEF': 1},
|
||||
'pargs': { 'flags': [ 'DEPENDS',
|
||||
'ANDROID',
|
||||
'ASM_JS',
|
||||
'IOS',
|
||||
'LINUX',
|
||||
'NACL',
|
||||
'OSX',
|
||||
'WINDOWS',
|
||||
'PREPROCESS',
|
||||
'RAW',
|
||||
'FRAGMENT',
|
||||
'VERTEX',
|
||||
'COMPUTE',
|
||||
'VERBOSE',
|
||||
'DEBUG',
|
||||
'DISASM',
|
||||
'WERROR'],
|
||||
'nargs': '1+'}}}
|
||||
additional_commands = { '_bgfx_bin2c_parse': { 'kwargs': { 'ARRAY_NAME': 1,
|
||||
'INPUT_FILE': 1,
|
||||
'OUTPUT_FILE': 1},
|
||||
'pargs': {'flags': [], 'nargs': '*'}},
|
||||
'_bgfx_get_profile_ext': {'pargs': {'nargs': 2}},
|
||||
'_bgfx_shaderc_parse': { 'kwargs': { 'BIN2C': 1,
|
||||
'DEFINES': '+',
|
||||
'FILE': 1,
|
||||
'INCLUDES': '+',
|
||||
'O': 1,
|
||||
'OUTPUT': 1,
|
||||
'PROFILE': 1,
|
||||
'VARYINGDEF': 1},
|
||||
'pargs': { 'flags': [ 'DEPENDS',
|
||||
'ANDROID',
|
||||
'ASM_JS',
|
||||
'IOS',
|
||||
'LINUX',
|
||||
'NACL',
|
||||
'OSX',
|
||||
'WINDOWS',
|
||||
'PREPROCESS',
|
||||
'RAW',
|
||||
'FRAGMENT',
|
||||
'VERTEX',
|
||||
'COMPUTE',
|
||||
'VERBOSE',
|
||||
'DEBUG',
|
||||
'DISASM',
|
||||
'WERROR'],
|
||||
'nargs': '1+'}},
|
||||
'_bgfx_texturec_parse': { 'kwargs': { 'AS': 1,
|
||||
'FILE': 1,
|
||||
'FORMAT': 1,
|
||||
'MAX': 1,
|
||||
'MIPSKIP': 1,
|
||||
'OUTPUT': 1,
|
||||
'QUALITY': 1,
|
||||
'RADIANCE': 1,
|
||||
'REF': 1},
|
||||
'pargs': { 'flags': [ 'MIPS',
|
||||
'NORMALMAP',
|
||||
'EQUIRECT',
|
||||
'STRIP',
|
||||
'SDF',
|
||||
'IQA',
|
||||
'PMA',
|
||||
'LINEAR'],
|
||||
'nargs': '*'}},
|
||||
'bgfx_compile_binary_to_header': { 'kwargs': { 'ARRAY_NAME': 1,
|
||||
'INPUT_FILE': 1,
|
||||
'OUTPUT_FILE': 1},
|
||||
'pargs': {'flags': [], 'nargs': '*'}},
|
||||
'bgfx_compile_shader_to_header': { 'kwargs': { 'OUTPUT_DIR': 1,
|
||||
'SHADERS': '+',
|
||||
'TYPE': 1,
|
||||
'VARYING_DEF': 1},
|
||||
'pargs': {'flags': [], 'nargs': '*'}},
|
||||
'bgfx_compile_texture': { 'kwargs': { 'AS': 1,
|
||||
'FILE': 1,
|
||||
'FORMAT': 1,
|
||||
'MAX': 1,
|
||||
'MIPSKIP': 1,
|
||||
'OUTPUT': 1,
|
||||
'QUALITY': 1,
|
||||
'RADIANCE': 1,
|
||||
'REF': 1},
|
||||
'pargs': { 'flags': [ 'MIPS',
|
||||
'NORMALMAP',
|
||||
'EQUIRECT',
|
||||
'STRIP',
|
||||
'SDF',
|
||||
'IQA',
|
||||
'PMA',
|
||||
'LINEAR'],
|
||||
'nargs': '*'}}}
|
||||
|
||||
# Override configurations per-command where available
|
||||
override_spec = {}
|
||||
|
||||
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
@@ -55,4 +55,9 @@ 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
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -13,4 +13,9 @@ install_manifest.txt
|
||||
generated/*
|
||||
!generated/*.in
|
||||
cmake_install.cmake
|
||||
.cache/
|
||||
.cache/
|
||||
.vscode/
|
||||
.idea/
|
||||
Makefile
|
||||
install*/
|
||||
cmake-build-*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# 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.1)
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
project(bgfx)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
|
||||
@@ -26,16 +26,23 @@ 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)
|
||||
option(BX_CONFIG_DEBUG "Log debug messages (default: on in debug)" OFF)
|
||||
option(BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF)
|
||||
option(BGFX_BUILD_TOOLS "Build bgfx tools." ON)
|
||||
option(BGFX_BUILD_TOOLS_SHADER "Build bgfx shader tools." ON)
|
||||
option(BGFX_BUILD_TOOLS_GEOMETRY "Build bgfx geometry tools." ON)
|
||||
option(BGFX_BUILD_TOOLS_TEXTURE "Build bgfx texture tools." ON)
|
||||
cmake_dependent_option(BGFX_BUILD_TOOLS_BIN2C "Build bx binary to c converter." ON BGFX_BUILD_TOOLS OFF)
|
||||
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)
|
||||
option(BGFX_BUILD_TESTS "Build bgfx tests." OFF)
|
||||
option(BGFX_INSTALL "Create installation target." ON)
|
||||
option(BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF)
|
||||
cmake_dependent_option(
|
||||
BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF "BGFX_INSTALL;BGFX_BUILD_EXAMPLES" OFF
|
||||
)
|
||||
option(BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON)
|
||||
option(BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON)
|
||||
option(BGFX_CONFIG_RENDERER_WEBGPU "Enable the webgpu renderer" OFF)
|
||||
@@ -44,6 +51,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")
|
||||
@@ -58,11 +66,16 @@ set(BGFX_CONFIG_MAX_TEXTURES "" CACHE STRING "Specify maximum texture count")
|
||||
set(BGFX_CONFIG_MAX_TEXTURE_SAMPLERS "" CACHE STRING "Specify maximum texture samplers")
|
||||
set(BGFX_CONFIG_MAX_SHADERS "" CACHE STRING "Specify shader count")
|
||||
set(BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM "" CACHE STRING "Specify maximum program count as 2^(program bits)")
|
||||
set(BGFX_CMAKE_USER_SCRIPT "" CACHE STRING "Path to custom cmake script to include")
|
||||
|
||||
set_property(CACHE BGFX_LIBRARY_TYPE PROPERTY STRINGS STATIC SHARED)
|
||||
if(BGFX_CMAKE_USER_SCRIPT)
|
||||
include(${BGFX_CMAKE_USER_SCRIPT})
|
||||
endif()
|
||||
|
||||
if(BGFX_LIBRARY_TYPE MATCHES "SHARED")
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
if(BGFX_BUILD_TESTS)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
if(NOT BX_DIR)
|
||||
@@ -83,19 +96,14 @@ endif()
|
||||
|
||||
# sets project version from api ver / git rev
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cmake)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/shared.cmake)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bx.cmake)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bimg.cmake)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bgfx.cmake)
|
||||
|
||||
if(BGFX_BUILD_TOOLS)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools.cmake)
|
||||
if(BGFX_BUILD_TOOLS AND BGFX_CUSTOM_TARGETS)
|
||||
add_custom_target(tools)
|
||||
set_target_properties(tools PROPERTIES FOLDER "bgfx/tools")
|
||||
endif()
|
||||
|
||||
if(BGFX_BUILD_TOOLS OR BGFX_BUILD_EXAMPLES)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/examples.cmake)
|
||||
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)
|
||||
@@ -130,6 +138,15 @@ if(BGFX_INSTALL)
|
||||
# Use variables:
|
||||
# * TARGETS_EXPORT_NAME
|
||||
# * PROJECT_NAME
|
||||
# * BGFX_CMAKE_USER_SCRIPT_PRESENT
|
||||
# * BGFX_CMAKE_USER_SCRIPT_INSTALL_NAME
|
||||
if(BGFX_CMAKE_USER_SCRIPT STREQUAL "")
|
||||
set(BGFX_CMAKE_USER_SCRIPT_PRESENT OFF)
|
||||
set(BGFX_CMAKE_USER_SCRIPT_INSTALL_NAME "NOT-USED")
|
||||
else()
|
||||
set(BGFX_CMAKE_USER_SCRIPT_PRESENT ON)
|
||||
get_filename_component(BGFX_CMAKE_USER_SCRIPT_INSTALL_NAME ${BGFX_CMAKE_USER_SCRIPT} NAME)
|
||||
endif()
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in" "${project_config}"
|
||||
INSTALL_DESTINATION "${config_install_dir}"
|
||||
@@ -148,17 +165,7 @@ if(BGFX_INSTALL)
|
||||
)
|
||||
if(NOT BGFX_LIBRARY_TYPE MATCHES "SHARED")
|
||||
install(
|
||||
TARGETS bimg
|
||||
bx
|
||||
astc-encoder
|
||||
edtaa3
|
||||
etc1
|
||||
etc2
|
||||
iqa
|
||||
squish
|
||||
nvtt
|
||||
pvrtc
|
||||
tinyexr
|
||||
TARGETS bimg bx
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
@@ -192,19 +199,23 @@ if(BGFX_INSTALL)
|
||||
)
|
||||
|
||||
# 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)
|
||||
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()
|
||||
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
|
||||
|
||||
128
README.md
128
README.md
@@ -1,13 +1,11 @@
|
||||
bgfx.cmake
|
||||
==========
|
||||
# bgfx.cmake
|
||||
[](https://github.com/bkaradzic/bgfx.cmake/workflows/Release/badge.svg)
|
||||
|
||||
**NOTE: This port only made to be used as C++ library, some features (such as bindings) might not work! For those features, please use original repo with GENie instead.**
|
||||
|
||||
This repo contains cmake configuration files that can be used to build bgfx with CMake.
|
||||
|
||||
Building
|
||||
---
|
||||
## Building
|
||||
|
||||
```bash
|
||||
git clone https://github.com/bkaradzic/bgfx.cmake.git
|
||||
@@ -20,12 +18,10 @@ cmake --build cmake-build
|
||||
|
||||
If downloading via zip (instead of using git submodules) manually download bx, bimg and bgfx and copy them into the root directory, or locate them via `BX_DIR`, `BIMG_DIR` and `BGFX_DIR` CMake variables.
|
||||
|
||||
How To Use
|
||||
----------
|
||||
## How To Use
|
||||
This project is setup to be included a few different ways. To include bgfx source code in your project simply use add_subdirectory to include this project. To build bgfx binaries build the `INSTALL` target (or `make install`). The installed files will be in the directory specified by `CMAKE_INSTALL_PREFIX` which we recommend you set to `./install` so it will export to your build directory. Note you may want to build install on both `Release` and `Debug` configurations.
|
||||
|
||||
Features
|
||||
--------
|
||||
## Features
|
||||
* No outside dependencies besides bx, bimg, bgfx, and CMake.
|
||||
* Tested on
|
||||
* Windows, OSX, Linux, Android, UWP, Emscripten (experimental)
|
||||
@@ -33,6 +29,118 @@ Features
|
||||
* Compiles bgfx, tools & examples.
|
||||
* Detects shader modifications and automatically rebuilds them for all examples.
|
||||
|
||||
Does this work with latest bx/bgfx/bimg?
|
||||
----------------------------------------
|
||||
## Added cmake commands
|
||||
bgfx.cmake will install `bgfxToolUtils.cmake` which has useful cmake functions for using bgfx's tools:
|
||||
|
||||
### `bgfx_compile_binary_to_header`
|
||||
Add a build rule for a binary file to the generated build system using bin2c.
|
||||
```cmake
|
||||
bgfx_compile_binary_to_header(
|
||||
INPUT_FILE filename
|
||||
OUTPUT_FILE filename
|
||||
ARRAY_NAME name
|
||||
)
|
||||
```
|
||||
This defines a bin2c command to generate a specified `OUTPUT_FILE` header with an array `ARRAY_NAME` with the binary representation of a `INPUT_FILE` file.
|
||||
|
||||
Adding these `INPUT_FILE` as source files to a target will run `bin2c` at build time and they will rebuild if either the contents of the `INPUT_FILE` change.
|
||||
|
||||
#### Examples: Generating an image as a header
|
||||
```cmake
|
||||
bgfx_compile_binary_to_header(
|
||||
INPUT_FILE image.png
|
||||
OUTPUT_FILE ${CMAKE_BINARY_DIR}/include/generated/images/image.png.h
|
||||
)
|
||||
add_library(myLib image.png)
|
||||
target_include_directories(myLib ${CMAKE_BINARY_DIR}/include/generated/images)
|
||||
```
|
||||
|
||||
```cpp
|
||||
// main.cpp
|
||||
#include <image.png.h>
|
||||
```
|
||||
|
||||
### `bgfx_compile_texture`
|
||||
Add a build rule for a texture to the generated build system be compiled using texturec.
|
||||
```cmake
|
||||
bgfx_compile_texture(
|
||||
FILE filename
|
||||
OUTPUT filename
|
||||
[FORMAT format]
|
||||
[QUALITY default|fastest|highest]
|
||||
[MIPS]
|
||||
[MIPSKIP N]
|
||||
[NORMALMAP]
|
||||
[EQUIRECT]
|
||||
[STRIP]
|
||||
[SDF]
|
||||
[REF alpha]
|
||||
[IQA]
|
||||
[PMA]
|
||||
[LINEAR]
|
||||
[MAX max size]
|
||||
[RADIANCE model]
|
||||
[AS extension]
|
||||
)
|
||||
```
|
||||
|
||||
### `bgfx_compile_shader_to_header`
|
||||
Add a build rule for a `*.sc` shader to the generated build system using shaderc.
|
||||
```cmake
|
||||
bgfx_compile_shader_to_header(
|
||||
TYPE VERTEX|FRAGMENT|COMPUTE
|
||||
SHADERS filenames
|
||||
VARYING_DEF filename
|
||||
OUTPUT_DIR directory
|
||||
)
|
||||
```
|
||||
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`.
|
||||
|
||||
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.
|
||||
|
||||
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(
|
||||
TYPE VERTEX
|
||||
SHADERS vs.sc
|
||||
VARYING_DEF varying.def.sc
|
||||
OUTPUT_DIR ${CMAKE_BINARY_DIR}/include/generated/shaders
|
||||
)
|
||||
bgfx_compile_shader_to_header(
|
||||
TYPE FRAGMENT
|
||||
SHADERS fs.sc
|
||||
VARYING_DEF ${CMAKE_SOURCE_DIR}/varying.def.sc
|
||||
OUTPUT_DIR ${CMAKE_BINARY_DIR}/include/generated/shaders
|
||||
)
|
||||
|
||||
add_library(myLib main.cpp vs.sc fs.sc)
|
||||
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>
|
||||
#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>
|
||||
#endif // defined(_WIN32)
|
||||
#if __APPLE__
|
||||
#include <vs.sc.mtl.bin.h>
|
||||
#include <fs.sc.mtl.bin.h>
|
||||
#endif // __APPLE__
|
||||
|
||||
const bgfx::EmbeddedShader k_vs = BGFX_EMBEDDED_SHADER(vs);
|
||||
const bgfx::EmbeddedShader k_fs = BGFX_EMBEDDED_SHADER(fs);
|
||||
```
|
||||
|
||||
## Does this work with latest bx/bgfx/bimg?
|
||||
Probably! This project needs to be updated if a dependency is added or the bgfx build system changes. The bgfx repository is very active but these types of changes are rare. New examples have to be added manually as well, but not doing so will merely result in that example not showing up and won't break anything else. If pulling latest causes issues, be sure to manually reconfigure CMake as the glob patterns may need to be refreshed (the use of glob patterns in CMake is generally discouraged but in this project it helps to ensure upwards compatibilty with newer bgfx updates).
|
||||
|
||||
24
cmake/3rdparty/astc-encoder.cmake
vendored
24
cmake/3rdparty/astc-encoder.cmake
vendored
@@ -1,24 +0,0 @@
|
||||
# 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 astc-encoder)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB ASTC_ENCODER_SOURCES ${BIMG_DIR}/3rdparty/astc-encoder/source/*.cpp
|
||||
${BIMG_DIR}/3rdparty/astc-encoder/include/*.h
|
||||
)
|
||||
|
||||
add_library(astc-encoder STATIC ${ASTC_ENCODER_SOURCES})
|
||||
target_include_directories(
|
||||
astc-encoder PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty> $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/astc-encoder>
|
||||
$<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/astc-encoder/include>
|
||||
)
|
||||
set_target_properties(astc-encoder PROPERTIES FOLDER "bgfx/3rdparty")
|
||||
23
cmake/3rdparty/dear-imgui.cmake
vendored
23
cmake/3rdparty/dear-imgui.cmake
vendored
@@ -1,23 +0,0 @@
|
||||
# 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 dear-imgui)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB dear_IMGUI_SOURCES ${BGFX_DIR}/3rdparty/dear-imgui/*.cpp ${BGFX_DIR}/3rdparty/dear-imgui/*.h
|
||||
${BGFX_DIR}/3rdparty/dear-imgui/*.inl
|
||||
)
|
||||
|
||||
add_library(dear-imgui STATIC EXCLUDE_FROM_ALL ${dear_IMGUI_SOURCES})
|
||||
target_compile_definitions(dear-imgui PRIVATE "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_FORMAT_MACROS")
|
||||
target_include_directories(dear-imgui PUBLIC ${BGFX_DIR}/3rdparty)
|
||||
target_link_libraries(dear-imgui PUBLIC bx)
|
||||
set_target_properties(dear-imgui PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
26
cmake/3rdparty/fcpp.cmake
vendored
26
cmake/3rdparty/fcpp.cmake
vendored
@@ -1,26 +0,0 @@
|
||||
# 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 fcpp)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB FCPP_SOURCES ${BGFX_DIR}/3rdparty/fcpp/*.c ${BGFX_DIR}/3rdparty/fcpp/*.h)
|
||||
|
||||
add_library(fcpp STATIC ${FCPP_SOURCES})
|
||||
target_include_directories(fcpp PUBLIC ${BGFX_DIR}/3rdparty/fcpp)
|
||||
target_compile_definitions(fcpp PRIVATE NINCLUDE=64 NWORK=65536 NBUFF=65536 OLD_PREPROCESSOR=0)
|
||||
|
||||
if(MSVC)
|
||||
set_target_properties(fcpp PROPERTIES COMPILE_FLAGS "/W0")
|
||||
endif()
|
||||
|
||||
set_target_properties(fcpp PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
set_source_files_properties(${BGFX_DIR}/3rdparty/fcpp/usecpp.c PROPERTIES HEADER_FILE_ONLY ON)
|
||||
80
cmake/3rdparty/glsl-optimizer.cmake
vendored
80
cmake/3rdparty/glsl-optimizer.cmake
vendored
@@ -1,80 +0,0 @@
|
||||
# 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 glsl-optimizer)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(GLSL-OPTIMIZER_INCLUDES
|
||||
${BGFX_DIR}/3rdparty/glsl-optimizer/include ${BGFX_DIR}/3rdparty/glsl-optimizer/src/mesa
|
||||
${BGFX_DIR}/3rdparty/glsl-optimizer/src/mapi ${BGFX_DIR}/3rdparty/glsl-optimizer/src/glsl
|
||||
${BGFX_DIR}/3rdparty/glsl-optimizer/src
|
||||
)
|
||||
|
||||
# glsl-optimizer makes UBSan segfault for whatever reason
|
||||
# We already know that it's full of UB anyway... so just don't build it with UBSan
|
||||
string(REPLACE "-fsanitize=undefined" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REPLACE "-fsanitize=undefined" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# glcpp
|
||||
file(GLOB GLCPP_SOURCES ${BGFX_DIR}/3rdparty/glsl-optimizer/src/glsl/glcpp/*.c
|
||||
${BGFX_DIR}/3rdparty/glsl-optimizer/src/util/*.c
|
||||
)
|
||||
# Library must be static because hash_table_ctor referenced in function glcpp_parser_create
|
||||
add_library(glcpp STATIC ${GLCPP_SOURCES})
|
||||
target_include_directories(glcpp PUBLIC ${GLSL-OPTIMIZER_INCLUDES})
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
target_compile_options(glcpp PRIVATE "-fno-strict-aliasing")
|
||||
endif()
|
||||
if(MSVC)
|
||||
set_target_properties(glcpp PROPERTIES COMPILE_FLAGS "/W0")
|
||||
endif()
|
||||
set_target_properties(glcpp PROPERTIES FOLDER "bgfx/3rdparty")
|
||||
|
||||
# mesa
|
||||
file(GLOB MESA_SOURCES ${BGFX_DIR}/3rdparty/glsl-optimizer/src/mesa/program/*.c
|
||||
${BGFX_DIR}/3rdparty/glsl-optimizer/src/mesa/main/*.c
|
||||
)
|
||||
# Library must be static because mesa/program/prog_hash_table.c uses _mesa_error_no_memory which is in glsl/standalone_scaffolding.cpp of glsl-optimizer
|
||||
add_library(mesa STATIC ${MESA_SOURCES})
|
||||
target_include_directories(mesa PUBLIC ${GLSL-OPTIMIZER_INCLUDES})
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
target_compile_options(mesa PRIVATE "-fno-strict-aliasing")
|
||||
endif()
|
||||
if(MSVC)
|
||||
set_target_properties(mesa PROPERTIES COMPILE_FLAGS "/W0")
|
||||
endif()
|
||||
set_target_properties(mesa PROPERTIES FOLDER "bgfx/3rdparty")
|
||||
|
||||
# glsl-optimizer
|
||||
file(GLOB GLSL-OPTIMIZER_SOURCES ${BGFX_DIR}/3rdparty/glsl-optimizer/src/glsl/*.cpp
|
||||
${BGFX_DIR}/3rdparty/glsl-optimizer/src/glsl/*.c
|
||||
)
|
||||
file(GLOB GLSL-OPTIMIZER_SOURCES_REMOVE ${BGFX_DIR}/3rdparty/glsl-optimizer/src/glsl/main.cpp
|
||||
${BGFX_DIR}/3rdparty/glsl-optimizer/src/glsl/builtin_stubs.cpp
|
||||
)
|
||||
list(REMOVE_ITEM GLSL-OPTIMIZER_SOURCES ${GLSL-OPTIMIZER_SOURCES_REMOVE})
|
||||
add_library(glsl-optimizer STATIC ${GLSL-OPTIMIZER_SOURCES})
|
||||
target_link_libraries(glsl-optimizer glcpp mesa)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
target_compile_options(
|
||||
glsl-optimizer PRIVATE -fno-strict-aliasing -Wno-implicit-fallthrough -Wno-parentheses -Wno-sign-compare
|
||||
-Wno-unused-function -Wno-unused-parameter
|
||||
)
|
||||
endif()
|
||||
if(MSVC)
|
||||
set_target_properties(glsl-optimizer PROPERTIES COMPILE_FLAGS "/W0")
|
||||
target_compile_definitions(
|
||||
glsl-optimizer PRIVATE __STDC__ __STDC_VERSION__=199901L strdup=_strdup alloca=_alloca isascii=__isascii
|
||||
)
|
||||
elseif(APPLE)
|
||||
target_compile_options(glsl-optimizer PRIVATE -Wno-deprecated-register)
|
||||
endif()
|
||||
set_target_properties(glsl-optimizer PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
91
cmake/3rdparty/glslang.cmake
vendored
91
cmake/3rdparty/glslang.cmake
vendored
@@ -1,91 +0,0 @@
|
||||
# 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 glslang)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(
|
||||
GLOB
|
||||
GLSLANG_SOURCES
|
||||
${BGFX_DIR}/3rdparty/glslang/glslang/GenericCodeGen/*.cpp
|
||||
${BGFX_DIR}/3rdparty/glslang/glslang/MachineIndependent/*.cpp
|
||||
${BGFX_DIR}/3rdparty/glslang/glslang/MachineIndependent/preprocessor/*.cpp
|
||||
${BGFX_DIR}/3rdparty/glslang/glslang/HLSL/*.cpp
|
||||
${BGFX_DIR}/3rdparty/glslang/hlsl/*.cpp
|
||||
${BGFX_DIR}/3rdparty/glslang/SPIRV/*.cpp
|
||||
${BGFX_DIR}/3rdparty/glslang/OGLCompilersDLL/*.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND GLSLANG_SOURCES ${BGFX_DIR}/3rdparty/glslang/glslang/OSDependent/Windows/ossource.cpp)
|
||||
else()
|
||||
list(APPEND GLSLANG_SOURCES ${BGFX_DIR}/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp)
|
||||
endif()
|
||||
|
||||
add_library(glslang STATIC EXCLUDE_FROM_ALL ${GLSLANG_SOURCES})
|
||||
target_include_directories(
|
||||
glslang
|
||||
PUBLIC ${BGFX_DIR}/3rdparty/spirv-tools/include ${BGFX_DIR}/3rdparty/spirv-tools/source ${BGFX_DIR}/3rdparty/glslang
|
||||
${BGFX_DIR}/3rdparty/glslang/glslang/Include ${BGFX_DIR}/3rdparty/glslang/glslang/Public
|
||||
PRIVATE ${BGFX_DIR}/3rdparty
|
||||
)
|
||||
|
||||
set_target_properties(glslang PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(
|
||||
glslang
|
||||
PRIVATE "/wd4005"
|
||||
"/wd4065"
|
||||
"/wd4100"
|
||||
"/wd4127"
|
||||
"/wd4189"
|
||||
"/wd4244"
|
||||
"/wd4310"
|
||||
"/wd4389"
|
||||
"/wd4456"
|
||||
"/wd4457"
|
||||
"/wd4458"
|
||||
"/wd4702"
|
||||
"/wd4715"
|
||||
"/wd4838"
|
||||
)
|
||||
else()
|
||||
target_compile_options(
|
||||
glslang
|
||||
PRIVATE "-Wno-ignored-qualifiers"
|
||||
"-Wno-implicit-fallthrough"
|
||||
"-Wno-missing-field-initializers"
|
||||
"-Wno-reorder"
|
||||
"-Wno-return-type"
|
||||
"-Wno-shadow"
|
||||
"-Wno-sign-compare"
|
||||
"-Wno-switch"
|
||||
"-Wno-undef"
|
||||
"-Wno-unknown-pragmas"
|
||||
"-Wno-unused-function"
|
||||
"-Wno-unused-parameter"
|
||||
"-Wno-unused-variable"
|
||||
"-fno-strict-aliasing"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
target_compile_options(
|
||||
glslang PRIVATE "-Wno-c++11-extensions" "-Wno-unused-const-variable" "-Wno-deprecated-register"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_compile_options(glslang PRIVATE "-Wno-unused-but-set-variable")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(glslang PRIVATE ENABLE_OPT=1 ENABLE_HLSL=1)
|
||||
21
cmake/3rdparty/libsquish.cmake
vendored
21
cmake/3rdparty/libsquish.cmake
vendored
@@ -1,21 +0,0 @@
|
||||
# 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 squish)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB SQUISH_SOURCES ${BIMG_DIR}/3rdparty/libsquish/*.cpp ${BIMG_DIR}/3rdparty/libsquish/*.h
|
||||
${BIMG_DIR}/3rdparty/libsquish/*.inl
|
||||
)
|
||||
|
||||
add_library(squish STATIC ${SQUISH_SOURCES})
|
||||
target_include_directories(squish PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty>)
|
||||
set_target_properties(squish PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
19
cmake/3rdparty/meshoptimizer.cmake
vendored
19
cmake/3rdparty/meshoptimizer.cmake
vendored
@@ -1,19 +0,0 @@
|
||||
# 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 meshoptimizer)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB MESHOPTIMIZER_SOURCES ${BGFX_DIR}/3rdparty/meshoptimizer/src/*.cpp ${BGFX_DIR}/3rdparty/meshoptimizer/src/*.h)
|
||||
|
||||
add_library(meshoptimizer STATIC ${MESHOPTIMIZER_SOURCES})
|
||||
target_include_directories(meshoptimizer PUBLIC ${BGFX_DIR}/3rdparty)
|
||||
set_target_properties(meshoptimizer PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
35
cmake/3rdparty/nvtt.cmake
vendored
35
cmake/3rdparty/nvtt.cmake
vendored
@@ -1,35 +0,0 @@
|
||||
# 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 nvtt)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(
|
||||
GLOB
|
||||
NVTT_SOURCES
|
||||
${BIMG_DIR}/3rdparty/nvtt/bc6h/*.cpp
|
||||
${BIMG_DIR}/3rdparty/nvtt/bc6h/*.h
|
||||
${BIMG_DIR}/3rdparty/nvtt/bc7/*.cpp
|
||||
${BIMG_DIR}/3rdparty/nvtt/bc7/*.h
|
||||
${BIMG_DIR}/3rdparty/nvtt/nvcore/*.h
|
||||
${BIMG_DIR}/3rdparty/nvtt/nvcore/*.inl
|
||||
${BIMG_DIR}/3rdparty/nvtt/nvmath/*.cpp
|
||||
${BIMG_DIR}/3rdparty/nvtt/nvmath/*.h
|
||||
${BIMG_DIR}/3rdparty/nvtt/*.cpp
|
||||
${BIMG_DIR}/3rdparty/nvtt/*.h
|
||||
)
|
||||
|
||||
add_library(nvtt STATIC ${NVTT_SOURCES})
|
||||
target_include_directories(
|
||||
nvtt PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty> $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/nvtt>
|
||||
)
|
||||
target_link_libraries(nvtt PUBLIC bx)
|
||||
set_target_properties(nvtt PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
25
cmake/3rdparty/spirv-cross.cmake
vendored
25
cmake/3rdparty/spirv-cross.cmake
vendored
@@ -1,25 +0,0 @@
|
||||
# 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 spirv-cross)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB SPIRV_CROSS_SOURCES ${BGFX_DIR}/3rdparty/spirv-cross/*.cpp ${BGFX_DIR}/3rdparty/spirv-cross/*.h)
|
||||
|
||||
add_library(spirv-cross STATIC ${SPIRV_CROSS_SOURCES})
|
||||
target_compile_definitions(spirv-cross PRIVATE SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
|
||||
target_include_directories(spirv-cross PUBLIC ${BGFX_DIR}/3rdparty/spirv-cross ${BGFX_DIR}/3rdparty/spirv-cross/include)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(spirv-cross PRIVATE "/wd4018" "/wd4245" "/wd4706" "/wd4715")
|
||||
endif()
|
||||
|
||||
set_target_properties(spirv-cross PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
48
cmake/3rdparty/spirv-tools.cmake
vendored
48
cmake/3rdparty/spirv-tools.cmake
vendored
@@ -1,48 +0,0 @@
|
||||
# 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 spirv-tools)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(
|
||||
GLOB
|
||||
SPIRV_TOOLS_SOURCES
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/*.cpp
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/*.h
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/opt/*.cpp
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/opt/*.h
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/reduce/*.cpp
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/reduce/*.h
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/util/*.cpp
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/util/*.h
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/val/*.cpp
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source/val/*.h
|
||||
)
|
||||
|
||||
add_library(spirv-tools STATIC ${SPIRV_TOOLS_SOURCES})
|
||||
target_include_directories(
|
||||
spirv-tools
|
||||
PUBLIC ${BGFX_DIR}/3rdparty/spirv-headers/include ${BGFX_DIR}/3rdparty/spirv-tools
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/include ${BGFX_DIR}/3rdparty/spirv-tools/include/generated
|
||||
${BGFX_DIR}/3rdparty/spirv-tools/source
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(spirv-tools PRIVATE "/wd4127" "/wd4389" "/wd4702" "/wd4706")
|
||||
else()
|
||||
target_compile_options(spirv-tools PRIVATE "-Wno-switch")
|
||||
|
||||
if(MINGW OR ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
||||
target_compile_options(spirv-tools PRIVATE "-Wno-misleading-indentation")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(spirv-tools PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
11
cmake/3rdparty/tinyexr.cmake
vendored
11
cmake/3rdparty/tinyexr.cmake
vendored
@@ -1,11 +0,0 @@
|
||||
if(TARGET tinyexr)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE TINYEXR_SOURCES ${BIMG_DIR}/3rdparty/tinyexr/*.c ${BIMG_DIR}/3rdparty/tinyexr/*.h)
|
||||
|
||||
add_library(tinyexr STATIC ${TINYEXR_SOURCES})
|
||||
target_include_directories(
|
||||
tinyexr PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty> $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/tinyexr/deps/miniz>
|
||||
)
|
||||
set_target_properties(tinyexr PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
@@ -1,21 +1,35 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
if(@BGFX_CMAKE_USER_SCRIPT_PRESENT@)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@BGFX_CMAKE_USER_SCRIPT_INSTALL_NAME@")
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
||||
get_target_property(BGFX_INCLUDE_PATH bgfx::bgfx INTERFACE_INCLUDE_DIRECTORIES)
|
||||
list(GET BGFX_INCLUDE_PATH 0 BGFX_INCLUDE_PATH_1) # bgfx::bgfx exports include directory twice?
|
||||
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@ AND NOT TARGET bgfx::shaderc)
|
||||
find_program(
|
||||
shaderc_EXECUTABLE REQUIRED
|
||||
NAMES bgfx-shaderc shaderc
|
||||
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::shaderc IMPORTED)
|
||||
set_target_properties(bgfx::shaderc PROPERTIES IMPORTED_LOCATION "${shaderc_EXECUTABLE}")
|
||||
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()
|
||||
|
||||
_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()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/bgfxToolUtils.cmake")
|
||||
|
||||
26
cmake/bgfx/3rdparty/dear-imgui.cmake
vendored
Normal file
26
cmake/bgfx/3rdparty/dear-imgui.cmake
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT DEAR_IMGUI_LIBRARIES)
|
||||
file(
|
||||
GLOB #
|
||||
DEAR_IMGUI_SOURCES #
|
||||
${BGFX_DIR}/3rdparty/dear-imgui/*.cpp #
|
||||
${BGFX_DIR}/3rdparty/dear-imgui/*.h #
|
||||
${BGFX_DIR}/3rdparty/dear-imgui/*.inl #
|
||||
)
|
||||
set(DEAR_IMGUI_INCLUDE_DIR ${BGFX_DIR}/3rdparty)
|
||||
endif()
|
||||
66
cmake/bgfx/3rdparty/fcpp.cmake
vendored
Normal file
66
cmake/bgfx/3rdparty/fcpp.cmake
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(FCPP_DIR ${BGFX_DIR}/3rdparty/fcpp)
|
||||
|
||||
add_library(fcpp STATIC)
|
||||
|
||||
target_compile_definitions(
|
||||
fcpp
|
||||
PRIVATE "NINCLUDE=64" #
|
||||
"NWORK=65536" #
|
||||
"NBUFF=65536" #
|
||||
"OLD_PREPROCESSOR=0" #
|
||||
# "MSG_PREFIX=\"Preprocessor: \"" #
|
||||
)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
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
|
||||
PRIVATE
|
||||
"/wd4055" # warning C4055: 'type cast': from data pointer 'void *' to function pointer 'void (__cdecl *)(char *,void *)'
|
||||
"/wd4244" # warning C4244: '=': conversion from 'const flex_int32_t' to 'YY_CHAR', possible loss of data
|
||||
"/wd4701" # warning C4701: potentially uninitialized local variable 'lower' used
|
||||
"/wd4706" # warning C4706: assignment within conditional expression
|
||||
)
|
||||
else()
|
||||
target_compile_options(
|
||||
fcpp
|
||||
PRIVATE -Wno-implicit-fallthrough #
|
||||
-Wno-incompatible-pointer-types #
|
||||
-Wno-parentheses-equality #
|
||||
)
|
||||
endif()
|
||||
248
cmake/bgfx/3rdparty/glsl-optimizer.cmake
vendored
Normal file
248
cmake/bgfx/3rdparty/glsl-optimizer.cmake
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}")
|
||||
return()
|
||||
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
|
||||
${GLSL_OPTIMIZER}/src/glsl/glcpp/glcpp.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/glcpp/glcpp-lex.c
|
||||
${GLSL_OPTIMIZER}/src/glsl/glcpp/glcpp-parse.c
|
||||
${GLSL_OPTIMIZER}/src/glsl/glcpp/glcpp-parse.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/glcpp/pp.c
|
||||
${GLSL_OPTIMIZER}/src/glsl/ast.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ast_array_index.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ast_expr.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ast_function.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ast_to_hir.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ast_type.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/builtin_functions.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/builtin_type_macros.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/builtin_types.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/builtin_variables.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_lexer.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_optimizer.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_optimizer.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_parser.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_parser.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_parser_extras.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_parser_extras.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_symbol_table.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_symbol_table.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_types.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/glsl_types.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/hir_field_selection.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_basic_block.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_basic_block.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_builder.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_builder.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_clone.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_constant_expression.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_equals.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_expression_flattening.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_expression_flattening.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_function.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_function_can_inline.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_function_detect_recursion.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_function_inlining.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_hierarchical_visitor.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_hierarchical_visitor.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_hv_accept.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_import_prototypes.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_optimization.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_print_glsl_visitor.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_print_glsl_visitor.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_print_metal_visitor.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_print_metal_visitor.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_print_visitor.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_print_visitor.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_rvalue_visitor.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_rvalue_visitor.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_stats.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_stats.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_uniform.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_unused_structs.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_unused_structs.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_validate.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_variable_refcount.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_variable_refcount.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/ir_visitor.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_atomics.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_functions.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_interface_blocks.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_uniform_block_active_visitor.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_uniform_block_active_visitor.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_uniform_blocks.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_uniform_initializers.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_uniforms.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_varyings.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/link_varyings.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/linker.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/linker.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/list.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/loop_analysis.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/loop_analysis.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/loop_controls.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/loop_unroll.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_clip_distance.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_discard.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_discard_flow.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_if_to_cond_assign.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_instructions.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_jumps.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_mat_op_to_vec.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_named_interface_blocks.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_noise.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_offset_array.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_output_reads.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_packed_varyings.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_packing_builtins.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_ubo_reference.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_variable_index_to_cond_assign.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_vec_index_to_cond_assign.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_vec_index_to_swizzle.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_vector.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_vector_insert.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/lower_vertex_id.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_algebraic.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_array_splitting.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_constant_folding.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_constant_propagation.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_constant_variable.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_copy_propagation.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_copy_propagation_elements.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_cse.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_dead_builtin_variables.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_dead_builtin_varyings.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_dead_code.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_dead_code_local.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_dead_functions.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_flatten_nested_if_blocks.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_flip_matrices.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_function_inlining.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_if_simplification.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_minmax.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_noop_swizzle.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_rebalance_tree.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_redundant_jumps.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_structure_splitting.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_swizzle_swizzle.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_tree_grafting.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/opt_vectorize.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/program.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/s_expression.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/s_expression.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/standalone_scaffolding.cpp
|
||||
${GLSL_OPTIMIZER}/src/glsl/standalone_scaffolding.h
|
||||
${GLSL_OPTIMIZER}/src/glsl/strtod.c
|
||||
${GLSL_OPTIMIZER}/src/glsl/strtod.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/compiler.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/config.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/context.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/core.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/dd.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/errors.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/glheader.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/glminimal.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/imports.c
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/imports.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/macros.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/mtypes.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/main/simple_list.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/program/hash_table.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/program/prog_hash_table.c
|
||||
${GLSL_OPTIMIZER}/src/mesa/program/prog_instruction.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/program/prog_parameter.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/program/prog_statevars.h
|
||||
${GLSL_OPTIMIZER}/src/mesa/program/symbol_table.c
|
||||
${GLSL_OPTIMIZER}/src/mesa/program/symbol_table.h
|
||||
${GLSL_OPTIMIZER}/src/util/hash_table.c
|
||||
${GLSL_OPTIMIZER}/src/util/hash_table.h
|
||||
${GLSL_OPTIMIZER}/src/util/macros.h
|
||||
${GLSL_OPTIMIZER}/src/util/ralloc.c
|
||||
${GLSL_OPTIMIZER}/src/util/ralloc.h
|
||||
)
|
||||
|
||||
target_sources(glsl-optimizer PRIVATE ${GLSL_OPTIMIZER_SOURCES})
|
||||
|
||||
if(MSVC)
|
||||
target_compile_definitions(
|
||||
glsl-optimizer
|
||||
PRIVATE "__STDC__" #
|
||||
"__STDC_VERSION__=199901L" #
|
||||
"strdup=_strdup" #
|
||||
"alloca=_alloca" #
|
||||
"isascii=__isascii" #
|
||||
)
|
||||
target_compile_options(
|
||||
glsl-optimizer
|
||||
PRIVATE
|
||||
"/wd4100" # error C4100: '' : unreferenced formal parameter
|
||||
"/wd4127" # warning C4127: conditional expression is constant
|
||||
"/wd4132" # warning C4132: 'deleted_key_value': const object should be initialized
|
||||
"/wd4189" # warning C4189: 'interface_type': local variable is initialized but not referenced
|
||||
"/wd4204" # warning C4204: nonstandard extension used: non-constant aggregate initializer
|
||||
"/wd4244" # warning C4244: '=': conversion from 'const flex_int32_t' to 'YY_CHAR', possible loss of data
|
||||
"/wd4389" # warning C4389: '!=': signed/unsigned mismatch
|
||||
"/wd4245" # warning C4245: 'return': conversion from 'int' to 'unsigned int', signed/unsigned mismatch
|
||||
"/wd4701" # warning C4701: potentially uninitialized local variable 'lower' used
|
||||
"/wd4702" # warning C4702: unreachable code
|
||||
"/wd4706" # warning C4706: assignment within conditional expression
|
||||
"/wd4996" # warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup.
|
||||
)
|
||||
else()
|
||||
target_compile_options(
|
||||
glsl-optimizer
|
||||
PRIVATE "-fno-strict-aliasing" # glsl-optimizer has bugs if strict aliasing is used.
|
||||
#
|
||||
"-Wno-implicit-fallthrough" #
|
||||
"-Wno-parentheses" #
|
||||
"-Wno-sign-compare" #
|
||||
"-Wno-unused-function" #
|
||||
"-Wno-unused-parameter" #
|
||||
)
|
||||
endif()
|
||||
|
||||
if(XCODE)
|
||||
target_compile_options(
|
||||
glsl-optimizer PRIVATE #
|
||||
"-Wno-deprecated-register" #
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
target_compile_options(
|
||||
glsl-optimizer PRIVATE #
|
||||
"-Wno-misleading-indentation" #
|
||||
)
|
||||
endif()
|
||||
65
cmake/bgfx/3rdparty/glslang.cmake
vendored
Normal file
65
cmake/bgfx/3rdparty/glslang.cmake
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}")
|
||||
return()
|
||||
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
|
||||
${GLSLANG}/glslang/*.cpp
|
||||
${GLSLANG}/glslang/*.h
|
||||
#
|
||||
${GLSLANG}/hlsl/*.cpp
|
||||
${GLSLANG}/hlsl/*.h
|
||||
#
|
||||
${GLSLANG}/SPIRV/*.cpp
|
||||
${GLSLANG}/SPIRV/*.h
|
||||
#
|
||||
${GLSLANG}/OGLCompilersDLL/*.cpp
|
||||
${GLSLANG}/OGLCompilersDLL/*.h
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
list(FILTER GLSLANG_SOURCES EXCLUDE REGEX "glslang/OSDependent/Unix/.*.cpp")
|
||||
list(FILTER GLSLANG_SOURCES EXCLUDE REGEX "glslang/OSDependent/Unix/.*.h")
|
||||
else()
|
||||
list(FILTER GLSLANG_SOURCES EXCLUDE REGEX "glslang/OSDependent/Windows/.*.cpp")
|
||||
list(FILTER GLSLANG_SOURCES EXCLUDE REGEX "glslang/OSDependent/Windows/.*.h")
|
||||
endif()
|
||||
|
||||
target_sources(glslang PRIVATE ${GLSLANG_SOURCES})
|
||||
@@ -1,20 +1,25 @@
|
||||
# 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 etc2)
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB ETC2_SOURCES ${BIMG_DIR}/3rdparty/etc2/*.cpp ${BIMG_DIR}/3rdparty/etc2/*.h)
|
||||
|
||||
add_library(etc2 STATIC ${ETC2_SOURCES})
|
||||
target_include_directories(etc2 PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty>)
|
||||
target_link_libraries(etc2 PUBLIC bx)
|
||||
set_target_properties(etc2 PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
if(NOT MESHOPTIMIZER_LIBRARIES)
|
||||
file(
|
||||
GLOB #
|
||||
MESHOPTIMIZER_SOURCES #
|
||||
${BGFX_DIR}/3rdparty/meshoptimizer/src/*.cpp #
|
||||
${BGFX_DIR}/3rdparty/meshoptimizer/src/*.h #
|
||||
)
|
||||
set(MESHOPTIMIZER_INCLUDE_DIR ${BGFX_DIR}/3rdparty)
|
||||
endif()
|
||||
62
cmake/bgfx/3rdparty/spirv-cross.cmake
vendored
Normal file
62
cmake/bgfx/3rdparty/spirv-cross.cmake
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}")
|
||||
return()
|
||||
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
|
||||
#
|
||||
${SPIRV_CROSS}/spirv.hpp
|
||||
${SPIRV_CROSS}/spirv_cfg.cpp
|
||||
${SPIRV_CROSS}/spirv_cfg.hpp
|
||||
${SPIRV_CROSS}/spirv_common.hpp
|
||||
${SPIRV_CROSS}/spirv_cpp.cpp
|
||||
${SPIRV_CROSS}/spirv_cpp.hpp
|
||||
${SPIRV_CROSS}/spirv_cross.cpp
|
||||
${SPIRV_CROSS}/spirv_cross.hpp
|
||||
${SPIRV_CROSS}/spirv_cross_parsed_ir.cpp
|
||||
${SPIRV_CROSS}/spirv_cross_parsed_ir.hpp
|
||||
${SPIRV_CROSS}/spirv_cross_util.cpp
|
||||
${SPIRV_CROSS}/spirv_cross_util.hpp
|
||||
${SPIRV_CROSS}/spirv_glsl.cpp
|
||||
${SPIRV_CROSS}/spirv_glsl.hpp
|
||||
${SPIRV_CROSS}/spirv_hlsl.cpp
|
||||
${SPIRV_CROSS}/spirv_hlsl.hpp
|
||||
${SPIRV_CROSS}/spirv_msl.cpp
|
||||
${SPIRV_CROSS}/spirv_msl.hpp
|
||||
${SPIRV_CROSS}/spirv_parser.cpp
|
||||
${SPIRV_CROSS}/spirv_parser.hpp
|
||||
${SPIRV_CROSS}/spirv_reflect.cpp
|
||||
${SPIRV_CROSS}/spirv_reflect.hpp
|
||||
)
|
||||
|
||||
target_sources(spirv-cross PRIVATE ${SPIRV_CROSS_SOURCES})
|
||||
147
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
Normal file
147
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}")
|
||||
return()
|
||||
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
|
||||
# libspirv
|
||||
${SPIRV_TOOLS}/source/opt/*.cpp
|
||||
${SPIRV_TOOLS}/source/opt/*.h
|
||||
${SPIRV_TOOLS}/source/reduce/*.cpp
|
||||
${SPIRV_TOOLS}/source/reduce/*.h
|
||||
${SPIRV_TOOLS}/source/assembly_grammar.cpp
|
||||
${SPIRV_TOOLS}/source/assembly_grammar.h
|
||||
${SPIRV_TOOLS}/source/binary.cpp
|
||||
${SPIRV_TOOLS}/source/binary.h
|
||||
${SPIRV_TOOLS}/source/cfa.h
|
||||
${SPIRV_TOOLS}/source/diagnostic.cpp
|
||||
${SPIRV_TOOLS}/source/diagnostic.h
|
||||
${SPIRV_TOOLS}/source/disassemble.cpp
|
||||
${SPIRV_TOOLS}/source/disassemble.h
|
||||
${SPIRV_TOOLS}/source/enum_set.h
|
||||
${SPIRV_TOOLS}/source/enum_string_mapping.cpp
|
||||
${SPIRV_TOOLS}/source/enum_string_mapping.h
|
||||
${SPIRV_TOOLS}/source/ext_inst.cpp
|
||||
${SPIRV_TOOLS}/source/ext_inst.h
|
||||
${SPIRV_TOOLS}/source/extensions.cpp
|
||||
${SPIRV_TOOLS}/source/extensions.h
|
||||
${SPIRV_TOOLS}/source/instruction.h
|
||||
${SPIRV_TOOLS}/source/latest_version_glsl_std_450_header.h
|
||||
${SPIRV_TOOLS}/source/latest_version_opencl_std_header.h
|
||||
${SPIRV_TOOLS}/source/latest_version_spirv_header.h
|
||||
${SPIRV_TOOLS}/source/libspirv.cpp
|
||||
${SPIRV_TOOLS}/source/macro.h
|
||||
${SPIRV_TOOLS}/source/name_mapper.cpp
|
||||
${SPIRV_TOOLS}/source/name_mapper.h
|
||||
${SPIRV_TOOLS}/source/opcode.cpp
|
||||
${SPIRV_TOOLS}/source/opcode.h
|
||||
${SPIRV_TOOLS}/source/operand.cpp
|
||||
${SPIRV_TOOLS}/source/operand.h
|
||||
${SPIRV_TOOLS}/source/parsed_operand.cpp
|
||||
${SPIRV_TOOLS}/source/parsed_operand.h
|
||||
${SPIRV_TOOLS}/source/print.cpp
|
||||
${SPIRV_TOOLS}/source/print.h
|
||||
${SPIRV_TOOLS}/source/software_version.cpp
|
||||
${SPIRV_TOOLS}/source/spirv_constant.h
|
||||
${SPIRV_TOOLS}/source/spirv_definition.h
|
||||
${SPIRV_TOOLS}/source/spirv_endian.cpp
|
||||
${SPIRV_TOOLS}/source/spirv_endian.h
|
||||
${SPIRV_TOOLS}/source/spirv_optimizer_options.cpp
|
||||
${SPIRV_TOOLS}/source/spirv_reducer_options.cpp
|
||||
${SPIRV_TOOLS}/source/spirv_target_env.cpp
|
||||
${SPIRV_TOOLS}/source/spirv_target_env.h
|
||||
${SPIRV_TOOLS}/source/spirv_validator_options.cpp
|
||||
${SPIRV_TOOLS}/source/spirv_validator_options.h
|
||||
${SPIRV_TOOLS}/source/table.cpp
|
||||
${SPIRV_TOOLS}/source/table.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/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/string_utils.cpp
|
||||
${SPIRV_TOOLS}/source/util/string_utils.h
|
||||
${SPIRV_TOOLS}/source/util/timer.h
|
||||
${SPIRV_TOOLS}/source/val/basic_block.cpp
|
||||
${SPIRV_TOOLS}/source/val/construct.cpp
|
||||
${SPIRV_TOOLS}/source/val/decoration.h
|
||||
${SPIRV_TOOLS}/source/val/function.cpp
|
||||
${SPIRV_TOOLS}/source/val/instruction.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate.h
|
||||
${SPIRV_TOOLS}/source/val/validate_adjacency.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_annotation.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_arithmetics.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_atomics.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_barriers.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_bitwise.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_builtins.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_capability.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_cfg.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_composites.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_constants.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_conversion.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_debug.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_decorations.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_derivatives.cpp
|
||||
${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_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_layout.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_literals.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_logicals.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_memory.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_memory_semantics.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_mesh_shading.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_misc.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_mode_setting.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_non_uniform.cpp
|
||||
${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_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})
|
||||
@@ -8,21 +8,26 @@
|
||||
# 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(BGFX_CUSTOM_TARGETS)
|
||||
add_custom_target(tools)
|
||||
set_target_properties(tools PROPERTIES FOLDER "bgfx/tools")
|
||||
endif()
|
||||
include(bgfx.cmake)
|
||||
include(3rdparty/meshoptimizer.cmake)
|
||||
include(3rdparty/dear-imgui.cmake)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_SHADER)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/tools/shaderc.cmake)
|
||||
endif()
|
||||
|
||||
if(BGFX_BUILD_TOOLS_GEOMETRY)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/tools/geometryc.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/tools/geometryv.cmake)
|
||||
endif()
|
||||
include(shared.cmake)
|
||||
include(examples.cmake)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/tools/texturec.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/tools/texturev.cmake)
|
||||
include(texturev.cmake)
|
||||
endif()
|
||||
if(BGFX_BUILD_TOOLS_GEOMETRY)
|
||||
include(geometryc.cmake)
|
||||
include(geometryv.cmake)
|
||||
endif()
|
||||
if(BGFX_BUILD_TOOLS_SHADER)
|
||||
include(3rdparty/spirv-opt.cmake)
|
||||
include(3rdparty/spirv-cross.cmake)
|
||||
include(3rdparty/glslang.cmake)
|
||||
include(3rdparty/glsl-optimizer.cmake)
|
||||
include(3rdparty/fcpp.cmake)
|
||||
include(3rdparty/webgpu.cmake)
|
||||
include(shaderc.cmake)
|
||||
endif()
|
||||
@@ -12,22 +12,17 @@ include(CMakeParseArguments)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/ConfigureDebugging.cmake)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/dear-imgui.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/meshoptimizer.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/bgfxToolUtils.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../bgfxToolUtils.cmake)
|
||||
|
||||
function(add_bgfx_shader FILE FOLDER)
|
||||
get_filename_component(FILENAME "${FILE}" NAME_WE)
|
||||
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()
|
||||
@@ -41,9 +36,9 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
# dx9
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
set(DX9_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/dx9/${FILENAME}.bin)
|
||||
shaderc_parse(
|
||||
_bgfx_shaderc_parse(
|
||||
DX9 ${COMMON} WINDOWS
|
||||
PROFILE ${D3D_PREFIX}_3_0
|
||||
PROFILE s_3_0
|
||||
O 3
|
||||
OUTPUT ${DX9_OUTPUT}
|
||||
)
|
||||
@@ -54,16 +49,16 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
# dx11
|
||||
set(DX11_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/dx11/${FILENAME}.bin)
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
shaderc_parse(
|
||||
_bgfx_shaderc_parse(
|
||||
DX11 ${COMMON} WINDOWS
|
||||
PROFILE ${D3D_PREFIX}_5_0
|
||||
PROFILE s_5_0
|
||||
O 3
|
||||
OUTPUT ${DX11_OUTPUT}
|
||||
)
|
||||
else()
|
||||
shaderc_parse(
|
||||
_bgfx_shaderc_parse(
|
||||
DX11 ${COMMON} WINDOWS
|
||||
PROFILE ${D3D_PREFIX}_5_0
|
||||
PROFILE s_5_0
|
||||
O 1
|
||||
OUTPUT ${DX11_OUTPUT}
|
||||
)
|
||||
@@ -75,7 +70,7 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
if(APPLE)
|
||||
# metal
|
||||
set(METAL_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/metal/${FILENAME}.bin)
|
||||
shaderc_parse(METAL ${COMMON} OSX PROFILE metal OUTPUT ${METAL_OUTPUT})
|
||||
_bgfx_shaderc_parse(METAL ${COMMON} OSX PROFILE metal OUTPUT ${METAL_OUTPUT})
|
||||
list(APPEND OUTPUTS "METAL")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}Metal, ")
|
||||
endif()
|
||||
@@ -83,7 +78,7 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
# essl
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
set(ESSL_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/essl/${FILENAME}.bin)
|
||||
shaderc_parse(ESSL ${COMMON} ANDROID OUTPUT ${ESSL_OUTPUT})
|
||||
_bgfx_shaderc_parse(ESSL ${COMMON} ANDROID OUTPUT ${ESSL_OUTPUT})
|
||||
list(APPEND OUTPUTS "ESSL")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}ESSL, ")
|
||||
endif()
|
||||
@@ -91,9 +86,9 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
# glsl
|
||||
set(GLSL_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/glsl/${FILENAME}.bin)
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
shaderc_parse(GLSL ${COMMON} LINUX PROFILE 120 OUTPUT ${GLSL_OUTPUT})
|
||||
_bgfx_shaderc_parse(GLSL ${COMMON} LINUX PROFILE 140 OUTPUT ${GLSL_OUTPUT})
|
||||
else()
|
||||
shaderc_parse(GLSL ${COMMON} LINUX PROFILE 430 OUTPUT ${GLSL_OUTPUT})
|
||||
_bgfx_shaderc_parse(GLSL ${COMMON} LINUX PROFILE 430 OUTPUT ${GLSL_OUTPUT})
|
||||
endif()
|
||||
list(APPEND OUTPUTS "GLSL")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}GLSL, ")
|
||||
@@ -101,7 +96,7 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
# spirv
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
set(SPIRV_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/spirv/${FILENAME}.bin)
|
||||
shaderc_parse(SPIRV ${COMMON} LINUX PROFILE spirv OUTPUT ${SPIRV_OUTPUT})
|
||||
_bgfx_shaderc_parse(SPIRV ${COMMON} LINUX PROFILE spirv OUTPUT ${SPIRV_OUTPUT})
|
||||
list(APPEND OUTPUTS "SPIRV")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}SPIRV")
|
||||
set(OUTPUT_FILES "")
|
||||
@@ -144,9 +139,16 @@ function(add_example ARG_NAME)
|
||||
|
||||
# Add target
|
||||
if(ARG_COMMON)
|
||||
add_library(example-${ARG_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
|
||||
target_include_directories(example-${ARG_NAME} PUBLIC ${BGFX_DIR}/examples/common)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC bgfx bx bimg dear-imgui meshoptimizer)
|
||||
add_library(
|
||||
example-${ARG_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES} ${DEAR_IMGUI_SOURCES} ${MESHOPTIMIZER_SOURCES}
|
||||
)
|
||||
target_include_directories(
|
||||
example-${ARG_NAME} PUBLIC ${BGFX_DIR}/examples/common ${DEAR_IMGUI_INCLUDE_DIR}
|
||||
${MESHOPTIMIZER_INCLUDE_DIR}
|
||||
)
|
||||
target_link_libraries(
|
||||
example-${ARG_NAME} PUBLIC bgfx bx bimg bimg_decode ${DEAR_IMGUI_LIBRARIES} ${MESHOPTIMIZER_LIBRARIES}
|
||||
)
|
||||
if(BGFX_WITH_GLFW)
|
||||
find_package(glfw3 REQUIRED)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC glfw)
|
||||
@@ -158,6 +160,50 @@ function(add_example ARG_NAME)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC X11)
|
||||
endif()
|
||||
|
||||
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(BGFX_INSTALL_EXAMPLES)
|
||||
add_executable(example-${ARG_NAME} WIN32 ${SOURCES})
|
||||
@@ -211,42 +257,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
|
||||
@@ -8,15 +8,28 @@
|
||||
# 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/>.
|
||||
|
||||
include(CMakeParseArguments)
|
||||
add_executable(geometryc)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../3rdparty/meshoptimizer.cmake)
|
||||
# Grab the geometryc source files
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
GEOMETRYC_SOURCES #
|
||||
${BGFX_DIR}/tools/geometryc/*.cpp #
|
||||
${BGFX_DIR}/tools/geometryc/*.h #
|
||||
#
|
||||
${MESHOPTIMIZER_SOURCES}
|
||||
)
|
||||
|
||||
add_executable(geometryc ${BGFX_DIR}/tools/geometryc/geometryc.cpp)
|
||||
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")
|
||||
target_link_libraries(geometryc bx bgfx-vertexlayout meshoptimizer)
|
||||
if(BGFX_CUSTOM_TARGETS)
|
||||
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)
|
||||
endif()
|
||||
|
||||
@@ -8,16 +8,26 @@
|
||||
# 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 ${BGFX_DIR}/tools/geometryv/geometryv.cpp)
|
||||
set_target_properties(geometryv PROPERTIES FOLDER "bgfx/tools")
|
||||
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(EMSCRIPTEN)
|
||||
target_link_options(geometryv PRIVATE -sMAX_WEBGL_VERSION=2)
|
||||
endif()
|
||||
if(BGFX_CUSTOM_TARGETS)
|
||||
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(IOS)
|
||||
if(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()
|
||||
73
cmake/bgfx/shaderc.cmake
Normal file
73
cmake/bgfx/shaderc.cmake
Normal file
@@ -0,0 +1,73 @@
|
||||
# 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/>.
|
||||
|
||||
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
|
||||
)
|
||||
target_link_libraries(
|
||||
shaderc
|
||||
PRIVATE bx
|
||||
bimg
|
||||
bgfx-vertexlayout
|
||||
fcpp
|
||||
glslang
|
||||
glsl-optimizer
|
||||
spirv-opt
|
||||
spirv-cross
|
||||
webgpu
|
||||
)
|
||||
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)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
target_link_libraries(shaderc PRIVATE log)
|
||||
elseif(IOS)
|
||||
set_target_properties(shaderc PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER shaderc)
|
||||
endif()
|
||||
@@ -1,25 +1,33 @@
|
||||
# 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/>.
|
||||
|
||||
include(CMakeParseArguments)
|
||||
add_executable(texturev)
|
||||
|
||||
add_executable(texturev ${BGFX_DIR}/tools/texturev/texturev.cpp)
|
||||
set_target_properties(texturev PROPERTIES FOLDER "bgfx/tools")
|
||||
target_link_libraries(texturev example-common)
|
||||
if(EMSCRIPTEN)
|
||||
target_link_options(texturev PRIVATE -sMAX_WEBGL_VERSION=2)
|
||||
endif()
|
||||
if(BGFX_CUSTOM_TARGETS)
|
||||
# Grab the texturev source files
|
||||
file(GLOB_RECURSE TEXTUREV_SOURCES #
|
||||
${BGFX_DIR}/tools/texturev/*
|
||||
)
|
||||
|
||||
target_sources(texturev PRIVATE ${TEXTUREV_SOURCES})
|
||||
target_link_libraries(texturev PRIVATE example-common)
|
||||
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(IOS)
|
||||
if(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()
|
||||
@@ -1,4 +1,351 @@
|
||||
# shaderc_parse(
|
||||
# _bgfx_bin2c_parse(
|
||||
# INPUT_FILE filename
|
||||
# OUTPUT_FILE filename
|
||||
# ARRAY_NAME name
|
||||
# )
|
||||
# Usage: bin2c -f <in> -o <out> -n <name>
|
||||
function(_bgfx_bin2c_parse ARG_OUT)
|
||||
set(options "")
|
||||
set(oneValueArgs INPUT_FILE;OUTPUT_FILE;ARRAY_NAME)
|
||||
set(multiValueArgs "")
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
||||
set(CLI "")
|
||||
|
||||
# -f
|
||||
if(ARG_INPUT_FILE)
|
||||
list(APPEND CLI "-f" "${ARG_INPUT_FILE}")
|
||||
else()
|
||||
message(SEND_ERROR "Call to _bgfx_bin2c_parse() must have an INPUT_FILE")
|
||||
endif()
|
||||
|
||||
# -o
|
||||
if(ARG_OUTPUT_FILE)
|
||||
list(APPEND CLI "-o" "${ARG_OUTPUT_FILE}")
|
||||
else()
|
||||
message(SEND_ERROR "Call to _bgfx_bin2c_parse() must have an OUTPUT_FILE")
|
||||
endif()
|
||||
|
||||
# -n
|
||||
if(ARG_ARRAY_NAME)
|
||||
list(APPEND CLI "-n" "${ARG_ARRAY_NAME}")
|
||||
else()
|
||||
message(SEND_ERROR "Call to _bgfx_bin2c_parse() must have an ARRAY_NAME")
|
||||
endif()
|
||||
|
||||
set(${ARG_OUT} ${CLI} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# bgfx_compile_binary_to_header(
|
||||
# INPUT_FILE filename
|
||||
# OUTPUT_FILE filename
|
||||
# ARRAY_NAME name
|
||||
# )
|
||||
#
|
||||
function(bgfx_compile_binary_to_header)
|
||||
set(options "")
|
||||
set(oneValueArgs INPUT_FILE;OUTPUT_FILE;ARRAY_NAME)
|
||||
set(multiValueArgs "")
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
||||
_bgfx_bin2c_parse(
|
||||
CLI
|
||||
INPUT_FILE ${ARG_INPUT_FILE}
|
||||
OUTPUT_FILE ${ARG_OUTPUT_FILE}
|
||||
ARRAY_NAME ${ARG_ARRAY_NAME}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT ${ARG_OUTPUT_FILE} #
|
||||
COMMAND bgfx::bin2c ${CLI} #
|
||||
MAIN_DEPENDENCY ${ARG_INPUT_FILE} #
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# _bgfx_texturec_parse(
|
||||
# FILE filename
|
||||
# OUTPUT filename
|
||||
# [FORMAT format]
|
||||
# [QUALITY default|fastest|highest]
|
||||
# [MIPS]
|
||||
# [MIPSKIP N]
|
||||
# [NORMALMAP]
|
||||
# [EQUIRECT]
|
||||
# [STRIP]
|
||||
# [SDF]
|
||||
# [REF alpha]
|
||||
# [IQA]
|
||||
# [PMA]
|
||||
# [LINEAR]
|
||||
# [MAX max size]
|
||||
# [RADIANCE model]
|
||||
# [AS extension]
|
||||
# )
|
||||
function(_bgfx_texturec_parse ARG_OUT)
|
||||
cmake_parse_arguments(
|
||||
ARG #
|
||||
"MIPS;NORMALMAP;EQUIRECT;STRIP;SDF;IQA;PMA;LINEAR" #
|
||||
"FILE;OUTPUT;FORMAT;QUALITY;MIPSKIP;REF;MAX;RADIANCE;AS" #
|
||||
"" #
|
||||
${ARGN} #
|
||||
)
|
||||
set(CLI "")
|
||||
|
||||
# -f
|
||||
if(ARG_FILE)
|
||||
list(APPEND CLI "-f" "${ARG_FILE}")
|
||||
endif()
|
||||
|
||||
# -o
|
||||
if(ARG_OUTPUT)
|
||||
list(APPEND CLI "-o" "${ARG_OUTPUT}")
|
||||
endif()
|
||||
|
||||
# -t
|
||||
if(ARG_FORMAT)
|
||||
list(APPEND CLI "-t" "${ARG_FORMAT}")
|
||||
endif()
|
||||
|
||||
# -q
|
||||
if(ARG_QUALITY)
|
||||
list(APPEND CLI "-q" "${ARG_QUALITY}")
|
||||
endif()
|
||||
|
||||
# --mips
|
||||
if(ARG_MIPS)
|
||||
list(APPEND CLI "--mips")
|
||||
endif()
|
||||
|
||||
# --mipskip
|
||||
if(ARG_MIPSKIP)
|
||||
list(APPEND CLI "--mipskip" "${ARG_MIPSKIP}")
|
||||
endif()
|
||||
|
||||
# --normalmap
|
||||
if(ARG_NORMALMAP)
|
||||
list(APPEND CLI "--normalmap")
|
||||
endif()
|
||||
|
||||
# --equirect
|
||||
if(ARG_EQUIRECT)
|
||||
list(APPEND CLI "--equirect")
|
||||
endif()
|
||||
|
||||
# --strip
|
||||
if(ARG_STRIP)
|
||||
list(APPEND CLI "--strip")
|
||||
endif()
|
||||
|
||||
# --sdf
|
||||
if(ARG_SDF)
|
||||
list(APPEND CLI "--sdf")
|
||||
endif()
|
||||
|
||||
# --ref
|
||||
if(ARG_REF)
|
||||
list(APPEND CLI "--ref" "${ARG_REF}")
|
||||
endif()
|
||||
|
||||
# --iqa
|
||||
if(ARG_IQA)
|
||||
list(APPEND CLI "--iqa")
|
||||
endif()
|
||||
|
||||
# --pma
|
||||
if(ARG_PMA)
|
||||
list(APPEND CLI "--pma")
|
||||
endif()
|
||||
|
||||
# --linear
|
||||
if(ARG_LINEAR)
|
||||
list(APPEND CLI "--linear")
|
||||
endif()
|
||||
|
||||
# --max
|
||||
if(ARG_MAX)
|
||||
list(APPEND CLI "--max" "${ARG_MAX}")
|
||||
endif()
|
||||
|
||||
# --radiance
|
||||
if(ARG_RADIANCE)
|
||||
list(APPEND CLI "--radiance" "${ARG_RADIANCE}")
|
||||
endif()
|
||||
|
||||
# --as
|
||||
if(ARG_AS)
|
||||
list(APPEND CLI "--as" "${ARG_AS}")
|
||||
endif()
|
||||
|
||||
set(${ARG_OUT} ${CLI} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# bgfx_compile_texture(
|
||||
# FILE filename
|
||||
# OUTPUT filename
|
||||
# [FORMAT format]
|
||||
# [QUALITY default|fastest|highest]
|
||||
# [MIPS]
|
||||
# [MIPSKIP N]
|
||||
# [NORMALMAP]
|
||||
# [EQUIRECT]
|
||||
# [STRIP]
|
||||
# [SDF]
|
||||
# [REF alpha]
|
||||
# [IQA]
|
||||
# [PMA]
|
||||
# [LINEAR]
|
||||
# [MAX max size]
|
||||
# [RADIANCE model]
|
||||
# [AS extension]
|
||||
# )
|
||||
#
|
||||
function(bgfx_compile_texture)
|
||||
cmake_parse_arguments(
|
||||
ARG #
|
||||
"MIPS;NORMALMAP;EQUIRECT;STRIP;SDF;IQA;PMA;LINEAR" #
|
||||
"FILE;OUTPUT;FORMAT;QUALITY;MIPSKIP;REF;MAX;RADIANCE;AS" #
|
||||
"" #
|
||||
${ARGN} #
|
||||
)
|
||||
_bgfx_texturec_parse(CLI ${ARGV})
|
||||
add_custom_command(
|
||||
OUTPUT ${ARG_OUTPUT} #
|
||||
COMMAND bgfx::texturec ${CLI} #
|
||||
MAIN_DEPENDENCY ${ARG_INPUT} #
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# _bgfx_geometryc_parse(
|
||||
# FILE filename
|
||||
# OUTPUT filename
|
||||
# [SCALE scale]
|
||||
# [CCW]
|
||||
# [FLIPV]
|
||||
# [OBB num steps]
|
||||
# [PACKNORMAL 0|1]
|
||||
# [PACKUV 0|1]
|
||||
# [TANGENT]
|
||||
# [BARYCENTRIC]
|
||||
# [COMPRESS]
|
||||
# [LH_UP_Y|LH_UP_Z|RH_UP_Y|RH_UP_Z]
|
||||
# )
|
||||
function(_bgfx_geometryc_parse ARG_OUT)
|
||||
cmake_parse_arguments(
|
||||
ARG #
|
||||
"CCW;FLIPV;TANGENT;BARYCENTRIC;COMPRESS;LH_UP_Y;LH_UP_Z;RH_UP_Y;RH_UP_Z" #
|
||||
"FILE;OUTPUT;SCALE;OBB;PACKNORMAL;PACKUV" #
|
||||
"" #
|
||||
${ARGN} #
|
||||
)
|
||||
set(CLI "")
|
||||
|
||||
# -f
|
||||
if(ARG_FILE)
|
||||
list(APPEND CLI "-f" "${ARG_FILE}")
|
||||
endif()
|
||||
|
||||
# -o
|
||||
if(ARG_OUTPUT)
|
||||
list(APPEND CLI "-o" "${ARG_OUTPUT}")
|
||||
endif()
|
||||
|
||||
# -s
|
||||
if(ARG_SCALE)
|
||||
list(APPEND CLI "-s" "${ARG_SCALE}")
|
||||
endif()
|
||||
|
||||
# --cw
|
||||
if(ARG_QUALITY)
|
||||
list(APPEND CLI "--cw")
|
||||
endif()
|
||||
|
||||
# --flipv
|
||||
if(ARG_FLIPV)
|
||||
list(APPEND CLI "--flipv")
|
||||
endif()
|
||||
|
||||
# --obb
|
||||
if(ARG_OBB)
|
||||
list(APPEND CLI "--mipskip" "${ARG_OBB}")
|
||||
endif()
|
||||
|
||||
# --packnormal
|
||||
if(ARG_PACKNORMAL)
|
||||
list(APPEND CLI "--packnormal ${ARG_PACKNORMAL}")
|
||||
endif()
|
||||
|
||||
# --packuv
|
||||
if(ARG_PACKUV)
|
||||
list(APPEND CLI "--packuv" ${ARG_PACKUV})
|
||||
endif()
|
||||
|
||||
# --tangent
|
||||
if(ARG_TANGENT)
|
||||
list(APPEND CLI "--tangent")
|
||||
endif()
|
||||
|
||||
# --barycentric
|
||||
if(ARG_BARYCENTRIC)
|
||||
list(APPEND CLI "--barycentric")
|
||||
endif()
|
||||
|
||||
# --compress
|
||||
if(ARG_REF)
|
||||
list(APPEND CLI "--compress" "${ARG_COMPRESS}")
|
||||
endif()
|
||||
|
||||
# --lh-up+y
|
||||
if(ARG_LH_UP_Y)
|
||||
list(APPEND CLI "--lh-up+y")
|
||||
endif()
|
||||
|
||||
# --lh-up+z
|
||||
if(ARG_LH_UP_Z)
|
||||
list(APPEND CLI "--lh-up+z")
|
||||
endif()
|
||||
|
||||
# --rh-up+y
|
||||
if(ARG_RH_UP_Y)
|
||||
list(APPEND CLI "--rh-up+y")
|
||||
endif()
|
||||
|
||||
# --rh-up+z
|
||||
if(ARG_RH_UP_Z)
|
||||
list(APPEND CLI "--rh-up+z")
|
||||
endif()
|
||||
|
||||
set(${ARG_OUT} ${CLI} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# bgfx_compile_geometry(
|
||||
# FILE filename
|
||||
# OUTPUT filename
|
||||
# [SCALE scale]
|
||||
# [CCW]
|
||||
# [FLIPV]
|
||||
# [OBB num steps]
|
||||
# [PACKNORMAL 0|1]
|
||||
# [PACKUV 0|1]
|
||||
# [TANGENT]
|
||||
# [BARYCENTRIC]
|
||||
# [COMPRESS]
|
||||
# [LH_UP_Y|LH_UP_Z|RH_UP_Y|RH_UP_Z]
|
||||
# )
|
||||
#
|
||||
function(bgfx_compile_geometry)
|
||||
cmake_parse_arguments(
|
||||
ARG #
|
||||
"CCW;FLIPV;TANGENT;BARYCENTRIC;COMPRESS;LH_UP_Y;LH_UP_Z;RH_UP_Y;RH_UP_Z" #
|
||||
"FILE;OUTPUT;SCALE;OBB;PACKNORMAL;PACKUV" #
|
||||
"" #
|
||||
${ARGN} #
|
||||
)
|
||||
_bgfx_geometryc_parse(CLI ${ARGV})
|
||||
add_custom_command(
|
||||
OUTPUT ${ARG_OUTPUT} #
|
||||
COMMAND bgfx::geometryc ${CLI} #
|
||||
MAIN_DEPENDENCY ${ARG_INPUT} #
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# _bgfx_shaderc_parse(
|
||||
# FILE filename
|
||||
# OUTPUT filename
|
||||
# FRAGMENT|VERTEX|COMPUTE
|
||||
@@ -17,7 +364,7 @@
|
||||
# [DISASM]
|
||||
# [WERROR]
|
||||
# )
|
||||
function(shaderc_parse ARG_OUT)
|
||||
function(_bgfx_shaderc_parse ARG_OUT)
|
||||
cmake_parse_arguments(
|
||||
ARG
|
||||
"DEPENDS;ANDROID;ASM_JS;IOS;LINUX;NACL;OSX;WINDOWS;PREPROCESS;RAW;FRAGMENT;VERTEX;COMPUTE;VERBOSE;DEBUG;DISASM;WERROR"
|
||||
@@ -61,14 +408,14 @@ function(shaderc_parse ARG_OUT)
|
||||
foreach(P ${PLATFORMS})
|
||||
if(ARG_${P})
|
||||
if(PLATFORM)
|
||||
message(SEND_ERROR "Call to shaderc_parse() cannot have both flags ${PLATFORM} and ${P}.")
|
||||
message(SEND_ERROR "Call to _bgfx_shaderc_parse() cannot have both flags ${PLATFORM} and ${P}.")
|
||||
return()
|
||||
endif()
|
||||
set(PLATFORM "${P}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(PLATFORM STREQUAL "")
|
||||
message(SEND_ERROR "Call to shaderc_parse() must have a platform flag: ${PLATFORMS}")
|
||||
message(SEND_ERROR "Call to _bgfx_shaderc_parse() must have a platform flag: ${PLATFORMS}")
|
||||
return()
|
||||
elseif(PLATFORM STREQUAL ANDROID)
|
||||
list(APPEND CLI "--platform" "android")
|
||||
@@ -116,14 +463,14 @@ function(shaderc_parse ARG_OUT)
|
||||
foreach(T ${TYPES})
|
||||
if(ARG_${T})
|
||||
if(TYPE)
|
||||
message(SEND_ERROR "Call to shaderc_parse() cannot have both flags ${TYPE} and ${T}.")
|
||||
message(SEND_ERROR "Call to _bgfx_shaderc_parse() cannot have both flags ${TYPE} and ${T}.")
|
||||
return()
|
||||
endif()
|
||||
set(TYPE "${T}")
|
||||
endif()
|
||||
endforeach()
|
||||
if("${TYPE}" STREQUAL "")
|
||||
message(SEND_ERROR "Call to shaderc_parse() must have a type flag: ${TYPES}")
|
||||
message(SEND_ERROR "Call to _bgfx_shaderc_parse() must have a type flag: ${TYPES}")
|
||||
return()
|
||||
elseif("${TYPE}" STREQUAL "FRAGMENT")
|
||||
list(APPEND CLI "--type" "fragment")
|
||||
@@ -171,7 +518,7 @@ function(shaderc_parse ARG_OUT)
|
||||
set(${ARG_OUT} ${CLI} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_get_profile_ext PROFILE PROFILE_EXT)
|
||||
function(_bgfx_get_profile_ext PROFILE PROFILE_EXT)
|
||||
string(REPLACE 300_es essl PROFILE ${PROFILE})
|
||||
string(REPLACE 120 glsl PROFILE ${PROFILE})
|
||||
string(REPLACE spirv spv PROFILE ${PROFILE})
|
||||
@@ -183,14 +530,14 @@ function(_get_profile_ext PROFILE PROFILE_EXT)
|
||||
set(${PROFILE_EXT} ${PROFILE} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# compile_shader_to_header(
|
||||
# TYPE VERTEX|FRAGMENT|COMPUTE
|
||||
# SHADERS filenames
|
||||
# VARYING_DEF filename
|
||||
# OUTPUT_DIR directory
|
||||
#)
|
||||
# bgfx_compile_shader_to_header(
|
||||
# TYPE VERTEX|FRAGMENT|COMPUTE
|
||||
# SHADERS filenames
|
||||
# VARYING_DEF filename
|
||||
# OUTPUT_DIR directory
|
||||
# )
|
||||
#
|
||||
function(compile_shader_to_header)
|
||||
function(bgfx_compile_shader_to_header)
|
||||
set(options "")
|
||||
set(oneValueArgs TYPE VARYING_DEF OUTPUT_DIR)
|
||||
set(multiValueArgs SHADERS)
|
||||
@@ -235,13 +582,13 @@ function(compile_shader_to_header)
|
||||
set(OUTPUTS "")
|
||||
set(COMMANDS "")
|
||||
foreach(PROFILE ${PROFILES})
|
||||
_get_profile_ext(${PROFILE} PROFILE_EXT)
|
||||
_bgfx_get_profile_ext(${PROFILE} PROFILE_EXT)
|
||||
set(OUTPUT ${ARGS_OUTPUT_DIR}/${SHADER_FILE_BASENAME}.${PROFILE_EXT}.bin.h)
|
||||
set(PLATFORM_I ${PLATFORM})
|
||||
if(PROFILE STREQUAL "spirv")
|
||||
set(PLATFORM_I LINUX)
|
||||
endif()
|
||||
shaderc_parse(
|
||||
_bgfx_shaderc_parse(
|
||||
CLI #
|
||||
${ARGS_TYPE} ${PLATFORM_I} WERROR "$<$<CONFIG:debug>:DEBUG>$<$<CONFIG:relwithdebinfo>:DEBUG>"
|
||||
FILE ${SHADER_FILE_ABSOLUTE}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
# 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/>.
|
||||
|
||||
# Third party libs
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/astc-encoder.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/edtaa3.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/etc1.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/etc2.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/iqa.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/libsquish.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/nvtt.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/pvrtc.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/tinyexr.cmake)
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Grab the bimg source files
|
||||
file(GLOB BIMG_SOURCES ${BIMG_DIR}/src/*.cpp)
|
||||
|
||||
# Create the bimg target
|
||||
add_library(bimg STATIC ${BIMG_SOURCES})
|
||||
|
||||
# Add include directory of bimg
|
||||
target_include_directories(
|
||||
bimg PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
# bimg dependencies
|
||||
target_link_libraries(
|
||||
bimg
|
||||
PUBLIC bx
|
||||
PRIVATE astc-encoder
|
||||
edtaa3
|
||||
etc1
|
||||
etc2
|
||||
iqa
|
||||
squish
|
||||
nvtt
|
||||
pvrtc
|
||||
tinyexr
|
||||
)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bimg PROPERTIES FOLDER "bgfx")
|
||||
25
cmake/bimg/3rdparty/astc_encoder.cmake
vendored
Normal file
25
cmake/bimg/3rdparty/astc_encoder.cmake
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT ASTC_ENCODER_LIBRARIES)
|
||||
file(
|
||||
GLOB_RECURSE #
|
||||
ASTC_ENCODER_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/astc-encoder/source/*.cpp #
|
||||
${BIMG_DIR}/3rdparty/astc-encoder/source/*.h #
|
||||
)
|
||||
set(ASTC_ENCODER_INCLUDE_DIR ${BIMG_DIR}/3rdparty/astc-encoder/include)
|
||||
endif()
|
||||
@@ -1,19 +1,25 @@
|
||||
# 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 iqa)
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB IQA_SOURCES ${BIMG_DIR}/3rdparty/iqa/source/*.c ${BIMG_DIR}/3rdparty/iqa/include/*.h)
|
||||
|
||||
add_library(iqa STATIC ${IQA_SOURCES})
|
||||
target_include_directories(iqa PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty/iqa/include>)
|
||||
set_target_properties(iqa PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
if(NOT EDTAA3_LIBRARIES)
|
||||
file(
|
||||
GLOB_RECURSE #
|
||||
EDTAA3_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/edtaa3/**.cpp #
|
||||
${BIMG_DIR}/3rdparty/edtaa3/**.h #
|
||||
)
|
||||
set(EDTAA3_INCLUDE_DIR ${BIMG_DIR}/3rdparty)
|
||||
endif()
|
||||
@@ -1,19 +1,22 @@
|
||||
# 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 etc1)
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB ETC1_SOURCES ${BIMG_DIR}/3rdparty/etc1/*.cpp ${BIMG_DIR}/3rdparty/etc1/*.h)
|
||||
|
||||
add_library(etc1 STATIC ${ETC1_SOURCES})
|
||||
target_include_directories(etc1 PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty>)
|
||||
set_target_properties(etc1 PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
if(NOT ETC1_LIBRARIES)
|
||||
file(GLOB_RECURSE ETC1_SOURCES ${BIMG_DIR}/3rdparty/etc1/**.cpp #
|
||||
${BIMG_DIR}/3rdparty/etc1/**.hpp #
|
||||
)
|
||||
set(ETC1_INCLUDE_DIR ${BIMG_DIR}/3rdparty)
|
||||
endif()
|
||||
@@ -1,19 +1,25 @@
|
||||
# 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 edtaa3)
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB EDTAA3_SOURCES ${BIMG_DIR}/3rdparty/edtaa3/*.cpp ${BIMG_DIR}/3rdparty/edtaa3/*.h)
|
||||
|
||||
add_library(edtaa3 STATIC ${EDTAA3_SOURCES})
|
||||
target_include_directories(edtaa3 PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty>)
|
||||
set_target_properties(edtaa3 PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
if(NOT ETC2_LIBRARIES)
|
||||
file(
|
||||
GLOB_RECURSE #
|
||||
ETC2_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/etc2/**.cpp #
|
||||
${BIMG_DIR}/3rdparty/etc2/**.hpp #
|
||||
)
|
||||
set(ETC2_INCLUDE_DIR ${BIMG_DIR}/3rdparty)
|
||||
endif()
|
||||
25
cmake/bimg/3rdparty/iqa.cmake
vendored
Normal file
25
cmake/bimg/3rdparty/iqa.cmake
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT IQA_LIBRARIES)
|
||||
file(
|
||||
GLOB_RECURSE #
|
||||
IQA_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/iqa/include/**.h #
|
||||
${BIMG_DIR}/3rdparty/iqa/source/**.c #
|
||||
)
|
||||
set(IQA_INCLUDE_DIR ${BIMG_DIR}/3rdparty/iqa/include)
|
||||
endif()
|
||||
25
cmake/bimg/3rdparty/libsquish.cmake
vendored
Normal file
25
cmake/bimg/3rdparty/libsquish.cmake
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT LIBSQUISH_LIBRARIES)
|
||||
file(
|
||||
GLOB_RECURSE #
|
||||
LIBSQUISH_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/libsquish/**.cpp #
|
||||
${BIMG_DIR}/3rdparty/libsquish/**.h #
|
||||
)
|
||||
set(LIBSQUISH_INCLUDE_DIR ${BIMG_DIR}/3rdparty)
|
||||
endif()
|
||||
26
cmake/bimg/3rdparty/loadpng.cmake
vendored
Normal file
26
cmake/bimg/3rdparty/loadpng.cmake
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT LOADPNG_LIBRARIES)
|
||||
file(
|
||||
GLOB_RECURSE #
|
||||
LOADPNG_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/lodepng/lodepng.cpp #
|
||||
${BIMG_DIR}/3rdparty/lodepng/lodepng.h #
|
||||
)
|
||||
set_source_files_properties(${BIMG_DIR}/3rdparty/lodepng/lodepng.cpp PROPERTIES HEADER_FILE_ONLY ON)
|
||||
set(LOADPNG_INCLUDE_DIR ${BIMG_DIR}/3rdparty)
|
||||
endif()
|
||||
@@ -1,19 +1,23 @@
|
||||
# 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 pvrtc)
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB PVRTC_SOURCES ${BIMG_DIR}/3rdparty/pvrtc/*.cpp ${BIMG_DIR}/3rdparty/pvrtc/*.h)
|
||||
|
||||
add_library(pvrtc STATIC ${PVRTC_SOURCES})
|
||||
target_include_directories(pvrtc PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/3rdparty>)
|
||||
set_target_properties(pvrtc PROPERTIES FOLDER "bgfx/3rdparty" PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}bgfx-")
|
||||
if(NOT MINIZ_LIBRARIES)
|
||||
file(GLOB_RECURSE #
|
||||
MINIZ_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/tinyexr/deps/miniz/miniz.* #
|
||||
)
|
||||
set(MINIZ_INCLUDE_DIR ${BIMG_DIR}/3rdparty/tinyexr/deps/miniz)
|
||||
endif()
|
||||
25
cmake/bimg/3rdparty/nvtt.cmake
vendored
Normal file
25
cmake/bimg/3rdparty/nvtt.cmake
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT NVTT_LIBRARIES)
|
||||
file(
|
||||
GLOB_RECURSE #
|
||||
NVTT_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/nvtt/**.cpp #
|
||||
${BIMG_DIR}/3rdparty/nvtt/**.h #
|
||||
)
|
||||
set(NVTT_INCLUDE_DIR ${BIMG_DIR}/3rdparty/nvtt)
|
||||
endif()
|
||||
25
cmake/bimg/3rdparty/pvrtc.cmake
vendored
Normal file
25
cmake/bimg/3rdparty/pvrtc.cmake
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT PVRTC_LIBRARIES)
|
||||
file(
|
||||
GLOB_RECURSE #
|
||||
PVRTC_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/pvrtc/**.cpp #
|
||||
${BIMG_DIR}/3rdparty/pvrtc/**.h #
|
||||
)
|
||||
set(PVRTC_INCLUDE_DIR ${BIMG_DIR}/3rdparty)
|
||||
endif()
|
||||
23
cmake/bimg/3rdparty/tinyexr.cmake
vendored
Normal file
23
cmake/bimg/3rdparty/tinyexr.cmake
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT TINYEXR_LIBRARIES)
|
||||
file(GLOB_RECURSE #
|
||||
TINYEXR_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/tinyexr/**.h #
|
||||
)
|
||||
set(TINYEXR_INCLUDE_DIR ${BIMG_DIR}/3rdparty)
|
||||
endif()
|
||||
28
cmake/bimg/CMakeLists.txt
Normal file
28
cmake/bimg/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
# 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/>.
|
||||
|
||||
include(3rdparty/loadpng.cmake)
|
||||
include(3rdparty/libsquish.cmake)
|
||||
include(3rdparty/astc_encoder.cmake)
|
||||
include(3rdparty/edtaa3.cmake)
|
||||
include(3rdparty/etc1.cmake)
|
||||
include(3rdparty/etc2.cmake)
|
||||
include(3rdparty/nvtt.cmake)
|
||||
include(3rdparty/pvrtc.cmake)
|
||||
include(3rdparty/tinyexr.cmake)
|
||||
include(3rdparty/iqa.cmake)
|
||||
include(3rdparty/miniz.cmake)
|
||||
include(bimg.cmake)
|
||||
include(bimg_decode.cmake)
|
||||
include(bimg_encode.cmake)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE)
|
||||
include(texturec.cmake)
|
||||
endif()
|
||||
46
cmake/bimg/bimg.cmake
Normal file
46
cmake/bimg/bimg.cmake
Normal file
@@ -0,0 +1,46 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg, directory does not exist. ${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
|
||||
${BIMG_DIR}/include/* #
|
||||
${BIMG_DIR}/src/image.* #
|
||||
${BIMG_DIR}/src/image_gnf.cpp #
|
||||
#
|
||||
${ASTC_ENCODER_SOURCES}
|
||||
${MINIZ_SOURCES}
|
||||
)
|
||||
|
||||
target_sources(bimg PRIVATE ${BIMG_SOURCES})
|
||||
|
||||
target_link_libraries(
|
||||
bimg
|
||||
PUBLIC bx #
|
||||
${ASTC_ENCODER_LIBRARIES} #
|
||||
${MINIZ_LIBRARIES} #
|
||||
)
|
||||
47
cmake/bimg/bimg_decode.cmake
Normal file
47
cmake/bimg/bimg_decode.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg_decode, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(bimg_decode STATIC)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bimg_decode PROPERTIES FOLDER "bgfx")
|
||||
target_include_directories(
|
||||
bimg_decode
|
||||
PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
PRIVATE ${LOADPNG_INCLUDE_DIR} #
|
||||
${MINIZ_INCLUDE_DIR} #
|
||||
${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 #
|
||||
${LOADPNG_LIBRARIES} #
|
||||
${MINIZ_LIBRARIES} #
|
||||
${TINYEXR_LIBRARIES} #
|
||||
)
|
||||
87
cmake/bimg/bimg_encode.cmake
Normal file
87
cmake/bimg/bimg_encode.cmake
Normal file
@@ -0,0 +1,87 @@
|
||||
# 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/>.
|
||||
|
||||
# Ensure the directory exists
|
||||
if(NOT IS_DIRECTORY ${BIMG_DIR})
|
||||
message(SEND_ERROR "Could not load bimg_encode, directory does not exist. ${BIMG_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(bimg_encode STATIC)
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bimg_encode PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
bimg_encode
|
||||
PUBLIC $<BUILD_INTERFACE:${BIMG_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
PRIVATE ${LIBSQUISH_INCLUDE_DIR} #
|
||||
${ASTC_ENCODER_INCLUDE_DIR} #
|
||||
${EDTAA3_INCLUDE_DIR} #
|
||||
${ETC1_INCLUDE_DIR} #
|
||||
${ETC2_INCLUDE_DIR} #
|
||||
${NVTT_INCLUDE_DIR} #
|
||||
${PVRTC_INCLUDE_DIR} #
|
||||
${TINYEXR_INCLUDE_DIR} #
|
||||
${IQA_INCLUDE_DIR} #
|
||||
${MINIZ_INCLUDE_DIR} #
|
||||
)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
BIMG_ENCODE_SOURCES
|
||||
${BIMG_DIR}/include/* #
|
||||
${BIMG_DIR}/src/image_encode.* #
|
||||
${BIMG_DIR}/src/image_cubemap_filter.* #
|
||||
${LIBSQUISH_SOURCES} #
|
||||
${EDTAA3_SOURCES} #
|
||||
${ETC1_SOURCES} #
|
||||
${ETC2_SOURCES} #
|
||||
${NVTT_SOURCES} #
|
||||
${PVRTC_SOURCES} #
|
||||
${TINYEXR_SOURCES}
|
||||
${IQA_SOURCES} #
|
||||
)
|
||||
|
||||
target_sources(bimg_encode PRIVATE ${BIMG_ENCODE_SOURCES})
|
||||
|
||||
target_link_libraries(
|
||||
bimg_encode
|
||||
PUBLIC bx #
|
||||
${LIBSQUISH_LIBRARIES} #
|
||||
${ASTC_ENCODER_LIBRARIES} #
|
||||
${EDTAA3_LIBRARIES} #
|
||||
${ETC1_LIBRARIES} #
|
||||
${ETC2_LIBRARIES} #
|
||||
${NVTT_LIBRARIES} #
|
||||
${PVRTC_LIBRARIES} #
|
||||
${TINYEXR_LIBRARIES} #
|
||||
${IQA_LIBRARIES} #
|
||||
)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
foreach(flag "-Wno-implicit-fallthrough" "-Wno-shadow" "-Wno-shift-negative-value" "-Wno-undef")
|
||||
check_cxx_compiler_flag(${flag} flag_supported)
|
||||
if(flag_supported)
|
||||
target_compile_options(bimg_encode PRIVATE ${flag})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(flag "-Wno-class-memaccess" "-Wno-deprecated-copy")
|
||||
check_cxx_compiler_flag(${flag} flag_supported)
|
||||
if(flag_supported)
|
||||
foreach(file ${BIMG_ENCODE_SOURCES})
|
||||
get_source_file_property(lang ${file} LANGUAGE)
|
||||
if(lang STREQUAL "CXX")
|
||||
set_source_files_properties(${file} PROPERTIES COMPILE_OPTIONS ${flag})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -1,24 +1,34 @@
|
||||
# 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/>.
|
||||
|
||||
include(CMakeParseArguments)
|
||||
add_executable(texturec)
|
||||
|
||||
add_executable(texturec ${BIMG_DIR}/tools/texturec/texturec.cpp)
|
||||
set_target_properties(texturec PROPERTIES FOLDER "bgfx/tools")
|
||||
target_link_libraries(texturec bimg)
|
||||
if(BGFX_CUSTOM_TARGETS)
|
||||
# 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" #
|
||||
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}texturec #
|
||||
)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools texturec)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
target_link_libraries(texturec log)
|
||||
target_link_libraries(texturec PRIVATE log)
|
||||
elseif(IOS)
|
||||
set_target_properties(texturec PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER texturec)
|
||||
endif()
|
||||
43
cmake/bx/CMakeLists.txt
Normal file
43
cmake/bx/CMakeLists.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
# 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/>.
|
||||
|
||||
include(bx.cmake)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_BIN2C)
|
||||
include(bin2c.cmake)
|
||||
endif()
|
||||
|
||||
if(BGFX_BUILD_TESTS)
|
||||
add_executable(bx_test)
|
||||
target_compile_definitions(bx_test PRIVATE CATCH_AMALGAMATED_CUSTOM_MAIN)
|
||||
file(
|
||||
GLOB
|
||||
BX_TEST_SOURCES #
|
||||
${BX_DIR}/3rdparty/catch/catch_amalgamated.cpp
|
||||
${BX_DIR}/tests/*_test.cpp #
|
||||
${BX_DIR}/tests/*.h #
|
||||
${BX_DIR}/tests/dbg.* #
|
||||
)
|
||||
target_sources(bx_test PRIVATE ${BX_TEST_SOURCES})
|
||||
target_link_libraries(bx_test PRIVATE bx)
|
||||
add_test(NAME bx.test COMMAND bx_test)
|
||||
|
||||
add_executable(bx_bench)
|
||||
file(
|
||||
GLOB
|
||||
BX_BENCH_SOURCES #
|
||||
${BX_DIR}/tests/*_bench.cpp #
|
||||
${BX_DIR}/tests/*_bench.h #
|
||||
${BX_DIR}/tests/dbg.* #
|
||||
)
|
||||
target_sources(bx_bench PRIVATE ${BX_BENCH_SOURCES})
|
||||
target_link_libraries(bx_bench PRIVATE bx)
|
||||
add_test(NAME bx.bench COMMAND bx_bench)
|
||||
endif()
|
||||
34
cmake/bx/bin2c.cmake
Normal file
34
cmake/bx/bin2c.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
# 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/>.
|
||||
|
||||
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" #
|
||||
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}bin2c #
|
||||
)
|
||||
|
||||
if(BGFX_BUILD_TOOLS_BIN2C AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools bin2c)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
target_link_libraries(bin2c PRIVATE log)
|
||||
elseif(IOS)
|
||||
set_target_properties(bin2c PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER bin2c)
|
||||
endif()
|
||||
@@ -14,21 +14,84 @@ if(NOT IS_DIRECTORY ${BX_DIR})
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Grab the bx source files
|
||||
file(GLOB BX_SOURCES ${BX_DIR}/src/*.cpp)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(BX_AMALGAMATED)
|
||||
set(BX_NOBUILD ${BX_SOURCES})
|
||||
list(REMOVE_ITEM BX_NOBUILD ${BX_DIR}/src/amalgamated.cpp)
|
||||
foreach(BX_SRC ${BX_NOBUILD})
|
||||
set_source_files_properties(${BX_SRC} PROPERTIES HEADER_FILE_ONLY ON)
|
||||
endforeach()
|
||||
else()
|
||||
set_source_files_properties(${BX_DIR}/src/amalgamated.cpp PROPERTIES HEADER_FILE_ONLY ON)
|
||||
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()
|
||||
|
||||
# Create the bx target
|
||||
add_library(bx STATIC ${BX_SOURCES})
|
||||
# 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
|
||||
BX_SOURCES
|
||||
${BX_DIR}/include/*.h #
|
||||
${BX_DIR}/include/**.inl #
|
||||
${BX_DIR}/src/*.cpp #
|
||||
${BX_DIR}/scripts/*.natvis #
|
||||
)
|
||||
|
||||
if(BX_AMALGAMATED)
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/allocator.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/bounds.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/bx.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/commandline.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/crtnone.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/debug.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/dtoa.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/easing.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/file.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/filepath.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/hash.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/math.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/mutex.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/os.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/process.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/semaphore.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/settings.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/sort.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/string.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/thread.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/timer.cpp")
|
||||
list(APPEND BX_NOBUILD "${BX_DIR}/src/url.cpp")
|
||||
else()
|
||||
file(GLOB_RECURSE BX_NOBUILD "${BX_DIR}/src/amalgamated.*")
|
||||
endif()
|
||||
|
||||
# Exclude files from the build but keep them in project
|
||||
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})
|
||||
|
||||
# All configurations
|
||||
target_compile_definitions(bx PUBLIC "BX_CONFIG_DEBUG=$<IF:$<CONFIG:Debug>,1,$<BOOL:${BX_CONFIG_DEBUG}>>")
|
||||
target_compile_definitions(bx PUBLIC "__STDC_LIMIT_MACROS")
|
||||
target_compile_definitions(bx PUBLIC "__STDC_FORMAT_MACROS")
|
||||
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)
|
||||
@@ -39,44 +102,6 @@ if(WIN32)
|
||||
target_link_libraries(bx PUBLIC psapi)
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# 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 system specific configurations
|
||||
if(MINGW)
|
||||
target_include_directories(
|
||||
bx PUBLIC $<BUILD_INTERFACE:${BX_DIR}/include/compat/mingw>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/compat/mingw>
|
||||
)
|
||||
elseif(WIN32)
|
||||
target_include_directories(
|
||||
bx PUBLIC $<BUILD_INTERFACE:${BX_DIR}/include/compat/msvc>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/compat/msvc>
|
||||
)
|
||||
elseif(APPLE) # APPLE is technically UNIX... ORDERING MATTERS!
|
||||
target_include_directories(
|
||||
bx PUBLIC $<BUILD_INTERFACE:${BX_DIR}/include/compat/osx>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/compat/osx>
|
||||
)
|
||||
elseif(UNIX)
|
||||
target_include_directories(
|
||||
bx PUBLIC $<BUILD_INTERFACE:${BX_DIR}/include/compat/linux>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/compat/linux>
|
||||
)
|
||||
endif()
|
||||
|
||||
# All configurations
|
||||
target_compile_definitions(bx PUBLIC "__STDC_LIMIT_MACROS")
|
||||
target_compile_definitions(bx PUBLIC "__STDC_FORMAT_MACROS")
|
||||
target_compile_definitions(bx PUBLIC "__STDC_CONSTANT_MACROS")
|
||||
|
||||
target_compile_definitions(bx PUBLIC "BX_CONFIG_DEBUG=$<IF:$<CONFIG:Debug>,1,$<BOOL:${BX_CONFIG_DEBUG}>>")
|
||||
|
||||
# Additional dependencies on Unix
|
||||
if(ANDROID)
|
||||
# For __android_log_write
|
||||
@@ -1,54 +0,0 @@
|
||||
# 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/>.
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../3rdparty/fcpp.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../3rdparty/glsl-optimizer.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../3rdparty/glslang.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../3rdparty/spirv-cross.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../3rdparty/spirv-tools.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../3rdparty/webgpu.cmake)
|
||||
|
||||
add_executable(
|
||||
shaderc
|
||||
${BGFX_DIR}/tools/shaderc/shaderc.cpp
|
||||
${BGFX_DIR}/tools/shaderc/shaderc.h
|
||||
${BGFX_DIR}/tools/shaderc/shaderc_glsl.cpp
|
||||
${BGFX_DIR}/tools/shaderc/shaderc_hlsl.cpp
|
||||
${BGFX_DIR}/tools/shaderc/shaderc_pssl.cpp
|
||||
${BGFX_DIR}/tools/shaderc/shaderc_spirv.cpp
|
||||
${BGFX_DIR}/tools/shaderc/shaderc_metal.cpp
|
||||
)
|
||||
target_compile_definitions(shaderc PRIVATE "-D_CRT_SECURE_NO_WARNINGS")
|
||||
set_target_properties(shaderc PROPERTIES FOLDER "bgfx/tools")
|
||||
target_link_libraries(
|
||||
shaderc
|
||||
PRIVATE bx
|
||||
bimg
|
||||
bgfx-vertexlayout
|
||||
bgfx-shader
|
||||
fcpp
|
||||
glsl-optimizer
|
||||
glslang
|
||||
spirv-cross
|
||||
spirv-tools
|
||||
webgpu
|
||||
)
|
||||
|
||||
if(BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools shaderc)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
target_link_libraries(shaderc PRIVATE log)
|
||||
elseif(IOS)
|
||||
set_target_properties(shaderc PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER shaderc)
|
||||
endif()
|
||||
Reference in New Issue
Block a user