<commit_before>cmake_minimum_required(VERSION 2.6)

project(chaiscript)

FIND_LIBRARY(READLINE_LIBRARY NAMES readline PATH /usr/lib /usr/local/lib /opt/local/lib)

MESSAGE(STATUS "Detecting readline support")
if (READLINE_LIBRARY)
    MESSAGE(STATUS "Found: ${READLINE_LIBRARY}")
    SET (READLINE_LIB readline)
    SET (READLINE_FLAG " -DREADLINE_AVAILABLE")
else(READLINE_LIBRARY)
    MESSAGE(STATUS "Not Found")
    SET (READLINE_LIB )
    SET (READLINE_FLAG )
endif(READLINE_LIBRARY)

SET (CMAKE_C_FLAGS_REL " -Wall -O3 ${READLINE_FLAG}")
SET (CMAKE_CXX_FLAGS_REL " -Wall -O3 ${READLINE_FLAG}")

SET (CMAKE_C_FLAGS " -Wall -ggdb ${READLINE_FLAG}")
SET (CMAKE_CXX_FLAGS " -Wall -ggdb ${READLINE_FLAG}")

include_directories(include)
 
find_package(Boost 1.36.0 COMPONENTS thread)

if (Boost_FOUND)
	include_directories(${Boost_INCLUDE_DIRS})
	add_executable(chaiscript_eval src/main.cpp)
	#add_executable(dispatchkit_test contrib/test/dispatchkit_test.cpp)
	target_link_libraries(chaiscript_eval dl ${Boost_LIBRARIES} ${READLINE_LIB})

        add_library(test MODULE src/test_module.cpp)
	target_link_libraries(test ${Boost_LIBRARIES})

        add_library(stl_extra MODULE src/stl_extra.cpp)
	target_link_libraries(stl_extra ${Boost_LIBRARIES})

	install(TARGETS chaiscript_eval DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin)
        
else(Boost_FOUND)
        message(FATAL_ERROR "Can not find Boost")
endif(Boost_FOUND)
<commit_msg>Use ctest to run unit tests. run "make test" to run them. Note, anything "use"ing another file or loading a module will fail. Need to come up with some cross platform mechanism for specifying include dirs to solve this. Current thought: using environment variables "CHAI_USE_PATH" and "CHAI_MODULE_PATH"<commit_after>cmake_minimum_required(VERSION 2.6)

project(chaiscript)

FIND_LIBRARY(READLINE_LIBRARY NAMES readline PATH /usr/lib /usr/local/lib /opt/local/lib)

enable_testing()

MESSAGE(STATUS "Detecting readline support")
if (READLINE_LIBRARY)
    MESSAGE(STATUS "Found: ${READLINE_LIBRARY}")
    SET (READLINE_LIB readline)
    SET (READLINE_FLAG " -DREADLINE_AVAILABLE")
else(READLINE_LIBRARY)
    MESSAGE(STATUS "Not Found")
    SET (READLINE_LIB )
    SET (READLINE_FLAG )
endif(READLINE_LIBRARY)

SET (CMAKE_C_FLAGS_REL " -Wall -O3 ${READLINE_FLAG}")
SET (CMAKE_CXX_FLAGS_REL " -Wall -O3 ${READLINE_FLAG}")

SET (CMAKE_C_FLAGS " -Wall -ggdb ${READLINE_FLAG}")
SET (CMAKE_CXX_FLAGS " -Wall -ggdb ${READLINE_FLAG}")

include_directories(include)
 
find_package(Boost 1.36.0 COMPONENTS thread)

if (NOT Boost_FOUND)
  message(FATAL_ERROR "Can not find Boost")
endif(NOT Boost_FOUND)



include_directories(${Boost_INCLUDE_DIRS})
add_executable(chaiscript_eval src/main.cpp)
#add_executable(dispatchkit_test contrib/test/dispatchkit_test.cpp)
target_link_libraries(chaiscript_eval dl ${Boost_LIBRARIES} ${READLINE_LIB})

add_library(test MODULE src/test_module.cpp)
target_link_libraries(test ${Boost_LIBRARIES})

add_library(stl_extra MODULE src/stl_extra.cpp)
target_link_libraries(stl_extra ${Boost_LIBRARIES})

file(GLOB UNIT_TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/unittests/ ${CMAKE_CURRENT_SOURCE_DIR}/unittests/*.chai)



foreach(filename ${UNIT_TESTS})
  message(STATUS "Adding test ${filename}")
  add_test(${filename} chaiscript_eval ${CMAKE_CURRENT_SOURCE_DIR}/unittests/unit_test.inc ${CMAKE_CURRENT_SOURCE_DIR}/unittests/${filename})
endforeach(filename)


install(TARGETS chaiscript_eval DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin)
        

{'fraction_non_alphanumeric': 0.10299572039942939, 'fraction_numerical': 0.00456490727532097, 'mean_word_length': 6.443736730360934, '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': '4688074', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1251, 'n_words': 246}