-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
50 lines (38 loc) · 1.62 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
cmake_minimum_required(VERSION 3.4...3.18)
project(pytlsd)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -std=c++17")
add_subdirectory(pybind11)
###################################### OpenCV ######################################
find_package(OpenCV QUIET)
message( STATUS " OpenCV_DIR: " ${OpenCV_DIR})
message( STATUS " OpenCV_INCLUDE_DIRS: " ${OpenCV_INCLUDE_DIRS})
message( STATUS " OpenCV_LIBS: " ${OpenCV_LIBS})
include_directories(${OpenCV_INCLUDE_DIRS})
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
set(OpenMP_LIBS OpenMP::OpenMP_CXX)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Declare the library containing the Line segment Detection (LSD) code
include_directories(src)
add_library(tlsd src/lsd.cpp)
# Create the python bindings
pybind11_add_module(pytlsd src/PYAPI.cpp)
# Add the dependency between the LSD code and the bindings
target_link_libraries(pytlsd PRIVATE tlsd ${OpenCV_LIBS} ${OpenMP_LIBS})
target_compile_definitions(pytlsd PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO})
enable_testing()
find_package(OpenCV QUIET)
if(${OpenCV_FOUND})
message( STATUS " OpenCV_DIR: " ${OpenCV_DIR})
message( STATUS " OpenCV_INCLUDE_DIRS: " ${OpenCV_INCLUDE_DIRS})
message( STATUS " OpenCV_LIBS: " ${OpenCV_LIBS})
add_executable(test_tlsd tests/test_tlsd.cpp)
target_include_directories(test_tlsd PRIVATE ${OpenCV_INCLUDE_DIRS})
target_link_libraries(test_tlsd PRIVATE tlsd ${OpenCV_LIBS})
add_test(test_tlsd test_tlsd)
else(${OpenCV_FOUND})
message( STATUS "OpenCV Not Found -- Tests disabled")
endif(${OpenCV_FOUND})