<commit_before>add_definitions(-DPy_BUILD_CORE)
add_definitions(-DNDEBUG)

set(MODULE_SOURCES # Equivalent to MODULE_OBJS in Makefile.pre
    ${PROJECT_BINARY_DIR}/CMakeFiles/config.c
    ${SRC_DIR}/Modules/gcmodule.c
    ${SRC_DIR}/Modules/main.c
)
if(UNIX)
    list(APPEND MODULE_SOURCES
        ${SRC_DIR}/Modules/getpath.c
    )
    set(PYTHONPATH "${EXTRA_PYTHONPATH}:lib-dynload:plat-${PY_PLATFORM}")
    if(ENABLE_TKINTER)
        set(PYTHONPATH "${PYTHONPATH}:lib-tk")
    endif()
    set_property(
        SOURCE ${SRC_DIR}/Modules/getpath.c
        PROPERTY COMPILE_DEFINITIONS
            PREFIX="${CMAKE_INSTALL_PREFIX}"
            EXEC_PREFIX="${CMAKE_INSTALL_PREFIX}"
            VERSION="${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}"
            VPATH="."
            PYTHONPATH="${PYTHONPATH}"
      )
elseif(WIN32)
    list(APPEND MODULE_SOURCES
        ${SRC_DIR}/PC/getpathp.c
    )
    # HACK To workaround limitation in escaping logic of CMake, the pythonpath
    #      separator is conditionally set depending of the version of Visual Studio.
    #      See http://cmake.org/Bug/view.php?id=14073
    if( ("${MSVC_VERSION}" VERSION_GREATER "1599") AND ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio") )
        set(PATHSEP "%3B")
    elseif( (${MSVC}) AND ("${CMAKE_GENERATOR}" MATCHES "^Ninja") )
        set(PATHSEP "\;")
    elseif( (${MSVC}) AND ("${CMAKE_GENERATOR}" MATCHES "^NMake") )
        set(PATHSEP "\;")
    elseif(MINGW)
        set(PATHSEP "\;")
    else()
        set(PATHSEP ";")
    endif()
    string(REPLACE "/" "\\\\" PYTHONHOME_ESCAPED ${PYTHONHOME})
    string(REPLACE "/" "\\\\" EXTENSION_INSTALL_DIR_ESCAPED ${EXTENSION_INSTALL_DIR})
    set(PYTHONPATH "${EXTRA_PYTHONPATH}")
    set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}")
    set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${EXTENSION_INSTALL_DIR_ESCAPED}")
    set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${EXTENSION_INSTALL_DIR_ESCAPED}\\\\${CMAKE_CFG_INTDIR}")
    set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}\\\\plat-${PY_PLATFORM}")
    if(ENABLE_TKINTER)
        set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}\\\\lib-tk")
    endif()

    set(_wide_char_modifier)
    if(IS_PY3)
        set(_wide_char_modifier "L")
    endif()

    set_property(
        SOURCE ${SRC_DIR}/PC/getpathp.c
        PROPERTY COMPILE_DEFINITIONS
            "LANDMARK=${_wide_char_modifier}\"${PYTHONHOME_ESCAPED}\\\\os.py\""
            "PYTHONPATH=${_wide_char_modifier}\"${PYTHONPATH}\""
    )
endif()

set(PARSER_COMMON_SOURCES # Equivalent to POBJS in Makefile.pre
    ${SRC_DIR}/Parser/acceler.c
    ${SRC_DIR}/Parser/bitset.c
    ${SRC_DIR}/Parser/firstsets.c
    ${SRC_DIR}/Parser/grammar1.c
    ${SRC_DIR}/Parser/grammar.c
    ${SRC_DIR}/Parser/listnode.c
    ${SRC_DIR}/Parser/metagrammar.c
    ${SRC_DIR}/Parser/node.c
    ${SRC_DIR}/Parser/parser.c
    ${SRC_DIR}/Parser/pgen.c
)

set(OBJECT2_SOURCES
    ${SRC_DIR}/Objects/bufferobject.c
    ${SRC_DIR}/Objects/cobject.c
    ${SRC_DIR}/Objects/intobject.c
    ${SRC_DIR}/Objects/stringobject.c
)
if(MSVC)
    if(EXISTS ${SRC_DIR}/PC/invalid_parameter_handler.c)
        list(APPEND OBJECT2_SOURCES
            ${SRC_DIR}/PC/invalid_parameter_handler.c
        )
    endif()
endif()

