# Copyright (c) OpenMMLab. All rights reserved.

project(mmdeploy_codebase)

set(CODEBASES "")
if ("all" IN_LIST MMDEPLOY_CODEBASES)
    list(APPEND CODEBASES "mmcls")
    list(APPEND CODEBASES "mmdet")
    list(APPEND CODEBASES "mmseg")
    list(APPEND CODEBASES "mmocr")
    list(APPEND CODEBASES "mmedit")
    list(APPEND CODEBASES "mmpose")
    list(APPEND CODEBASES "mmrotate")
    list(APPEND CODEBASES "mmaction")
else ()
    set(CODEBASES ${MMDEPLOY_CODEBASES})
endif ()

foreach (codebase IN LISTS CODEBASES)
    message(STATUS "build codebase: ${codebase}")
    if (codebase STREQUAL "mmpretrain")
        set(subdir_name "mmcls")
    elseif (codebase STREQUAL "mmyolo")
        set(subdir_name "mmdet")
    elseif (codebase STREQUAL "mmagic")
        set(subdir_name "mmedit")
    else()
	    set(subdir_name ${codebase})
    endif()
    add_subdirectory(${subdir_name})
endforeach ()
