mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
CMake: use gen-man.py
to generate man file
This commit is contained in:
parent
fe57b28581
commit
d7fa0417ed
@ -256,6 +256,7 @@ endfunction(fastfetch_load_text)
|
|||||||
|
|
||||||
find_package(Python)
|
find_package(Python)
|
||||||
if(Python_FOUND)
|
if(Python_FOUND)
|
||||||
|
message(STATUS "Minifying 'help.json'")
|
||||||
execute_process(COMMAND ${Python_EXECUTABLE} -c "import json,sys;json.dump(json.load(sys.stdin),sys.stdout,separators=(',',':'))"
|
execute_process(COMMAND ${Python_EXECUTABLE} -c "import json,sys;json.dump(json.load(sys.stdin),sys.stdout,separators=(',',':'))"
|
||||||
INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/data/help.json"
|
INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/data/help.json"
|
||||||
OUTPUT_VARIABLE DATATEXT_JSON_HELP)
|
OUTPUT_VARIABLE DATATEXT_JSON_HELP)
|
||||||
@ -263,20 +264,31 @@ if(Python_FOUND)
|
|||||||
message(ERROR "DATATEXT_JSON_HELP is empty, which should not happen!")
|
message(ERROR "DATATEXT_JSON_HELP is empty, which should not happen!")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS "Python3 is not found, 'help.json' will not be minified")
|
message(WARNING "Python3 is not found, 'help.json' will not be minified")
|
||||||
file(READ "src/data/help.json" DATATEXT_JSON_HELP)
|
file(READ "src/data/help.json" DATATEXT_JSON_HELP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "fastfetch_pciids.c.inc")
|
if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "fastfetch_pciids.c.inc")
|
||||||
if(Python_FOUND)
|
if(Python_FOUND)
|
||||||
|
message(STATUS "Generating 'fastfetch_pciids.c.inc'")
|
||||||
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py"
|
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py"
|
||||||
OUTPUT_FILE "fastfetch_pciids.c.inc")
|
OUTPUT_FILE "fastfetch_pciids.c.inc")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")
|
message(WARNING "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")
|
||||||
set(ENABLE_EMBEDDED_PCIIDS OFF)
|
set(ENABLE_EMBEDDED_PCIIDS OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(Python_FOUND)
|
||||||
|
message(STATUS "Generating 'fastfetch.1'")
|
||||||
|
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-man.py"
|
||||||
|
OUTPUT_FILE "fastfetch.1")
|
||||||
|
else()
|
||||||
|
message(WARNING "Python3 is not found, use basic 'fastfetch.1.in' instead")
|
||||||
|
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)
|
||||||
|
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
|
||||||
|
endif()
|
||||||
|
|
||||||
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)
|
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)
|
||||||
fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE)
|
fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE)
|
||||||
fastfetch_load_text(src/data/help_footer.txt DATATEXT_HELP_FOOTER)
|
fastfetch_load_text(src/data/help_footer.txt DATATEXT_HELP_FOOTER)
|
||||||
@ -289,9 +301,6 @@ if(APPLE)
|
|||||||
configure_file(src/util/apple/Info.plist.in Info.plist @ONLY)
|
configure_file(src/util/apple/Info.plist.in Info.plist @ONLY)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)
|
|
||||||
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Ascii image data #
|
# Ascii image data #
|
||||||
####################
|
####################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user