Skip to content

Commit

Permalink
CMake: remove lib prefix from v4l and vidstab variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Karry committed Dec 18, 2020
1 parent 2ba0d67 commit 90deeb6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 52 deletions.
38 changes: 19 additions & 19 deletions CMakeMod/FindV4L.cmake
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# - Try to find LibV4L
# Once done this will define
# LIBV4L_FOUND - System has LibV4L
# LIBV4L_INCLUDE_DIRS - The LibV4L include directories
# LIBV4LCONVERT_LIBRARY
# LIBV4L_LIBRARIES - The libraries needed to use LibV4L
# LIBV4L_DEFINITIONS - Compiler switches required for using LibV4L
# V4L_FOUND - System has LibV4L
# V4L_INCLUDE_DIRS - The LibV4L include directories
# V4LCONVERT_LIBRARY
# V4L_LIBRARIES - The libraries needed to use LibV4L
# V4L_DEFINITIONS - Compiler switches required for using LibV4L

find_package(PkgConfig)
pkg_check_modules(PC_LIBV4L QUIET libv4l)
set(LIBV4L_DEFINITIONS ${PC_LIBV4L_CFLAGS_OTHER})
pkg_check_modules(PC_V4L QUIET libv4l)
set(V4L_DEFINITIONS ${PC_V4L_CFLAGS_OTHER})

find_path(LIBV4L_INCLUDE_DIR libv4l2.h libv4lconvert.h
HINTS ${PC_LIBV4L_INCLUDEDIR} ${PC_LIBV4L_INCLUDE_DIRS}
find_path(V4L_INCLUDE_DIR libv4l2.h libv4lconvert.h
HINTS ${PC_V4L_INCLUDEDIR} ${PC_V4L_INCLUDE_DIRS}
PATH_SUFFIXES libv4l )

find_library(LIBV4L_LIBRARY NAMES v4l2
HINTS ${PC_LIBV4L_LIBDIR} ${PC_LIBV4L_LIBRARY_DIRS} )
find_library(LIBV4LCONVERT_LIBRARY NAMES v4lconvert
HINTS ${PC_LIBV4L_LIBDIR} ${PC_LIBV4L_LIBRARY_DIRS} )
find_library(V4L_LIBRARY NAMES v4l2
HINTS ${PC_V4L_LIBDIR} ${PC_V4L_LIBRARY_DIRS} )
find_library(V4LCONVERT_LIBRARY NAMES v4lconvert
HINTS ${PC_V4L_LIBDIR} ${PC_V4L_LIBRARY_DIRS} )

set(LIBV4L_LIBRARIES ${LIBV4L_LIBRARY} ${LIBV4LCONVERT_LIBRARY})
set(LIBV4L_INCLUDE_DIRS ${LIBV4L_INCLUDE_DIR} )
set(V4L_LIBRARIES ${V4L_LIBRARY} ${V4LCONVERT_LIBRARY})
set(V4L_INCLUDE_DIRS ${V4L_INCLUDE_DIR} )

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBV4L_FOUND to TRUE
# handle the QUIETLY and REQUIRED arguments and set V4L_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibV4L DEFAULT_MSG
LIBV4L_LIBRARY LIBV4LCONVERT_LIBRARY LIBV4L_INCLUDE_DIR)
find_package_handle_standard_args(V4L DEFAULT_MSG
V4L_LIBRARY V4LCONVERT_LIBRARY V4L_INCLUDE_DIR)

mark_as_advanced(LIBV4L_INCLUDE_DIR LIBV4L_LIBRARY )
mark_as_advanced(V4L_INCLUDE_DIR V4L_LIBRARY )
32 changes: 16 additions & 16 deletions CMakeMod/FindVidStab.cmake
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# - Try to find LibVidStab
# Once done this will define
# LIBVIDSTAB_FOUND - System has LibVidStab
# LIBVIDSTAB_INCLUDE_DIRS - The LibVidStab include directories
# LIBVIDSTAB_LIBRARIES - The libraries needed to use LibVidStab
# LIBVIDSTAB_DEFINITIONS - Compiler switches required for using LibVidStab
# VIDSTAB_FOUND - System has LibVidStab
# VIDSTAB_INCLUDE_DIRS - The LibVidStab include directories
# VIDSTAB_LIBRARIES - The libraries needed to use LibVidStab
# VIDSTAB_DEFINITIONS - Compiler switches required for using LibVidStab

find_package(PkgConfig)
pkg_check_modules(PC_LIBVIDSTAB QUIET libvidstab)
set(LIBVIDSTAB_DEFINITIONS ${PC_LIBVIDSTAB_CFLAGS_OTHER})
pkg_check_modules(PC_VIDSTAB QUIET libvidstab)
set(VIDSTAB_DEFINITIONS ${PC_VIDSTAB_CFLAGS_OTHER})

