<commit_before># -------------------------------------------------------
# Paintown cmake build script. Creates makefiles for unix 
# based systems and/or
# project files for a given environment like MSVC.
#
# Written by: juvinious
# -------------------------------------------------------

# -------------------------------------------------------
# Ensure that we are doing an out of source build
# Prevents any mishaps
# Also remove the makefile to regenerate the filelist
# -------------------------------------------------------
cmake_minimum_required(VERSION 2.3)
if(EXISTS ${CMAKE_SOURCE_DIR}/CMakeCache.txt)
	file(REMOVE ${CMAKE_SOURCE_DIR}/CMakeCache.txt)
	file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/CMakeFiles)
endif(EXISTS ${CMAKE_SOURCE_DIR}/CMakeCache.txt)
if(EXISTS ${CMAKE_BINARY_DIR}/Makefile)
	file(REMOVE ${CMAKE_BINARY_DIR}/Makefile)
endif(EXISTS ${CMAKE_BINARY_DIR}/Makefile)	
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
	if(UNIX AND NOT CYGWIN)
		message(FATAL_ERROR "Oops. Don't do an in-source build. Create an extra directory change into it and run cmake pointing to the base directory. IE: \nmkdir mybuild && cd mybuild && cmake ../ && make\nYou may need to remove CMakeCache.txt and the CMakeFiles directory in ${CMAKE_SOURCE_DIR} if you can't get rid of this error.")
	else(UNIX AND NOT CYGWIN)
		message(FATAL_ERROR "Oops. Don't do an in-source build. Create an extra directory change into it and run cmake pointing to the base directory. IE: \nmkdir mybuild; cd mybuild; cmakesetup ../\nYou may need to remove CMakeCache.txt and the CMakeFiles directory in  ${CMAKE_SOURCE_DIR} if you can't get rid of this error.")
	endif(UNIX AND NOT CYGWIN)
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})

# -------------------------------------------------------
# Directory in which extra macros can be found
# -------------------------------------------------------
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)

# -------------------------------------------------------
# Directory in which extra macros can be found
# -------------------------------------------------------
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

# -------------------------------------------------------
# Add in uninstall target 
# -------------------------------------------------------
configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  IMMEDIATE @ONLY)

add_custom_target(uninstall
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

# -------------------------------------------------------
# project name
# -------------------------------------------------------
project (paintown)

# -------------------------------------------------------
# Including needed macros
# -------------------------------------------------------
include(CMakeMacros)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
find_package(ZLIB)
find_package(PNG)
find_package(ALLEGRO)
find_package(FREETYPE)
find_package(Threads)
include(TestForPythonEmbed)

# -------------------------------------------------------
# Include Source
# -------------------------------------------------------
include(FileList)

mark_as_advanced(CLEAR ZLIB_INCLUDE_DIR)
mark_as_advanced(CLEAR ZLIB_LIBRARY)

mark_as_advanced(CLEAR PNG_PNG_INCLUDE_DIR)
mark_as_advanced(CLEAR PNG_LIBRARY)

# -------------------------------------------------------
# User setable options
# -------------------------------------------------------
if(NOT MSVC)
	set(CXXFLAGS "-O2 -Wall -funroll-loops -fexpensive-optimizations -Woverloaded-virtual -Werror")
else(NOT MSVC)
	set(CXXFLAGS "-O2")
endif(NOT MSVC)

add_definitions(${CXXFLAGS})

# allegro
if(NOT ALLEGRO_FOUND)
	message(FATAL_ERROR "Couldn't find Allegro")
endif(NOT ALLEGRO_FOUND)

# freetype
if(NOT FREETYPE_FOUND)
	message(FATAL_ERROR "Couldn't find freetype")
endif(NOT FREETYPE_FOUND)

# Python
if(PYTHON_EMBEDABLE)
	set(PY_INCLUDE ${PYTHON_INCLUDE_PATH}) 
	set(PY_LIBS ${PYTHON_LIBRARIES})
	add_definitions(-DHAVE_PYTHON)
endif(PYTHON_EMBEDABLE)

# -------------------------------------------------------
# Paths and system setup
# -------------------------------------------------------

# -------------------------------------------------------
# MINGW
# -------------------------------------------------------

if(MINGW)
	# -------------------------------------------------------
	# Take those user options and set the necessary compile time preprocessors
	# -------------------------------------------------------
	add_definitions(-DWINDOWS)
	set(WIN_LIB -lgdi32 -luser32 -lwsock32)
	 set(CMAKE_THREAD_LIBS_INIT -lpthreadGC2)
else(MINGW)
	 set(CMAKE_THREAD_LIBS_INIT -lpthread)
endif(MINGW)


if(APPLE)
	# -------------------------------------------------------
    # Added stuff for osx
	# -------------------------------------------------------
	set(WIN_LIB "-framework Carbon")
endif(APPLE)

# -------------------------------------------------------
# MSVC
# -------------------------------------------------------

if(MSVC)
	# -------------------------------------------------------
	# Take those user options and set the necessary compile time preprocessors
	# -------------------------------------------------------
	add_definitions("/DWINDOWS")
	set(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
	set(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
	set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
	set(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
	set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
	set(CMAKE_CONFIGURATION_TYPES "Release")
	
	# -------------------------------------------------------	
	# library checks
	# -------------------------------------------------------
	
	set(WIN_LIB /gdi32 /user32)
	
endif(MSVC)

# -------------------------------------------------------<commit_msg>Updated cmake build to comform to OSX<commit_after># -------------------------------------------------------
# Paintown cmake build script. Creates makefiles for unix 
# based systems and/or
# project files for a given environment like MSVC.
#
# Written by: juvinious
# -------------------------------------------------------

# -------------------------------------------------------
# Ensure that we are doing an out of source build
# Prevents any mishaps
# Also remove the makefile to regenerate the filelist
# -------------------------------------------------------
cmake_minimum_required(VERSION 2.3)
if(EXISTS ${CMAKE_SOURCE_DIR}/CMakeCache.txt)
	file(REMOVE ${CMAKE_SOURCE_DIR}/CMakeCache.txt)
	file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/CMakeFiles)
endif(EXISTS ${CMAKE_SOURCE_DIR}/CMakeCache.txt)
if(EXISTS ${CMAKE_BINARY_DIR}/Makefile)
	file(REMOVE ${CMAKE_BINARY_DIR}/Makefile)
endif(EXISTS ${CMAKE_BINARY_DIR}/Makefile)	
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
	if(UNIX AND NOT CYGWIN)
		message(FATAL_ERROR "Oops. Don't do an in-source build. Create an extra directory change into it and run cmake pointing to the base directory. IE: \nmkdir mybuild && cd mybuild && cmake ../ && make\nYou may need to remove CMakeCache.txt and the CMakeFiles directory in ${CMAKE_SOURCE_DIR} if you can't get rid of this error.")
	else(UNIX AND NOT CYGWIN)
		message(FATAL_ERROR "Oops. Don't do an in-source build. Create an extra directory change into it and run cmake pointing to the base directory. IE: \nmkdir mybuild; cd mybuild; cmakesetup ../\nYou may need to remove CMakeCache.txt and the CMakeFiles directory in  ${CMAKE_SOURCE_DIR} if you can't get rid of this error.")
	endif(UNIX AND NOT CYGWIN)
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})

# -------------------------------------------------------
# Directory in which extra macros can be found
# -------------------------------------------------------
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)

