forked from wangzhaode/mnn-stable-diffusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
46 lines (40 loc) · 1.22 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
cmake_minimum_required(VERSION 3.0)
project(stable-diffusion-mnn)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
option(BUILD_FOR_ANDROID "Build for android." OFF)
# include dir
include_directories(${CMAKE_CURRENT_LIST_DIR}/include/)
# libs dir
link_directories(${CMAKE_CURRENT_LIST_DIR}/libs)
# source files
FILE(GLOB SRCS ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
if (BUILD_FOR_ANDROID)
add_library(MNN SHARED IMPORTED)
add_library(MNN_Express SHARED IMPORTED)
add_library(MNNOpenCV SHARED IMPORTED)
set_target_properties(
MNN
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/libs/libMNN.so
)
set_target_properties(
MNN_Express
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/libs/libMNN_Express.so
)
set_target_properties(
MNNOpenCV
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/libs/libMNNOpenCV.so
)
add_executable(main ${SRCS})
target_link_libraries(main MNN MNN_Express MNNOpenCV log)
else()
# target
add_executable(main ${SRCS})
if (MSVC)
target_link_libraries(main MNN)
else()
target_link_libraries(main MNN MNN_Express MNNOpenCV)
endif()
endif()