set(OBJECT3_SOURCES
    ${SRC_DIR}/Objects/accu.c
    ${SRC_DIR}/Objects/bytesobject.c
    ${SRC_DIR}/Objects/namespaceobject.c
    ${SRC_DIR}/Objects/odictobject.c
)
if(MSVC)
    list(APPEND OBJECT3_SOURCES
        ${SRC_DIR}/PC/invalid_parameter_handler.c
    )
endif()

set(OBJECT_COMMON_SOURCES # Equivalent to OBJECT_OBJS in Makefile.pre
    ${OBJECT${PY_VERSION_MAJOR}_SOURCES}
    ${SRC_DIR}/Objects/abstract.c
    ${SRC_DIR}/Objects/boolobject.c
    ${SRC_DIR}/Objects/bytearrayobject.c
    ${SRC_DIR}/Objects/bytes_methods.c
    ${SRC_DIR}/Objects/capsule.c
    ${SRC_DIR}/Objects/cellobject.c
    ${SRC_DIR}/Objects/classobject.c
    ${SRC_DIR}/Objects/codeobject.c
    ${SRC_DIR}/Objects/complexobject.c
    ${SRC_DIR}/Objects/descrobject.c
    ${SRC_DIR}/Objects/dictobject.c
    ${SRC_DIR}/Objects/enumobject.c
    ${SRC_DIR}/Objects/exceptions.c
    ${SRC_DIR}/Objects/fileobject.c
    ${SRC_DIR}/Objects/floatobject.c
    ${SRC_DIR}/Objects/frameobject.c
    ${SRC_DIR}/Objects/funcobject.c
    ${SRC_DIR}/Objects/genobject.c
    ${SRC_DIR}/Objects/iterobject.c
    ${SRC_DIR}/Objects/listobject.c
    ${SRC_DIR}/Objects/longobject.c
    ${SRC_DIR}/Objects/memoryobject.c
    ${SRC_DIR}/Objects/methodobject.c
    ${SRC_DIR}/Objects/moduleobject.c
    ${SRC_DIR}/Objects/object.c
    ${SRC_DIR}/Objects/obmalloc.c
    ${SRC_DIR}/Objects/rangeobject.c
    ${SRC_DIR}/Objects/setobject.c
    ${SRC_DIR}/Objects/sliceobject.c
    ${SRC_DIR}/Objects/structseq.c
    ${SRC_DIR}/Objects/tupleobject.c
    ${SRC_DIR}/Objects/typeobject.c
    ${SRC_DIR}/Objects/unicodectype.c
    ${SRC_DIR}/Objects/unicodeobject.c
    ${SRC_DIR}/Objects/weakrefobject.c
)

if(CMAKE_C_COMPILER_ID MATCHES GNU)
    foreach(filename class complex float int method string type unicode weakref)
        set_property(SOURCE ${SRC_DIR}/Objects/${filename}object.c PROPERTY COMPILE_FLAGS -Wno-unused-value)
    endforeach()
endif()

set(DYNLOAD_SOURCES
  )

if(UNIX AND HAVE_DLOPEN)
    list(APPEND DYNLOAD_SOURCES
        ${SRC_DIR}/Python/dynload_shlib.c
    )
    if(IS_PY3)
    set_property(
        SOURCE ${SRC_DIR}/Python/dynload_shlib.c
        PROPERTY COMPILE_DEFINITIONS
            SOABI="${SOABI}"
        )
    endif()
elseif(WIN32)
    list(APPEND DYNLOAD_SOURCES
        ${SRC_DIR}/PC/dl_nt.c
        ${SRC_DIR}/Python/dynload_win.c
        )
    set_property(
        SOURCE ${SRC_DIR}/PC/dl_nt.c
        PROPERTY COMPILE_DEFINITIONS Py_ENABLE_SHARED
    )
endif()

set(THREAD_SOURCES )
if(WITH_THREAD)
    list(APPEND THREAD_SOURCES
        ${SRC_DIR}/Python/thread.c
    )
endif()