# -------------------------------------------------------
# Directory in which extra macros can be found
# -------------------------------------------------------
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

# -------------------------------------------------------
# Add in uninstall target 
# -------------------------------------------------------
configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  IMMEDIATE @ONLY)

add_custom_target(uninstall
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

# -------------------------------------------------------
# project name
# -------------------------------------------------------
project (paintown)

# -------------------------------------------------------
# Including needed macros
# -------------------------------------------------------
include(CMakeMacros)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
find_package(ZLIB)
find_package(PNG)
find_package(ALLEGRO)
find_package(FREETYPE)
find_package(Threads)
include(TestForPythonEmbed)

# -------------------------------------------------------
# Include Source
# -------------------------------------------------------
include(FileList)

mark_as_advanced(CLEAR ZLIB_INCLUDE_DIR)
mark_as_advanced(CLEAR ZLIB_LIBRARY)

mark_as_advanced(CLEAR PNG_PNG_INCLUDE_DIR)
mark_as_advanced(CLEAR PNG_LIBRARY)

# -------------------------------------------------------
# User setable options
# -------------------------------------------------------
if(NOT MSVC)
	set(CXXFLAGS "-O2 -Wall -funroll-loops -fexpensive-optimizations -Woverloaded-virtual -Werror")
else(NOT MSVC)
	set(CXXFLAGS "-O2")
endif(NOT MSVC)

add_definitions(${CXXFLAGS})

# allegro
if(NOT ALLEGRO_FOUND)
	message(FATAL_ERROR "Couldn't find Allegro")
endif(NOT ALLEGRO_FOUND)

# freetype
if(NOT FREETYPE_FOUND)
	message(FATAL_ERROR "Couldn't find freetype")
endif(NOT FREETYPE_FOUND)

# Python
if(PYTHON_EMBEDABLE)
	set(PY_INCLUDE ${PYTHON_INCLUDE_PATH}) 
	set(PY_LIBS ${PYTHON_LIBRARIES})
	add_definitions(-DHAVE_PYTHON)
endif(PYTHON_EMBEDABLE)

# -------------------------------------------------------
# Paths and system setup
# -------------------------------------------------------

# -------------------------------------------------------
# MINGW
# -------------------------------------------------------

if(MINGW)
	# -------------------------------------------------------
	# Take those user options and set the necessary compile time preprocessors
	# -------------------------------------------------------
	add_definitions(-DWINDOWS)
	set(WIN_LIB -lgdi32 -luser32 -lwsock32)
	 set(CMAKE_THREAD_LIBS_INIT -lpthreadGC2)
else(MINGW)
	 set(CMAKE_THREAD_LIBS_INIT -lpthread)
endif(MINGW)


if(APPLE)
	# -------------------------------------------------------
    # Added stuff for osx
	# -------------------------------------------------------
	set(WIN_LIB "-framework Carbon")
	add_definitions(-DMACOSX)
endif(APPLE)

# -------------------------------------------------------
# MSVC
# -------------------------------------------------------

if(MSVC)
	# -------------------------------------------------------
	# Take those user options and set the necessary compile time preprocessors
	# -------------------------------------------------------
	add_definitions("/DWINDOWS")
	set(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
	set(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
	set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
	set(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
	set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
	set(CMAKE_CONFIGURATION_TYPES "Release")
	
	# -------------------------------------------------------	
	# library checks
	# -------------------------------------------------------
	
	set(WIN_LIB /gdi32 /user32)
	
endif(MSVC)

# -------------------------------------------------------
{'fraction_non_alphanumeric': 0.37740486481905244, 'fraction_numerical': 0.003390117806593779, 'mean_word_length': 1.414075286415712, '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': '6666882', 'n_tokens_mistral': 3378, 'n_tokens_neox': 3173, 'n_words': 725}