<commit_before>cmake_minimum_required(VERSION 2.6)
project(periphery C)

option(BUILD_TESTS "Build test programs" ON)

# Check for Linux kernel header files for character device GPIO support
include(CheckIncludeFiles)
CHECK_INCLUDE_FILES(linux/gpio.h HAVE_CDEV_GPIO_HEADERS)
if(NOT HAVE_CDEV_GPIO_HEADERS)
message(WARNING "Linux kernel header files not found for character device GPIO support. c-periphery will be built with legacy sysfs GPIO support only.")
endif()
add_definitions(-DPERIPHERY_GPIO_CDEV_SUPPORT=$<BOOL:${HAVE_CDEV_GPIO_HEADERS}>)

# Library version
set(VERSION "2.2.4")
set(SOVERSION ${VERSION})

# Glob sources, headers, tests
file(GLOB_RECURSE periphery_SOURCES src/*.c)
file(GLOB_RECURSE periphery_HEADERS src/*.h)
file(GLOB_RECURSE periphery_TESTS tests/*.c)

# Expose git commit id into COMMIT_ID variable
execute_process(
    COMMAND git --git-dir="${CMAKE_CURRENT_SOURCE_DIR}/.git" describe --abbrev --always --tags --dirty
    WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
    OUTPUT_VARIABLE COMMIT_ID
    ERROR_QUIET
    OUTPUT_STRIP_TRAILING_WHITESPACE)

# Define C flags and include directories
add_definitions(-DPERIPHERY_VERSION_COMMIT="${COMMIT_ID}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -Wall -Wextra -Wno-unused-parameter -fPIC")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

# Declare library target
add_library(periphery ${periphery_SOURCES} ${periphery_HEADERS})
set_target_properties(periphery PROPERTIES SOVERSION ${VERSION})

include(GNUInstallDirs)

# Generate pkg-config pc file<commit_msg>cmake: add debug and release flags to CFLAGS<commit_after>cmake_minimum_required(VERSION 2.6)
project(periphery C)

option(BUILD_TESTS "Build test programs" ON)

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release)
endif()

# Check for Linux kernel header files for character device GPIO support
include(CheckIncludeFiles)
CHECK_INCLUDE_FILES(linux/gpio.h HAVE_CDEV_GPIO_HEADERS)
if(NOT HAVE_CDEV_GPIO_HEADERS)
message(WARNING "Linux kernel header files not found for character device GPIO support. c-periphery will be built with legacy sysfs GPIO support only.")
endif()
add_definitions(-DPERIPHERY_GPIO_CDEV_SUPPORT=$<BOOL:${HAVE_CDEV_GPIO_HEADERS}>)

# Library version
set(VERSION "2.2.4")
set(SOVERSION ${VERSION})

# Glob sources, headers, tests
file(GLOB_RECURSE periphery_SOURCES src/*.c)
file(GLOB_RECURSE periphery_HEADERS src/*.h)
file(GLOB_RECURSE periphery_TESTS tests/*.c)

# Expose git commit id into COMMIT_ID variable
execute_process(
    COMMAND git --git-dir="${CMAKE_CURRENT_SOURCE_DIR}/.git" describe --abbrev --always --tags --dirty
    WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
    OUTPUT_VARIABLE COMMIT_ID
    ERROR_QUIET
    OUTPUT_STRIP_TRAILING_WHITESPACE)

# Define C flags and include directories
add_definitions(-DPERIPHERY_VERSION_COMMIT="${COMMIT_ID}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -Wall -Wextra -Wno-unused-parameter -Wno-stringop-truncation -fPIC")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_C_FLAGS_RELEASE "-O3")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

# Declare library target
add_library(periphery ${periphery_SOURCES} ${periphery_HEADERS})
set_target_properties(periphery PROPERTIES SOVERSION ${VERSION})

include(GNUInstallDirs)

# Generate pkg-config pc file
{'fraction_non_alphanumeric': 0.09543944427665357, 'fraction_numerical': 0.0045303533675626695, 'mean_word_length': 6.961538461538462, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '5849558', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1119, 'n_words': 258}