Merge pull request #3161 from bmiklautz/uwac_versioning

uwac: versioning and export
This commit is contained in:
akallabeth 2016-02-26 09:23:34 +01:00
commit f44f339ce8
8 changed files with 116 additions and 14 deletions

View File

@ -1,5 +1,5 @@
# - Finds Wayland
# Find the Wayland libraries that are needed for UWAC
# Find the Wayland libraries that are needed for UWAC
#
# This module defines the following variables:
# WAYLAND_FOUND - true if UWAC has been found
@ -28,29 +28,29 @@
include(FindPkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(WAYLAND_SCANNER_PKG wayland-scanner)
pkg_check_modules(WAYLAND_CLIENT_PKG wayland-client)
pkg_check_modules(XKBCOMMON_PC_PKG xkbcommon)
pkg_check_modules(WAYLAND_SCANNER_PC wayland-scanner)
pkg_check_modules(WAYLAND_CLIENT_PC wayland-client)
pkg_check_modules(XKBCOMMON_PC xkbcommon)
endif()
find_program(WAYLAND_SCANNER wayland-scanner
HINTS "${WAYLAND_SCANNER_PKG_PREFIX}/bin"
HINTS "${WAYLAND_SCANNER_PC_PREFIX}/bin"
)
find_path(WAYLAND_INCLUDE_DIR wayland-client.h
HINTS ${WAYLAND_CLIENT_PKG_INCLUDE_DIRS}
HINTS ${WAYLAND_CLIENT_PC_INCLUDE_DIRS}
)
find_library(WAYLAND_LIBS
find_library(WAYLAND_LIBS
NAMES "wayland-client"
HINTS "${WAYLAND_CLIENT_PKG_LIBRARY_DIRS}"
HINTS "${WAYLAND_CLIENT_PC_LIBRARY_DIRS}"
)
find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h
HINTS ${XKBCOMMON_PC_INCLUDE_DIRS}
)
find_library(XKBCOMMON_LIBS
find_library(XKBCOMMON_LIBS
NAMES xkbcommon
HINTS "${XKBCOMMON_PC_LIBRARY_DIRS}"
)

View File

@ -15,6 +15,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Soname versioning
set(UWAC_VERSION_MAJOR "0")
set(UWAC_VERSION_MINOR "0")
set(UWAC_VERSION_REVISION "1")
set(UWAC_VERSION "${UWAC_VERSION_MAJOR}.${UWAC_VERSION_MINOR}.${UWAC_VERSION_REVISION}")
set(UWAC_VERSION_FULL "${UWAC_VERSION}")
set(UWAC_API_VERSION "${UWAC_VERSION_MAJOR}")
add_subdirectory(include)
add_subdirectory(libuwac)
set(UWAC_INCLUDE_DIR "include/uwac${UWAC_VERSION_MAJOR}")
# cmake package
if(${CMAKE_VERSION} VERSION_GREATER "2.8.10")
export(PACKAGE uwac)
set(UWAC_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/uwac${UWAC_VERSION_MAJOR}")
configure_package_config_file(uwacConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake
INSTALL_DESTINATION ${UWAC_CMAKE_INSTALL_DIR}
PATH_VARS UWAC_INCLUDE_DIR)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake
VERSION ${UWAC_VERSION} COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake
DESTINATION ${UWAC_CMAKE_INSTALL_DIR})
install(EXPORT uwac DESTINATION ${UWAC_CMAKE_INSTALL_DIR})
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/uwac.pc.in ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

View File

@ -16,5 +16,4 @@
# limitations under the License.
file(GLOB UWAC_HEADERS "uwac/*.h")
install(FILES ${UWAC_HEADERS} DESTINATION include/uwac COMPONENT headers)
install(FILES ${UWAC_HEADERS} DESTINATION include/uwac${UWAC_API_VERSION}/uwac COMPONENT headers)

View File

@ -65,12 +65,12 @@ add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
if (WITH_LIBRARY_VERSIONING)
#set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${UWAC_VERSION} SOVERSION ${UWAC_API_VERSION})
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${UWAC_VERSION} SOVERSION ${UWAC_API_VERSION})
endif()
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} ${WAYLAND_LIBS} ${XKBCOMMON_LIBS})
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} ${WAYLAND_LIBS} ${XKBCOMMON_LIBS} freerdp)
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT Uwac)
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT uwac)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "uwac")

15
uwac/uwac.pc.in Normal file
View File

@ -0,0 +1,15 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=${prefix}/@UWAC_INCLUDE_DIR@
libs=-luwac
Name: uwac
Description: uwac: using wayland as a client
URL: http://www.freerdp.com/
Version: @UWAC_VERSION@
Requires:
Requires.private: wayland-client xkbcommon freerdp@FREERDP_VERSION_MAJOR@
Libs: -L${libdir} ${libs}
Libs.private:
Cflags: -I${includedir}

9
uwac/uwacConfig.cmake.in Normal file
View File

@ -0,0 +1,9 @@
@PACKAGE_INIT@
set(UWAC_VERSION_MAJOR "@UWAC_VERSION_MAJOR@")
set(UWAC_VERSION_MINOR "@UWAC_VERSION_MINOR@")
set(UWAC_VERSION_REVISION "@UWAC_VERSION_REVISION@")
set_and_check(UWAC_INCLUDE_DIR "@PACKAGE_UWAC_INCLUDE_DIR@")
include("${CMAKE_CURRENT_LIST_DIR}/uwac.cmake")

46
uwac/uwacVersion.cmake Normal file
View File

@ -0,0 +1,46 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
# but only if the requested major version is the same as the current one.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "0.0.1")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
if("0.0.1" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_MAJOR "0.0.1")
endif()
if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${CVF_VERSION_MAJOR}")
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -66,6 +66,7 @@ endif(NOT IOS)
if(FREERDP_BUILD)
set(WINPR_VERSION_FULL ${WINPR_VERSION_FULL} PARENT_SCOPE)
set(WINPR_VERSION ${WINPR_VERSION} PARENT_SCOPE)
set(WINPR_API_VERSION ${WINPR_API_VERSION} PARENT_SCOPE)
else()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)