Dav1dde / glad

Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs.
https://glad.dav1d.de/
Other
3.77k stars 447 forks source link

Being able to not "echo" Cleaning, Generating, Writing when using 'QUIET' #491

Open pltanguay opened 4 weeks ago

pltanguay commented 4 weeks ago

https://github.com/Dav1dde/glad/blob/01277173613cdb0339f58de9f6d090474ddbeab2/cmake/GladConfig.cmake#L242

In the GladConfig.cmake file, there should be a flag that can be set by the user to not 'echo' these info when using the 'QUIET' mode:

image

Also, there should be a flag allowing not to produce the 'args.txt'

In the case a user would like a Quiet build (like myself), there are still messages outputing to the console. There should not be.

pltanguay commented 4 weeks ago

Here is my suggestion for the "echo" commands: `

# echo commands if logging is enabled
set(ECHO_CLEANING   "")
set(ECHO_GENERATING "")
set(ECHO_WRITING    "")

if (NOT GG_QUIET)
    list(APPEND ECHO_CLEANING   "echo Cleaning ${GLAD_DIR}")
    list(APPEND ECHO_GENERATING "echo Generating with args ${GLAD_ARGS}")
    list(APPEND ECHO_WRITING    "echo Writing ${GLAD_ARGS_PATH}")
else()
    set(COMMAND ${CMAKE_COMMAND} -E echo "Condition is false")
endif()

# add make custom target
add_custom_command(
    OUTPUT ${GLAD_FILES} ${GLAD_ARGS_PATH}
    COMMAND "${ECHO_CLEANING}"
    COMMAND ${CMAKE_COMMAND} -E remove_directory ${GLAD_DIR}
    COMMAND ${CMAKE_COMMAND} -E make_directory   ${GLAD_DIR}
    COMMAND "${ECHO_GENERATING}"
    COMMAND ${Python_EXECUTABLE} -m glad ${GLAD_ARGS}
    COMMAND "${ECHO_WRITING}"
    COMMAND echo ${GLAD_ARGS} > ${GLAD_ARGS_PATH}
    WORKING_DIRECTORY $<$<BOOL:${GLAD_SOURCES_DIR}>:${GLAD_SOURCES_DIR}>
    COMMENT "${TARGET}-generate"
    USES_TERMINAL
    )

`