<commit_before>set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(RDOC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(RDOC_DEFINITIONS PRIVATE -DRENDERDOC_EXPORTS)
set(RDOC_INCLUDES
    PRIVATE ${RDOC_SOURCE_DIR}
    PRIVATE ${RDOC_SOURCE_DIR}/3rdparty)
set(RDOC_LIBRARIES)

# get git commit hash
execute_process(COMMAND sh ${CMAKE_SOURCE_DIR}/calc_hash.sh
    OUTPUT_VARIABLE GIT_COMMIT_HASH)
string(STRIP ${GIT_COMMIT_HASH} GIT_COMMIT_HASH)
list(APPEND RDOC_DEFINITIONS
    PRIVATE -DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")

if(UNIX)
    find_package(PkgConfig REQUIRED)
    find_package(Threads REQUIRED)
    find_package(X11 REQUIRED)

    # This should be fixed and moved to FindXCB.cmake
    pkg_check_modules(PC_XCB REQUIRED xcb xcb-keysyms)
    set(XCB_INCLUDE_DIRS)
    set(XCB_LIBRARIES xcb xcb-keysyms)

    list(APPEND RDOC_DEFINITIONS
        PRIVATE -DLINUX)

    list(APPEND RDOC_INCLUDES
        PRIVATE ${X11_X11_INCLUDE_PATH}
        PRIVATE ${XCB_INCLUDE_DIRS})

    list(APPEND RDOC_LIBRARIES
        PRIVATE m
        PRIVATE dl
        PRIVATE ${CMAKE_THREAD_LIBS_INIT}
        PRIVATE ${X11_X11_LIB}
        PRIVATE ${XCB_LIBRARIES})
endif()

set(sources
    api/app/renderdoc_app.h
    api/replay/basic_types.h
    api/replay/capture_options.h
    api/replay/control_types.h
    api/replay/d3d11_pipestate.h
    api/replay/data_types.h
    api/replay/gl_pipestate.h
    api/replay/renderdoc_replay.h
    api/replay/replay_enums.h
    api/replay/shader_types.h
    api/replay/vk_pipestate.h
    common/common.cpp
    common/common.h
    common/custom_assert.h
    common/dds_readwrite.cpp
    common/dds_readwrite.h
    common/globalconfig.h
    common/shader_cache.h
    common/threading.h
    common/timing.h
    common/wrapped_pool.h
    core/core.cpp
    core/core.h
    core/crash_handler.h
    core/remote_access.cpp
    core/remote_replay.cpp
    core/replay_proxy.cpp
    core/replay_proxy.h
    core/resource_manager.cpp
    core/resource_manager.h
    core/socket_helpers.h
    data/glsl/debuguniforms.h
    data/glsl/texsample.h
    data/hlsl/debugcbuffers.h
    data/spv/debuguniforms.h
    data/spv/texsample.h
    data/version.h
    hooks/hooks.cpp
    hooks/hooks.h
    maths/camera.cpp
    maths/camera.h
    maths/formatpacking.h
    maths/half_convert.h
    maths/matrix.cpp
    maths/matrix.h
    maths/quat.h
    maths/vec.h
    os/os_specific.cpp
    os/os_specific.h
    replay/app_api.cpp
    replay/capture_options.cpp
    replay/entry_points.cpp
    replay/replay_driver.h
    replay/replay_output.cpp
    replay/replay_renderer.cpp
    replay/replay_renderer.h
    replay/type_helpers.cpp
    replay/type_helpers.h
    serialise/grisu2.cpp
    serialise/serialiser.cpp
    serialise/serialiser.h
    serialise/string_utils.cpp
    serialise/string_utils.h
    serialise/utf8printf.cpp
    3rdparty/jpeg-compressor/jpgd.cpp
    3rdparty/jpeg-compressor/jpgd.h
    3rdparty/jpeg-compressor/jpge.cpp
    3rdparty/jpeg-compressor/jpge.h
    3rdparty/lz4/lz4.c
    3rdparty/lz4/lz4.h
    3rdparty/stb/stb_image.h
    3rdparty/stb/stb_image_write.h
    3rdparty/stb/stb_impl.c
    3rdparty/stb/stb_truetype.h
    3rdparty/tinyexr/tinyexr.cpp
    3rdparty/tinyexr/tinyexr.h)

if(UNIX)
    list(APPEND sources
        data/embedded_files.h
        os/linux/linux_callstack.cpp
        os/linux/linux_hook.cpp
        os/linux/linux_hook.h
        os/linux/linux_network.cpp
        os/linux/linux_process.cpp
        os/linux/linux_stringio.cpp
        os/linux/linux_threading.cpp
        os/linux_specific.h)
    # linux_libentry must be the last so that library_loaded is called after
    # static objects are constructed.
    list(APPEND sources os/linux/linux_libentry.cpp)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    set_source_files_properties(3rdparty/tinyexr/tinyexr.cpp
        PROPERTIES COMPILE_FLAGS "-Wno-extra -Wno-unused-function")
endif()

add_library(rdoc OBJECT ${sources})
target_compile_definitions(rdoc ${RDOC_DEFINITIONS})
target_include_directories(rdoc ${RDOC_INCLUDES})<commit_msg>Rename file in CMakeLists.txt<commit_after>set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(RDOC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(RDOC_DEFINITIONS PRIVATE -DRENDERDOC_EXPORTS)
set(RDOC_INCLUDES
    PRIVATE ${RDOC_SOURCE_DIR}
    PRIVATE ${RDOC_SOURCE_DIR}/3rdparty)
set(RDOC_LIBRARIES)

# get git commit hash
execute_process(COMMAND sh ${CMAKE_SOURCE_DIR}/calc_hash.sh
    OUTPUT_VARIABLE GIT_COMMIT_HASH)
string(STRIP ${GIT_COMMIT_HASH} GIT_COMMIT_HASH)
list(APPEND RDOC_DEFINITIONS
    PRIVATE -DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")

if(UNIX)
    find_package(PkgConfig REQUIRED)
    find_package(Threads REQUIRED)
    find_package(X11 REQUIRED)

    # This should be fixed and moved to FindXCB.cmake
    pkg_check_modules(PC_XCB REQUIRED xcb xcb-keysyms)
    set(XCB_INCLUDE_DIRS)
    set(XCB_LIBRARIES xcb xcb-keysyms)

    list(APPEND RDOC_DEFINITIONS
        PRIVATE -DLINUX)

    list(APPEND RDOC_INCLUDES
        PRIVATE ${X11_X11_INCLUDE_PATH}
        PRIVATE ${XCB_INCLUDE_DIRS})

    list(APPEND RDOC_LIBRARIES
        PRIVATE m
        PRIVATE dl
        PRIVATE ${CMAKE_THREAD_LIBS_INIT}
        PRIVATE ${X11_X11_LIB}
        PRIVATE ${XCB_LIBRARIES})
endif()

set(sources
    api/app/renderdoc_app.h
    api/replay/basic_types.h
    api/replay/capture_options.h
    api/replay/control_types.h
    api/replay/d3d11_pipestate.h
    api/replay/data_types.h
    api/replay/gl_pipestate.h
    api/replay/renderdoc_replay.h
    api/replay/replay_enums.h
    api/replay/shader_types.h
    api/replay/vk_pipestate.h
    common/common.cpp
    common/common.h
    common/custom_assert.h
    common/dds_readwrite.cpp
    common/dds_readwrite.h
    common/globalconfig.h
    common/shader_cache.h
    common/threading.h
    common/timing.h
    common/wrapped_pool.h
    core/core.cpp
    core/core.h
    core/crash_handler.h
    core/remote_access.cpp
    core/remote_replay.cpp
    core/replay_proxy.cpp
    core/replay_proxy.h
    core/resource_manager.cpp
    core/resource_manager.h
    core/socket_helpers.h
    data/glsl/debuguniforms.h
    data/glsl/texsample.h
    data/hlsl/debugcbuffers.h
    data/spv/debuguniforms.h
    data/spv/texsample.h
    data/version.h
    hooks/hooks.cpp
    hooks/hooks.h
    maths/camera.cpp
    maths/camera.h
    maths/formatpacking.h
    maths/half_convert.h
    maths/matrix.cpp
    maths/matrix.h
    maths/quat.h
    maths/vec.h
    os/os_specific.cpp
    os/os_specific.h
    replay/app_api.cpp
    replay/capture_options.cpp
    replay/entry_points.cpp
    replay/replay_driver.h
    replay/replay_output.cpp
    replay/replay_renderer.cpp
    replay/replay_renderer.h
    replay/type_helpers.cpp
    replay/type_helpers.h
    serialise/grisu2.cpp
    serialise/serialiser.cpp
    serialise/serialiser.h
    serialise/string_utils.cpp
    serialise/string_utils.h
    serialise/utf8printf.cpp
    3rdparty/jpeg-compressor/jpgd.cpp
    3rdparty/jpeg-compressor/jpgd.h
    3rdparty/jpeg-compressor/jpge.cpp
    3rdparty/jpeg-compressor/jpge.h
    3rdparty/lz4/lz4.c
    3rdparty/lz4/lz4.h
    3rdparty/stb/stb_image.h
    3rdparty/stb/stb_image_write.h
    3rdparty/stb/stb_impl.c
    3rdparty/stb/stb_truetype.h
    3rdparty/tinyexr/tinyexr.cpp
    3rdparty/tinyexr/tinyexr.h)

if(UNIX)
    list(APPEND sources
        data/embedded_files.h
        os/linux/linux_callstack.cpp
        os/linux/linux_hook.cpp
        os/linux/linux_hook.h
        os/linux/linux_network.cpp
        os/linux/linux_process.cpp
        os/linux/linux_stringio.cpp
        os/linux/linux_threading.cpp
        os/linux/linux_specific.h)
    # linux_libentry must be the last so that library_loaded is called after
    # static objects are constructed.
    list(APPEND sources os/linux/linux_libentry.cpp)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    set_source_files_properties(3rdparty/tinyexr/tinyexr.cpp
        PROPERTIES COMPILE_FLAGS "-Wno-extra -Wno-unused-function")
endif()

add_library(rdoc OBJECT ${sources})
target_compile_definitions(rdoc ${RDOC_DEFINITIONS})
target_include_directories(rdoc ${RDOC_INCLUDES})
{'fraction_non_alphanumeric': 0.08490335209199902, 'fraction_numerical': 0.008074382187423538, 'mean_word_length': 3.205246913580247, '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': '2098914', 'n_tokens_mistral': 3336, 'n_tokens_neox': 3194, 'n_words': 404}