From f04c457a51e80b45550e8b6e2c4c7080145f6c92 Mon Sep 17 00:00:00 2001 From: Cosmin Truta Date: Thu, 29 May 2025 19:47:03 +0300 Subject: [PATCH] build: Remove the PNG_DEBUG option from CMake files and project files Counter-intuitively, defining the PNG_DEBUG macro as 1 (i.e. setting the debug verbosity level to 1) does *not* cause any of the existing debug traces to show up. This setting would have worked if we had trace statements like `png_debug(0, message)`, but we don't have any. Debug traces do show up for verbosity levels from 2 to 5. The libpng manual describes in detail how they are meant to be used. According to the history of the CMake file, as well as the history of other project files, PNG_DEBUG was never set to a numeric value larger than 1. In other words, these debug settings inside these build files never produced any output in any (unmodified) libpng version. (As for the configure build, PNG_DEBUG has no special treatment there.) Considering the plethora of alternative methods to pass C preprocessor options through our build files, scripts and projects onto libpng, we'd rather discontinue PNG_DEBUG as a dedicated build option. --- CMakeLists.txt | 7 ------- projects/visualc71/libpng.vcproj | 6 +++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dffb77338..89c3a105a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,9 +46,6 @@ set(PNG_DEBUG_POSTFIX "d" CACHE STRING "Postfix to append to library file names under the Debug configuration") -# Allow the users to switch on/off debug logging. -option(PNG_DEBUG "Enable debug logging" OFF) - # Allow the users to import their own extra configuration settings. # Those settings can be either passed via DFA_XTRA if they are in DFA form # (such as "pngusr.dfa"), or via PNG_LIBCONF_HEADER if they are in prebuilt @@ -682,10 +679,6 @@ set(png_fix_itxt_sources contrib/tools/png-fix-itxt.c ) -if(PNG_DEBUG) - add_definitions(-DPNG_DEBUG) -endif() - # Now build our targets. # Initialize the list of libpng library targets. diff --git a/projects/visualc71/libpng.vcproj b/projects/visualc71/libpng.vcproj index 608ec4e6b..3bdebb359 100644 --- a/projects/visualc71/libpng.vcproj +++ b/projects/visualc71/libpng.vcproj @@ -66,7 +66,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..;..\..\..\zlib" - PreprocessorDefinitions="WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_BUILD_DLL;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS" + PreprocessorDefinitions="WIN32;_DEBUG;DEBUG;PNG_BUILD_DLL;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="3" @@ -91,7 +91,7 @@ Name="VCPreLinkEventTool"/>