Add verbose logging cmake option

pull/5628/head
Steve M 2024-07-11 18:09:59 -07:00
parent 3496284824
commit c7374336af
3 changed files with 16 additions and 7 deletions

View File

@ -40,6 +40,9 @@ SET(CMAKE_POLICY_DEFAULT_CMP0092 NEW)
CMAKE_MINIMUM_REQUIRED( VERSION 3.22 )
# Experimental USD importer: disabled, need to opt-in
option(ASSIMP_BUILD_USD_VERBOSE_LOGS "Enable verbose USD import debug logging" off)
# Disabled importers: m3d for 5.1 or later
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_IMPORTER)
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_EXPORTER)

View File

@ -935,6 +935,9 @@ SOURCE_GROUP( Extra FILES ${Extra_SRCS})
# USD/USDA/USDC/USDZ support
# tinyusdz
IF (NOT ASSIMP_BUILD_NO_USD_IMPORTER)
if (ASSIMP_BUILD_USD_VERBOSE_LOGS)
ADD_DEFINITIONS( -DASSIMP_USD_VERBOSE_LOGS)
endif ()
# Use CMAKE_CURRENT_SOURCE_DIR which provides assimp-local path (CMAKE_SOURCE_DIR is
# relative to top-level/main project)
set(Tinyusdz_BASE_ABSPATH "${CMAKE_CURRENT_SOURCE_DIR}/../contrib/tinyusdz")

View File

@ -29,6 +29,7 @@
#if defined(TINYUSDZ_LOCAL_DEBUG_PRINT)
#if defined(__ANDROID__)
#if defined(ASSIMP_USD_VERBOSE_LOGS)
// Works well but _extremely_ verbose
#define DCOUT(x) \
do { \
@ -37,14 +38,16 @@
<< std::to_string(__LINE__) << " " << x << "\n"; \
TINYUSDZLOGE("tinyusdz", "%s", ss.str().c_str()); \
} while (false)
#else // defined(ASSIMP_USD_VERBOSE_LOGS)
// Silent version
//#define DCOUT(x) \
// do { \
// std::stringstream ss; \
// ss << __FILE__ << ":" << __func__ << ":" \
// << std::to_string(__LINE__) << " " << x << "\n"; \
// } while (false)
#else
#define DCOUT(x) \
do { \
std::stringstream ss; \
ss << __FILE__ << ":" << __func__ << ":" \
<< std::to_string(__LINE__) << " " << x << "\n"; \
} while (false)
#endif // defined(ASSIMP_USD_VERBOSE_LOGS)
#else // defined(__ANDROID__)
#define DCOUT(x) \
do { \
std::cout << __FILE__ << ":" << __func__ << ":" \