Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance/cmake #260

Open
wants to merge 5 commits into
base: master
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
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
############################################################################

# Validate CMake version.
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW)
Expand All @@ -50,8 +50,8 @@ set(PROJECT_SHORT_NAME "DUNE")
set(PROJECT_VENDOR "Universidade do Porto - LSTS")
set(PROJECT_COPYRIGHT "Copyright (C) 2007-2024 - ${PROJECT_VENDOR}")
set(PROJECT_CONTACT "DUNE <dune@lsts.pt>")
set(PROJECT_VERSION_YEAR "2022")
set(PROJECT_VERSION_MONTH "04")
set(PROJECT_VERSION_YEAR "2024")
set(PROJECT_VERSION_MONTH "07")
set(PROJECT_VERSION_PATCH "0")
set(PROJECT_VERSION_RCN "0")

Expand Down
5 changes: 5 additions & 0 deletions cmake/Architecture.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ macro(dune_test_cpu cpu bits endianess macro header)

if(${output})
check_cxx_source_compiles("#if defined(__arch64__)\n#else\n#error not defined\n#endif\nint main(void) {return 0; }\n" __ARCH64__)
check_cxx_source_compiles("#if defined(__aarch64__)\n#else\n#error not defined\n#endif\nint main(void) {return 0; }\n" __AARCH64__)
if(__ARCH64__)
set(gbits 64)
endif(__ARCH64__)
if(__AARCH64__)
set(gbits 64)
endif(__AARCH64__)

set(DUNE_CPU 1)
set(DUNE_CPU_${ucpu} 1)
Expand Down Expand Up @@ -91,6 +95,7 @@ macro(dune_probe_cpu)
dune_test_cpu(ARMv4 32 unknown __ARM_ARCH_4T__ cstdio)
dune_test_cpu(ARMv5 32 unknown __ARM_ARCH_5T__ cstdio)
dune_test_cpu(ARMv7 32 unknown __ARM_ARCH_7A__ cstdio)
dune_test_cpu(ARMv8 64 little __aarch64__ cstdio)
dune_test_cpu(ARM 32 unknown __arm__ cstdio)
dune_test_cpu(SPARC 32 big __sparc__ cstdio)
dune_test_cpu(SPARCv9 64 big __sparcv9 cstdio)
Expand Down
4 changes: 2 additions & 2 deletions cmake/Libraries/Exiv2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

if(EXIV2)
find_library(EXIV2_LIBRARY NAMES exiv2 PATHS /usr/lib)

if(${EXIV2_LIBRARY} STRLESS "libexiv2.so")
if(${EXIV2_LIBRARY} MATCHES "libexiv2.so")
message(STATUS "Found Exiv2 library: ${EXIV2_LIBRARY}")
# Exiv2 Present
set(DUNE_SYS_HAS_EXIV2 1 CACHE INTERNAL "Exiv2 library")
set(DUNE_USING_EXIV2 1 CACHE INTERNAL "Exiv2 library")
Expand Down
15 changes: 3 additions & 12 deletions cmake/Libraries/JPEG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,11 @@
CHECK_LIBRARY_EXISTS(jpeg jpeg_set_defaults "" HAVE_LIB_JPEG)
dune_test_header_deps(jpeglib.h "sys/types.h;stdio.h")

check_cxx_source_compiles("
#include <stdio.h>
#include <jpeglib.h>
#if JPEG_LIB_VERSION < 80
# error JPEG too old
#endif
int main(void) {return 0;}"
HAVE_LIB_JPEG_80)

if(HAVE_LIB_JPEG AND HAVE_LIB_JPEG_80 AND DUNE_SYS_HAS_JPEGLIB_H)
if(HAVE_LIB_JPEG AND DUNE_SYS_HAS_JPEGLIB_H)
dune_add_lib(jpeg)
set(DUNE_SYS_HAS_JPEG 1 CACHE INTERNAL "JPEG library")
set(DUNE_USING_JPEG 1 CACHE INTERNAL "JPEG library")
else(HAVE_LIB_JPEG AND HAVE_LIB_JPEG_80 AND DUNE_SYS_HAS_JPEGLIB_H)
else(HAVE_LIB_JPEG AND DUNE_SYS_HAS_JPEGLIB_H)
set(DUNE_SYS_HAS_JPEG 0 CACHE INTERNAL "JPEG library")
set(DUNE_USING_JPEG 0 CACHE INTERNAL "JPEG library")
endif(HAVE_LIB_JPEG AND HAVE_LIB_JPEG_80 AND DUNE_SYS_HAS_JPEGLIB_H)
endif(HAVE_LIB_JPEG AND DUNE_SYS_HAS_JPEGLIB_H)
29 changes: 12 additions & 17 deletions cmake/Libraries/OpenCV.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
############################################################################

