diff --git a/CMakeLists.txt b/CMakeLists.txt index ea83734..8b75a6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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." ) diff --git a/cmake/bgfx.cmake b/cmake/bgfx.cmake index 2ae4a5c..bc51838 100755 --- a/cmake/bgfx.cmake +++ b/cmake/bgfx.cmake @@ -35,6 +35,9 @@ add_library( bgfx STATIC ${BGFX_SOURCES} ) # Enable BGFX_CONFIG_DEBUG in Debug configuration target_compile_definitions( bgfx PRIVATE "$<$:BGFX_CONFIG_DEBUG=1>" ) +if(BGFX_CONFIG_DEBUG) + target_compile_definitions( bgfx PRIVATE BGFX_CONFIG_DEBUG=1) +endif() # Special Visual Studio Flags if( MSVC ) diff --git a/cmake/bx.cmake b/cmake/bx.cmake index 257880c..17d2ad0 100644 --- a/cmake/bx.cmake +++ b/cmake/bx.cmake @@ -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 "$<$: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