<commit_before>CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(EasyRPG_Reader CXX C)

# Doxygen
FIND_PACKAGE(Doxygen REQUIRED)
ADD_CUSTOM_TARGET(reader_doc
	${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../Doxyfile
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
	COMMENT "Generating API documentation with Doxygen" VERBATIM
)

AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src SRCS)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../include)

IF(${APPLE})
	INCLUDE_DIRECTORIES(/opt/local/include)
ENDIF()

# endianess checking
INCLUDE(TestBigEndian)
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
IF(${IS_BIG_ENDIAN})
	ADD_DEFINITIONS(-D READER_BIG_ENDIAN=1)
ENDIF()

ADD_LIBRARY(${PROJECT_NAME} STATIC ${SRCS})
IF(${APPLE})
	TARGET_LINK_LIBRARIES(${PROJECT_NAME} iconv)
ENDIF()

# test
ENABLE_TESTING()

INCLUDE(FindThreads REQUIRED)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../src)

FUNCTION(CXX_TEST target libs)
	ADD_EXECUTABLE(test_${target} ${CMAKE_CURRENT_SOURCE_DIR}/../../test/${target}.cpp)
	TARGET_LINK_LIBRARIES(test_${target}
		${PROJECT_NAME}
		${libs}
		"gtest"
	)
	IF(${UNIX})
		TARGET_LINK_LIBRARIES(test_${target} ${CMAKE_THREAD_LIBS_INIT})
	ENDIF()
	ADD_TEST(
		NAME test_${target}
		WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
		COMMAND ${EXECUTABLE_OUTPUT_PATH}/test_${target}
	)
	ADD_DEPENDENCIES(test_${target} ${PROJECT_NAME})

	SET(CXX_TEST_EXECUTABLES "${CXX_TEST_EXECUTABLES};test_${target}" PARENT_SCOPE)
ENDFUNCTION()

IF(${APPLE})
	LINK_DIRECTORIES(/opt/local/lib)
ENDIF()

SET(CXX_TEST_SOURCES "time_stamp;")
FOREACH(i ${CXX_TEST_SOURCES})
	CXX_TEST(${i} "gtest_main")
ENDFOREACH()

# borrowed from
# http://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests
ADD_CUSTOM_TARGET(check_reader COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS ${CXX_TEST_EXECUTABLES})<commit_msg>refactor to CMakeLists.txt<commit_after>CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(EasyRPG_Reader CXX C)

SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../lib)
LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../lib)

AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src SRCS)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../include)

# Doxygen
FIND_PACKAGE(Doxygen REQUIRED)
ADD_CUSTOM_TARGET(reader_doc
	${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../Doxyfile
	DEPENDS ${SRCS}
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
	COMMENT "Generating API documentation with Doxygen" VERBATIM
)

# endianess checking
INCLUDE(TestBigEndian)
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
IF(IS_BIG_ENDIAN)
	ADD_DEFINITIONS(-D READER_BIG_ENDIAN=1)
ENDIF()

ADD_LIBRARY(${PROJECT_NAME} STATIC ${SRCS})
IF(APPLE)
	INCLUDE_DIRECTORIES(/opt/local/include)
	LINK_DIRECTORIES(/opt/local/lib)
	TARGET_LINK_LIBRARIES(${PROJECT_NAME} iconv)
ENDIF()

# test
ENABLE_TESTING()

INCLUDE(FindThreads REQUIRED)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../src)

FUNCTION(CXX_TEST target libs)
	ADD_EXECUTABLE(test_${target} ${CMAKE_CURRENT_SOURCE_DIR}/../../test/${target}.cpp)
	TARGET_LINK_LIBRARIES(test_${target}
		${PROJECT_NAME}
		${libs}
		"gtest"
	)
	TARGET_LINK_LIBRARIES(test_${target} ${CMAKE_THREAD_LIBS_INIT})
	ADD_TEST(
		NAME test_${target}
		WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
		COMMAND ${EXECUTABLE_OUTPUT_PATH}/test_${target}
	)
	ADD_DEPENDENCIES(test_${target} ${PROJECT_NAME})
ENDFUNCTION()

SET(CXX_TEST_SOURCES "time_stamp;")
FOREACH(i ${CXX_TEST_SOURCES})
	CXX_TEST(${i} "gtest_main")
ENDFOREACH()
{'fraction_non_alphanumeric': 0.14143990929705216, 'fraction_numerical': 0.003401360544217687, 'mean_word_length': 7.979643765903308, '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': '939265', 'n_tokens_mistral': 1525, 'n_tokens_neox': 1405, 'n_words': 171}