diff --git a/cmake/Conky.cmake b/cmake/Conky.cmake index 53f517cda..f49a19633 100644 --- a/cmake/Conky.cmake +++ b/cmake/Conky.cmake @@ -155,6 +155,10 @@ endif(NOT APP_UNAME) find_program(APP_GPERF gperf) +if(NOT APP_GPERF) + message(FATAL_ERROR "Unable to find program 'gperf' (required at build-time as of Conky v1.20.2)") +endif(NOT APP_GPERF) + if(NOT RELEASE) find_program(APP_GIT git) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fe3e24709..d36f4dbc2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -51,21 +51,16 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/defconfig.h) endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/defconfig.h) # Generate colour-names.hh with gperf -if(APP_GPERF) - execute_process( - INPUT_FILE "${CMAKE_SOURCE_DIR}/data/color-names.yml" - OUTPUT_FILE "${CMAKE_BINARY_DIR}/data/color-names.gperf" - COMMAND sh "${CMAKE_SOURCE_DIR}/bin/format-colors.sh" - ) - execute_process( - INPUT_FILE "${CMAKE_BINARY_DIR}/data/color-names.gperf" - OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/colour-names.hh" - COMMAND ${APP_GPERF} --ignore-case -LC++ -Zcolor_name_hash -t -7 -m1 -C -E - ) -else(APP_GPERF) - message(WARNING "'gperf' program not found, using stub colour-names.hh; colors names will not be parsed") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/colour-names-stub.hh" "${CMAKE_CURRENT_BINARY_DIR}/colour-names.hh" COPYONLY) -endif(APP_GPERF) +execute_process( + INPUT_FILE "${CMAKE_SOURCE_DIR}/data/color-names.yml" + OUTPUT_FILE "${CMAKE_BINARY_DIR}/data/color-names.gperf" + COMMAND sh "${CMAKE_SOURCE_DIR}/bin/format-colors.sh" +) +execute_process( + INPUT_FILE "${CMAKE_BINARY_DIR}/data/color-names.gperf" + OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/colour-names.hh" + COMMAND ${APP_GPERF} --ignore-case -LC++ -Zcolor_name_hash -t -7 -m1 -C -E +) set(conky_sources ${conky_sources} diff --git a/src/colour-names-stub.hh b/src/colour-names-stub.hh deleted file mode 100644 index 29f64fffd..000000000 --- a/src/colour-names-stub.hh +++ /dev/null @@ -1,22 +0,0 @@ -/* - * To generate colour-names.hh, you must have gperf installed during build. - * This is a dummy implementation for builds without gperf. - * Color name matching will always return null (i.e. no match). - */ - -struct rgb { - const char *name; - uint8_t red; - uint8_t green; - uint8_t blue; -}; - -class color_name_hash { - public: - static const struct rgb *in_word_set(const char *str, size_t len); -}; - -const struct rgb *color_name_hash::in_word_set(const char *str, size_t len) { - DBGP("color parsing not supported"); - return nullptr; -}