safesight-edge/samples/mpp_decode_demo/CMakeLists.txt
2025-12-09 11:13:16 +08:00

59 lines
1.9 KiB
CMake

if(NOT ENABLE_RK_DEMOS)
add_executable(mpp_decode_demo
main.cpp)
target_link_libraries(mpp_decode_demo PRIVATE project_options)
else()
set(MPP_SRC_ROOT ${RK_MPP_ROOT})
set(MPP_TEST_SOURCE ${MPP_SRC_ROOT}/test/mpi_dec_test.c)
set(MPP_UTIL_SOURCE
${MPP_SRC_ROOT}/utils/mpi_dec_utils.c
${MPP_SRC_ROOT}/utils/utils.c
${MPP_SRC_ROOT}/utils/mpp_opt.c
${MPP_SRC_ROOT}/utils/dictionary.c
${MPP_SRC_ROOT}/utils/iniparser.c)
set(MPP_BASE_SOURCE
${MPP_SRC_ROOT}/mpp/base/mpp_trie.c)
if(NOT EXISTS ${MPP_TEST_SOURCE})
message(FATAL_ERROR "mpi_dec_test.c not found at ${MPP_TEST_SOURCE}. Verify RK_MPP_ROOT")
endif()
foreach(src ${MPP_UTIL_SOURCE})
if(NOT EXISTS ${src})
message(FATAL_ERROR "MPP util source not found at ${src}. Verify RK_MPP_ROOT")
endif()
endforeach()
if(NOT RK_MPP_LIB_PATH)
message(FATAL_ERROR "Set RK_MPP_LIB_PATH to the built librockchip_mpp.so for RK3588")
endif()
if(NOT EXISTS ${RK_MPP_LIB_PATH})
message(FATAL_ERROR "RK_MPP_LIB_PATH=${RK_MPP_LIB_PATH} does not exist")
endif()
add_executable(mpp_decode_demo
${MPP_TEST_SOURCE}
${MPP_UTIL_SOURCE}
${MPP_BASE_SOURCE})
target_include_directories(mpp_decode_demo PRIVATE
${MPP_SRC_ROOT}/inc
${MPP_SRC_ROOT}/mpp
${MPP_SRC_ROOT}/osal/inc
${MPP_SRC_ROOT}/osal
${MPP_SRC_ROOT}/test
${MPP_SRC_ROOT}/utils)
target_link_libraries(mpp_decode_demo PRIVATE project_options
${RK_MPP_LIB_PATH}
pthread
dl
m)
set_target_properties(mpp_decode_demo PROPERTIES LINKER_LANGUAGE C)
endif()
install(TARGETS mpp_decode_demo RUNTIME DESTINATION bin)
if(ENABLE_RK_DEMOS AND EXISTS ${RK_MPP_LIB_PATH})
install(FILES ${RK_MPP_LIB_PATH} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()