mirror of
https://github.com/polybar/polybar.git
synced 2024-11-18 13:55:11 -05:00
fix(build): Improved dependency checks
This commit is contained in:
parent
f5bb87f39a
commit
dbd5e679db
3 changed files with 77 additions and 30 deletions
|
@ -3,7 +3,12 @@
|
|||
#
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
find_program(clang_EXECUTABLE "clang++")
|
||||
if(clang_EXECUTABLE)
|
||||
set(CMAKE_CXX_COMPILER ${clang_EXECUTABLE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
project(lemonbuddy VERSION 1.0.0)
|
||||
|
||||
|
@ -23,26 +28,11 @@ endif()
|
|||
#
|
||||
# Internal values and switches
|
||||
#
|
||||
|
||||
option(ENABLE_CCACHE "Enable ccache support" ON)
|
||||
option(ENABLE_ALSA "Enable alsa support" ON)
|
||||
option(ENABLE_MPD "Enable mpd support" ON)
|
||||
option(ENABLE_I3 "Enable i3 support" OFF)
|
||||
|
||||
find_program(I3_EXECUTABLE i3)
|
||||
if(I3_EXECUTABLE)
|
||||
message(STATUS "Enabling i3 since executable was found")
|
||||
set(ENABLE_I3 ON)
|
||||
else()
|
||||
message(STATUS "Coult not find i3 executable")
|
||||
endif()
|
||||
|
||||
message(STATUS "---------------------------")
|
||||
message(STATUS " Enable ccache support ${ENABLE_CCACHE}")
|
||||
message(STATUS " Enable mpd support ${ENABLE_MPD}")
|
||||
message(STATUS " Enable alsa support ${ENABLE_ALSA}")
|
||||
message(STATUS " Enable i3 support ${ENABLE_I3}")
|
||||
message(STATUS "---------------------------")
|
||||
option(ENABLE_CCACHE "Enable ccache support" ON)
|
||||
option(ENABLE_ALSA "Enable alsa support" ON)
|
||||
option(ENABLE_I3 "Enable i3 support" ON)
|
||||
option(ENABLE_MPD "Enable mpd support" ON)
|
||||
option(ENABLE_NETWORK "Enable network support" ON)
|
||||
|
||||
if(ENABLE_ALSA)
|
||||
set(SETTING_ALSA_SOUNDCARD "default"
|
||||
|
@ -93,7 +83,6 @@ endif()
|
|||
# Locate and insert libs
|
||||
#
|
||||
find_package("Boost" REQUIRED)
|
||||
#find_package("Boost" REQUIRED "regex")
|
||||
find_package("Threads" REQUIRED)
|
||||
find_package("X11" REQUIRED "X11_Xrandr" "X11_Xutil" "X11_Xlib")
|
||||
|
||||
|
@ -121,7 +110,16 @@ if(ENABLE_ALSA)
|
|||
set(LINK_LIBS ${LINK_LIBS} ${ALSA_LIBRARIES})
|
||||
else(ALSA_FOUND)
|
||||
# graceful fail
|
||||
message(STATUS "Disabling alsa since required package wasn't found")
|
||||
message(WARNING "Disabling alsa since required package wasn't found")
|
||||
set(ENABLE_ALSA OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_I3)
|
||||
find_program(I3_EXECUTABLE "i3")
|
||||
if(NOT I3_EXECUTABLE)
|
||||
# graceful fail
|
||||
message(WARNING "Disabling i3 support since executable was not found")
|
||||
set(ENABLE_ALSA OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -134,15 +132,35 @@ if(ENABLE_MPD)
|
|||
set(LINK_LIBS ${LINK_LIBS} ${LIBMPDCLIENT_LIBRARY})
|
||||
else(LibMPDClient_FOUND)
|
||||
# graceful fail
|
||||
message(STATUS "Disabling mpd since required package wasn't found")
|
||||
message(WARNING "Disabling mpd since required package wasn't found")
|
||||
set(ENABLE_MPD OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_NETWORK)
|
||||
find_package("Libiw")
|
||||
if(LibMPDClient_FOUND)
|
||||
include_directories(${LIBMPDCLIENT_INCLUDE_DIRS})
|
||||
link_directories(${LIBMPDCLIENT_LIBRARY_DIRS})
|
||||
set(LINK_LIBS ${LINK_LIBS} ${LIBMPDCLIENT_LIBRARY})
|
||||
else(Libiw_FOUND)
|
||||
# graceful fail
|
||||
message(WARNING "Disabling network support since required library wasn't found")
|
||||
set(ENABLE_NETWORK OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Install executable and wrapper
|
||||
#
|
||||
message(STATUS "---------------------------")
|
||||
message(STATUS " Enable ccache support ${ENABLE_CCACHE}")
|
||||
message(STATUS " Enable alsa support ${ENABLE_ALSA}")
|
||||
message(STATUS " Enable i3 support ${ENABLE_I3}")
|
||||
message(STATUS " Enable mpd support ${ENABLE_MPD}")
|
||||
message(STATUS " Enable network support ${ENABLE_NETWORK}")
|
||||
message(STATUS "---------------------------")
|
||||
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/src")
|
||||
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
||||
|
||||
|
|
24
README.md
24
README.md
|
@ -34,21 +34,33 @@ A C++ compiler with C++14 support. For example `clang`.
|
|||
- boost
|
||||
- libx11
|
||||
- libxrandr
|
||||
- wireless_tools
|
||||
- alsa-lib _optional_
|
||||
- libmpdclient _optional_
|
||||
- libsigc++ _optional_
|
||||
- wireless_tools _(optional: used by the network module)_
|
||||
- alsa-lib _(optional: used by the volume module)_
|
||||
- libmpdclient _(optional: used by the mpd module)_
|
||||
- libsigc++ _(optional: used by the i3 module)_
|
||||
|
||||
**With Pacman you can install the packages using:**
|
||||
**Installing using pacman:**
|
||||
~~~ sh
|
||||
$ pacman -S cmake boost libx11 libxrandr wireless_tools alsa-lib libmpdclient libsigc++ i3-wm
|
||||
~~~
|
||||
|
||||
**With XBPS you can install the packages using:**
|
||||
**Installing using xbps-install:**
|
||||
~~~ sh
|
||||
$ xbps-install -S cmake alsa-lib-devel boost-devel i3-devel libX11-devel libXrandr-devel libmpdclient-devel libsigc++-devel wireless_tools-devel
|
||||
~~~~
|
||||
|
||||
**Installing using apt-get:**
|
||||
|
||||
> NOTE: `libmpdclient-dev` is located in the `universe` repository, so make sure it's
|
||||
> included in the list of sources in `/etc/apt/sources.list`, for example:
|
||||
>
|
||||
> `deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe`
|
||||
|
||||
~~~ sh
|
||||
$ apt-get install cmake libx11-dev libxrandr-dev libboost-dev libiw-dev libmpdclient-dev libsigc++-dev i3-wm
|
||||
~~~~
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
## Building from source
|
||||
|
|
17
cmake/modules/FindLibiw.cmake
Normal file
17
cmake/modules/FindLibiw.cmake
Normal file
|
@ -0,0 +1,17 @@
|
|||
# This module defines
|
||||
# LIBIW_FOUND - whether the libiw library was found
|
||||
# LIBIW_LIBRARIES - the libiw library
|
||||
# LIBIW_INCLUDE_DIR - the include path of the libiw library
|
||||
|
||||
find_library(LIBIW_LIBRARY iw)
|
||||
|
||||
if(LIBIW_LIBRARY)
|
||||
set(LIBIW_LIBRARIES ${LIBIW_LIBRARY})
|
||||
endif(LIBIW_LIBRARY)
|
||||
|
||||
find_path(LIBIW_INCLUDE_DIR NAMES iwlib.h)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libiw DEFAULT_MSG LIBIW_LIBRARY LIBIW_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(LIBIW_INCLUDE_DIR LIBIW_LIBRARY)
|
Loading…
Reference in a new issue