set(PYTHON2_COMMON_SOURCES
    ${SRC_DIR}/Python/formatter_string.c
    ${SRC_DIR}/Python/pystrtod.c
)
if(WIN32)
    list(APPEND PYTHON2_COMMON_SOURCES<commit_msg>python3: Associate MS_DLL_ID definition with dl_nt.c (introduced in python 3.5)<commit_after>add_definitions(-DPy_BUILD_CORE)
add_definitions(-DNDEBUG)

set(MODULE_SOURCES # Equivalent to MODULE_OBJS in Makefile.pre
    ${PROJECT_BINARY_DIR}/CMakeFiles/config.c
    ${SRC_DIR}/Modules/gcmodule.c
    ${SRC_DIR}/Modules/main.c
)
if(UNIX)
    list(APPEND MODULE_SOURCES
        ${SRC_DIR}/Modules/getpath.c
    )
    set(PYTHONPATH "${EXTRA_PYTHONPATH}:lib-dynload:plat-${PY_PLATFORM}")
    if(ENABLE_TKINTER)
        set(PYTHONPATH "${PYTHONPATH}:lib-tk")
    endif()
    set_property(
        SOURCE ${SRC_DIR}/Modules/getpath.c
        PROPERTY COMPILE_DEFINITIONS
            PREFIX="${CMAKE_INSTALL_PREFIX}"
            EXEC_PREFIX="${CMAKE_INSTALL_PREFIX}"
            VERSION="${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}"
            VPATH="."
            PYTHONPATH="${PYTHONPATH}"
      )
elseif(WIN32)
    list(APPEND MODULE_SOURCES
        ${SRC_DIR}/PC/getpathp.c
    )
    # HACK To workaround limitation in escaping logic of CMake, the pythonpath
    #      separator is conditionally set depending of the version of Visual Studio.
    #      See http://cmake.org/Bug/view.php?id=14073
    if( ("${MSVC_VERSION}" VERSION_GREATER "1599") AND ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio") )
        set(PATHSEP "%3B")
    elseif( (${MSVC}) AND ("${CMAKE_GENERATOR}" MATCHES "^Ninja") )
        set(PATHSEP "\;")
    elseif( (${MSVC}) AND ("${CMAKE_GENERATOR}" MATCHES "^NMake") )
        set(PATHSEP "\;")
    elseif(MINGW)
        set(PATHSEP "\;")
    else()
        set(PATHSEP ";")
    endif()
    string(REPLACE "/" "\\\\" PYTHONHOME_ESCAPED ${PYTHONHOME})
    string(REPLACE "/" "\\\\" EXTENSION_INSTALL_DIR_ESCAPED ${EXTENSION_INSTALL_DIR})
    set(PYTHONPATH "${EXTRA_PYTHONPATH}")
    set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}")
    set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${EXTENSION_INSTALL_DIR_ESCAPED}")
    set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${EXTENSION_INSTALL_DIR_ESCAPED}\\\\${CMAKE_CFG_INTDIR}")
    set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}\\\\plat-${PY_PLATFORM}")
    if(ENABLE_TKINTER)
        set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}\\\\lib-tk")
    endif()

    set(_wide_char_modifier)
    if(IS_PY3)
        set(_wide_char_modifier "L")
    endif()

    set_property(
        SOURCE ${SRC_DIR}/PC/getpathp.c
        PROPERTY COMPILE_DEFINITIONS
            "LANDMARK=${_wide_char_modifier}\"${PYTHONHOME_ESCAPED}\\\\os.py\""
            "PYTHONPATH=${_wide_char_modifier}\"${PYTHONPATH}\""
    )
endif()

set(PARSER_COMMON_SOURCES # Equivalent to POBJS in Makefile.pre
    ${SRC_DIR}/Parser/acceler.c
    ${SRC_DIR}/Parser/bitset.c
    ${SRC_DIR}/Parser/firstsets.c
    ${SRC_DIR}/Parser/grammar1.c
    ${SRC_DIR}/Parser/grammar.c
    ${SRC_DIR}/Parser/listnode.c
    ${SRC_DIR}/Parser/metagrammar.c
    ${SRC_DIR}/Parser/node.c
    ${SRC_DIR}/Parser/parser.c
    ${SRC_DIR}/Parser/pgen.c
)

set(OBJECT2_SOURCES
    ${SRC_DIR}/Objects/bufferobject.c
    ${SRC_DIR}/Objects/cobject.c
    ${SRC_DIR}/Objects/intobject.c
    ${SRC_DIR}/Objects/stringobject.c
)
if(MSVC)
    if(EXISTS ${SRC_DIR}/PC/invalid_parameter_handler.c)
        list(APPEND OBJECT2_SOURCES
            ${SRC_DIR}/PC/invalid_parameter_handler.c
        )
    endif()
endif()

set(OBJECT3_SOURCES
    ${SRC_DIR}/Objects/accu.c
    ${SRC_DIR}/Objects/bytesobject.c
    ${SRC_DIR}/Objects/namespaceobject.c
    ${SRC_DIR}/Objects/odictobject.c
)
if(MSVC)
    list(APPEND OBJECT3_SOURCES
        ${SRC_DIR}/PC/invalid_parameter_handler.c
    )
