Make some dependencies optional

Closes #368
This commit is contained in:
Drew DeVault 2015-12-20 09:14:30 -05:00
parent 3777c8993b
commit 05e48835f7
2 changed files with 48 additions and 13 deletions

View file

@ -41,16 +41,23 @@ add_definitions(-DSWAY_GIT_BRANCH=\"${GIT_BRANCH}\")
string(TIMESTAMP CURRENT_DATE "%Y-%m-%d" UTC) string(TIMESTAMP CURRENT_DATE "%Y-%m-%d" UTC)
add_definitions(-DSWAY_VERSION_DATE=\"${CURRENT_DATE}\") add_definitions(-DSWAY_VERSION_DATE=\"${CURRENT_DATE}\")
find_package(Cairo REQUIRED) option(enable-swaylock "Enables the swaylock utility" YES)
option(enable-swaybg "Enables the wallpaper utility" YES)
option(enable-swaybar "Enables the swaybar utility" YES)
option(enable-swaygrab "Enables the swaygrab utility" YES)
option(enable-swaymsg "Enables the swaymsg utility" YES)
find_package(JsonC REQUIRED) find_package(JsonC REQUIRED)
find_package(PCRE REQUIRED) find_package(PCRE REQUIRED)
find_package(Pango REQUIRED)
find_package(WLC REQUIRED) find_package(WLC REQUIRED)
find_package(Wayland REQUIRED) find_package(Wayland REQUIRED)
find_package(XKBCommon REQUIRED) find_package(XKBCommon REQUIRED)
find_package(GdkPixbuf REQUIRED) find_package(Cairo)
find_package(PAM REQUIRED) find_package(Pango)
find_package(GdkPixbuf)
find_package(PAM)
include(FeatureSummary)
include(Manpage) include(Manpage)
include_directories(include) include_directories(include)
@ -60,14 +67,38 @@ add_subdirectory(common)
add_subdirectory(wayland) add_subdirectory(wayland)
add_subdirectory(sway) add_subdirectory(sway)
add_subdirectory(swaybg) if(enable-swaybg)
add_subdirectory(swaymsg) if(CAIRO_FOUND AND PANGO_FOUND AND GDK_PIXBUF_FOUND)
add_subdirectory(swaygrab) add_subdirectory(swaybg)
add_subdirectory(swaybar) else()
add_subdirectory(swaylock) message(WARNING "Not building swaybg - cairo, pango, and gdk-pixbuf are required.")
endif()
endif()
if(enable-swaymsg)
add_subdirectory(swaymsg)
endif()
if(enable-swaygrab)
add_subdirectory(swaygrab)
endif()
if(enable-swaybar)
if(CAIRO_FOUND AND PANGO_FOUND AND GDK_PIXBUF_FOUND)
add_subdirectory(swaybar)
else()
message(WARNING "Not building swaybar - cairo, pango, and gdk-pixbuf are required.")
endif()
endif()
if(enable-swaylock)
if(CAIRO_FOUND AND PANGO_FOUND AND GDK_PIXBUF_FOUND AND PAM_FOUND)
add_subdirectory(swaylock)
else()
message(WARNING "Not building swaylock - cairo, pango, gdk-pixbuf, and PAM are required.")
endif()
endif()
install( install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/sway.desktop FILES ${CMAKE_CURRENT_SOURCE_DIR}/sway.desktop
DESTINATION share/wayland-sessions DESTINATION share/wayland-sessions
COMPONENT data COMPONENT data
) )
feature_summary(WHAT ALL)

View file

@ -41,10 +41,14 @@ Install dependencies:
* asciidoc * asciidoc
* pcre * pcre
* json-c * json-c
* pango * pango *
* cairo * cairo *
* gdk-pixbuf2 * gdk-pixbuf2 *
* pam * pam **
_\*Only required for swaybar, swaybg, and swaylock_
_\*\*Only required for swaylock_
Run these commands: Run these commands: