Skip to content

Commit

Permalink
linux build ok
Browse files Browse the repository at this point in the history
  • Loading branch information
gezhaoyou committed Feb 18, 2024
1 parent 14f5d1a commit 7626fb0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
12 changes: 9 additions & 3 deletions examples/app.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
19 changes: 18 additions & 1 deletion src/lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 7626fb0

Please sign in to comment.