summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2013-10-29 09:05:51 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2013-10-29 09:05:51 +0100
commit137f03b9a34fb39e5321524ab11fa31276458476 (patch)
tree83ea6e2b2228d1e99a37a0e510faaa13130ef849
parent85a0f33711fd4467b9027da85ab9e09e406398d4 (diff)
downloadlibuca-137f03b9a34fb39e5321524ab11fa31276458476.tar.gz
libuca-137f03b9a34fb39e5321524ab11fa31276458476.tar.bz2
libuca-137f03b9a34fb39e5321524ab11fa31276458476.tar.xz
libuca-137f03b9a34fb39e5321524ab11fa31276458476.zip
Use ConfigurePaths to get installation paths
The advantage is twofold: 1) we have a clear separation between setting up the paths and actually using them, 2) the interface is very likely as configure scripts and makes integration into build system a bit easier.
-rw-r--r--CMakeLists.txt5
-rw-r--r--bin/gui/CMakeLists.txt7
-rw-r--r--bin/gui/config.h.in2
-rw-r--r--bin/tools/CMakeLists.txt4
-rw-r--r--cmake/ConfigurePaths.cmake90
-rw-r--r--plugins/dexela/CMakeLists.txt2
-rw-r--r--plugins/mock/CMakeLists.txt2
-rw-r--r--plugins/pco/CMakeLists.txt2
-rw-r--r--plugins/pf/CMakeLists.txt2
-rw-r--r--plugins/pylon/CMakeLists.txt2
-rw-r--r--plugins/ufo/CMakeLists.txt2
-rw-r--r--plugins/xkit/CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt28
-rw-r--r--src/config.h.in2
-rw-r--r--src/libuca.pc.in17
15 files changed, 127 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25c07e3..6c5ede2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,11 +66,14 @@ macro(create_enums prefix template_prefix header_list)
endmacro()
#}}}
#{{{ Configure
+include(ConfigurePaths)
+configure_paths(UCA)
+
+set(UCA_PLUGINDIR "${UCA_LIBDIR}/uca")
set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/package.sh.in
${CMAKE_CURRENT_BINARY_DIR}/package.sh)
-
#}}}
#{{{ Common dependencies
find_package(PkgConfig)
diff --git a/bin/gui/CMakeLists.txt b/bin/gui/CMakeLists.txt
index bb5a8f4..a75b5b1 100644
--- a/bin/gui/CMakeLists.txt
+++ b/bin/gui/CMakeLists.txt
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 2.6)
+#{{{ Variables
+set(UCA_GLADEDIR "${UCA_DATADIR}/libuca")
+#}}}
#{{{ Configure
find_package(PkgConfig)
@@ -32,9 +35,9 @@ if (GTK2_FOUND)
${GTHREAD2_LIBRARIES})
install(TARGETS ${BINARY}
- RUNTIME DESTINATION bin)
+ RUNTIME DESTINATION ${UCA_BINDIR})
install(FILES control.glade
- DESTINATION share/libuca)
+ DESTINATION ${UCA_GLADEDIR})
endif()
#}}}
diff --git a/bin/gui/config.h.in b/bin/gui/config.h.in
index e7de9c6..566a405 100644
--- a/bin/gui/config.h.in
+++ b/bin/gui/config.h.in
@@ -1 +1 @@
-#define CONTROL_GLADE_PATH "${CMAKE_INSTALL_PREFIX}/share/libuca/control.glade"
+#define CONTROL_GLADE_PATH "${UCA_GLADE_DIR}/control.glade"
diff --git a/bin/tools/CMakeLists.txt b/bin/tools/CMakeLists.txt
index 285b2d7..964b1f9 100644
--- a/bin/tools/CMakeLists.txt
+++ b/bin/tools/CMakeLists.txt
@@ -32,8 +32,8 @@ target_link_libraries(uca-grab ringbuffer ${libs})
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)
-#}}}
+ RUNTIME DESTINATION ${UCA_BINDIR})
#}}}
diff --git a/cmake/ConfigurePaths.cmake b/cmake/ConfigurePaths.cmake
new file mode 100644
index 0000000..df9c03c
--- /dev/null
+++ b/cmake/ConfigurePaths.cmake
@@ -0,0 +1,90 @@
+# - pre-configured paths for CMake
+#
+# Usage:
+# configure_paths(<PREFIX>)
+#
+# Checks if configure-like prefix and installation paths were passed by the user
+# and sets up corresponding variables for use in install() commands and to fill
+# out .pc files:
+#
+# PREFIX_PREFIX defaults to ... CMAKE_INSTALL_PREFIX
+# PREFIX_EPREFIX PREFIX_PREFIX
+# PREFIX_SBINDIR PREFIX_EPREFIX/sbin
+# PREFIX_SYSCONFDIR PREFIX_PREFIX/etc
+# PREFIX_LOCALSTATEDIR PREFIX_PREFIX/var
+# PREFIX_BINDIR PREFIX_EPREFIX/bin
+# PREFIX_LIBDIR PREFIX_EPREFIX/lib
+# PREFIX_INCLUDEDIR PREFIX_PREFIX/include
+# PREFIX_PKGCONFIGDIR PREFIX_LIBDIR/pkgconfig
+# PREFIX_TYPELIBDIR PREFIX_LIBDIR/girepository-1.0
+# PREFIX_DATAROOTDIR PREFIX_PREFIX/share
+# PREFIX_DATADIR PREFIX_DATAROOTDIR
+# PREFIX_INFODIR PREFIX_DATAROOTDIR/info
+# PREFIX_MANDIR PREFIX_DATAROOTDIR/man
+# PREFIX_LOCALEDIR PREFIX_DATAROOTDIR/locale
+# PREFIX_GIRDIR PREFIX_DATAROOTDIR/gir-1.0
+
+# Copyright (C) 2013 Matthias Vogelgesang <matthias.vogelgesang@gmail.com>
+#
+# Redistribution and use, with or without modification, are permitted
+# provided that the following conditions are met:
+#
+# 1. Redistributions must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# 2. The name of the author may not be used to endorse or promote
+# products derived from this software without specific prior
+# written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+if(__configure_paths)
+ return()
+endif()
+
+set(__configure_paths YES)
+
+macro(_set_var _prefix _var _user _override _description)
+ set(_name "${_prefix}_${_var}")
+
+ set("${_name}" "${_user}")
+
+ if("${_name}" STREQUAL "")
+ set("${_name}" "${_override}")
+ endif()
+
+ set(${_name} "${${_name}}" CACHE PATH "${_description}")
+ mark_as_advanced(${_name})
+endmacro()
+
+function(configure_paths _prefix)
+ _set_var("${_prefix}" "PREFIX" "${PREFIX}" "${CMAKE_INSTALL_PREFIX}" "install architecture-independent files in PREFIX")
+ _set_var("${_prefix}" "EPREFIX" "${EXEC_PREFIX}" "${${_prefix}_PREFIX}" "install architecture-dependent files in EPREFIX")
+
+ _set_var("${_prefix}" "SBINDIR" "${SBINDIR}" "${${_prefix}_EPREFIX}/sbin" "system admin executabls")
+ _set_var("${_prefix}" "SYSCONFDIR" "${SYSCONFDIR}" "${${_prefix}_PREFIX}/etc" "read-only single-machine data")
+ _set_var("${_prefix}" "LOCALSTATEDIR" "${LOCALSTATEDIR}" "${${_prefix}_PREFIX}/var" "modifiable single-machine data")
+ _set_var("${_prefix}" "BINDIR" "${BINDIR}" "${${_prefix}_EPREFIX}/bin" "user executables")
+ _set_var("${_prefix}" "LIBDIR" "${LIBDIR}" "${${_prefix}_EPREFIX}/lib" "object code libraries")
+ _set_var("${_prefix}" "INCLUDEDIR" "${INCLUDEDIR}" "${${_prefix}_PREFIX}/include" "C header files")
+ _set_var("${_prefix}" "PKGCONFIGDIR" "${PKGCONFIGDIR}" "${${_prefix}_LIBDIR}/pkgconfig" "pkg-config files")
+ _set_var("${_prefix}" "TYPELIBDIR" "${TYPELIBDIR}" "${${_prefix}_LIBDIR}/girepository-1.0" "GObject run-time introspection data")
+ _set_var("${_prefix}" "DATAROOTDIR" "${DATAROOTDIR}" "${${_prefix}_PREFIX}/share" "read-only arch.-independent data root")
+ _set_var("${_prefix}" "DATADIR" "${DATADIR}" "${${_prefix}_DATAROOTDIR}" "read-only architecture-independent data")
+ _set_var("${_prefix}" "INFODIR" "${INFODIR}" "${${_prefix}_DATAROOTDIR}/info" "info documentation")
+ _set_var("${_prefix}" "MANDIR" "${MANDIR}" "${${_prefix}_DATAROOTDIR}/man" "man documentation")
+ _set_var("${_prefix}" "LOCALEDIR" "${LOCALEDIR}" "${${_prefix}_DATAROOTDIR}/locale" "locale-dependent data")
+ _set_var("${_prefix}" "GIRDIR" "${GIRDIR}" "${${_prefix}_DATAROOTDIR}/gir-1.0" "GObject introspection data")
+endfunction()
+
+# vim: tw=0:
diff --git a/plugins/dexela/CMakeLists.txt b/plugins/dexela/CMakeLists.txt
index 9079565..d497f7d 100644
--- a/plugins/dexela/CMakeLists.txt
+++ b/plugins/dexela/CMakeLists.txt
@@ -24,6 +24,6 @@ if (DEXELA_FOUND)
target_link_libraries(ucadexela ${UCA_DEPS} ${DEXELA_LIBRARIES})
install(TARGETS ucadexela
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}/uca
+ LIBRARY DESTINATION ${UCA_PLUGINDIR}
COMPONENT ${UCA_CAMERA_NAME})
endif()
diff --git a/plugins/mock/CMakeLists.txt b/plugins/mock/CMakeLists.txt
index bf6ed29..3dac582 100644
--- a/plugins/mock/CMakeLists.txt
+++ b/plugins/mock/CMakeLists.txt
@@ -18,5 +18,5 @@ target_link_libraries(ucamock
${UCA_DEPS})
install(TARGETS ucamock
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}/uca
+ LIBRARY DESTINATION ${UCA_PLUGINDIR}
COMPONENT ${UCA_CAMERA_NAME})
diff --git a/plugins/pco/CMakeLists.txt b/plugins/pco/CMakeLists.txt
index 7e10320..ea28c2f 100644
--- a/plugins/pco/CMakeLists.txt
+++ b/plugins/pco/CMakeLists.txt
@@ -35,6 +35,6 @@ if (PCO_FOUND AND CLSERME4_FOUND AND FGLIB5_FOUND)
${FGLIB5_LIBRARY})
install(TARGETS ucapco
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}/uca
+ LIBRARY DESTINATION ${UCA_PLUGINDIR}
COMPONENT ${UCA_CAMERA_NAME})
endif()
diff --git a/plugins/pf/CMakeLists.txt b/plugins/pf/CMakeLists.txt
index 766f557..a384ae8 100644
--- a/plugins/pf/CMakeLists.txt
+++ b/plugins/pf/CMakeLists.txt
@@ -28,6 +28,6 @@ if (PF_FOUND AND CLSERME4_FOUND AND FGLIB5_FOUND)
${FGLIB5_LIBRARY})
install(TARGETS ucapf
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}/uca
+ LIBRARY DESTINATION ${UCA_PLUGINDIR}
COMPONENT ${UCA_CAMERA_NAME})
endif()
diff --git a/plugins/pylon/CMakeLists.txt b/plugins/pylon/CMakeLists.txt
index 7b67167..0e9088d 100644
--- a/plugins/pylon/CMakeLists.txt
+++ b/plugins/pylon/CMakeLists.txt
@@ -18,6 +18,6 @@ if (PYLON_FOUND)
${LIBPYLONCAM_LIBRARIES})
install(TARGETS ucapylon
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}/uca
+ LIBRARY DESTINATION ${UCA_PLUGINDIR}
COMPONENT ${UCA_CAMERA_NAME})
endif()
diff --git a/plugins/ufo/CMakeLists.txt b/plugins/ufo/CMakeLists.txt
index b85504a..b3372d4 100644
--- a/plugins/ufo/CMakeLists.txt
+++ b/plugins/ufo/CMakeLists.txt
@@ -22,6 +22,6 @@ if (IPE_FOUND)
${IPE_LIBRARIES})
install(TARGETS ucaufo
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}/uca
+ LIBRARY DESTINATION ${UCA_PLUGINDIR}
COMPONENT ${UCA_CAMERA_NAME})
endif()
diff --git a/plugins/xkit/CMakeLists.txt b/plugins/xkit/CMakeLists.txt
index 209ef34..b82881e 100644
--- a/plugins/xkit/CMakeLists.txt
+++ b/plugins/xkit/CMakeLists.txt
@@ -27,6 +27,6 @@ if (XKIT_INCLUDE_DIR AND XKIT_LIBRARIES)
${XKIT_LIBRARIES})
install(TARGETS ucaxkit
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}/uca
+ LIBRARY DESTINATION ${UCA_PLUGINDIR}
COMPONENT ${UCA_CAMERA_NAME})
endif ()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6872015..066649b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,15 +16,9 @@ create_enums(uca-enums
${uca_HDRS})
#}}}
#{{{ Variables
-set(prefix ${CMAKE_INSTALL_PREFIX})
if (CI_INSTALL_PREFIX)
- set(prefix ${CI_INSTALL_PREFIX})
+ set(UCA_PREFIX "${CI_INSTALL_PREFIX}")
endif()
-
-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")
@@ -37,7 +31,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libuca.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/libuca.pc" @ONLY IMMEDIATE)
#}}}
#{{{ Target
-
include_directories(${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR})
@@ -168,32 +161,31 @@ if(GTK_DOC_FOUND)
add_custom_target(reference ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html.stamp)
- install(FILES ${reference_files} DESTINATION share/gtk-doc/html/uca)
+ install(FILES ${reference_files}
+ DESTINATION ${UCA_DATADIR}/gtk-doc/html/uca)
endif()
endif()
-
-
-# --- Install target ----------------------------------------------------------
-
+#}}}
+#{{{ Installation
install(TARGETS uca
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ LIBRARY DESTINATION ${UCA_LIBDIR}
COMPONENT libraries)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libuca.pc
- DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
+ DESTINATION ${UCA_PKGCONFIGDIR}
COMPONENT libraries)
install(FILES ${uca_HDRS}
- DESTINATION include/uca
+ DESTINATION ${UCA_INCLUDEDIR}
COMPONENT headers)
if(WITH_GIR)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_XML}
- DESTINATION share/gir-1.0
+ DESTINATION ${UCA_GIRDIR}
COMPONENT libraries)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_TYPELIB}
- DESTINATION ${LIB_INSTALL_DIR}/girepository-1.0
+ DESTINATION ${UCA_TYPELIBDIR}
COMPONENT libraries)
endif()
#}}}
diff --git a/src/config.h.in b/src/config.h.in
index ec1fb62..28f4ffb 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -4,6 +4,4 @@
#cmakedefine HAVE_UFO_CAMERA
#cmakedefine HAVE_PYLON_CAMERA
#cmakedefine HAVE_DEXELA_CL
-
#cmakedefine HAVE_MOCK_CAMERA
-#define CONTROL_GLADE_PATH "${CMAKE_INSTALL_PREFIX}/share/libuca/control.glade"
diff --git a/src/libuca.pc.in b/src/libuca.pc.in
index 3ca4dbe..14a9361 100644
--- a/src/libuca.pc.in
+++ b/src/libuca.pc.in
@@ -1,14 +1,13 @@
-# Package Information for pkg-config
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir_old=@includedir@/uca
-includedir_new=@includedir@
+prefix=@UCA_PREFIX@
+exec_prefix=@UCA_EPREFIX@
+libdir=@UCA_LIBDIR@
+includedir=@UCA_INCLUDEDIR@
+girdir=@UCA_GIRDIR@
+typelibdir=@UCA_TYPELIBDIR@
Name: libuca
Description: @UCA_DESCRIPTION@
-Version: @VERSION@
+Version: @UCA_VERSION_STRING@
Libs: -L${libdir} -luca
-Cflags: -I${includedir_old} -I${includedir_new}
+Cflags: -I${includedir}
Requires: glib-2.0 gobject-2.0