From 85a0f33711fd4467b9027da85ab9e09e406398d4 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 29 Oct 2013 08:48:27 +0100 Subject: Cleanup CMakeLists.txt --- CMakeLists.txt | 59 +++++++++++++++++++++---------------------- bin/CMakeLists.txt | 3 +-- bin/gui/CMakeLists.txt | 18 ++++++------- bin/tools/CMakeLists.txt | 33 ++++++++++++------------ plugins/CMakeLists.txt | 3 --- plugins/dexela/CMakeLists.txt | 2 +- plugins/mock/CMakeLists.txt | 2 +- plugins/pco/CMakeLists.txt | 2 +- plugins/pf/CMakeLists.txt | 2 +- plugins/pylon/CMakeLists.txt | 2 +- plugins/ufo/CMakeLists.txt | 2 +- plugins/xkit/CMakeLists.txt | 2 +- src/CMakeLists.txt | 47 +++++++++++++++------------------- test/CMakeLists.txt | 9 +++---- 14 files changed, 84 insertions(+), 102 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e57396..25c07e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,10 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(uca C) +#{{{ CMake +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +#}}} +#{{{ Metadata set(TARNAME "libuca") set(UCA_DESCRIPTION "Unified Camera Access") @@ -15,6 +19,7 @@ set(UCA_VERSION_STRING "${UCA_VERSION_MAJOR}.${UCA_VERSION_MINOR}.${UCA_VERSION_ # changed. set(UCA_ABI_VERSION "2") +#{{{ CPack set(CPACK_PACKAGE_VERSION "${UCA_VERSION_STRING}") set(CPACK_PACKAGE_NAME "${TARNAME}") set(PACKAGE_TARNAME "${TARNAME}") @@ -31,28 +36,9 @@ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION_SUMMARY ${UCA_DESCRIPTION}) set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}") set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") - -set(UCA_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) - -set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}") - -set(UCA_ENUM_HDRS - ${CMAKE_CURRENT_SOURCE_DIR}/src/uca-camera.h - ${CMAKE_CURRENT_SOURCE_DIR}/plugins/pco/uca-pco-camera.h) - - -# --- Common configuration --------------------------------------------------- - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/package.sh.in - ${CMAKE_CURRENT_BINARY_DIR}/package.sh) - -# --- Common flags ------------------------------------------------------------ - -add_definitions("-std=c99 -Wall") - - -# --- Common macros - +#}}} +#}}} +#{{{ Macros # create_enums # @prefix: prefix of the output enum files # @template_prefix: prefix of the template (should be src/uca-enums) @@ -78,36 +64,49 @@ macro(create_enums prefix template_prefix header_list) ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h ) endmacro() +#}}} +#{{{ Configure +set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/package.sh.in + ${CMAKE_CURRENT_BINARY_DIR}/package.sh) -# --- Common libraries -------------------------------------------------------- - -set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) - +#}}} +#{{{ Common dependencies find_package(PkgConfig) find_program(GLIB2_MKENUMS glib-mkenums REQUIRED) pkg_check_modules(GLIB2 glib-2.0>=2.24 REQUIRED) pkg_check_modules(GOBJECT2 gobject-2.0>=2.24 REQUIRED) pkg_check_modules(GMODULE2 gmodule-2.0>=2.24 REQUIRED) pkg_check_modules(GIO2 gio-2.0>=2.24 REQUIRED) - +#}}} +#{{{ Common includes include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src ${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GMODULE2_INCLUDE_DIRS} ${GIO2_INCLUDE_DIRS}) - +#}}} +#{{{ Common variables set(UCA_DEPS ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES} ${GMODULE2_LIBRARIES} ${GIO2_LIBRARIES}) +set(UCA_ENUM_HDRS + ${CMAKE_CURRENT_SOURCE_DIR}/src/uca-camera.h + ${CMAKE_CURRENT_SOURCE_DIR}/plugins/pco/uca-pco-camera.h) +#}}} +#{{{ Common definitions +add_definitions("-std=c99 -Wall") +#}}} +#{{{ Subdirectories add_subdirectory(src) add_subdirectory(plugins) add_subdirectory(test) add_subdirectory(bin) +#}}} include(CPack) - diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index b8d065b..b600684 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) add_library(ringbuffer ${CMAKE_CURRENT_SOURCE_DIR}/common/ring-buffer.c) @@ -7,4 +7,3 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common) add_subdirectory(gui) add_subdirectory(tools) - diff --git a/bin/gui/CMakeLists.txt b/bin/gui/CMakeLists.txt index c42bf35..bb5a8f4 100644 --- a/bin/gui/CMakeLists.txt +++ b/bin/gui/CMakeLists.txt @@ -1,8 +1,6 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) -add_definitions("--std=c99 -Wall") - -# --- Find packages and libraries --------------------------------------------- +#{{{ Configure find_package(PkgConfig) pkg_check_modules(GTK2 gtk+-2.0>=2.22) @@ -13,12 +11,11 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/control.glade ${CMAKE_CURRENT_BINARY_DIR}) - -# --- Build targets ----------------------------------------------------------- -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - +#}}} +#{{{ Target if (GTK2_FOUND) - include_directories(${GTK2_INCLUDE_DIRS}) + include_directories(${GTK2_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR}) set(BINARY "uca-camera-control") add_executable(${BINARY} @@ -31,7 +28,7 @@ if (GTK2_FOUND) m uca ringbuffer - ${GTK2_LIBRARIES} + ${GTK2_LIBRARIES} ${GTHREAD2_LIBRARIES}) install(TARGETS ${BINARY} @@ -40,3 +37,4 @@ if (GTK2_FOUND) install(FILES control.glade DESTINATION share/libuca) endif() +#}}} diff --git a/bin/tools/CMakeLists.txt b/bin/tools/CMakeLists.txt index 2bec9c9..285b2d7 100644 --- a/bin/tools/CMakeLists.txt +++ b/bin/tools/CMakeLists.txt @@ -1,17 +1,10 @@ -cmake_minimum_required(VERSION 2.8) - -add_definitions("--std=c99 -Wall") - -# --- Find packages and libraries --------------------------------------------- -find_package(TIFF) - -# --- Build targets ----------------------------------------------------------- -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ) +cmake_minimum_required(VERSION 2.6) +#{{{ Variables set(libs uca) +#}}} +#{{{ Configure +find_package(TIFF) if (TIFF_FOUND) set(HAVE_LIBTIFF "1") @@ -21,20 +14,26 @@ endif () configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) +#}}} +#{{{ Targets +include_directories(${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}) -# --- gen-doc +#{{{ gen-doc add_executable(uca-gen-doc gen-doc.c) target_link_libraries(uca-gen-doc ${libs}) - -# --- uca-grab +#}}} +#{{{ uca-grab add_executable(uca-grab grab.c common.c) target_link_libraries(uca-grab ringbuffer ${libs}) - -# --- uca-benchmark +#}}} +#{{{ uca-benchmark add_executable(uca-benchmark benchmark.c common.c) target_link_libraries(uca-benchmark ${libs}) install(TARGETS uca-benchmark uca-grab uca-gen-doc RUNTIME DESTINATION bin) +#}}} +#}}} diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 88acd86..ff6ebeb 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,6 +1,3 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src) - add_subdirectory(mock) add_subdirectory(pf) add_subdirectory(pco) diff --git a/plugins/dexela/CMakeLists.txt b/plugins/dexela/CMakeLists.txt index e853b53..9079565 100644 --- a/plugins/dexela/CMakeLists.txt +++ b/plugins/dexela/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(ucadexela C) set(VERSION "1.0.0") diff --git a/plugins/mock/CMakeLists.txt b/plugins/mock/CMakeLists.txt index 526fbf0..bf6ed29 100644 --- a/plugins/mock/CMakeLists.txt +++ b/plugins/mock/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(ucamock C) set(UCA_CAMERA_NAME "mock") diff --git a/plugins/pco/CMakeLists.txt b/plugins/pco/CMakeLists.txt index 649e435..7e10320 100644 --- a/plugins/pco/CMakeLists.txt +++ b/plugins/pco/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(ucapco C) find_package(PCO) diff --git a/plugins/pf/CMakeLists.txt b/plugins/pf/CMakeLists.txt index 4c896d9..766f557 100644 --- a/plugins/pf/CMakeLists.txt +++ b/plugins/pf/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(ucapf C) find_package(PF) diff --git a/plugins/pylon/CMakeLists.txt b/plugins/pylon/CMakeLists.txt index 9a3c15c..7b67167 100644 --- a/plugins/pylon/CMakeLists.txt +++ b/plugins/pylon/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(ucapylon C) diff --git a/plugins/ufo/CMakeLists.txt b/plugins/ufo/CMakeLists.txt index 368b7d7..b85504a 100644 --- a/plugins/ufo/CMakeLists.txt +++ b/plugins/ufo/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(ucaufo C) find_package(IPE) diff --git a/plugins/xkit/CMakeLists.txt b/plugins/xkit/CMakeLists.txt index f328f25..209ef34 100644 --- a/plugins/xkit/CMakeLists.txt +++ b/plugins/xkit/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(ucaxkit CXX) set(UCA_CAMERA_NAME "xkit") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c733ba3..6872015 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(uca C) -# --- Set sources ------------------------------------------------------------- +#{{{ Sources set(uca_SRCS uca-camera.c uca-plugin-manager.c @@ -14,15 +14,8 @@ set(uca_HDRS create_enums(uca-enums ${CMAKE_CURRENT_SOURCE_DIR}/uca-enums ${uca_HDRS}) - -# --- Configure --------------------------------------------------------------- - -find_program(INTROSPECTION_SCANNER "g-ir-scanner") -find_program(INTROSPECTION_COMPILER "g-ir-compiler") - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h) - +#}}} +#{{{ Variables set(prefix ${CMAKE_INSTALL_PREFIX}) if (CI_INSTALL_PREFIX) set(prefix ${CI_INSTALL_PREFIX}) @@ -32,12 +25,18 @@ set(exec_prefix "\${prefix}") set(libdir ${prefix}/${LIB_INSTALL_DIR}) set(includedir "\${prefix}/include") set(VERSION ${UCA_VERSION_STRING}) +#}}} +#{{{ Configure +find_program(INTROSPECTION_SCANNER "g-ir-scanner") +find_program(INTROSPECTION_COMPILER "g-ir-compiler") + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/config.h) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libuca.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libuca.pc" @ONLY IMMEDIATE) - - -# --- Build target ------------------------------------------------------------ +#}}} +#{{{ Target include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) @@ -51,10 +50,8 @@ set_target_properties(uca PROPERTIES SOVERSION ${UCA_ABI_VERSION}) target_link_libraries(uca ${UCA_DEPS}) - - -# --- Build introspection files ----------------------------------------------- - +#}}} +#{{{ GObject introspection if (INTROSPECTION_SCANNER AND INTROSPECTION_COMPILER) option(WITH_GIR "Build introspection files" ON) @@ -97,10 +94,8 @@ if (INTROSPECTION_SCANNER AND INTROSPECTION_COMPILER) endif() endif() - - -# --- Build documentation ----------------------------------------------------- - +#}}} +#{{{ Documentation pkg_check_modules(GTK_DOC gtk-doc) if(GTK_DOC_FOUND) @@ -201,10 +196,8 @@ if(WITH_GIR) DESTINATION ${LIB_INSTALL_DIR}/girepository-1.0 COMPONENT libraries) endif() - - -# --- Generate package description -------------------------------------------- - +#}}} +#{{{ CPack set(CPACK_PACKAGE_DESCRIPTION "Unified Camera Access library") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GObject-based library for accessing scientific cameras") set(CPACK_PACKAGE_NAME "libuca") @@ -226,5 +219,5 @@ set(CPACK_SOURCE_IGNORE_FILES ".git" "tags" ".bzr" ".swp") set(CPACK_SOURCE_PACKAGE_FILE_NAME "libuca-${UCA_VERSION_STRING}" CACHE INTERNAL "tarball basename") set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${UCA_VERSION_STRING}-${CMAKE_SYSTEM_PROCESSOR}") - include(CPack) +#}}} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7b98cc4..d9ce857 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gtester.xsl + ${CMAKE_CURRENT_BINARY_DIR}/gtester.xsl) add_executable(test-mock test-mock.c) target_link_libraries(test-mock uca ${UCA_DEPS}) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gtester.xsl - ${CMAKE_CURRENT_BINARY_DIR}/gtester.xsl) -- cgit v1.2.3