mirror of
https://github.com/polybar/polybar.git
synced 2024-11-25 13:55:47 -05:00
refactor(cmake): Cleanup
This commit is contained in:
parent
886d0f4ff3
commit
37d0a0e57b
6 changed files with 47 additions and 78 deletions
|
@ -19,6 +19,7 @@ include(build/summary)
|
|||
add_subdirectory(${PROJECT_SOURCE_DIR}/man)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/bin)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/doc ${PROJECT_BINARY_DIR}/doc)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/doc/zsh ${PROJECT_BINARY_DIR}/doc/zsh)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/tests ${PROJECT_BINARY_DIR}/tests)
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/templates/userconfig.cmake.in
|
||||
${PROJECT_BINARY_DIR}/userconfig.cmake
|
||||
IMMEDIATE @ONLY)
|
||||
${PROJECT_BINARY_DIR}/cmake/userconfig.cmake
|
||||
ESCAPE_QUOTES @ONLY)
|
||||
|
||||
add_custom_target(userconfig COMMAND ${CMAKE_COMMAND}
|
||||
-P ${PROJECT_BINARY_DIR}/userconfig.cmake)
|
||||
add_custom_target(userconfig
|
||||
DEPENDS ${PROJECT_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake/userconfig.cmake)
|
||||
|
||||
# }}}
|
||||
# Target: uninstall {{{
|
||||
|
@ -18,48 +19,55 @@ add_custom_target(userconfig COMMAND ${CMAKE_COMMAND}
|
|||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/templates/uninstall.cmake.in
|
||||
${PROJECT_BINARY_DIR}/cmake/uninstall.cmake
|
||||
IMMEDIATE @ONLY)
|
||||
ESCAPE_QUOTES @ONLY)
|
||||
|
||||
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND}
|
||||
-P ${PROJECT_BINARY_DIR}/cmake/uninstall.cmake)
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake/uninstall.cmake)
|
||||
|
||||
# }}}
|
||||
# Target: codeformat (clang-format) {{{
|
||||
|
||||
add_custom_target(codeformat)
|
||||
add_custom_command(TARGET codeformat COMMAND
|
||||
${PROJECT_SOURCE_DIR}/common/clang-format.sh ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/include)
|
||||
add_custom_command(TARGET codeformat
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/common/clang-format.sh
|
||||
${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
# }}}
|
||||
# Target: codecheck (clang-tidy) {{{
|
||||
|
||||
add_custom_target(codecheck)
|
||||
add_custom_command(TARGET codecheck COMMAND
|
||||
${PROJECT_SOURCE_DIR}/common/clang-tidy.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src)
|
||||
add_custom_command(TARGET codecheck
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/common/clang-tidy.sh
|
||||
${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
# }}}
|
||||
# Target: codecheck-fix (clang-tidy + clang-format) {{{
|
||||
|
||||
add_custom_target(codecheck-fix)
|
||||
add_custom_command(TARGET codecheck-fix COMMAND
|
||||
${PROJECT_SOURCE_DIR}/common/clang-tidy.sh ${PROJECT_BINARY_DIR} -fix ${PROJECT_SOURCE_DIR}/src)
|
||||
add_custom_command(TARGET codecheck-fix
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/common/clang-tidy.sh
|
||||
${PROJECT_BINARY_DIR} -fix ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
# }}}
|
||||
|
||||
# Target: memcheck (valgrind) {{{
|
||||
|
||||
add_custom_target(memcheck)
|
||||
add_custom_command(TARGET memcheck COMMAND valgrind
|
||||
add_custom_command(TARGET memcheck
|
||||
COMMAND valgrind
|
||||
--leak-check=summary
|
||||
--suppressions=${PROJECT_SOURCE_DIR}/.valgrind-suppressions
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME} example --config=${PROJECT_SOURCE_DIR}/doc/config)
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}
|
||||
example --config=${PROJECT_SOURCE_DIR}/doc/config)
|
||||
|
||||
add_custom_target(memcheck-full)
|
||||
add_custom_command(TARGET memcheck-full COMMAND valgrind
|
||||
add_custom_command(TARGET memcheck-full
|
||||
COMMAND valgrind
|
||||
--leak-check=full
|
||||
--track-origins=yes
|
||||
--track-fds=yes
|
||||
--suppressions=${PROJECT_SOURCE_DIR}/.valgrind-suppressions
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME} example --config=${PROJECT_SOURCE_DIR}/doc/config)
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}
|
||||
example --config=${PROJECT_SOURCE_DIR}/doc/config)
|
||||
|
||||
# }}}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
# - Try to find libX11-xcb
|
||||
# Once done this will define
|
||||
#
|
||||
# X11_XCB_FOUND - system has libX11-xcb
|
||||
# X11_XCB_LIBRARIES - Link these to use libX11-xcb
|
||||
# X11_XCB_INCLUDE_DIR - the libX11-xcb include dir
|
||||
# X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb
|
||||
|
||||
# Copyright (c) 2011 Fredrik Höglund <fredrik@kde.org>
|
||||
# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
|
||||
# Copyright (c) 2007 Matthias Kretz, <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
IF (NOT WIN32)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
FIND_PACKAGE(PkgConfig)
|
||||
PKG_CHECK_MODULES(PKG_X11_XCB QUIET x11-xcb)
|
||||
|
||||
SET(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS})
|
||||
|
||||
FIND_PATH(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS})
|
||||
FIND_LIBRARY(X11_XCB_LIBRARIES NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES)
|
||||
ENDIF (NOT WIN32)
|
|
@ -1,26 +1,23 @@
|
|||
set(INSTALL_MANIFEST "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
set(INSTALL_MANIFEST "@CMAKE_CURRENT_BINARY_DIR@/install_manifest")
|
||||
if(NOT EXISTS ${INSTALL_MANIFEST})
|
||||
message(FATAL_ERROR "Cannot find install manifest: ${INSTALL_MANIFEST}")
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS ${INSTALL_MANIFEST})
|
||||
message(FATAL_ERROR
|
||||
"Cannot find install manifest:
|
||||
\"${INSTALL_MANIFEST}\"")
|
||||
endif(NOT EXISTS ${INSTALL_MANIFEST})
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
list(REVERSE files)
|
||||
|
||||
foreach (file ${files})
|
||||
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||
execute_process(
|
||||
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(EXISTS "$ENV{DESTDIR}${file}")
|
||||
execute_process(COMMAND "@CMAKE_COMMAND@"
|
||||
-E remove "$ENV{DESTDIR}${file}"
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RESULT_VARIABLE rm_retval)
|
||||
if(NOT ${rm_retval} EQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
endif (NOT ${rm_retval} EQUAL 0)
|
||||
else (EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
endif (EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist")
|
||||
endif()
|
||||
endforeach()
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
set(USER_CONFIG_HOME $ENV{XDG_CONFIG_HOME})
|
||||
set(USER_CONFIG_HOME "$ENV{XDG_CONFIG_HOME}")
|
||||
if(NOT USER_CONFIG_HOME)
|
||||
set(USER_CONFIG_HOME $ENV{HOME}/.config)
|
||||
set(USER_CONFIG_HOME "$ENV{HOME}/.config")
|
||||
endif()
|
||||
set(USER_CONFIG_HOME ${USER_CONFIG_HOME}/polybar)
|
||||
set(USER_CONFIG_HOME "${USER_CONFIG_HOME}/polybar")
|
||||
|
||||
file(INSTALL @CMAKE_SOURCE_DIR@/doc/config DESTINATION ${USER_CONFIG_HOME})
|
||||
file(INSTALL "@CMAKE_SOURCE_DIR@/doc/config"
|
||||
DESTINATION "${USER_CONFIG_HOME}")
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
# Generate configuration file
|
||||
#
|
||||
|
||||
add_subdirectory(zsh)
|
||||
|
||||
set(MODULES_LEFT "bspwm i3")
|
||||
set(MODULES_CENTER "mpd")
|
||||
set(MODULES_RIGHT "xbacklight volume xkeyboard memory cpu wlan eth battery temperature date powermenu")
|
||||
|
@ -42,16 +40,13 @@ endif()
|
|||
|
||||
string(REGEX REPLACE /%battery%.* "" PATH_BAT ${SETTING_PATH_BATTERY})
|
||||
string(REGEX REPLACE /%adapter%.* "" PATH_ADP ${SETTING_PATH_ADAPTER})
|
||||
|
||||
file(GLOB BAT_LIST RELATIVE ${PATH_BAT} ${PATH_ADP}/B*)
|
||||
file(GLOB ADP_LIST RELATIVE ${PATH_ADP} ${PATH_ADP}/A*)
|
||||
|
||||
if(BAT_LIST)
|
||||
list(GET BAT_LIST 0 BATTERY)
|
||||
else()
|
||||
set(BATTERY BAT0)
|
||||
endif()
|
||||
|
||||
if(ADP_LIST)
|
||||
list(GET ADP_LIST 0 ADAPTER)
|
||||
else()
|
||||
|
@ -63,7 +58,6 @@ endif()
|
|||
|
||||
if(ENABLE_NETWORK)
|
||||
file(GLOB IFLIST RELATIVE /sys/class/net /sys/class/net/*)
|
||||
|
||||
foreach(INTERFACE ${IFLIST})
|
||||
if(NOT ${INTERFACE} STREQUAL "lo")
|
||||
file(GLOB IS_WIRELESS /sys/class/net/${INTERFACE}/wireless)
|
||||
|
@ -74,7 +68,6 @@ if(ENABLE_NETWORK)
|
|||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT INTERFACE_ETH)
|
||||
set(INTERFACE_ETH net0)
|
||||
endif()
|
||||
|
|
Loading…
Reference in a new issue