<commit_before># framework flags
# FRAMEWORK_SOUND
# FRAMEWORK_GRAPHICS
# FRAMEWORK_NET
# FRAMEWORK_XML
# FRAMEWORK_SQL

# CMAKE_CURRENT_LIST_DIR cmake 2.6 compatibility
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
    get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)

# add framework cmake modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake;${CMAKE_MODULE_PATH}")

set(framework_LIBRARIES "")
set(framework_DEFINITIONS "")
set(framework_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/..")
set(framework_SOURCES ${framework_SOURCES}
    ${CMAKE_CURRENT_LIST_DIR}/const.h
    ${CMAKE_CURRENT_LIST_DIR}/global.h
    ${CMAKE_CURRENT_LIST_DIR}/pch.h
    ${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp

    ${CMAKE_CURRENT_LIST_DIR}/util/color.cpp
    ${CMAKE_CURRENT_LIST_DIR}/util/color.h
    ${CMAKE_CURRENT_LIST_DIR}/util/crypt.cpp
    ${CMAKE_CURRENT_LIST_DIR}/util/crypt.h
    ${CMAKE_CURRENT_LIST_DIR}/util/databuffer.h
    ${CMAKE_CURRENT_LIST_DIR}/util/matrix.h
    ${CMAKE_CURRENT_LIST_DIR}/util/point.h
    ${CMAKE_CURRENT_LIST_DIR}/util/rect.h
    ${CMAKE_CURRENT_LIST_DIR}/util/size.h

    # stdext
    ${CMAKE_CURRENT_LIST_DIR}/stdext/any.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/boolean.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/cast.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/compiler.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/demangle.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/demangle.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/dumper.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/dynamic_storage.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/exception.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/format.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/math.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/math.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/net.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/net.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/packed_any.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/packed_storage.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/packed_vector.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/shared_object.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/shared_ptr.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/stdext.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/string.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/string.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/time.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/time.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/traits.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/types.h

    # core
    ${CMAKE_CURRENT_LIST_DIR}/core/application.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/application.h
    ${CMAKE_CURRENT_LIST_DIR}/core/adaptativeframecounter.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/adaptativeframecounter.h
    ${CMAKE_CURRENT_LIST_DIR}/core/asyncdispatcher.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/asyncdispatcher.h
    ${CMAKE_CURRENT_LIST_DIR}/core/binarytree.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/binarytree.h
    ${CMAKE_CURRENT_LIST_DIR}/core/clock.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/clock.h
    ${CMAKE_CURRENT_LIST_DIR}/core/config.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/config.h
    ${CMAKE_CURRENT_LIST_DIR}/core/configmanager.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/configmanager.h
    ${CMAKE_CURRENT_LIST_DIR}/core/declarations.h
    ${CMAKE_CURRENT_LIST_DIR}/core/event.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/event.h
    ${CMAKE_CURRENT_LIST_DIR}/core/eventdispatcher.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/eventdispatcher.h
    ${CMAKE_CURRENT_LIST_DIR}/core/filestream.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/filestream.h
    ${CMAKE_CURRENT_LIST_DIR}/core/inputevent.h
    ${CMAKE_CURRENT_LIST_DIR}/core/logger.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/logger.h
    ${CMAKE_CURRENT_LIST_DIR}/core/module.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/module.h
    ${CMAKE_CURRENT_LIST_DIR}/core/modulemanager.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/modulemanager.h
    ${CMAKE_CURRENT_LIST_DIR}/core/resourcemanager.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/resourcemanager.h
    ${CMAKE_CURRENT_LIST_DIR}/core/scheduledevent.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/scheduledevent.h
    ${CMAKE_CURRENT_LIST_DIR}/core/timer.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/timer.h

    # luaengine
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/declarations.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luabinder.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaexception.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaexception.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luainterface.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luainterface.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaobject.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaobject.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luavaluecasts.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luavaluecasts.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/lbitlib.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/lbitlib.h

    # otml
    ${CMAKE_CURRENT_LIST_DIR}/otml/declarations.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otml.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.h

    # crash handler
    ${CMAKE_CURRENT_LIST_DIR}/platform/crashhandler.h
    ${CMAKE_CURRENT_LIST_DIR}/platform/unixcrashhandler.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/win32crashhandler.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/win32platform.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/unixplatform.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/platform.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/platform.h
)

set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp
                            PROPERTIES LANGUAGE CXX COMPILE_FLAGS "-g0 -Os")

# some build options
option(LUAJIT "Use lua jit" OFF)
if(NOT APPLE)
    option(CRASH_HANDLER "Generate crash reports" ON)
    option(USE_STATIC_LIBS "Don't use shared libraries (dlls)" ON)
    option(USE_LIBCPP "Use the new libc++ library instead of stdc++" OFF)
    option(USE_LTO "Use link time optimizations" OFF)
else()
    set(CRASH_HANDLER OFF)
    set(USE_STATIC_LIBS OFF)
    set(USE_LIBCPP ON)
endif()
set(BUILD_COMMIT "devel" CACHE "Git commit string (intended for releases)" STRING)
set(BUILD_REVISION "0" CACHE "Git revision string (intended for releases)" STRING)

# default build type
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()

if(WIN32)
    set(CPP2011_FLAGS "-std=gnu++0x")
else()
    set(CPP2011_FLAGS "-std=c++0x")
endif()

# gcc compile flags
set(WARNS_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-unused-result")
set(CMAKE_CXX_FLAGS                   "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} ${CPP2011_FLAGS} -pipe")
set(CMAKE_CXX_FLAGS_COMPILESPEED      "-O0")
set(CMAKE_CXX_FLAGS_DEBUG             "-O0 -g")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO    "-O1 -g -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_RELEASE           "-Os")
set(CMAKE_CXX_FLAGS_PERFORMANCE       "-Ofast -mmmx -msse -msse2")

if(USE_LTO)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fwhole-program -flto")
    if(WIN32)
        set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-O1,--gc-sections,--sort-common,--relax")
    else()
        set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-O1,--gc-sections,--sort-common,--relax,-z,relro")
    endif()
endif()

# process options
if(USE_STATIC_LIBS)
    if(NOT APPLE)
        set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -static-libgcc -static-libstdc++")
    endif()
    message(STATUS "Link to static libraries: ON")
else()
    message(STATUS "Link to static libraries: OFF")
endif()

message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
add_definitions(-D"BUILD_TYPE=\\\"${CMAKE_BUILD_TYPE}\\\"")
message(STATUS "Build commit: ${BUILD_COMMIT}")
add_definitions(-D"BUILD_COMMIT=\\\"${BUILD_COMMIT}\\\"")
message(STATUS "Build revision: ${BUILD_REVISION}")
add_definitions(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"")

# find boost<commit_msg>Use -O2 in release build<commit_after># framework flags
# FRAMEWORK_SOUND
# FRAMEWORK_GRAPHICS
# FRAMEWORK_NET
# FRAMEWORK_XML
# FRAMEWORK_SQL

# CMAKE_CURRENT_LIST_DIR cmake 2.6 compatibility
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
    get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)

# add framework cmake modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake;${CMAKE_MODULE_PATH}")

set(framework_LIBRARIES "")
set(framework_DEFINITIONS "")
set(framework_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/..")
set(framework_SOURCES ${framework_SOURCES}
    ${CMAKE_CURRENT_LIST_DIR}/const.h
    ${CMAKE_CURRENT_LIST_DIR}/global.h
    ${CMAKE_CURRENT_LIST_DIR}/pch.h
    ${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp

    ${CMAKE_CURRENT_LIST_DIR}/util/color.cpp
    ${CMAKE_CURRENT_LIST_DIR}/util/color.h
    ${CMAKE_CURRENT_LIST_DIR}/util/crypt.cpp
    ${CMAKE_CURRENT_LIST_DIR}/util/crypt.h
    ${CMAKE_CURRENT_LIST_DIR}/util/databuffer.h
    ${CMAKE_CURRENT_LIST_DIR}/util/matrix.h
    ${CMAKE_CURRENT_LIST_DIR}/util/point.h
    ${CMAKE_CURRENT_LIST_DIR}/util/rect.h
    ${CMAKE_CURRENT_LIST_DIR}/util/size.h

    # stdext
    ${CMAKE_CURRENT_LIST_DIR}/stdext/any.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/boolean.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/cast.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/compiler.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/demangle.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/demangle.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/dumper.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/dynamic_storage.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/exception.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/format.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/math.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/math.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/net.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/net.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/packed_any.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/packed_storage.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/packed_vector.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/shared_object.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/shared_ptr.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/stdext.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/string.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/string.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/time.cpp
    ${CMAKE_CURRENT_LIST_DIR}/stdext/time.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/traits.h
    ${CMAKE_CURRENT_LIST_DIR}/stdext/types.h

    # core
    ${CMAKE_CURRENT_LIST_DIR}/core/application.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/application.h
    ${CMAKE_CURRENT_LIST_DIR}/core/adaptativeframecounter.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/adaptativeframecounter.h
    ${CMAKE_CURRENT_LIST_DIR}/core/asyncdispatcher.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/asyncdispatcher.h
    ${CMAKE_CURRENT_LIST_DIR}/core/binarytree.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/binarytree.h
    ${CMAKE_CURRENT_LIST_DIR}/core/clock.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/clock.h
    ${CMAKE_CURRENT_LIST_DIR}/core/config.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/config.h
    ${CMAKE_CURRENT_LIST_DIR}/core/configmanager.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/configmanager.h
    ${CMAKE_CURRENT_LIST_DIR}/core/declarations.h
    ${CMAKE_CURRENT_LIST_DIR}/core/event.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/event.h
    ${CMAKE_CURRENT_LIST_DIR}/core/eventdispatcher.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/eventdispatcher.h
    ${CMAKE_CURRENT_LIST_DIR}/core/filestream.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/filestream.h
    ${CMAKE_CURRENT_LIST_DIR}/core/inputevent.h
    ${CMAKE_CURRENT_LIST_DIR}/core/logger.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/logger.h
    ${CMAKE_CURRENT_LIST_DIR}/core/module.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/module.h
    ${CMAKE_CURRENT_LIST_DIR}/core/modulemanager.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/modulemanager.h
    ${CMAKE_CURRENT_LIST_DIR}/core/resourcemanager.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/resourcemanager.h
    ${CMAKE_CURRENT_LIST_DIR}/core/scheduledevent.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/scheduledevent.h
    ${CMAKE_CURRENT_LIST_DIR}/core/timer.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/timer.h

    # luaengine
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/declarations.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luabinder.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaexception.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaexception.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luainterface.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luainterface.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaobject.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaobject.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luavaluecasts.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/luavaluecasts.h
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/lbitlib.cpp
    ${CMAKE_CURRENT_LIST_DIR}/luaengine/lbitlib.h

    # otml
    ${CMAKE_CURRENT_LIST_DIR}/otml/declarations.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otml.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.h
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.cpp
    ${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.h

    # crash handler
    ${CMAKE_CURRENT_LIST_DIR}/platform/crashhandler.h
    ${CMAKE_CURRENT_LIST_DIR}/platform/unixcrashhandler.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/win32crashhandler.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/win32platform.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/unixplatform.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/platform.cpp
    ${CMAKE_CURRENT_LIST_DIR}/platform/platform.h
)

set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp
                            PROPERTIES LANGUAGE CXX COMPILE_FLAGS "-g0 -Os")

# some build options
option(LUAJIT "Use lua jit" OFF)
if(NOT APPLE)
    option(CRASH_HANDLER "Generate crash reports" ON)
    option(USE_STATIC_LIBS "Don't use shared libraries (dlls)" ON)
    option(USE_LIBCPP "Use the new libc++ library instead of stdc++" OFF)
    option(USE_LTO "Use link time optimizations" OFF)
else()
    set(CRASH_HANDLER OFF)
    set(USE_STATIC_LIBS OFF)
    set(USE_LIBCPP ON)
endif()
set(BUILD_COMMIT "devel" CACHE "Git commit string (intended for releases)" STRING)
set(BUILD_REVISION "0" CACHE "Git revision string (intended for releases)" STRING)

# default build type
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()

if(WIN32)
    set(CPP2011_FLAGS "-std=gnu++0x")
else()
    set(CPP2011_FLAGS "-std=c++0x")
endif()

# gcc compile flags
set(WARNS_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-unused-result")
set(CMAKE_CXX_FLAGS                   "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} ${CPP2011_FLAGS} -pipe")
set(CMAKE_CXX_FLAGS_COMPILESPEED      "-O0")
set(CMAKE_CXX_FLAGS_DEBUG             "-O0 -g")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO    "-O1 -g -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_RELEASE           "-O2")
set(CMAKE_CXX_FLAGS_PERFORMANCE       "-Ofast -mmmx -msse -msse2")

if(USE_LTO)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fwhole-program -flto")
    if(WIN32)
        set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-O1,--gc-sections,--sort-common,--relax")
    else()
        set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-O1,--gc-sections,--sort-common,--relax,-z,relro")
    endif()
endif()

# process options
if(USE_STATIC_LIBS)
    if(NOT APPLE)
        set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -static-libgcc -static-libstdc++")
    endif()
    message(STATUS "Link to static libraries: ON")
else()
    message(STATUS "Link to static libraries: OFF")
endif()

message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
add_definitions(-D"BUILD_TYPE=\\\"${CMAKE_BUILD_TYPE}\\\"")
message(STATUS "Build commit: ${BUILD_COMMIT}")
add_definitions(-D"BUILD_COMMIT=\\\"${BUILD_COMMIT}\\\"")
message(STATUS "Build revision: ${BUILD_REVISION}")
add_definitions(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"")

# find boost
{'fraction_non_alphanumeric': 0.12494710753793145, 'fraction_numerical': 0.004473191077797255, 'mean_word_length': 4.998549673676577, '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': '7433674', 'n_tokens_mistral': 6674, 'n_tokens_neox': 6253, 'n_words': 655}