Merge pull request #130 from ceamac/features/cmake/options

Make dependencies check optional
This commit is contained in:
Linus Dierheimer
2022-02-08 11:51:08 +01:00
committed by GitHub
+100 -66
View File
@@ -48,82 +48,116 @@ find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules (LIBPCI libpci)
if(LIBPCI_FOUND)
add_compile_definitions(FF_HAVE_LIBPCI=1)
else(LIBPCI_FOUND)
message(WARNING "Package libpci not found. Building without support.")
endif(LIBPCI_FOUND)
OPTION(ENABLE_LIBPCI "Enable libpci" ON)
OPTION(ENABLE_VULKAN "Enable vulkan" ON)
OPTION(ENABLE_WAYLAND "Enable wayland-client" ON)
OPTION(ENABLE_XCB_RANDR "Enable xcb-randr" ON)
OPTION(ENABLE_XCB "Enable xcb" ON)
OPTION(ENABLE_XRANDR "Enable xrandr" ON)
OPTION(ENABLE_X11 "Enable x11" ON)
OPTION(ENABLE_GIO "Enable gio-2.0" ON)
OPTION(ENABLE_DCONF "Enable dconf" ON)
OPTION(ENABLE_XFCONF "Enable libxfconf-0" ON)
OPTION(ENABLE_RPM "Enable rpm" ON)
pkg_check_modules (VULKAN vulkan)
if(VULKAN_FOUND)
add_compile_definitions(FF_HAVE_VULKAN=1)
else(VULKAN_FOUND)
message(WARNING "Package vulkan not found. Building without support.")
endif(VULKAN_FOUND)
if(ENABLE_LIBPCI)
pkg_check_modules (LIBPCI libpci)
if(LIBPCI_FOUND)
add_compile_definitions(FF_HAVE_LIBPCI=1)
else(LIBPCI_FOUND)
message(WARNING "Package libpci not found. Building without support.")
endif(LIBPCI_FOUND)
endif(ENABLE_LIBPCI)
pkg_check_modules (WAYLAND wayland-client)
if(WAYLAND_FOUND)
add_compile_definitions(FF_HAVE_WAYLAND=1)
else(WAYLAND_FOUND)
message(WARNING "Package wayland-client not found. Building without support.")
endif(WAYLAND_FOUND)
if(ENABLE_VULKAN)
pkg_check_modules (VULKAN vulkan)
if(VULKAN_FOUND)
add_compile_definitions(FF_HAVE_VULKAN=1)
else(VULKAN_FOUND)
message(WARNING "Package vulkan not found. Building without support.")
endif(VULKAN_FOUND)
endif(ENABLE_VULKAN)
pkg_check_modules (XCB_RANDR xcb-randr)
if(XCB_RANDR_FOUND)
add_compile_definitions(FF_HAVE_XCB_RANDR=1)
else(XCB_RANDR_FOUND)
message(WARNING "Package xcb-randr not found. Building without support.")
endif(XCB_RANDR_FOUND)
if(ENABLE_WAYLAND)
pkg_check_modules (WAYLAND wayland-client)
if(WAYLAND_FOUND)
add_compile_definitions(FF_HAVE_WAYLAND=1)
else(WAYLAND_FOUND)
message(WARNING "Package wayland-client not found. Building without support.")
endif(WAYLAND_FOUND)
endif(ENABLE_WAYLAND)
pkg_check_modules (XCB xcb)
if(XCB_FOUND)
add_compile_definitions(FF_HAVE_XCB=1)
else(XCB_FOUND)
message(WARNING "Package xcb not found. Building without support.")
endif(XCB_FOUND)
if(ENABLE_XCB_RANDR)
pkg_check_modules (XCB_RANDR xcb-randr)
if(XCB_RANDR_FOUND)
add_compile_definitions(FF_HAVE_XCB_RANDR=1)
else(XCB_RANDR_FOUND)
message(WARNING "Package xcb-randr not found. Building without support.")
endif(XCB_RANDR_FOUND)
endif(ENABLE_XCB_RANDR)
pkg_check_modules (XRANDR xrandr)
if(XRANDR_FOUND)
add_compile_definitions(FF_HAVE_XRANDR=1)
else(XRANDR_FOUND)
message(WARNING "Package xrandr not found. Building without support.")
endif(XRANDR_FOUND)
if(ENABLE_XCB)
pkg_check_modules (XCB xcb)
if(XCB_FOUND)
add_compile_definitions(FF_HAVE_XCB=1)
else(XCB_FOUND)
message(WARNING "Package xcb not found. Building without support.")
endif(XCB_FOUND)
endif(ENABLE_XCB)
pkg_check_modules (X11 x11)
if(X11_FOUND)
add_compile_definitions(FF_HAVE_X11=1)
else(X11_FOUND)
message(WARNING "Package x11 not found. Building without support.")
endif(X11_FOUND)
if(ENABLE_XRANDR)
pkg_check_modules (XRANDR xrandr)
if(XRANDR_FOUND)
add_compile_definitions(FF_HAVE_XRANDR=1)
else(XRANDR_FOUND)
message(WARNING "Package xrandr not found. Building without support.")
endif(XRANDR_FOUND)
endif(ENABLE_XRANDR)
pkg_check_modules (GIO gio-2.0)
if(GIO_FOUND)
add_compile_definitions(FF_HAVE_GIO=1)
else(GIO_FOUND)
message(WARNING "Package gio-2.0 not found. Building without support.")
endif(GIO_FOUND)
if(ENABLE_X11)
pkg_check_modules (X11 x11)
if(X11_FOUND)
add_compile_definitions(FF_HAVE_X11=1)
else(X11_FOUND)
message(WARNING "Package x11 not found. Building without support.")
endif(X11_FOUND)
endif(ENABLE_X11)
pkg_check_modules (DCONF dconf)
if(DCONF_FOUND)
add_compile_definitions(FF_HAVE_DCONF=1)
else(DCONF_FOUND)
message(WARNING "Package dconf not found. Building without support.")
endif(DCONF_FOUND)
if(ENABLE_GIO)
pkg_check_modules (GIO gio-2.0)
if(GIO_FOUND)
add_compile_definitions(FF_HAVE_GIO=1)
else(GIO_FOUND)
message(WARNING "Package gio-2.0 not found. Building without support.")
endif(GIO_FOUND)
endif(ENABLE_GIO)
pkg_check_modules (XFCONF libxfconf-0)
if(XFCONF_FOUND)
add_compile_definitions(FF_HAVE_XFCONF=1)
else(XFCONF_FOUND)
message(WARNING "Package libxfconf-0 not found. Building without support.")
endif(XFCONF_FOUND)
if(ENABLE_DCONF)
pkg_check_modules (DCONF dconf)
if(DCONF_FOUND)
add_compile_definitions(FF_HAVE_DCONF=1)
else(DCONF_FOUND)
message(WARNING "Package dconf not found. Building without support.")
endif(DCONF_FOUND)
endif(ENABLE_DCONF)
pkg_check_modules (RPM rpm)
if(RPM_FOUND)
add_compile_definitions(FF_HAVE_RPM=1)
else(RPM_FOUND)
message(WARNING "Package librpm not found. Building without support.")
endif(RPM_FOUND)
if(ENABLE_XFCONF)
pkg_check_modules (XFCONF libxfconf-0)
if(XFCONF_FOUND)
add_compile_definitions(FF_HAVE_XFCONF=1)
else(XFCONF_FOUND)
message(WARNING "Package libxfconf-0 not found. Building without support.")
endif(XFCONF_FOUND)
endif(ENABLE_XFCONF)
if(ENABLE_RPM)
pkg_check_modules (RPM rpm)
if(RPM_FOUND)
add_compile_definitions(FF_HAVE_RPM=1)
else(RPM_FOUND)
message(WARNING "Package librpm not found. Building without support.")
endif(RPM_FOUND)
endif(ENABLE_RPM)
include_directories(
${PROJECT_BINARY_DIR}