Skip to content

Commit

Permalink
[onert] Change core install path (#13472)
Browse files Browse the repository at this point in the history
This commit changes core library install path: lib -> lib/nnfw.
Only API libraries are installed to lib.

ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
  • Loading branch information
hseok-oh authored Sep 4, 2024
1 parent c66e299 commit 949661a
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 15 deletions.
4 changes: 3 additions & 1 deletion compute/ARMComputeEx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ target_compile_definitions(arm_compute_ex PRIVATE EMBEDDED_KERNELS
add_library(ignore_unused_warning INTERFACE)
target_compile_options(ignore_unused_warning INTERFACE -Wno-unused-parameter -Wno-unused-function)
target_link_libraries(arm_compute_ex PRIVATE $<$<NOT:$<CONFIG:Debug>>:ignore_unused_warning>)
install(TARGETS arm_compute_ex DESTINATION lib)
# Install arm_compute_ex with acl backend
install(TARGETS arm_compute_ex DESTINATION lib/nnfw/backend)
set_target_properties(arm_compute_ex PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/..:$ORIGIN/../..")
1 change: 1 addition & 0 deletions infra/debian/runtime/onert.install
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# {FILES_TO_INSTALL} {DEST_DIR}
# lib
usr/lib/*.so usr/lib/
usr/lib/nnfw/*.so usr/lib/nnfw
usr/lib/nnfw/backend/*.so usr/lib/nnfw/backend/
# tvn loader debian build is not supported yet
#usr/lib/nnfw/loader/*.so usr/lib/nnfw/loader/
2 changes: 2 additions & 0 deletions packaging/nnfw.spec
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ mkdir -p %{buildroot}%{_libdir}/nnfw/loader
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_includedir}
install -m 644 build/out/lib/*.so %{buildroot}%{_libdir}
install -m 644 build/out/lib/nnfw/*.so %{buildroot}%{_libdir}/nnfw/
install -m 644 build/out/lib/nnfw/backend/*.so %{buildroot}%{_libdir}/nnfw/backend
install -m 644 build/out/lib/nnfw/loader/*.so %{buildroot}%{_libdir}/nnfw/loader
install -m 755 build/out/bin/onert-minimal-app %{buildroot}%{_bindir}
Expand Down Expand Up @@ -294,6 +295,7 @@ install -m 644 build/out/lib/nnfw/odc/*.so %{buildroot}%{_libdir}/nnfw/odc
%defattr(-,root,root,-)
%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64
%{_libdir}/*.so
%{_libdir}/nnfw/*.so
%{_libdir}/nnfw/backend/*.so
%{_libdir}/nnfw/loader/*.so
%exclude %{_includedir}/CL/*
Expand Down
4 changes: 4 additions & 0 deletions runtime/onert/api/nnapi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ target_link_libraries(${LIB_ONERT} PRIVATE nnfw_common)
target_link_libraries(${LIB_ONERT} PRIVATE nnfw_coverage)

set_target_properties(${LIB_ONERT} PROPERTIES OUTPUT_NAME neuralnetworks)
set_target_properties(${LIB_ONERT} PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/nnfw")

install(TARGETS ${LIB_ONERT} DESTINATION lib)

Expand All @@ -23,5 +24,8 @@ add_executable(test_onert_frontend_nnapi ${TESTS_FRONTEND})
target_link_libraries(test_onert_frontend_nnapi PRIVATE ${LIB_ONERT} dl)
target_link_libraries(test_onert_frontend_nnapi PRIVATE gtest)
target_link_libraries(test_onert_frontend_nnapi PRIVATE gtest_main)
# INSTALL_RPATH is for onert_core public link
# TODO Remove INSTALL_RPATH
set_target_properties(test_onert_frontend_nnapi PROPERTIES INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/../lib/nnfw")

install(TARGETS test_onert_frontend_nnapi DESTINATION unittest)
4 changes: 3 additions & 1 deletion runtime/onert/api/nnfw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ if (ANDROID)
endif (ANDROID)

target_include_directories(${ONERT_DEV} PUBLIC include)
set_target_properties(${ONERT_DEV} PROPERTIES PUBLIC_HEADER "${NNFW_API_HEADERS}")
set_target_properties(${ONERT_DEV} PROPERTIES
PUBLIC_HEADER "${NNFW_API_HEADERS}"
INSTALL_RPATH "$ORIGIN:$ORIGIN/nnfw")

install(TARGETS ${ONERT_DEV}
LIBRARY DESTINATION lib
Expand Down
3 changes: 2 additions & 1 deletion runtime/onert/backend/acl_cl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ target_link_libraries(${LIB_ONERT_BACKEND_ACL_CL} PRIVATE ${LIB_ONERT_BACKEND_AC
target_link_libraries(${LIB_ONERT_BACKEND_ACL_CL} PRIVATE nnfw_common)
target_link_libraries(${LIB_ONERT_BACKEND_ACL_CL} PRIVATE nnfw_coverage)

# Set install rpath to find onert_core and acl library
set_target_properties(${LIB_ONERT_BACKEND_ACL_CL} PROPERTIES
OUTPUT_NAME backend_acl_cl
INSTALL_RPATH "$ORIGIN:$ORIGIN/../..")
INSTALL_RPATH "$ORIGIN:$ORIGIN/..:$ORIGIN/../..")

install(TARGETS ${LIB_ONERT_BACKEND_ACL_CL} DESTINATION lib/nnfw/backend)
3 changes: 2 additions & 1 deletion runtime/onert/backend/acl_neon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ target_link_libraries(${LIB_ONERT_BACKEND_ACL_NEON} PRIVATE ${LIB_ONERT_BACKEND_
target_link_libraries(${LIB_ONERT_BACKEND_ACL_NEON} PRIVATE nnfw_common)
target_link_libraries(${LIB_ONERT_BACKEND_ACL_NEON} PRIVATE nnfw_coverage)

# Set install rpath to find onert_core and acl library
set_target_properties(${LIB_ONERT_BACKEND_ACL_NEON} PROPERTIES
OUTPUT_NAME backend_acl_neon
INSTALL_RPATH "$ORIGIN:$ORIGIN/../..")
INSTALL_RPATH "$ORIGIN:$ORIGIN/..:$ORIGIN/../..")

install(TARGETS ${LIB_ONERT_BACKEND_ACL_NEON} DESTINATION lib/nnfw/backend)
2 changes: 1 addition & 1 deletion runtime/onert/backend/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ target_link_libraries(${LIB_ONERT_BACKEND_CPU} PRIVATE ndarray)
set_target_properties(${LIB_ONERT_BACKEND_CPU} PROPERTIES
OUTPUT_NAME backend_cpu
POSITION_INDEPENDENT_CODE ON
INSTALL_RPATH "$ORIGIN:$ORIGIN/../..")
INSTALL_RPATH "$ORIGIN:$ORIGIN/..")

install(TARGETS ${LIB_ONERT_BACKEND_CPU} DESTINATION lib/nnfw/backend)
2 changes: 1 addition & 1 deletion runtime/onert/backend/ruy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ target_link_libraries(${LIB_ONERT_BACKEND_RUY} PRIVATE ruy)

set_target_properties(${LIB_ONERT_BACKEND_RUY} PROPERTIES
OUTPUT_NAME backend_ruy
INSTALL_RPATH "$ORIGIN:$ORIGIN/../..")
INSTALL_RPATH "$ORIGIN:$ORIGIN/..")

install(TARGETS ${LIB_ONERT_BACKEND_RUY} DESTINATION lib/nnfw/backend)
4 changes: 2 additions & 2 deletions runtime/onert/backend/train/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ target_link_libraries(${LIB_ONERT_BACKEND_TRAIN} PRIVATE nnfw_coverage)

set_target_properties(${LIB_ONERT_BACKEND_TRAIN} PROPERTIES
OUTPUT_NAME backend_train
INSTALL_RPATH "$ORIGIN:$ORIGIN/../..")
INSTALL_RPATH "$ORIGIN:$ORIGIN/..")

install(TARGETS ${LIB_ONERT_BACKEND_TRAIN} DESTINATION lib/nnfw/backend)

Expand All @@ -35,7 +35,7 @@ target_link_libraries(${TEST_ONERT_TRAIN_BACKEND} gtest gtest_main dl ${LIB_PTHR

# Set install rpath to find onert_core, onert_backend_train, etc
set_target_properties(${TEST_ONERT_TRAIN_BACKEND} PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../lib:$ORIGIN/../lib/nnfw/backend")
INSTALL_RPATH "$ORIGIN/../lib/nnfw:$ORIGIN/../lib/nnfw/backend")

add_test(${TEST_ONERT_TRAIN_BACKEND} ${TEST_ONERT_TRAIN_BACKEND})
install(TARGETS ${TEST_ONERT_TRAIN_BACKEND} DESTINATION unittest)
2 changes: 1 addition & 1 deletion runtime/onert/backend/trix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ target_link_libraries(${LIB_ONERT_BACKEND_TRIX} PRIVATE nnfw_coverage)

set_target_properties(${LIB_ONERT_BACKEND_TRIX} PROPERTIES
OUTPUT_NAME backend_trix
INSTALL_RPATH "$ORIGIN:$ORIGIN/../..")
INSTALL_RPATH "$ORIGIN:$ORIGIN/..")

install(TARGETS ${LIB_ONERT_BACKEND_TRIX} DESTINATION lib/nnfw/backend)
2 changes: 1 addition & 1 deletion runtime/onert/backend/xnnpack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ target_link_libraries(${LIB_ONERT_BACKEND_XNNPACK} PRIVATE XNNPACK)

set_target_properties(${LIB_ONERT_BACKEND_XNNPACK} PROPERTIES
OUTPUT_NAME backend_xnnpack
INSTALL_RPATH "$ORIGIN:$ORIGIN/../..")
INSTALL_RPATH "$ORIGIN:$ORIGIN/..")

install(TARGETS ${LIB_ONERT_BACKEND_XNNPACK} DESTINATION lib/nnfw/backend)
6 changes: 4 additions & 2 deletions runtime/onert/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ if(ENVVAR_ONERT_CONFIG)
target_compile_definitions(onert_core PRIVATE ENVVAR_FOR_DEFAULT_CONFIG)
endif(ENVVAR_ONERT_CONFIG)

install(TARGETS onert_core LIBRARY DESTINATION lib)
install(TARGETS onert_core LIBRARY DESTINATION lib/nnfw)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
DESTINATION "include/onert"
FILES_MATCHING PATTERN "*.h" PATTERN "*.lst"
)
# Set install rpath to find plugins - odc, codegen, etc
set_target_properties(onert_core PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/nnfw/odc:$ORIGIN/nnfw/codegen:$ORIGIN/nnfw/backend:$ORIGIN/nnfw/loader")
INSTALL_RPATH "$ORIGIN:$ORIGIN/odc:$ORIGIN/codegen:$ORIGIN/backend:$ORIGIN/loader")

if(NOT ENABLE_TEST)
return()
Expand All @@ -61,4 +61,6 @@ target_link_libraries(${TEST_ONERT_CORE} nnfw_coverage)
target_link_libraries(${TEST_ONERT_CORE} gtest gtest_main dl ${LIB_PTHREAD})

add_test(${TEST_ONERT_CORE} ${TEST_ONERT_CORE})
set_target_properties(${TEST_ONERT_CORE} PROPERTIES
INSTALL_RPATH "$ORIGIN/../lib/nnfw")
install(TARGETS ${TEST_ONERT_CORE} DESTINATION unittest)
2 changes: 1 addition & 1 deletion runtime/onert/loader/trix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif(TRIXEngine_FOUND)
add_library(tvn_loader SHARED ${SOURCES})
set_target_properties(tvn_loader PROPERTIES
POSITION_INDEPENDENT_CODE ON
INSTALL_RPATH "$ORIGIN:$ORIGIN/../..")
INSTALL_RPATH "$ORIGIN:$ORIGIN/..")
target_link_libraries(tvn_loader PRIVATE onert_core)
target_link_libraries(tvn_loader PRIVATE nnfw_common nnfw_coverage)
target_link_libraries(tvn_loader PRIVATE trix_engine)
Expand Down
4 changes: 2 additions & 2 deletions runtime/onert/odc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ target_link_libraries(onert_odc PRIVATE nnfw_common)
target_link_libraries(onert_odc PRIVATE nnfw_coverage)

install(TARGETS onert_odc LIBRARY DESTINATION lib/nnfw/odc)
set_target_properties(onert_odc PROPERTIES INSTALL_RPATH "$ORIGIN/../../:$ORIGIN/")
set_target_properties(onert_odc PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/..")

if(NOT ENABLE_TEST)
return()
Expand All @@ -33,4 +33,4 @@ target_include_directories(${TEST_ONERT_ODC} PRIVATE $<TARGET_PROPERTY:onert_odc

add_test(${TEST_ONERT_ODC} ${TEST_ONERT_ODC})
install(TARGETS ${TEST_ONERT_ODC} DESTINATION unittest)
set_target_properties(${TEST_ONERT_ODC} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib/nnfw/odc:$ORIGIN/../lib/")
set_target_properties(${TEST_ONERT_ODC} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib/nnfw/odc")

0 comments on commit 949661a

Please sign in to comment.