mirror of https://github.com/libsdl-org/SDL
cmake: add function to print dict list
This commit is contained in:
parent
a787b1c0b7
commit
289b024715
|
@ -3058,20 +3058,19 @@ message(STATUS "Compiler: ${CMAKE_C_COMPILER}")
|
||||||
message(STATUS "Revision: ${SDL_REVISION}")
|
message(STATUS "Revision: ${SDL_REVISION}")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS "Subsystems:")
|
message(STATUS "Subsystems:")
|
||||||
foreach(_SUB ${SDL_SUBSYSTEMS})
|
|
||||||
|
find_stringlength_longest_item(SDL_SUBSYSTEMS maxLength)
|
||||||
|
foreach(_SUB IN LISTS SDL_SUBSYSTEMS)
|
||||||
|
string(LENGTH ${_SUB} _SUBLEN)
|
||||||
|
math(EXPR _PADLEN "(${maxLength} + 1) - ${_SUBLEN}")
|
||||||
|
string(RANDOM LENGTH ${_PADLEN} ALPHABET " " _PADDING)
|
||||||
string(TOUPPER ${_SUB} _OPT)
|
string(TOUPPER ${_SUB} _OPT)
|
||||||
message_bool_option(${_SUB} SDL_${_OPT})
|
message_bool_option(${_SUB} SDL_${_OPT} ${_PADDING})
|
||||||
endforeach()
|
endforeach()
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS "Options:")
|
message(STATUS "Options:")
|
||||||
list(SORT ALLOPTIONS)
|
list(SORT ALLOPTIONS)
|
||||||
foreach(_OPT ${ALLOPTIONS})
|
message_dictlist(ALLOPTIONS)
|
||||||
# Get the padding
|
|
||||||
string(LENGTH ${_OPT} _OPTLEN)
|
|
||||||
math(EXPR _PADLEN "(${LONGESTOPTIONNAME} + 1) - ${_OPTLEN}")
|
|
||||||
string(RANDOM LENGTH ${_PADLEN} ALPHABET " " _PADDING)
|
|
||||||
message_tested_option(${_OPT} ${_PADDING})
|
|
||||||
endforeach()
|
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS " CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
|
message(STATUS " CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
|
||||||
|
|
|
@ -37,10 +37,14 @@ macro(MESSAGE_ERROR _TEXT)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(MESSAGE_BOOL_OPTION _NAME _VALUE)
|
macro(MESSAGE_BOOL_OPTION _NAME _VALUE)
|
||||||
|
set(_PAD "\t")
|
||||||
|
if(${ARGC} EQUAL 3)
|
||||||
|
set(_PAD ${ARGV2})
|
||||||
|
endif()
|
||||||
if(${_VALUE})
|
if(${_VALUE})
|
||||||
message(STATUS " ${_NAME}:\tON")
|
message(STATUS " ${_NAME}:${_PAD}ON")
|
||||||
else()
|
else()
|
||||||
message(STATUS " ${_NAME}:\tOFF")
|
message(STATUS " ${_NAME}:${_PAD}OFF")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
@ -94,6 +98,28 @@ function(LISTTOSTRREV _LIST _OUTPUT)
|
||||||
set($_OUTPUT} "${res}" PARENT_SCOPE)
|
set($_OUTPUT} "${res}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(find_stringlength_longest_item inList outLength)
|
||||||
|
set(maxLength 0)
|
||||||
|
foreach(item IN LISTS ${inList})
|
||||||
|
string(LENGTH "${item}" slen)
|
||||||
|
if(slen GREATER maxLength)
|
||||||
|
set(maxLength ${slen})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set("${outLength}" ${maxLength} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(message_dictlist inList)
|
||||||
|
find_stringlength_longest_item(${inList} maxLength)
|
||||||
|
foreach(name IN LISTS ${inList})
|
||||||
|
# Get the padding
|
||||||
|
string(LENGTH ${name} nameLength)
|
||||||
|
math(EXPR padLength "(${maxLength} + 1) - ${nameLength}")
|
||||||
|
string(RANDOM LENGTH ${padLength} ALPHABET " " padding)
|
||||||
|
message_tested_option(${name} ${padding})
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.16.0 OR SDL3_SUBPROJECT)
|
if(CMAKE_VERSION VERSION_LESS 3.16.0 OR SDL3_SUBPROJECT)
|
||||||
# - CMake versions <3.16 do not support the OBJC language
|
# - CMake versions <3.16 do not support the OBJC language
|
||||||
# - When SDL is built as a subproject and when the main project does not enable OBJC,
|
# - When SDL is built as a subproject and when the main project does not enable OBJC,
|
||||||
|
|
Loading…
Reference in New Issue