Skip to content
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
40 changes: 16 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
cmake_minimum_required(VERSION 2.6)

if (POLICY CMP0053)
cmake_policy(SET CMP0053 OLD)
endif ()

if (POLICY CMP0054)
cmake_policy(SET CMP0054 OLD)
endif ()
cmake_minimum_required(VERSION 3.16)

project(uca C)

Expand All @@ -17,29 +9,29 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(UCA_DESCRIPTION "Unified Camera Access")

# These are software release versions
set(UCA_VERSION_MAJOR "2")
set(UCA_VERSION_MINOR "4")
set(UCA_VERSION_PATCH "0")
set(UCA_VERSION_MAJOR 2)
set(UCA_VERSION_MINOR 4)
set(UCA_VERSION_PATCH 0)
set(UCA_VERSION_STRING "${UCA_VERSION_MAJOR}.${UCA_VERSION_MINOR}.${UCA_VERSION_PATCH}")

# Increase the ABI version when binary compatibility cannot be guaranteed, e.g.
# symbols have been removed, function signatures, structures, constants etc.
# changed.
set(UCA_ABI_VERSION "2")
set(UCA_ABI_VERSION 2)
#}}}
#{{{ Macros
# create_enums
# @prefix: prefix of the output enum files
# @template_prefix: prefix of the template (should be src/uca-enums)
# @header_list: list with header files that should be searched for enums
macro(create_enums prefix template_prefix header_list)
function(create_enums prefix template_prefix header_list)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h
COMMAND ${GLIB2_MKENUMS}
ARGS
--template ${template_prefix}.h.template
${header_list} > ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${header_list})

add_custom_command(
Expand All @@ -48,11 +40,11 @@ macro(create_enums prefix template_prefix header_list)
ARGS
--template ${template_prefix}.c.template
${header_list} > ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.c
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${header_list}
${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h
)
endmacro()
endfunction()
#}}}
#{{{ Configure
include(PkgConfigVars)
Expand All @@ -67,12 +59,12 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/package.sh.in
${CMAKE_CURRENT_BINARY_DIR}/package.sh)
#}}}
#{{{ Common dependencies
find_package(PkgConfig)
find_package(PkgConfig REQUIRED)
find_program(GLIB2_MKENUMS glib-mkenums REQUIRED)
pkg_check_modules(GLIB2 glib-2.0>=2.38 REQUIRED)
pkg_check_modules(GOBJECT2 gobject-2.0>=2.38 REQUIRED)
pkg_check_modules(GMODULE2 gmodule-2.0>=2.38 REQUIRED)
pkg_check_modules(GIO2 gio-2.0>=2.38 REQUIRED)
pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.38)
pkg_check_modules(GOBJECT2 REQUIRED gobject-2.0>=2.38)
pkg_check_modules(GMODULE2 REQUIRED gmodule-2.0>=2.38)
pkg_check_modules(GIO2 REQUIRED gio-2.0>=2.38)

set(GLIB_VERSION_MIN_REQUIRED "GLIB_VERSION_2_38")
set(GLIB_VERSION_MAX_ALLOWED "GLIB_VERSION_2_38")
Expand All @@ -99,11 +91,11 @@ set(UCA_ENUM_HDRS
${CMAKE_CURRENT_SOURCE_DIR}/plugins/pco/uca-pco-camera.h)
#}}}
#{{{ Common definitions
add_definitions("-std=c99 -Wall -fPIC")
add_compile_options("-std=c99" "-Wall" "-fPIC")
#}}}
#{{{ Subdirectories
add_subdirectory(src)
add_subdirectory(plugins)
add_subdirectory(test)
add_subdirectory(bin)
#}}}
#}}}
2 changes: 1 addition & 1 deletion bin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.16...3.22)

add_subdirectory(gui)
add_subdirectory(tools)
10 changes: 5 additions & 5 deletions bin/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.16...3.22)

find_package(PkgConfig)
find_package(PkgConfig REQUIRED)
find_program(GLIB_COMPILE_RESOURCES glib-compile-resources REQUIRED)

pkg_check_modules(GTK2 gtk+-2.0>=2.22)
pkg_check_modules(GTHREAD2 gthread-2.0)
pkg_check_modules(GTK2 REQUIRED gtk+-2.0>=2.22)
pkg_check_modules(GTHREAD2 REQUIRED gthread-2.0)

if (GTK2_FOUND)
set(GRESOURCES_XML "${CMAKE_CURRENT_SOURCE_DIR}/uca-camera-control.gresource.xml")
Expand Down Expand Up @@ -52,4 +52,4 @@ if (GTK2_FOUND)
install(TARGETS uca-camera-control
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT executables)
endif()
endif()
8 changes: 4 additions & 4 deletions bin/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.16...3.22)

#{{{ Variables
set(libs uca)
#}}}
#{{{ Configure
find_package(TIFF)
find_package(TIFF REQUIRED)

if (TIFF_FOUND)
set(HAVE_LIBTIFF "1")
Expand All @@ -21,7 +21,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}

set(BINARIES "benchmark" "gen-doc" "info")

foreach (BINARY ${BINARIES})
foreach (BINARY IN LISTS BINARIES)
add_executable(uca-${BINARY} ${BINARY}.c common.c)
target_link_libraries(uca-${BINARY} ${libs})
endforeach ()
Expand All @@ -32,4 +32,4 @@ target_link_libraries(uca-grab ${libs} m)
install(TARGETS uca-benchmark uca-grab uca-gen-doc uca-info
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT executables)
#}}}
#}}}
8 changes: 4 additions & 4 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ set(UCA_CONFIGDIR "${CMAKE_CURRENT_BINARY_DIR}/../src")
add_subdirectory(mock)
add_subdirectory(file)

message("-- Building the following plugins:")
message(STATUS "Building the following plugins:")
set(_plugins "mock;file")

foreach(_target ${_plugins})
foreach(_target IN LISTS _plugins)
if (TARGET "uca${_target}")
message("-- ${_target}")
message(STATUS " ${_target}")
endif()
endforeach()
endforeach()
4 changes: 2 additions & 2 deletions plugins/file/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.16...3.22)
project(ucafile C)

find_package(TIFF)
find_package(TIFF REQUIRED)

if (TIFF_FOUND)
set(UCA_CAMERA_NAME "file")
Expand Down
Loading