Skip to content

Integration into another project, documentation #451

@selimsandal

Description

@selimsandal

Hi,

I've integrated slang-rhi to my project using this repository. I see that merging the codebase with slang is planned #348. Does this mean all slang-rhi source will be moved to the slang repository or is it going stay as a submodule of slang for now?

Here is my current setup:

if(CMAKE_CONFIGURATION_TYPES)
    set(SLANG_RHI_BINARY_DIR "${OUTPUT_DIR}/$<CONFIG>" CACHE STRING "" FORCE)
else()
    set(SLANG_RHI_BINARY_DIR "${OUTPUT_DIR}" CACHE STRING "" FORCE)
endif()

FetchContent_Declare(
        slang-rhi
        GIT_REPOSITORY https://github.com/shader-slang/slang-rhi.git
        GIT_TAG main
        GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(slang-rhi)

target_link_libraries(${PROJECT_NAME} PRIVATE
        slang-rhi
        slang
)

add_dependencies(${PROJECT_NAME} slang-rhi-copy-files)

I add the slang-rhi-copy-files target to copy slang.dll to my binary dir, which is needed for slang-rhi to run (even if static linking is enabled, since slang is downloaded as binary). I also add the slang target to my library list since slang exposes it. Should I do that or compile slang separately?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions