mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
Compare commits
11 Commits
v1.118.839
...
v1.118.841
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fba0379121 | ||
|
|
a6cfe968a5 | ||
|
|
0479a929a7 | ||
|
|
e5fea62b02 | ||
|
|
0a11910c2a | ||
|
|
1c31493614 | ||
|
|
fb50e78e49 | ||
|
|
cf8b57e65c | ||
|
|
38d11732c7 | ||
|
|
b6c4027d20 | ||
|
|
086fccf3a8 |
52
.github/workflows/ci.yml
vendored
52
.github/workflows/ci.yml
vendored
@@ -8,7 +8,7 @@ on:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
job:
|
||||
native:
|
||||
name: ${{ matrix.os }} ${{ matrix.cc }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
@@ -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,50 @@ jobs:
|
||||
# Build the whole project with Ninja (which is spawn by CMake).
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}"
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}"
|
||||
|
||||
# Build the examples which are excluded from all
|
||||
- name: Build examples
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target examples
|
||||
|
||||
cross-android:
|
||||
name: cross-android
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
env:
|
||||
# Indicates the CMake build directory where project files and binaries are being produced.
|
||||
CMAKE_BUILD_DIR: ${{ github.workspace }}/build/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y libgl1-mesa-dev
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
|
||||
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
|
||||
- uses: lukka/get-cmake@latest
|
||||
|
||||
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
# Run CMake to generate Ninja project files
|
||||
- name: Generate project files
|
||||
run: |
|
||||
cmake -B "${{ env.CMAKE_BUILD_DIR }}" -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake
|
||||
|
||||
# Build the whole project with Ninja (which is spawn by CMake).
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}"
|
||||
|
||||
# Build the examples which are excluded from all
|
||||
- name: Build examples
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target examples
|
||||
|
||||
@@ -51,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")
|
||||
@@ -71,11 +72,7 @@ if(BGFX_CMAKE_USER_SCRIPT)
|
||||
include(${BGFX_CMAKE_USER_SCRIPT})
|
||||
endif()
|
||||
|
||||
set_property(CACHE BGFX_LIBRARY_TYPE PROPERTY STRINGS STATIC SHARED)
|
||||
|
||||
if(BGFX_LIBRARY_TYPE MATCHES "SHARED")
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
if(BGFX_BUILD_TESTS)
|
||||
enable_testing()
|
||||
|
||||
2
bgfx
2
bgfx
Submodule bgfx updated: 5f435ea56b...6f36b4fb3a
2
bimg
2
bimg
Submodule bimg updated: 1af90543ca...7afa241925
2
bx
2
bx
Submodule bx updated: aed1086c48...fa1411e4aa
1
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
1
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
@@ -138,6 +138,7 @@ file(
|
||||
${SPIRV_TOOLS}/source/val/validate_primitives.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_ray_query.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_ray_tracing.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_ray_tracing_reorder.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_scopes.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_small_type_uses.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_type.cpp
|
||||
|
||||
@@ -19,13 +19,10 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
string(SUBSTRING "${FILENAME}" 0 2 TYPE)
|
||||
if("${TYPE}" STREQUAL "fs")
|
||||
set(TYPE "FRAGMENT")
|
||||
set(D3D_PREFIX "ps")
|
||||
elseif("${TYPE}" STREQUAL "vs")
|
||||
set(TYPE "VERTEX")
|
||||
set(D3D_PREFIX "vs")
|
||||
elseif("${TYPE}" STREQUAL "cs")
|
||||
set(TYPE "COMPUTE")
|
||||
set(D3D_PREFIX "cs")
|
||||
else()
|
||||
set(TYPE "")
|
||||
endif()
|
||||
@@ -41,7 +38,7 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
set(DX9_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/dx9/${FILENAME}.bin)
|
||||
_bgfx_shaderc_parse(
|
||||
DX9 ${COMMON} WINDOWS
|
||||
PROFILE ${D3D_PREFIX}_3_0
|
||||
PROFILE s_3_0
|
||||
O 3
|
||||
OUTPUT ${DX9_OUTPUT}
|
||||
)
|
||||
@@ -54,14 +51,14 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
_bgfx_shaderc_parse(
|
||||
DX11 ${COMMON} WINDOWS
|
||||
PROFILE ${D3D_PREFIX}_5_0
|
||||
PROFILE s_5_0
|
||||
O 3
|
||||
OUTPUT ${DX11_OUTPUT}
|
||||
)
|
||||
else()
|
||||
_bgfx_shaderc_parse(
|
||||
DX11 ${COMMON} WINDOWS
|
||||
PROFILE ${D3D_PREFIX}_5_0
|
||||
PROFILE s_5_0
|
||||
O 1
|
||||
OUTPUT ${DX11_OUTPUT}
|
||||
)
|
||||
@@ -89,7 +86,7 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
# glsl
|
||||
set(GLSL_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/glsl/${FILENAME}.bin)
|
||||
if(NOT "${TYPE}" STREQUAL "COMPUTE")
|
||||
_bgfx_shaderc_parse(GLSL ${COMMON} LINUX PROFILE 120 OUTPUT ${GLSL_OUTPUT})
|
||||
_bgfx_shaderc_parse(GLSL ${COMMON} LINUX PROFILE 140 OUTPUT ${GLSL_OUTPUT})
|
||||
else()
|
||||
_bgfx_shaderc_parse(GLSL ${COMMON} LINUX PROFILE 430 OUTPUT ${GLSL_OUTPUT})
|
||||
endif()
|
||||
@@ -160,16 +157,69 @@ function(add_example ARG_NAME)
|
||||
find_package(SDL2 REQUIRED)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC ${SDL2_LIBRARIES})
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_SDL)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC X11)
|
||||
endif()
|
||||
else()
|
||||
if(BGFX_INSTALL_EXAMPLES)
|
||||
add_executable(example-${ARG_NAME} WIN32 ${SOURCES})
|
||||
else()
|
||||
add_executable(example-${ARG_NAME} WIN32 EXCLUDE_FROM_ALL ${SOURCES})
|
||||
|
||||
if(ANDROID)
|
||||
target_include_directories(example-${ARG_NAME} PRIVATE ${BGFX_DIR}/3rdparty/native_app_glue)
|
||||
target_link_libraries(example-${ARG_NAME} INTERFACE android EGL GLESv2)
|
||||
endif()
|
||||
target_link_libraries(example-${ARG_NAME} example-common)
|
||||
|
||||
if(BGFX_BUILD_EXAMPLES)
|
||||
if(IOS OR WIN32)
|
||||
# on iOS we need to build a bundle so have to copy the data rather than symlink
|
||||
# and on windows we can't create symlinks
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} COMMAND ${CMAKE_COMMAND} -E copy_directory ${BGFX_DIR}/examples/runtime/
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>
|
||||
)
|
||||
else()
|
||||
# For everything else symlink some folders into our output directory
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/font
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/font
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/images
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/images
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/meshes
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/meshes
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/shaders
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/shaders
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/text
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/text
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/textures
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/textures
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else()
|
||||
if(ANDROID)
|
||||
add_library(example-${ARG_NAME} SHARED)
|
||||
else()
|
||||
add_executable(example-${ARG_NAME} WIN32)
|
||||
endif()
|
||||
if(NOT BGFX_INSTALL_EXAMPLES)
|
||||
set_property(TARGET example-${ARG_NAME} PROPERTY EXCLUDE_FROM_ALL ON)
|
||||
endif()
|
||||
target_sources(example-${ARG_NAME} PUBLIC ${SOURCES})
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC example-common)
|
||||
configure_debugging(example-${ARG_NAME} WORKING_DIR ${BGFX_DIR}/examples/runtime)
|
||||
if(MSVC)
|
||||
set_target_properties(example-${ARG_NAME} PROPERTIES LINK_FLAGS "/ENTRY:\"mainCRTStartup\"")
|
||||
@@ -189,8 +239,10 @@ function(add_example ARG_NAME)
|
||||
endif()
|
||||
endif()
|
||||
target_compile_definitions(
|
||||
example-${ARG_NAME} PRIVATE "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_FORMAT_MACROS"
|
||||
"-DENTRY_CONFIG_IMPLEMENT_MAIN=1"
|
||||
example-${ARG_NAME}
|
||||
PRIVATE "-D_CRT_SECURE_NO_WARNINGS" #
|
||||
"-D__STDC_FORMAT_MACROS" #
|
||||
"-DENTRY_CONFIG_IMPLEMENT_MAIN=1" #
|
||||
)
|
||||
|
||||
# Configure shaders
|
||||
@@ -216,42 +268,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,7 +8,11 @@
|
||||
# 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)
|
||||
if(ANDROID)
|
||||
add_library(geometryv SHARED)
|
||||
else()
|
||||
add_executable(geometryv)
|
||||
endif()
|
||||
|
||||
# Grab the geometryv source files
|
||||
file(GLOB_RECURSE GEOMETRYV_SOURCES #
|
||||
@@ -16,7 +20,7 @@ file(GLOB_RECURSE GEOMETRYV_SOURCES #
|
||||
)
|
||||
|
||||
target_sources(geometryv PRIVATE ${GEOMETRYV_SOURCES})
|
||||
target_link_libraries(geometryv example-common)
|
||||
target_link_libraries(geometryv PRIVATE example-common)
|
||||
set_target_properties(
|
||||
geometryv PROPERTIES FOLDER "bgfx/tools" #
|
||||
OUTPUT_NAME ${BGFX_TOOLS_PREFIX}geometryv #
|
||||
@@ -26,7 +30,9 @@ if(BGFX_BUILD_TOOLS_GEOMETRY AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools geometryv)
|
||||
endif()
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
if(ANDROID)
|
||||
set_property(TARGET geometryv PROPERTY PREFIX "")
|
||||
elseif(EMSCRIPTEN)
|
||||
target_link_options(geometryv PRIVATE -sMAX_WEBGL_VERSION=2)
|
||||
elseif(IOS)
|
||||
set_target_properties(geometryv PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER geometryv)
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
# You should have received a copy of the CC0 Public Domain Dedication along with
|
||||
# this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
|
||||
add_executable(texturev)
|
||||
if(ANDROID)
|
||||
add_library(texturev SHARED)
|
||||
else()
|
||||
add_executable(texturev)
|
||||
endif()
|
||||
|
||||
# Grab the texturev source files
|
||||
file(GLOB_RECURSE TEXTUREV_SOURCES #
|
||||
@@ -26,7 +30,9 @@ if(BGFX_BUILD_TOOLS_TEXTURE AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools texturev)
|
||||
endif()
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
if(ANDROID)
|
||||
set_property(TARGET texturev PROPERTY PREFIX "")
|
||||
elseif(EMSCRIPTEN)
|
||||
target_link_options(texturev PRIVATE -sMAX_WEBGL_VERSION=2)
|
||||
elseif(IOS)
|
||||
set_target_properties(texturev PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_GUI_IDENTIFIER texturev)
|
||||
|
||||
Reference in New Issue
Block a user