endif()

set(OBJECT_COMMON_SOURCES # Equivalent to OBJECT_OBJS in Makefile.pre
    ${OBJECT${PY_VERSION_MAJOR}_SOURCES}
    ${SRC_DIR}/Objects/abstract.c
    ${SRC_DIR}/Objects/boolobject.c
    ${SRC_DIR}/Objects/bytearrayobject.c
    ${SRC_DIR}/Objects/bytes_methods.c
    ${SRC_DIR}/Objects/capsule.c
    ${SRC_DIR}/Objects/cellobject.c
    ${SRC_DIR}/Objects/classobject.c
    ${SRC_DIR}/Objects/codeobject.c
    ${SRC_DIR}/Objects/complexobject.c
    ${SRC_DIR}/Objects/descrobject.c
    ${SRC_DIR}/Objects/dictobject.c
    ${SRC_DIR}/Objects/enumobject.c
    ${SRC_DIR}/Objects/exceptions.c
    ${SRC_DIR}/Objects/fileobject.c
    ${SRC_DIR}/Objects/floatobject.c
    ${SRC_DIR}/Objects/frameobject.c
    ${SRC_DIR}/Objects/funcobject.c
    ${SRC_DIR}/Objects/genobject.c
    ${SRC_DIR}/Objects/iterobject.c
    ${SRC_DIR}/Objects/listobject.c
    ${SRC_DIR}/Objects/longobject.c
    ${SRC_DIR}/Objects/memoryobject.c
    ${SRC_DIR}/Objects/methodobject.c
    ${SRC_DIR}/Objects/moduleobject.c
    ${SRC_DIR}/Objects/object.c
    ${SRC_DIR}/Objects/obmalloc.c
    ${SRC_DIR}/Objects/rangeobject.c
    ${SRC_DIR}/Objects/setobject.c
    ${SRC_DIR}/Objects/sliceobject.c
    ${SRC_DIR}/Objects/structseq.c
    ${SRC_DIR}/Objects/tupleobject.c
    ${SRC_DIR}/Objects/typeobject.c
    ${SRC_DIR}/Objects/unicodectype.c
    ${SRC_DIR}/Objects/unicodeobject.c
    ${SRC_DIR}/Objects/weakrefobject.c
)

if(CMAKE_C_COMPILER_ID MATCHES GNU)
    foreach(filename class complex float int method string type unicode weakref)
        set_property(SOURCE ${SRC_DIR}/Objects/${filename}object.c PROPERTY COMPILE_FLAGS -Wno-unused-value)
    endforeach()
endif()

set(DYNLOAD_SOURCES
  )

if(UNIX AND HAVE_DLOPEN)
    list(APPEND DYNLOAD_SOURCES
        ${SRC_DIR}/Python/dynload_shlib.c
    )
    if(IS_PY3)
    set_property(
        SOURCE ${SRC_DIR}/Python/dynload_shlib.c
        PROPERTY COMPILE_DEFINITIONS
            SOABI="${SOABI}"
        )
    endif()
elseif(WIN32)
    list(APPEND DYNLOAD_SOURCES
        ${SRC_DIR}/PC/dl_nt.c
        ${SRC_DIR}/Python/dynload_win.c
        )
    set(ms_dll_id "${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}")
    if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
      set(ms_dll_id "${ms_dll_id}-32")
    endif()
    set_property(
        SOURCE ${SRC_DIR}/PC/dl_nt.c
        PROPERTY COMPILE_DEFINITIONS
            Py_ENABLE_SHARED
            MS_DLL_ID="${ms_dll_id}"
        )
endif()

set(THREAD_SOURCES )
if(WITH_THREAD)
    list(APPEND THREAD_SOURCES
        ${SRC_DIR}/Python/thread.c
    )
endif()

set(PYTHON2_COMMON_SOURCES
    ${SRC_DIR}/Python/formatter_string.c
    ${SRC_DIR}/Python/pystrtod.c
)
if(WIN32)
    list(APPEND PYTHON2_COMMON_SOURCES
{'fraction_non_alphanumeric': 0.14886547811993517, 'fraction_numerical': 0.00453808752025932, 'mean_word_length': 3.3500176242509694, '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': '1659912', 'n_tokens_mistral': 4829, 'n_tokens_neox': 4600, 'n_words': 541}