<commit_before>include (LibAddMacros)

find_package (libuv QUIET)

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
	exclude_binding (io_uv "cannot be built on Windows")
elseif (NOT libuv_FOUND)
	exclude_binding (io_uv "package libuv (libuv1-dev) not found")
elseif (ENABLE_ASAN)
	exclude_binding (io_uv "io bindings are not compatible with ENABLE_ASAN")
else ()
	add_binding (io_uv)

	# Build library
	set (BINDING_VARIANT uv)

	set (IO_UV_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/io_uv.c")

	add_headers (ELEKTRA_HEADERS)
	set (SOURCES ${IO_UV_SRC_FILES} ${ELEKTRA_HEADERS})

	set (IO_UV_LIBRARY elektra-io-${BINDING_VARIANT})

	# create object library so that executables can use $<TARGET_OBJECTS:OBJ_${IO_UV_LIBRARY}>
	add_library (OBJ_${IO_UV_LIBRARY} OBJECT ${SOURCES})
	if (libuv_VERSION VERSION_LESS "1.0")
		target_compile_definitions (OBJ_${IO_UV_LIBRARY} PRIVATE "HAVE_LIBUV0")
	else ()
		target_compile_definitions (OBJ_${IO_UV_LIBRARY} PRIVATE "HAVE_LIBUV1")
	endif ()

	add_lib (io-${BINDING_VARIANT} SOURCES ${SOURCES} LINK_ELEKTRA elektra-io LINK_LIBRARIES ${libuv_LIBRARIES})

	if (BUILD_FULL OR BUILD_STATIC)
		add_includes ("elektra-full" ${libuv_INCLUDE_DIRS})

		if (libuv_VERSION VERSION_LESS "1.0")
			add_definitions ("-DHAVE_LIBUV0")
		else ()
			add_definitions ("-DHAVE_LIBUV1")
		endif ()
	endif ()
	if (BUILD_SHARED)
		target_include_directories (${IO_UV_LIBRARY} SYSTEM PUBLIC ${libuv_INCLUDE_DIRS})

		if (libuv_VERSION VERSION_LESS "1.0")
			target_compile_definitions (${IO_UV_LIBRARY} PRIVATE "HAVE_LIBUV0")
		else ()
			target_compile_definitions (${IO_UV_LIBRARY} PRIVATE "HAVE_LIBUV1")
		endif ()
	endif ()

	configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/${IO_UV_LIBRARY}.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/${IO_UV_LIBRARY}.pc" @ONLY)

	install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${IO_UV_LIBRARY}.pc" DESTINATION lib${LIB_SUFFIX}/${TARGET_PKGCONFIG_FOLDER})

	# Build test
	set (TESTEXENAME testio_${BINDING_VARIANT})

	set (TEST_SOURCES $<TARGET_OBJECTS:cframework>)
	add_headers (TEST_SOURCES)
	file (GLOB IO_TEST_SRC_FILES
		   "${CMAKE_SOURCE_DIR}/src/bindings/io/test/test*.c")
	list (APPEND TEST_SOURCES
		     ${IO_TEST_SRC_FILES})
	list (APPEND TEST_SOURCES
		     "${CMAKE_CURRENT_SOURCE_DIR}/testio_${BINDING_VARIANT}.c")

	if (BUILD_FULL OR BUILD_STATIC)
		list (APPEND TEST_SOURCES
			     $<TARGET_OBJECTS:OBJ_${IO_UV_LIBRARY}>) # add sources for elektra-io-uv for static and full builds
	endif ()

	add_executable (${TESTEXENAME} ${TEST_SOURCES})
	add_dependencies (${TESTEXENAME} kdberrors_generated elektra_error_codes_generated)

	target_include_directories (${TESTEXENAME} PUBLIC "${CMAKE_SOURCE_DIR}/tests/cframework")
<commit_msg>IO UV: Fix error about missing header file<commit_after>include (LibAddMacros)

find_package (libuv QUIET)

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
	exclude_binding (io_uv "cannot be built on Windows")
elseif (NOT libuv_FOUND)
	exclude_binding (io_uv "package libuv (libuv1-dev) not found")
elseif (ENABLE_ASAN)
	exclude_binding (io_uv "io bindings are not compatible with ENABLE_ASAN")
else ()
	add_binding (io_uv)

	# Build library
	set (BINDING_VARIANT uv)

	set (IO_UV_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/io_uv.c")

	add_headers (ELEKTRA_HEADERS)
	set (SOURCES ${IO_UV_SRC_FILES} ${ELEKTRA_HEADERS})

	set (IO_UV_LIBRARY elektra-io-${BINDING_VARIANT})

	# create object library so that executables can use $<TARGET_OBJECTS:OBJ_${IO_UV_LIBRARY}>
	add_library (OBJ_${IO_UV_LIBRARY} OBJECT ${SOURCES})
	target_include_directories (OBJ_${IO_UV_LIBRARY} SYSTEM PUBLIC ${libuv_INCLUDE_DIRS})

	if (libuv_VERSION VERSION_LESS "1.0")
		target_compile_definitions (OBJ_${IO_UV_LIBRARY} PRIVATE "HAVE_LIBUV0")
	else ()
		target_compile_definitions (OBJ_${IO_UV_LIBRARY} PRIVATE "HAVE_LIBUV1")
	endif ()

	add_lib (io-${BINDING_VARIANT} SOURCES ${SOURCES} LINK_ELEKTRA elektra-io LINK_LIBRARIES ${libuv_LIBRARIES})

	if (BUILD_FULL OR BUILD_STATIC)
		add_includes ("elektra-full" ${libuv_INCLUDE_DIRS})

		if (libuv_VERSION VERSION_LESS "1.0")
			add_definitions ("-DHAVE_LIBUV0")
		else ()
			add_definitions ("-DHAVE_LIBUV1")
		endif ()
	endif ()
	if (BUILD_SHARED)
		target_include_directories (${IO_UV_LIBRARY} SYSTEM PUBLIC ${libuv_INCLUDE_DIRS})

		if (libuv_VERSION VERSION_LESS "1.0")
			target_compile_definitions (${IO_UV_LIBRARY} PRIVATE "HAVE_LIBUV0")
		else ()
			target_compile_definitions (${IO_UV_LIBRARY} PRIVATE "HAVE_LIBUV1")
		endif ()
	endif ()

	configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/${IO_UV_LIBRARY}.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/${IO_UV_LIBRARY}.pc" @ONLY)

	install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${IO_UV_LIBRARY}.pc" DESTINATION lib${LIB_SUFFIX}/${TARGET_PKGCONFIG_FOLDER})

	# Build test
	set (TESTEXENAME testio_${BINDING_VARIANT})

	set (TEST_SOURCES $<TARGET_OBJECTS:cframework>)
	add_headers (TEST_SOURCES)
	file (GLOB IO_TEST_SRC_FILES
		   "${CMAKE_SOURCE_DIR}/src/bindings/io/test/test*.c")
	list (APPEND TEST_SOURCES
		     ${IO_TEST_SRC_FILES})
	list (APPEND TEST_SOURCES
		     "${CMAKE_CURRENT_SOURCE_DIR}/testio_${BINDING_VARIANT}.c")

	if (BUILD_FULL OR BUILD_STATIC)
		list (APPEND TEST_SOURCES
			     $<TARGET_OBJECTS:OBJ_${IO_UV_LIBRARY}>) # add sources for elektra-io-uv for static and full builds
	endif ()

	add_executable (${TESTEXENAME} ${TEST_SOURCES})
	add_dependencies (${TESTEXENAME} kdberrors_generated elektra_error_codes_generated)

	target_include_directories (${TESTEXENAME}
				    PUBLIC "${CMAKE_SOURCE_DIR}/tests/cframework"
					   "${libuv_INCLUDE_DIRS}")

{'fraction_non_alphanumeric': 0.11592102879913059, 'fraction_numerical': 0.00470929179496468, 'mean_word_length': 6.502717391304348, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '952562', 'n_tokens_mistral': 2391, 'n_tokens_neox': 2116, 'n_words': 399}