find_path(LIBVIDSTAB_INCLUDE_DIR vid.stab/libvidstab.h
HINTS ${PC_LIBVIDSTAB_INCLUDEDIR} ${PC_LIBVIDSTAB_INCLUDE_DIRS}
find_path(VIDSTAB_INCLUDE_DIR vid.stab/libvidstab.h
HINTS ${PC_VIDSTAB_INCLUDEDIR} ${PC_VIDSTAB_INCLUDE_DIRS}
PATH_SUFFIXES libvidstab )

find_library(LIBVIDSTAB_LIBRARY NAMES vidstab libvidstab
HINTS ${PC_LIBVIDSTAB_LIBDIR} ${PC_LIBVIDSTAB_LIBRARY_DIRS} )
find_library(VIDSTAB_LIBRARY NAMES vidstab libvidstab
HINTS ${PC_VIDSTAB_LIBDIR} ${PC_VIDSTAB_LIBRARY_DIRS} )

set(LIBVIDSTAB_LIBRARIES ${LIBVIDSTAB_LIBRARY} )
set(LIBVIDSTAB_INCLUDE_DIRS ${LIBVIDSTAB_INCLUDE_DIR} )
set(VIDSTAB_LIBRARIES ${VIDSTAB_LIBRARY} )
set(VIDSTAB_INCLUDE_DIRS ${VIDSTAB_INCLUDE_DIR} )

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBVIDSTAB_FOUND to TRUE
# handle the QUIETLY and REQUIRED arguments and set VIDSTAB_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibVidStab DEFAULT_MSG
LIBVIDSTAB_LIBRARY LIBVIDSTAB_INCLUDE_DIR)
find_package_handle_standard_args(VidStab DEFAULT_MSG
VIDSTAB_LIBRARY VIDSTAB_INCLUDE_DIR)

mark_as_advanced(LIBVIDSTAB_INCLUDE_DIR LIBVIDSTAB_LIBRARY )
mark_as_advanced(VIDSTAB_INCLUDE_DIR VIDSTAB_LIBRARY )
29 changes: 12 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/timelapse_version.h.cmake"
include_directories(
${Qt5Core_INCLUDE_DIRS}
${ImageMagick_INCLUDE_DIRS}
${LIBVIDSTAB_INCLUDE_DIRS}
${VIDSTAB_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR} # for moc files generated by macro QT5_AUTOMOC, timelapse_version.h
${LIBV4L_INCLUDE_DIRS}
${V4L_INCLUDE_DIRS}
${GPHOTO2_INCLUDE_DIR}
)

Expand Down Expand Up @@ -67,12 +67,12 @@ message(STATUS "Qt5Core_DEFINITIONS: ${Qt5Core_DEFINITIONS}")
message(STATUS "ImageMagick_INCLUDE_DIRS: ${ImageMagick_INCLUDE_DIRS}")
message(STATUS "ImageMagick_LIBRARIES: ${ImageMagick_LIBRARIES}")
message(STATUS "IM_CFLAGS: ${IM_CFLAGS}")
message(STATUS "LIBVIDSTAB_INCLUDE_DIRS: ${LIBVIDSTAB_INCLUDE_DIRS}")
message(STATUS "LIBVIDSTAB_LIBRARIES: ${LIBVIDSTAB_LIBRARIES}")
message(STATUS "LIBVIDSTAB_FOUND: ${LIBVIDSTAB_FOUND}")
message(STATUS "LIBV4L_INCLUDE_DIRS: ${LIBV4L_INCLUDE_DIRS}")
message(STATUS "LIBV4L_LIBRARIES: ${LIBV4L_LIBRARIES}")
message(STATUS "LIBV4L_FOUND: ${LIBV4L_FOUND}")
message(STATUS "VIDSTAB_INCLUDE_DIRS: ${VIDSTAB_INCLUDE_DIRS}")
message(STATUS "VIDSTAB_LIBRARIES: ${VIDSTAB_LIBRARIES}")
message(STATUS "VIDSTAB_FOUND: ${VIDSTAB_FOUND}")
message(STATUS "V4L_INCLUDE_DIRS: ${V4L_INCLUDE_DIRS}")
message(STATUS "V4L_LIBRARIES: ${V4L_LIBRARIES}")
message(STATUS "V4L_FOUND: ${V4L_FOUND}")
message(STATUS "GPHOTO2_FOUND: ${GPHOTO2_FOUND}")
message(STATUS "GPHOTO2_INCLUDE_DIR: ${GPHOTO2_INCLUDE_DIR}")
message(STATUS "GPHOTO2_LIBRARIES: ${GPHOTO2_LIBRARIES}")
Expand Down Expand Up @@ -195,8 +195,8 @@ set_property(TARGET timelapse_capture PROPERTY CXX_STANDARD 17)
target_link_libraries( timelapse
Qt5::Core
${ImageMagick_LIBRARIES} # Magick++-6.Q16
${LIBVIDSTAB_LIBRARIES} # LibVidStab
${LIBV4L_LIBRARIES}
${VIDSTAB_LIBRARIES}
${V4L_LIBRARIES}
${GPHOTO2_LIBRARIES}
)
target_link_libraries( timelapse_assembly
Expand All @@ -214,13 +214,13 @@ target_link_libraries( timelapse_stabilize
timelapse
Qt5::Core
${ImageMagick_LIBRARIES} # Magick++-6.Q16
${LIBVIDSTAB_LIBRARIES} # LibVidStab
${VIDSTAB_LIBRARIES}
)
target_link_libraries( timelapse_capture
timelapse
Qt5::Core
${ImageMagick_LIBRARIES} # Magick++-6.Q16
${LIBV4L_LIBRARIES}
${V4L_LIBRARIES}
${GPHOTO2_LIBRARIES}
)

Expand All @@ -229,8 +229,3 @@ install(TARGETS timelapse timelapse_assembly timelapse_deflicker timelapse_stabi
LIBRARY DESTINATION lib COMPONENT libraries
ARCHIVE DESTINATION lib/static COMPONENT libraries
)

# INSTALL(FILES monitormanager.desktop DESTINATION share/applications)
# INSTALL(FILES monitormanager.png DESTINATION share/icons)

# message(SYSTEM " DATA INSTALL DIR ${DATA_INSTALL_DIR}")

0 comments on commit 90deeb6

Please sign in to comment.