Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Fix cmake #39

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 33 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,30 +164,41 @@ find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
link_directories(${CURL_LIBRARY_DIRS})

# set(Python_ADDITIONAL_VERSIONS 3.6 3.5 3.4)

find_package(PythonInterp)
find_package(PythonLibs)

if (PYTHON_PLUGIN)
if (NOT ${PYTHON_VERISON_MAJOR} EQUAL ${OpenCV_VERSION_MAJOR})
message(WARNING "Python version " ${PYTHON_VERSION_MAJOR} " incompatible with OpenCV version " ${OpenCV_VERSION_MAJOR})
endif ()
endif (PYTHON_PLUGIN)
if (${CMAKE_VERSION} VERSION_LESS "3.14.7")
find_package(PythonInterp 3.0)
find_package(PythonLibs 3.0)
if (PYTHONLIBS_FOUND)
if (${PYTHONLIBS_VERSION_STRING} VERSION_LESS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0")
message(WARNING "Python library version found does not match python interpreter version. Specify PYTHON_LIBRARY and PYTHON_INCLUDE_DIR manually.")
endif()
set(Python3_LIBRARIES ${PYTHON_LIBRARIES})
find_package(NumPy)
if(NUMPY_FOUND)
set(Python3_NumPy_FOUND TRUE)
set(Python3_NumPy_INCLUDE_DIRS ${NUMPY_INCLUDE_DIRS})
set(Python3_NumPy_VERSION ${NUMPY_VERSION})
set(Python3_FOUND TRUE)
endif(NUMPY_FOUND)
else()
unset(PYTHON_LIBRARIES)
endif (PYTHONLIBS_FOUND)
set(Python3_Interpreter_FOUND ${PYTHONINTERP_FOUND})
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
set(Python3_VERSION ${PYTHON_VERSION_STRING})
set(Python3_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
set(Python3_LIBRARY_DIRS ${PYTHON_LIBRARY_DIRS} ${NUMPY_LIBRARY_DIRS})
set(Python3_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
set(Python3_Development_FOUND ${PYTHONLIBS_FOUND})
set(Python3_NumPy_INCLUDE_DIRS ${NUMPY_INCLUDE_DIRS})
else()
find_package(Python3 COMPONENTS Interpreter Development NumPy)
endif()

if (PYTHONLIBS_FOUND)
find_package(NumPy)
if(NUMPY_FOUND)
set(PYTHON_FOUND true)
if (Python3_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPYTHON_FOUND")
include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS})
link_directories(${PYTHON_LIBRARY_DIRS})
include_directories(SYSTEM ${NUMPY_INCLUDE_DIRS})
link_directories(${NUMPY_LIBRARY_DIRS})
endif(NUMPY_FOUND)
else()
unset(PYTHON_LIBRARIES)
endif (PYTHONLIBS_FOUND)
include_directories(SYSTEM ${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS})
link_directories(${Python3_LIBRARY_DIRS})
endif (Python3_FOUND)

if (ENABLE_AEON_SERVICE)
# Check for C++ REST SDK from Microsoft
Expand Down
4 changes: 2 additions & 2 deletions cmake/Modules/FindNumPy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ unset(NUMPY_INCLUDE_DIRS)

if(NOT PYTHON_EXECUTABLE)
if(NumPy_FIND_QUIETLY)
find_package(PythonInterp QUIET)
find_package(PythonInterp 3.0 QUIET)
else()
find_package(PythonInterp)
find_package(PythonInterp 3.0)
endif()
endif()

Expand Down
4 changes: 2 additions & 2 deletions cmake/Modules/FindSphinx.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
# Copyright 2017-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@ if (SPHINX_EXECUTABLE)
RESULT_VARIABLE __sphinx_result OUTPUT_VARIABLE __sphinx_output ERROR_VARIABLE __sphinx_error
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
if (__sphinx_result MATCHES 0)
string(REGEX MATCH ".* ([0-9]+)\\.([0-9]+)\\.([0-9]+)" __sphinx_version_check "${__sphinx_error}")
string(REGEX MATCH ".* ([0-9]+)\\.([0-9]+)\\.([0-9]+)" __sphinx_version_check "${__sphinx_output}")
set(SPHINX_VERSION ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3})
else()
set(__sphinx_output "${__sphinx_error}")
Expand Down
13 changes: 9 additions & 4 deletions cmake/summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function(print_configuration_summary)
else()
report_status(" AEON Service : No")
endif()
report_status(" AEON Python Interface : " PYTHONLIBS_FOUND AND NUMPY_FOUND THEN "Yes" ELSE "No (Python not found, see details below)")
report_status(" AEON Python Interface : " Python3_FOUND THEN "Yes" ELSE "No (Python not found, see details below)")
report_status(" AEON Python Plugin : " PYTHON_PLUGIN THEN "Yes" ELSE "No")
if (ENABLE_AEON_SERVICE)
report_status("")
Expand All @@ -91,9 +91,14 @@ function(print_configuration_summary)
report_status(" OpenSSL : " OPENSSL_FOUND THEN "Yes (ver. ${OPENSSL_VERSION})" ELSE "Not Found")
report_status("")
report_status(" Python:")
report_status(" Interpreter : " PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTABLE} (ver. ${PYTHON_VERSION_STRING})" ELSE "No")
report_status(" Libraries : " PYTHONLIBS_FOUND THEN "${PYTHON_LIBRARIES} (ver. ${PYTHONLIBS_VERSION_STRING})" ELSE "No")
report_status(" NumPy : " NUMPY_FOUND THEN "${NUMPY_INCLUDE_DIRS} (ver. ${NUMPY_VERSION})" ELSE "No")
if (PYTHONLIBS_VERSION_STRING)
set(APPEND_VER_IF_PRESENT " (ver. ${PYTHONLIBS_VERSION_STRING})")
else()
unset(APPEND_VER_IF_PRESENT)
endif()
report_status(" Interpreter : " Python3_Interpreter_FOUND THEN "${Python3_EXECUTABLE} (ver. ${Python3_VERSION})" ELSE "No")
report_status(" Libraries : " Python3_Development_FOUND THEN "${Python3_LIBRARIES}${APPEND_VER_IF_PRESENT}" ELSE "No")
report_status(" NumPy : " Python3_NumPy_FOUND THEN "${Python3_NUMPY_INCLUDE_DIRS} (ver. ${Python3_NumPy_VERSION})" ELSE "No")
report_status("")
report_status(" Documentation:")
report_status(" Doxygen : " DOXYGEN_FOUND THEN "${DOXYGEN_EXECUTABLE} (ver. ${DOXYGEN_VERSION})" ELSE "No")
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp_iterator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ file(COPY ${TEST_DATA_DIR}/flowers.jpg DESTINATION .)
file(COPY ${TEST_DATA_DIR}/img_2112_70.jpg DESTINATION .)

add_executable(iterator ${SRC})
target_link_libraries(iterator aeon pthread ${CURL_LIBRARIES} opencv_imgproc opencv_highgui opencv_core ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(iterator aeon pthread ${CURL_LIBRARIES} opencv_imgproc opencv_highgui opencv_core ${Python3_LIBRARIES} ${Boost_LIBRARIES})
add_dependencies(iterator aeon)
2 changes: 1 addition & 1 deletion examples/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ file(COPY ${TEST_DATA_DIR}/flowers.jpg DESTINATION .)
file(COPY ${TEST_DATA_DIR}/img_2112_70.jpg DESTINATION .)

add_executable(plugin_iterator ${SRC})
target_link_libraries(plugin_iterator aeon pthread ${CURL_LIBRARIES} opencv_imgproc opencv_highgui opencv_core ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(plugin_iterator aeon pthread ${CURL_LIBRARIES} opencv_imgproc opencv_highgui opencv_core ${Python3_LIBRARIES} ${Boost_LIBRARIES})
add_dependencies(plugin_iterator aeon)
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ endif()
set(AEON_HEADER_FILES
version.hpp)

if (PYTHON_FOUND)
if (Python3_FOUND)
list(APPEND SRC api.cpp)
endif(PYTHON_FOUND)
endif(Python3_FOUND)

if (PYTHON_PLUGIN)
list(APPEND SRC python_plugin.cpp
Expand All @@ -96,7 +96,7 @@ add_library(aeon SHARED ${SRC} ${AEON_HEADER_FILES})

install(TARGETS aeon DESTINATION lib)

set(AEON_LIBRARIES ${CURL_LIBRARIES} ${OpenCV_LIBRARIES} ${PYTHON_LIBRARIES})
set(AEON_LIBRARIES ${CURL_LIBRARIES} ${OpenCV_LIBRARIES} ${Python3_LIBRARIES})
if (ENABLE_OPENFABRICS_CONNECTOR)
list(APPEND AEON_LIBRARIES ${OPENFABRICS_LIBRARIES})
endif()
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ set (SRC
)

set(TESTSUITE_LIBRARIES aeon gtest gmock
${LCOVERAGE} ${OpenCV_LIBRARIES} ${PYTHON_LIBRARIES}
${LCOVERAGE} ${OpenCV_LIBRARIES} ${Python3_LIBRARIES}
${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})

if (ENABLE_AEON_SERVICE)
Expand Down