if(OPENCV)
CHECK_LIBRARY_EXISTS(opencv_core cvGetImage "" HAVE_LIB_OPENCV)
#find_package(OpenCV4 REQUIRED)
find_library(OPENCV_LIBRARY NAMES opencv_core PATHS /usr/lib)
if(${OPENCV_LIBRARY} MATCHES "libopencv_core.so")
# OPENCV Present
message(STATUS "Found Opencv library: ${OPENCV_LIBRARY}")
set(DUNE_SYS_HAS_OPENCV 1 CACHE INTERNAL "Opencv library")
set(DUNE_USING_OPENCV 1 CACHE INTERNAL "Opencv library")

if(HAVE_LIB_OPENCV)
# OpenCV Present
set(DUNE_SYS_HAS_OPENCV 1 CACHE INTERNAL "OpenCV library")
set(DUNE_USING_OPENCV 1 CACHE INTERNAL "OpenCV library")

# FIND_PACKAGE(OpenCV REQUIRED)
# FIND_PACKAGE(OpenCV REQUIRED)
dune_add_lib(opencv_calib3d)
dune_add_lib(opencv_core)
dune_add_lib(opencv_features2d)
Expand All @@ -54,19 +55,13 @@ if(OPENCV)
#dune_add_lib(opencv_contrib)
#dune_add_lib(opencv_gpu)
#dune_add_lib(opencv_legacy)
dune_add_lib(opencv_imgcodecs)

# Check Header
dune_test_header(opencv2/opencv.hpp)

dune_test_header(opencv2/imgcodecs.hpp)
if(DUNE_SYS_HAS_OPENCV2_IMGCODECS_HPP)
dune_add_lib(opencv_imgcodecs)
endif(DUNE_SYS_HAS_OPENCV2_IMGCODECS_HPP)

else(HAVE_LIB_OPENCV)
else()
# OpenCV not found on the system.
message(SEND_ERROR "OpenCV was not found on the system.")
set(DUNE_SYS_HAS_OPENCV 0 CACHE INTERNAL "OpenCV library")
set(DUNE_USING_OPENCV 0 CACHE INTERNAL "OpenCV library")
endif(HAVE_LIB_OPENCV)
endif()

endif(OPENCV)
19 changes: 7 additions & 12 deletions cmake/Libraries/PointGrey.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,21 @@
############################################################################

if(POINTGREY)
CHECK_LIBRARY_EXISTS(flycapture-c GetInternal "" HAVE_LIB_FLYCAPTURE)

if(HAVE_LIB_FLYCAPTURE)
# FlyCapture Present
find_library(POINTGREY_LIBRARY NAMES flycapture PATHS /usr/lib)
if(${POINTGREY_LIBRARY} MATCHES "libflycapture.so")
message(STATUS "Found Pointgrey library: ${POINTGREY_LIBRARY}")
# Flycapture Present
set(DUNE_SYS_HAS_FLYCAPTURE 1 CACHE INTERNAL "FlyCapture library")
set(DUNE_USING_FLYCAPTURE 1 CACHE INTERNAL "FlyCapture library")


dune_add_lib(flycapture)
dune_add_lib(flycapture-c)

# Check Header
dune_test_header(flycapture/FlyCapture2.h)
dune_test_header(flycapture/FlyCapture2_C.h)

else(HAVE_LIB_FLYCAPTURE)
# FlyCapture not found on the system.
else()
# FlyCapture not found on the system.
message(SEND_ERROR "FlyCapture was not found on the system.")
set(DUNE_SYS_HAS_FLYCAPTURE 0 CACHE INTERNAL "FlyCapture library")
set(DUNE_USING_FLYCAPTURE 0 CACHE INTERNAL "FlyCapture library")
endif(HAVE_LIB_FLYCAPTURE)
endif()

endif(POINTGREY)
Loading