diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2013-05-31 13:16:09 +0300 |
---|---|---|
committer | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2013-06-07 14:46:23 +0300 |
commit | 2b01b283ced8b9d5da9d6b1c940103400fa8d8a8 (patch) | |
tree | d1cc572eb5c6d22cb386a277cae1a9de40fcc127 | |
parent | 7e27fdee6c931728c79d348b94f0258081fdf607 (diff) |
cmake: Improve installation dirs macros
* Use GNUInstallDirs as a base
* Install .dlls in $prefix/bin on windows
* Install cmake config files in lib/cmake/<package>
* Rename macros for readability
-rw-r--r-- | CMakeLists.txt | 23 | ||||
-rw-r--r-- | cmake/modules/QtGStreamerConfig.cmake.in | 2 | ||||
-rw-r--r-- | elements/gstqtvideosink/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 13 | ||||
-rw-r--r-- | src/QGlib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/QGlib/QtGLib-2.0.pc.in | 4 | ||||
-rw-r--r-- | src/QGst/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/QGst/QtGStreamer-0.10.pc.in | 4 | ||||
-rw-r--r-- | src/QGst/QtGStreamerUi-0.10.pc.in | 4 | ||||
-rw-r--r-- | src/QGst/QtGStreamerUtils-0.10.pc.in | 4 | ||||
-rw-r--r-- | src/qml/CMakeLists.txt | 6 |
11 files changed, 39 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 540cae8..aa8abb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,8 +17,8 @@ option(USE_GST_PLUGIN_DIR "Install gstreamer plugins at the system location" ON) option(USE_QT_PLUGIN_DIR "Install qt plugins at the system location" ON) set(QT_VERSION "4" CACHE STRING "Qt version used for the build") +include(GNUInstallDirs) include(MacroLogFeature) - include(QtHelpers) macro_log_feature(QT_FOUND "Qt" "Required for building everything" "http://qt.nokia.com/" TRUE "${QT_MIN_VERSION}") @@ -114,25 +114,32 @@ if (CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat-security -Wundef -Wpointer-arith -fno-common") endif () -set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE STRING "Destination directory for libraries") -set(INCLUDES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/${QTGSTREAMER_PACKAGE_NAME}) + +set(QTGSTREAMER_INSTALL_TARGET_DEFAULT_ARGS + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +set(QTGSTREAMER_PC_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +set(QTGSTREAMER_CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${QTGSTREAMER_PACKAGE_NAME}) +set(QTGSTREAMER_INCLUDES_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/${QTGSTREAMER_PACKAGE_NAME}) if (USE_GST_PLUGIN_DIR) - set(PLUGINS_INSTALL_DIR ${GSTREAMER_PLUGIN_DIR}) + set(QTGSTREAMER_GST_PLUGINS_INSTALL_DIR ${GSTREAMER_PLUGIN_DIR}) else() - set(PLUGINS_INSTALL_DIR ${LIB_INSTALL_DIR}/gstreamer-0.10) + set(QTGSTREAMER_GST_PLUGINS_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/gstreamer-0.10) endif() if (USE_QT_PLUGIN_DIR) - set(IMPORTS_INSTALL_DIR ${QT_IMPORTS_DIR}) + set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${QT_IMPORTS_DIR}) else() if (USE_QT5) - set(IMPORTS_INSTALL_DIR ${LIB_INSTALL_DIR}/qt5/imports) + set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt5/imports) else() - set(IMPORTS_INSTALL_DIR ${LIB_INSTALL_DIR}/qt4/imports) + set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt4/imports) endif() endif() + if (QTGSTREAMER_CODEGEN AND FLEX_FOUND AND BISON_FOUND) add_subdirectory(codegen) endif() diff --git a/cmake/modules/QtGStreamerConfig.cmake.in b/cmake/modules/QtGStreamerConfig.cmake.in index b139536..9fa50cb 100644 --- a/cmake/modules/QtGStreamerConfig.cmake.in +++ b/cmake/modules/QtGStreamerConfig.cmake.in @@ -13,7 +13,7 @@ set(QTGLIB_LIBRARY @QTGLIB_LIBRARY@) set(QTGSTREAMER_LIBRARY @QTGSTREAMER_LIBRARY@) set(QTGSTREAMER_UI_LIBRARY @QTGSTREAMER_UI_LIBRARY@) set(QTGSTREAMER_UTILS_LIBRARY @QTGSTREAMER_UTILS_LIBRARY@) -set_and_check(QTGSTREAMER_INCLUDE_DIR @PACKAGE_INCLUDES_INSTALL_DIR@) +set_and_check(QTGSTREAMER_INCLUDE_DIR @PACKAGE_QTGSTREAMER_INCLUDES_INSTALL_DIR@) # Find dependencies, if not already found if ("@QTGSTREAMER_PACKAGE_NAME@" STREQUAL "Qt5GStreamer") diff --git a/elements/gstqtvideosink/CMakeLists.txt b/elements/gstqtvideosink/CMakeLists.txt index db253ff..49de034 100644 --- a/elements/gstqtvideosink/CMakeLists.txt +++ b/elements/gstqtvideosink/CMakeLists.txt @@ -51,7 +51,7 @@ target_link_libraries(gstqtvideosink ${GSTREAMER_INTERFACES_LIBRARY} ${GstQtVideoSink_GL_LIBS} ) -install(TARGETS gstqtvideosink DESTINATION ${PLUGINS_INSTALL_DIR}) +install(TARGETS gstqtvideosink DESTINATION ${QTGSTREAMER_GST_PLUGINS_INSTALL_DIR}) if (QTGSTREAMER_TESTS) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e553c0e..faa0d6b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,7 +37,7 @@ endmacro() macro(install_headers _dir_name) foreach(header ${ARGN}) get_filename_component(header_path ${header} PATH) - install(FILES ${header} DESTINATION ${INCLUDES_INSTALL_DIR}/${_dir_name}/${header_path}) + install(FILES ${header} DESTINATION ${QTGSTREAMER_INCLUDES_INSTALL_DIR}/${_dir_name}/${header_path}) endforeach() endmacro() @@ -60,18 +60,18 @@ include(CMakePackageConfigHelpers) configure_package_config_file( ${CMAKE_SOURCE_DIR}/cmake/modules/QtGStreamerConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${QTGSTREAMER_PACKAGE_NAME}Config.cmake - INSTALL_DESTINATION ${LIB_INSTALL_DIR}/${QTGSTREAMER_PACKAGE_NAME} - PATH_VARS INCLUDES_INSTALL_DIR + INSTALL_DESTINATION ${QTGSTREAMER_CMAKE_CONFIG_INSTALL_DIR} + PATH_VARS QTGSTREAMER_INCLUDES_INSTALL_DIR NO_CHECK_REQUIRED_COMPONENTS_MACRO) write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/${QTGSTREAMER_PACKAGE_NAME}ConfigVersion.cmake VERSION ${QTGSTREAMER_VERSION} COMPATIBILITY SameMajorVersion) -install(EXPORT ${EXPORT_TARGET_SET} DESTINATION ${LIB_INSTALL_DIR}/${QTGSTREAMER_PACKAGE_NAME}) +install(EXPORT ${EXPORT_TARGET_SET} DESTINATION ${QTGSTREAMER_CMAKE_CONFIG_INSTALL_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${QTGSTREAMER_PACKAGE_NAME}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${QTGSTREAMER_PACKAGE_NAME}ConfigVersion.cmake ${CMAKE_SOURCE_DIR}/cmake/modules/QtGStreamerConfigCommon.cmake - DESTINATION ${LIB_INSTALL_DIR}/${QTGSTREAMER_PACKAGE_NAME}) + DESTINATION ${QTGSTREAMER_CMAKE_CONFIG_INSTALL_DIR}) # Install pkgconfig files file(GLOB_RECURSE PC_IN_FILES "*.pc.in") @@ -79,5 +79,6 @@ foreach(pc_in_file ${PC_IN_FILES}) get_filename_component(pc_out_file ${pc_in_file} NAME) string(REPLACE ".pc.in" ".pc" pc_out_file ${pc_out_file}) configure_file(${pc_in_file} ${CMAKE_CURRENT_BINARY_DIR}/${pc_out_file} @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pc_out_file} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pc_out_file} + DESTINATION ${QTGSTREAMER_PC_INSTALL_DIR}) endforeach() diff --git a/src/QGlib/CMakeLists.txt b/src/QGlib/CMakeLists.txt index 16bb628..71850b1 100644 --- a/src/QGlib/CMakeLists.txt +++ b/src/QGlib/CMakeLists.txt @@ -53,5 +53,5 @@ target_link_libraries(${QTGLIB_LIBRARY} ${QT_QTCORE_LIBRARY} ${GOBJECT_LIBRARIES target_link_libraries(${QTGLIB_LIBRARY} LINK_INTERFACE_LIBRARIES ${QT_QTCORE_LIBRARY}) # Install -install(TARGETS ${QTGLIB_LIBRARY} DESTINATION ${LIB_INSTALL_DIR} EXPORT ${EXPORT_TARGET_SET}) +install(TARGETS ${QTGLIB_LIBRARY} EXPORT ${EXPORT_TARGET_SET} ${QTGSTREAMER_INSTALL_TARGET_DEFAULT_ARGS}) install_headers("QGlib" ${QtGLib_INSTALLED_HEADERS}) diff --git a/src/QGlib/QtGLib-2.0.pc.in b/src/QGlib/QtGLib-2.0.pc.in index 5e0c295..bbf9006 100644 --- a/src/QGlib/QtGLib-2.0.pc.in +++ b/src/QGlib/QtGLib-2.0.pc.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDES_INSTALL_DIR@ +libdir=@CMAKE_INSTALL_LIBDIR@ +includedir=@QTGSTREAMER_INCLUDES_INSTALL_DIR@ Name: QtGLib-2.0 Description: Qt-style C++ bindings library for GLib & GObject diff --git a/src/QGst/CMakeLists.txt b/src/QGst/CMakeLists.txt index 017329d..f8ac39c 100644 --- a/src/QGst/CMakeLists.txt +++ b/src/QGst/CMakeLists.txt @@ -169,7 +169,7 @@ target_link_libraries(${QTGSTREAMER_UTILS_LIBRARY} ${QTGSTREAMER_LIBRARY} ${GSTR target_link_libraries(${QTGSTREAMER_UTILS_LIBRARY} LINK_INTERFACE_LIBRARIES ${QTGSTREAMER_LIBRARY}) # Install -install(TARGETS ${QTGSTREAMER_LIBRARY} DESTINATION ${LIB_INSTALL_DIR} EXPORT ${EXPORT_TARGET_SET}) -install(TARGETS ${QTGSTREAMER_UI_LIBRARY} DESTINATION ${LIB_INSTALL_DIR} EXPORT ${EXPORT_TARGET_SET}) -install(TARGETS ${QTGSTREAMER_UTILS_LIBRARY} DESTINATION ${LIB_INSTALL_DIR} EXPORT ${EXPORT_TARGET_SET}) +install(TARGETS ${QTGSTREAMER_LIBRARY} EXPORT ${EXPORT_TARGET_SET} ${QTGSTREAMER_INSTALL_TARGET_DEFAULT_ARGS}) +install(TARGETS ${QTGSTREAMER_UI_LIBRARY} EXPORT ${EXPORT_TARGET_SET} ${QTGSTREAMER_INSTALL_TARGET_DEFAULT_ARGS}) +install(TARGETS ${QTGSTREAMER_UTILS_LIBRARY} EXPORT ${EXPORT_TARGET_SET} ${QTGSTREAMER_INSTALL_TARGET_DEFAULT_ARGS}) install_headers("QGst" ${QtGStreamer_INSTALLED_HEADERS}) diff --git a/src/QGst/QtGStreamer-0.10.pc.in b/src/QGst/QtGStreamer-0.10.pc.in index 9e783cd..784fbdc 100644 --- a/src/QGst/QtGStreamer-0.10.pc.in +++ b/src/QGst/QtGStreamer-0.10.pc.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDES_INSTALL_DIR@ +libdir=@CMAKE_INSTALL_LIBDIR@ +includedir=@QTGSTREAMER_INCLUDES_INSTALL_DIR@ Name: QtGStreamer-0.10 Description: Qt-style C++ bindings library for GStreamer diff --git a/src/QGst/QtGStreamerUi-0.10.pc.in b/src/QGst/QtGStreamerUi-0.10.pc.in index 5b483c3..017e177 100644 --- a/src/QGst/QtGStreamerUi-0.10.pc.in +++ b/src/QGst/QtGStreamerUi-0.10.pc.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDES_INSTALL_DIR@ +libdir=@CMAKE_INSTALL_LIBDIR@ +includedir=@QTGSTREAMER_INCLUDES_INSTALL_DIR@ Name: QtGStreamerUi-0.10 Description: QtGui/QtWidgets GStreamer integration library diff --git a/src/QGst/QtGStreamerUtils-0.10.pc.in b/src/QGst/QtGStreamerUtils-0.10.pc.in index 2254a38..2785da2 100644 --- a/src/QGst/QtGStreamerUtils-0.10.pc.in +++ b/src/QGst/QtGStreamerUtils-0.10.pc.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDES_INSTALL_DIR@ +libdir=@CMAKE_INSTALL_LIBDIR@ +includedir=@QTGSTREAMER_INCLUDES_INSTALL_DIR@ Name: QtGStreamerUtils-0.10 Description: QtGStreamer's high level utility classes diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt index 1bd63cb..b563195 100644 --- a/src/qml/CMakeLists.txt +++ b/src/qml/CMakeLists.txt @@ -9,10 +9,10 @@ target_link_libraries(QtGStreamerQML ${QT_QTDECLARATIVE_LIBRARY} ) -install(TARGETS QtGStreamerQML DESTINATION ${IMPORTS_INSTALL_DIR}/QtGStreamer) -install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/QtGStreamer) +install(TARGETS QtGStreamerQML DESTINATION ${QTGSTREAMER_QTQUICK1_INSTALL_DIR}/QtGStreamer) +install(FILES qmldir DESTINATION ${QTGSTREAMER_QTQUICK1_INSTALL_DIR}/QtGStreamer) -# create a layout similar to the one in ${IMPORTS_INSTALL_DIR} for testing +# create a layout similar to the one in ${QTGSTREAMER_QTQUICK1_INSTALL_DIR} for testing add_custom_command(TARGET QtGStreamerQML POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/QtGStreamer COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:QtGStreamerQML> ${CMAKE_CURRENT_BINARY_DIR}/QtGStreamer/ |