| 1 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 |
# you may not use this file except in compliance with the License. |
| 3 |
# You may obtain a copy of the License at |
| 4 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 5 |
# Unless required by applicable law or agreed to in writing, software |
| 6 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 7 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 8 |
# See the License for the specific language governing permissions and |
| 9 |
# limitations under the License. |
| 10 |
# |
| 11 |
# This module can find the MMAL camera libraries. |
| 12 |
# |
| 13 |
cmake_minimum_required(VERSION 3.0.0) |
| 14 |
|
| 15 |
set (MMAL_LIBS mmal_core mmal_util mmal_vc_client) |
| 16 |
set (EGL_LIBS brcmGLESv2 brcmEGL) |
| 17 |
|
| 18 |
foreach(lib ${MMAL_LIBS} ${EGL_LIBS} vcos bcm_host m dl) |
| 19 |
find_library(${lib}_LIBRARY |
| 20 |
NAMES ${lib} |
| 21 |
HINTS ${MMAL_DIR}/lib /opt/vc/lib |
| 22 |
) |
| 23 |
if (DEFINED ${lib}_LIBRARY) |
| 24 |
set(MMAL_LIBRARIES ${MMAL_LIBRARIES} ${${lib}_LIBRARY}) |
| 25 |
else() |
| 26 |
message(FATAL_ERROR "Failed to find ${${lib}_LIBRARY} library") |
| 27 |
endif() |
| 28 |
endforeach(lib) |
| 29 |
|
| 30 |
find_path(BCM_INCLUDE_DIR NAMES bcm_host.h |
| 31 |
HINTS "/opt/vc/include" |
| 32 |
) |
| 33 |
|
| 34 |
find_path(MMAL_BASE_INCLUDE_DIR NAMES mmal.h |
| 35 |
HINTS "/opt/vc/include/interface/mmal" |
| 36 |
) |
| 37 |
|
| 38 |
find_path(MMAL_UTIL_INCLUDE_DIR NAMES mmal_util.h |
| 39 |
HINTS "/opt/vc/include/interface/mmal/util" |
| 40 |
) |
| 41 |
|
| 42 |
if (MMAL_BASE_INCLUDE_DIR AND BCM_INCLUDE_DIR AND MMAL_UTIL_INCLUDE_DIR) |
| 43 |
set(MMAL_INCLUDE_DIR ${MMAL_BASE_INCLUDE_DIR} ${BCM_INCLUDE_DIR} ${MMAL_UTIL_INCLUDE_DIR}) |
| 44 |
set(MMAL_FOUND TRUE) |
| 45 |
endif() |