Fixed: Debug/CHECK builds of bgfx were not straightforward with the current setup; bgfx relies on BX also being debug-enabled, while this only enabled it for BGFX and only in CMAKE Debug mode. Added BGFX_CONFIG_DEBUG cmake option to easily enable checked/trace builds in release mode

This commit is contained in:
Walter Pearce
2017-11-30 15:38:49 -08:00
committed by Joshua Brookover
parent 9972c1001b
commit 43c8db3c9f
3 changed files with 10 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ option( BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON
option( BGFX_USE_OVR "Build with OVR support." OFF )
option( BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF )
option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF )
option( BGFX_CONFIG_DEBUG "Enables debug configuration on all builds" OFF)
if( NOT BX_DIR )
set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bx." )

View File

@@ -35,6 +35,9 @@ add_library( bgfx STATIC ${BGFX_SOURCES} )
# Enable BGFX_CONFIG_DEBUG in Debug configuration
target_compile_definitions( bgfx PRIVATE "$<$<CONFIG:Debug>:BGFX_CONFIG_DEBUG=1>" )
if(BGFX_CONFIG_DEBUG)
target_compile_definitions( bgfx PRIVATE BGFX_CONFIG_DEBUG=1)
endif()
# Special Visual Studio Flags
if( MSVC )

View File

@@ -16,6 +16,7 @@ endif()
# Grab the bx source files
file( GLOB BX_SOURCES ${BX_DIR}/src/*.cpp )
if(BX_AMALGAMATED)
set(BX_NOBUILD ${BX_SOURCES})
list(REMOVE_ITEM BX_NOBUILD ${BX_DIR}/src/amalgamated.cpp)
@@ -51,6 +52,11 @@ 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 PRIVATE "$<$<CONFIG:Debug>:BX_CONFIG_DEBUG=1>" )
if(BGFX_CONFIG_DEBUG)
target_compile_definitions( bx PRIVATE BX_CONFIG_DEBUG=1)
endif()
# Additional dependencies on Unix
if( UNIX AND NOT APPLE )
# Threads