<commit_before># Lists all subdirectories of a given directory
MACRO(SUBDIRLIST result curdir)
    FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
    SET(dirlist "")
    FOREACH(child ${children})
        IF(IS_DIRECTORY ${curdir}/${child})
            LIST(APPEND dirlist ${child})
        ENDIF()
    ENDFOREACH()
    SET(${result} ${dirlist})
ENDMACRO()

# initialize variables
set (SAMPLES_SOURCES "")
set (SAMPLES_HEADERS "")
set (SAMPLES_SUBDIRS "")

# gather sample dirs
SUBDIRLIST(SAMPLES_SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})

# loop through samples and exclude those that should not be build 
foreach (dir ${SAMPLES_SUBDIRS})
    if ("${dir}" MATCHES "^GLESDemo$") # exclude the hacky GLES demo
    elseif ("${dir}" MATCHES "^common$") # exclude common folder; samples include files from there directly when necessary
    else()
        add_subdirectory (${dir})
    endif ()
endforeach ()

# additional include directories have to go here
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/common/include)
include_directories(${CMAKE_BINARY_DIR}/samples/common/include)

cegui_add_library_impl("CEGUISamples" FALSE SAMPLES_SOURCES SAMPLES_HEADERS FALSE FALSE)<commit_msg>MOD: (SAMPLES) enhancement of base CMakeLists.txt<commit_after># Lists all subdirectories of a given directory
MACRO(SUBDIRLIST result curdir)
    FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
    SET(dirlist "")
    FOREACH(child ${children})
        IF(IS_DIRECTORY ${curdir}/${child})
            LIST(APPEND dirlist ${child})
        ENDIF()
    ENDFOREACH()
    SET(${result} ${dirlist})
ENDMACRO()

# initialize variables
set (ADDITIONAL_LIBS "${CEGUI_BASE_LIBNAME}")
set (SAMPLES_SOURCES "")
set (SAMPLES_HEADERS "")
set (SAMPLES_LIST "")
set (SAMPLES_SUBDIRS "")

set (SAMPLE_LIST_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/common/include/samples.h)
set (SAMPLE_LIST_CODE ${CMAKE_CURRENT_SOURCE_DIR}/common/include/samples.inc)

# gather sample dirs
SUBDIRLIST(SAMPLES_SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})

# loop through samples and exclude those that should not be build 
foreach (dir ${SAMPLES_SUBDIRS})
    if ("${dir}" MATCHES "^GLESDemo$") # exclude the hacky GLES demo
    elseif ("${dir}" MATCHES "^common$") # exclude common folder; samples include files from there directly when necessary
    elseif ("${dir}" MATCHES "^samples$") # exclude this directory
    elseif ("${dir}" MATCHES "^Demo8$") # this demo doesnt work at the moment
    elseif ("${dir}" MATCHES "^SimpleGameMenu$") # the sample is broken somewhere
    else()
        add_subdirectory (${dir})
    endif ()
endforeach ()

# add all registered samples to samples.inc and samples.h file
file (WRITE ${SAMPLE_LIST_HEADER} "#ifndef _SamplesListHeader_h_\n#define _SamplesListHeader_h_\n\n#include \"Sample.h\"\n")
file (WRITE ${SAMPLE_LIST_CODE} "std::vector<Sample*> samples;")
foreach (sample ${SAMPLES_LIST})
    set (_PATH "../../samples/${sample}/${sample}.h")
    file (APPEND ${SAMPLE_LIST_HEADER} "\n#include \"${_PATH}\"")
    file (APPEND ${SAMPLE_LIST_CODE} "\nsamples.push_back(new ${sample}Sample());")
endforeach ()
file (APPEND ${SAMPLE_LIST_HEADER} "\n#endif")

# additional include directories have to go here
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/common/include)
include_directories (${CMAKE_BINARY_DIR}/samples/common/include)

cegui_add_library_impl("CEGUISamples" FALSE SAMPLES_SOURCES SAMPLES_HEADERS FALSE FALSE)

# parse additional libs
foreach (lib ${ADDITIONAL_LIBS})
    cegui_target_link_libraries("CEGUISamples" ${lib})
endforeach ()
{'fraction_non_alphanumeric': 0.12874929258630446, 'fraction_numerical': 0.0002829654782116582, 'mean_word_length': 5.290035587188612, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1840357', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1137, 'n_words': 296}