-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
26 lines (19 loc) · 1.08 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
# This CMakeLists is not needed when using C++. This is only for Python bindings.
cmake_minimum_required(VERSION 3.5)
project(tinycar_lib)
SET(CMAKE_CXX_FLAGS "-std=c++0x")
set(TINYCAR_DIR ./)
include_directories(${TINYCAR_DIR})
file(GLOB TINYCAR_SOURCES ${TINYCAR_DIR}/*.cpp)
set(PYBIND11_FINDPYTHON ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
find_package(OpenCV REQUIRED)
find_package(pybind11 REQUIRED)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.get_include())" OUTPUT_VARIABLE NUMPY_INCLUDE OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "NUMPY_INCLUDE: " ${NUMPY_INCLUDE})
message(STATUS "PYTHON_EXECUTABLE: " ${PYTHON_EXECUTABLE})
add_library(tinycar_lib STATIC ${TINYCAR_SOURCES})
target_link_libraries(tinycar_lib PRIVATE ${OpenCV_LIBS})
target_include_directories(tinycar_lib PUBLIC "${CMAKE_CURRENT_LIST_DIR}/" ${NUMPY_INCLUDE})
pybind11_add_module(tinycar MODULE ${CMAKE_CURRENT_LIST_DIR}/tinycar_python/tinycar_pybindings.cpp ${CMAKE_CURRENT_LIST_DIR}/tinycar_python/ndarray_converter.cpp)
target_link_libraries(tinycar PRIVATE tinycar_lib ${OpenCV_LIBS})