mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
Compare commits
4 Commits
v1.115.808
...
v1.115.808
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d725e78f86 | ||
|
|
dd2017c332 | ||
|
|
ead887f59b | ||
|
|
f184835827 |
@@ -21,14 +21,15 @@ if( APPLE AND NOT XCODE )
|
||||
set( CMAKE_CXX_FLAGS "-ObjC++" )
|
||||
endif()
|
||||
|
||||
option( BGFX_BUILD_TOOLS "Build bgfx tools." ON )
|
||||
option( BGFX_BUILD_EXAMPLES "Build bgfx examples." ON )
|
||||
option( BGFX_INSTALL "Create installation target." ON )
|
||||
option( BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF )
|
||||
option( BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON )
|
||||
option( BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF )
|
||||
option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF )
|
||||
option( BGFX_CONFIG_RENDERER_WEBGPU "Enables the webgpu renderer" OFF )
|
||||
option( BGFX_BUILD_TOOLS "Build bgfx tools." ON )
|
||||
option( BGFX_BUILD_EXAMPLES "Build bgfx examples." ON )
|
||||
option( BGFX_INSTALL "Create installation target." ON )
|
||||
option( BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF )
|
||||
option( BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON )
|
||||
option( BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF )
|
||||
option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF )
|
||||
option( BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON )
|
||||
option( BGFX_CONFIG_RENDERER_WEBGPU "Enables the webgpu renderer" OFF )
|
||||
|
||||
set( BGFX_OPENGL_VERSION "" CACHE STRING "Specify minimum opengl version" )
|
||||
set( BGFX_OPENGLES_VERSION "" CACHE STRING "Specify minimum OpenGL ES version" )
|
||||
|
||||
8
cmake/3rdparty/glsl-optimizer.cmake
vendored
8
cmake/3rdparty/glsl-optimizer.cmake
vendored
@@ -27,7 +27,8 @@ 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 )
|
||||
add_library( glcpp ${GLCPP_SOURCES} )
|
||||
# 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")
|
||||
@@ -39,7 +40,8 @@ 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 )
|
||||
add_library( mesa ${MESA_SOURCES} )
|
||||
# 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")
|
||||
@@ -53,7 +55,7 @@ set_target_properties( mesa PROPERTIES FOLDER "bgfx/3rdparty" )
|
||||
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 ${GLSL-OPTIMIZER_SOURCES} )
|
||||
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
|
||||
|
||||
@@ -70,7 +70,11 @@ if( MSVC )
|
||||
endif()
|
||||
|
||||
# Add debug config required in bx headers since bx is private
|
||||
target_compile_definitions(bgfx PUBLIC "BX_CONFIG_DEBUG=$<CONFIG:Debug>")
|
||||
target_compile_definitions(bgfx
|
||||
PUBLIC
|
||||
"BX_CONFIG_DEBUG=$<CONFIG:Debug>"
|
||||
"BGFX_CONFIG_MULTITHREADED=$<BOOL:${BGFX_CONFIG_MULTITHREADED}>"
|
||||
)
|
||||
|
||||
# Includes
|
||||
target_include_directories( bgfx
|
||||
|
||||
@@ -70,17 +70,22 @@ target_compile_definitions( bx PUBLIC "__STDC_CONSTANT_MACROS" )
|
||||
target_compile_definitions(bx PUBLIC "BX_CONFIG_DEBUG=$<CONFIG:Debug>")
|
||||
|
||||
# Additional dependencies on Unix
|
||||
if( UNIX AND NOT APPLE AND NOT ANDROID )
|
||||
if (ANDROID)
|
||||
# For __android_log_write
|
||||
find_library( LOG_LIBRARY log )
|
||||
mark_as_advanced( LOG_LIBRARY )
|
||||
target_link_libraries( bx PUBLIC ${LOG_LIBRARY} )
|
||||
elseif( APPLE )
|
||||
find_library( FOUNDATION_LIBRARY Foundation)
|
||||
mark_as_advanced( FOUNDATION_LIBRARY )
|
||||
target_link_libraries( bx PUBLIC ${FOUNDATION_LIBRARY} )
|
||||
elseif( UNIX )
|
||||
# Threads
|
||||
find_package( Threads )
|
||||
target_link_libraries( bx ${CMAKE_THREAD_LIBS_INIT} dl )
|
||||
|
||||
# Real time (for clock_gettime)
|
||||
target_link_libraries( bx rt )
|
||||
elseif(APPLE)
|
||||
find_library( FOUNDATION_LIBRARY Foundation)
|
||||
mark_as_advanced( FOUNDATION_LIBRARY )
|
||||
target_link_libraries( bx PUBLIC ${FOUNDATION_LIBRARY} )
|
||||
endif()
|
||||
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
|
||||
@@ -171,7 +171,7 @@ function( add_example ARG_NAME )
|
||||
target_compile_definitions( example-${ARG_NAME} PRIVATE "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_FORMAT_MACROS" "-DENTRY_CONFIG_IMPLEMENT_MAIN=1" )
|
||||
|
||||
# Configure shaders
|
||||
if( NOT ARG_COMMON AND NOT IOS AND NOT EMSCRIPTEN)
|
||||
if( NOT ARG_COMMON AND NOT IOS AND NOT EMSCRIPTEN AND NOT ANDROID)
|
||||
foreach( SHADER ${SHADERS} )
|
||||
add_bgfx_shader( ${SHADER} ${ARG_NAME} )
|
||||
endforeach()
|
||||
|
||||
Reference in New Issue
Block a user