<commit_before>cmake_minimum_required(VERSION 3.2)

if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
    message(FATAL_ERROR "Do not run cmake in-source. Instead run\n$ mkdir build\n$ cd build\n$ cmake ..\n")
endif ()

project(CssPreprocessor)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

# Set Bison/Flex - generated content
find_package(BISON 3.0.2 REQUIRED)
find_package(FLEX 2.5.35 REQUIRED)

set(GENERATED_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/generated)
file(MAKE_DIRECTORY ${GENERATED_OUTPUT_DIRECTORY})

BISON_TARGET(Parser src/parser.y ${GENERATED_OUTPUT_DIRECTORY}/parser.cpp)
FLEX_TARGET(Scanner src/lexer.l ${GENERATED_OUTPUT_DIRECTORY}/lexer.cpp)
ADD_FLEX_BISON_DEPENDENCY(Scanner Parser)

set(GENERATED_FILES ${BISON_Parser_OUTPUTS} ${FLEX_Scanner_OUTPUTS})
include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
# / End of Bison/Flex

include_directories(src)
set(SOURCE_FILES
    src/main.cpp
    src/lib/driver/Driver.cpp
    src/lib/logger/Logger.cpp
    src/lib/ast/node/Node.cpp
    src/lib/ast/node/Node.hpp
    src/lib/ast/modifier/Modifier.cpp
    src/lib/ast/property/Property.cpp
    src/lib/ast/value/string/String.cpp
    src/lib/ast/value/value/Value.cpp
    src/lib/ast/value/color/Color.cpp
    src/lib/ast/value/number/Number.cpp
    src/lib/ast/value/variable/Variable.cpp
    src/lib/ast/value/calculation/Calculation.cpp
    src/lib/token/Token.cpp
    src/lib/ast/separator/Separator.cpp
    src/lib/ast/selector/Selector.cpp
    src/lib/ast/block/Block.cpp
    src/lib/ast/import/Import.cpp
    src/lib/ast/variableSetter/VariableSetter.cpp
    src/lib/ast/media/Media.cpp
    src/lib/ast/mediaEntry/MediaEntry.cpp
    src/lib/generator/Generator.cpp src/lib/generator/Generator.hpp)

add_executable(CssPreprocessor ${SOURCE_FILES} ${GENERATED_FILES})
target_link_libraries(CssPreprocessor fl)

# Add test target
set(TEST_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests")
enable_testing()

FILE(GLOB TESTS_SIMPLE "${TEST_SOURCE_DIR}/simple/*.simple")
FOREACH (TEST ${TESTS_SIMPLE})<commit_msg>remove generator from CMake<commit_after>cmake_minimum_required(VERSION 3.2)

if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
    message(FATAL_ERROR "Do not run cmake in-source. Instead run\n$ mkdir build\n$ cd build\n$ cmake ..\n")
endif ()

project(CssPreprocessor)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

# Set Bison/Flex - generated content
find_package(BISON 3.0.2 REQUIRED)
find_package(FLEX 2.5.35 REQUIRED)

set(GENERATED_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/generated)
file(MAKE_DIRECTORY ${GENERATED_OUTPUT_DIRECTORY})

BISON_TARGET(Parser src/parser.y ${GENERATED_OUTPUT_DIRECTORY}/parser.cpp)
FLEX_TARGET(Scanner src/lexer.l ${GENERATED_OUTPUT_DIRECTORY}/lexer.cpp)
ADD_FLEX_BISON_DEPENDENCY(Scanner Parser)

set(GENERATED_FILES ${BISON_Parser_OUTPUTS} ${FLEX_Scanner_OUTPUTS})
include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
# / End of Bison/Flex

include_directories(src)
set(SOURCE_FILES
    src/main.cpp
    src/lib/driver/Driver.cpp
    src/lib/logger/Logger.cpp
    src/lib/ast/node/Node.cpp
    src/lib/ast/node/Node.hpp
    src/lib/ast/modifier/Modifier.cpp
    src/lib/ast/property/Property.cpp
    src/lib/ast/value/string/String.cpp
    src/lib/ast/value/value/Value.cpp
    src/lib/ast/value/color/Color.cpp
    src/lib/ast/value/number/Number.cpp
    src/lib/ast/value/variable/Variable.cpp
    src/lib/ast/value/calculation/Calculation.cpp
    src/lib/token/Token.cpp
    src/lib/ast/separator/Separator.cpp
    src/lib/ast/selector/Selector.cpp
    src/lib/ast/block/Block.cpp
    src/lib/ast/import/Import.cpp
    src/lib/ast/variableSetter/VariableSetter.cpp
    src/lib/ast/media/Media.cpp
    src/lib/ast/mediaEntry/MediaEntry.cpp
    )

add_executable(CssPreprocessor ${SOURCE_FILES} ${GENERATED_FILES})
target_link_libraries(CssPreprocessor fl)

# Add test target
set(TEST_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests")
enable_testing()

FILE(GLOB TESTS_SIMPLE "${TEST_SOURCE_DIR}/simple/*.simple")
FOREACH (TEST ${TESTS_SIMPLE})
{'fraction_non_alphanumeric': 0.12444444444444444, 'fraction_numerical': 0.005146198830409357, 'mean_word_length': 5.082503556187767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3656054', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1580, 'n_words': 202}