-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (44 loc) · 2.64 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
47
48
49
50
51
52
53
54
55
project(Test_pybind11)
#**************************************************************************************************
# General cMake settings
#**************************************************************************************************
cmake_minimum_required(VERSION 3.5)
#**************************************************************************************************
# Find Package **************************************************************************************************
find_package(OpenCV REQUIRED)
MESSAGE( " *** OpenCV_INCLUDE_DIRS : " ${OpenCV_INCLUDE_DIRS} )
MESSAGE( " *** OpenCV_LIB_DIRS : " ${OpenCV_LIB_DIRS} )
MESSAGE( " *** OpenCV_LIBS : " ${OpenCV_LIBS} )
find_package(PythonLibs 3 REQUIRED)
MESSAGE( " *** PYTHON_INCLUDE_DIRS : " ${PYTHON_INCLUDE_DIRS} )
MESSAGE( " *** PYTHON_LIBRARIES : " ${PYTHON_LIBRARIES} )
#find_package(pybind11 CONFIG REQUIRED)
#**************************************************************************************************
# Include **************************************************************************************************
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS}/opencv4)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/pybind11/include)
#include_directories(${pybind11_INCLUDE_DIR})
#**************************************************************************************************
# Set variable **************************************************************************************************
SET(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/example.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ndarray_converter.cpp
)
#**************************************************************************************************
# Set compiler **************************************************************************************************
SET(CMAKE_CXX_FLAGS "-std=c++11 -Wall -O3 -fPIC")
#**************************************************************************************************
# Linker **************************************************************************************************
LINK_DIRECTORIES(
${OpenCV_LIB_DIR}
)
#**************************************************************************************************
# Make configuration
#**************************************************************************************************
add_library(example SHARED ${SOURCES})
target_link_libraries(example ${PYTHON_LIBRARIES} ${OpenCV_LIBS})
SET_TARGET_PROPERTIES(example PROPERTIES PREFIX "")
install(TARGETS example DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/example)