<commit_before>#
# Build configuration
#
cmake_minimum_required(VERSION 3.0)

# TODO(jaagr): Replace with git tag
project(lemonbuddy VERSION 1.2.0)

set(CMAKE_MODULE_PATH
  "${CMAKE_MODULE_PATH}"
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

set(CMAKE_CXX_FLAGS         "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wpedantic -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG} -g3 -DDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wno-unused-variable")

if(NOT CMAKE_BUILD_TYPE)
  message(STATUS "No build type specified; using Release")
  set(CMAKE_BUILD_TYPE "Release")
endif()

string(ASCII 27 ANSI)

#
# Internal values and switches
#
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"
    CACHE STRING "Name of the ALSA soundcard driver")
endif()

set(SETTING_CONNECTION_TEST_IP "8.8.8.8"
  CACHE STRING "Address to ping when testing network connection")
set(SETTING_PATH_BACKLIGHT_VAL "/sys/class/backlight/%card%/brightness"
  CACHE STRING "Path to file containing the current backlight value")
set(SETTING_PATH_BACKLIGHT_MAX "/sys/class/backlight/%card%/max_brightness"
  CACHE STRING "Path to file containing the maximum backlight value")
set(SETTING_PATH_BATTERY_CAPACITY "/sys/class/power_supply/%battery%/capacity"
  CACHE STRING "Path to file containing the current battery capacity")
set(SETTING_PATH_ADAPTER_STATUS "/sys/class/power_supply/%adapter%/online"
  CACHE STRING "Path to file containing the current adapter status")
set(SETTING_BSPWM_SOCKET_PATH "/tmp/bspwm_0_0-socket"
  CACHE STRING "Path to bspwm socket")
set(SETTING_BSPWM_STATUS_PREFIX "W"
  CACHE STRING "Prefix prepended to the bspwm status line")
set(SETTING_PATH_CPU_INFO "/proc/stat"
  CACHE STRING "Path to file containing cpu info")
set(SETTING_PATH_MEMORY_INFO "/proc/meminfo"
  CACHE STRING "Path to file containing memory info")

if(ENABLE_CCACHE)
  find_program(CCACHE_FOUND "ccache")
  if(CCACHE_FOUND)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache")
    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache")
  endif()
endif()

#
# Locate and insert libs
#
find_package("Boost" REQUIRED)
find_package("Threads" REQUIRED)
find_package("X11" REQUIRED "X11_Xrandr")

set(PROJECT_INCL_DIRS "${PROJECT_SOURCE_DIR}/include"
  ${Boost_INCLUDE_DIRS}
  ${X11_INCLUDE_DIR})

set(PROJECT_LINK_LIBS
  ${Boost_LIBRARIES}
  ${X11_LIBRARIES}
  ${X11_Xrandr_LIB}
  ${CMAKE_THREAD_LIBS_INIT})

if(ENABLE_I3)
  find_program(I3_EXECUTABLE "i3")
  if(NOT I3_EXECUTABLE)
    message(WARNING "${ANSI}[41;1mDisabling \"i3 module\" support (prerequisites failed)${ANSI}[0m")
    set(ENABLE_I3 OFF)
  endif()
endif()

if(ENABLE_ALSA)
  find_package("ALSA")
  if(ALSA_FOUND)
    set(PROJECT_INCL_DIRS ${PROJECT_INCL_DIRS} ${ALSA_INCLUDE_DIR})
    set(PROJECT_LINK_LIBS ${PROJECT_LINK_LIBS} ${ALSA_LIBRARY})
  else(ALSA_FOUND)
    message(WARNING "${ANSI}[41;1mDisabling \"volume module\" support (prerequisites failed)${ANSI}[0m")
    set(ENABLE_ALSA OFF)
  endif()
endif()

if(ENABLE_MPD)
  find_package("LibMPDClient")
  if(LIBMPDCLIENT_FOUND)
    set(PROJECT_INCL_DIRS ${PROJECT_INCL_DIRS} ${LIBMPDCLIENT_INCLUDE_DIR})
    set(PROJECT_LINK_LIBS ${PROJECT_LINK_LIBS} ${LIBMPDCLIENT_LIBRARY})
  else(LIBMPDCLIENT_FOUND)
    message(WARNING "${ANSI}[41;1mDisabling \"mpd module\" support (prerequisites failed)${ANSI}[0m")
    set(ENABLE_MPD OFF)<commit_msg>build: Dont exclude i3 if option is explicitly defined<commit_after>#
# Build configuration
#
cmake_minimum_required(VERSION 3.0)

# TODO(jaagr): Replace with git tag
project(lemonbuddy VERSION 1.2.0)

