From 7626fb0f7f96c766fdc5acfb1eeb8d7db9188416 Mon Sep 17 00:00:00 2001 From: gezhaoyou Date: Sun, 18 Feb 2024 09:46:25 +0800 Subject: [PATCH] linux build ok --- examples/app.cmake | 12 +++++++++--- src/lib.cmake | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/examples/app.cmake b/examples/app.cmake index 781a0f25..a50d250d 100644 --- a/examples/app.cmake +++ b/examples/app.cmake @@ -81,11 +81,19 @@ IF(${CURRENT_OS} STREQUAL "linux") gpupixel GL glfw) + + FIlE(GLOB VNN_LIBS + ${CMAKE_CURRENT_SOURCE_DIR}/../src/third_party/vnn/libs/${CURRENT_OS}/* + ) ELSEIF(${CURRENT_OS} STREQUAL "windows") TARGET_LINK_LIBRARIES(${PROJECT_NAME} gpupixel opengl32 glfw3) + + FIlE(GLOB VNN_LIBS + ${CMAKE_CURRENT_SOURCE_DIR}/../src/third_party/vnn/libs/${CURRENT_OS}/x64/* + ) ENDIF() # copy resource file @@ -95,9 +103,7 @@ FILE(GLOB RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../src/resources/*" "${CMAKE_CURRENT_SOURCE_DIR}/../src/third_party/vnn/models/vnn_face278_data/face_pc[1.0.0].vnnmodel" ) -FIlE(GLOB VNN_LIBS - ${CMAKE_CURRENT_SOURCE_DIR}/../src/third_party/vnn/libs/${CURRENT_OS}/x64/* -) + MACRO(EXPORT_INCLUDE) ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} PRE_BUILD diff --git a/src/lib.cmake b/src/lib.cmake index 68189382..174cf57a 100644 --- a/src/lib.cmake +++ b/src/lib.cmake @@ -127,7 +127,21 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${RESOURCE_FILES}) # set platform project IF(${CURRENT_OS} STREQUAL "linux") + # 设置要构建的目标库的名称和类型 + add_library(vnn_kit SHARED IMPORTED) + # 设置目标库的实际路径 + set_target_properties(vnn_kit PROPERTIES IMPORTED_LOCATION + ${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/libs/${CURRENT_OS}/libvnn_kit.so) + + add_library(vnn_core SHARED IMPORTED) + # 设置目标库的实际路径 + set_target_properties(vnn_core PROPERTIES IMPORTED_LOCATION + ${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/libs/${CURRENT_OS}/libvnn_core.so) + add_library(vnn_face SHARED IMPORTED) + # 设置目标库的实际路径 + set_target_properties(vnn_face PROPERTIES IMPORTED_LOCATION + ${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/libs/${CURRENT_OS}/libvnn_face.so) ELSEIF(${CURRENT_OS} STREQUAL "windows") # 设置要构建的目标库的名称和类型 add_library(vnn_kit SHARED IMPORTED) @@ -193,7 +207,10 @@ IF(${CURRENT_OS} STREQUAL "linux" OR ${CURRENT_OS} STREQUAL "wasm") TARGET_LINK_LIBRARIES( ${PROJECT_NAME} GL - glfw) + glfw + vnn_core + vnn_kit + vnn_face) ELSEIF(${CURRENT_OS} STREQUAL "windows") TARGET_LINK_LIBRARIES( ${PROJECT_NAME}