set(CMAKE_MODULE_PATH
  "${CMAKE_MODULE_PATH}"
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

set(CMAKE_CXX_FLAGS         "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wpedantic -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG} -g3 -DDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wno-unused-variable")

if(NOT CMAKE_BUILD_TYPE)
  message(STATUS "No build type specified; using Release")
  set(CMAKE_BUILD_TYPE "Release")
endif()

string(ASCII 27 ANSI)

#
# Internal values and switches
#

# Keep track if the i3 option is explicitly defined
if(ENABLE_I3)
  set(ENABLE_I3_NODEF ON)
endif()

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"
    CACHE STRING "Name of the ALSA soundcard driver")
endif()

set(SETTING_CONNECTION_TEST_IP "8.8.8.8"
  CACHE STRING "Address to ping when testing network connection")
set(SETTING_PATH_BACKLIGHT_VAL "/sys/class/backlight/%card%/brightness"
  CACHE STRING "Path to file containing the current backlight value")
set(SETTING_PATH_BACKLIGHT_MAX "/sys/class/backlight/%card%/max_brightness"
  CACHE STRING "Path to file containing the maximum backlight value")
set(SETTING_PATH_BATTERY_CAPACITY "/sys/class/power_supply/%battery%/capacity"
  CACHE STRING "Path to file containing the current battery capacity")
set(SETTING_PATH_ADAPTER_STATUS "/sys/class/power_supply/%adapter%/online"
  CACHE STRING "Path to file containing the current adapter status")
set(SETTING_BSPWM_SOCKET_PATH "/tmp/bspwm_0_0-socket"
  CACHE STRING "Path to bspwm socket")
set(SETTING_BSPWM_STATUS_PREFIX "W"
  CACHE STRING "Prefix prepended to the bspwm status line")
set(SETTING_PATH_CPU_INFO "/proc/stat"
  CACHE STRING "Path to file containing cpu info")
set(SETTING_PATH_MEMORY_INFO "/proc/meminfo"
  CACHE STRING "Path to file containing memory info")

if(ENABLE_CCACHE)
  find_program(CCACHE_FOUND "ccache")
  if(CCACHE_FOUND)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache")
    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache")
  endif()
endif()

#
# Locate and insert libs
#
find_package("Boost" REQUIRED)
find_package("Threads" REQUIRED)
find_package("X11" REQUIRED "X11_Xrandr")

set(PROJECT_INCL_DIRS "${PROJECT_SOURCE_DIR}/include"
  ${Boost_INCLUDE_DIRS}
  ${X11_INCLUDE_DIR})

set(PROJECT_LINK_LIBS
  ${Boost_LIBRARIES}
  ${X11_LIBRARIES}
  ${X11_Xrandr_LIB}
  ${CMAKE_THREAD_LIBS_INIT})

if(ENABLE_I3)
  find_program(I3_EXECUTABLE "i3")
  if(NOT I3_EXECUTABLE AND NOT ENABLE_I3_NODEF)
    message(WARNING "${ANSI}[41;1mDisabling \"i3 module\" support (prerequisites failed)${ANSI}[0m")
    set(ENABLE_I3 OFF)
  endif()
endif()

if(ENABLE_ALSA)
  find_package("ALSA")
  if(ALSA_FOUND)
    set(PROJECT_INCL_DIRS ${PROJECT_INCL_DIRS} ${ALSA_INCLUDE_DIR})
    set(PROJECT_LINK_LIBS ${PROJECT_LINK_LIBS} ${ALSA_LIBRARY})
  else(ALSA_FOUND)
    message(WARNING "${ANSI}[41;1mDisabling \"volume module\" support (prerequisites failed)${ANSI}[0m")
    set(ENABLE_ALSA OFF)
  endif()
endif()

if(ENABLE_MPD)
  find_package("LibMPDClient")
  if(LIBMPDCLIENT_FOUND)
    set(PROJECT_INCL_DIRS ${PROJECT_INCL_DIRS} ${LIBMPDCLIENT_INCLUDE_DIR})
    set(PROJECT_LINK_LIBS ${PROJECT_LINK_LIBS} ${LIBMPDCLIENT_LIBRARY})
  else(LIBMPDCLIENT_FOUND)
    message(WARNING "${ANSI}[41;1mDisabling \"mpd module\" support (prerequisites failed)${ANSI}[0m")
    set(ENABLE_MPD OFF)
{'fraction_non_alphanumeric': 0.10922232632847008, 'fraction_numerical': 0.013251238120733503, 'mean_word_length': 6.157088122605364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5123892', 'n_tokens_mistral': 2884, 'n_tokens_neox': 2801, 'n_words': 573}