Commit 39efd6eb authored by Ralf Habacker's avatar Ralf Habacker

Add version info to installed executables for cmake build system on Windows

Signed-off-by: Ralf Habacker's avatarRalf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103387
parent 64a1d59b
......@@ -44,6 +44,8 @@ autopackage(
include(Macros)
string(TIMESTAMP DBUS_BUILD_TIMESTAMP "%Y%m%d%H%M" UTC)
set (BUILD_FILEVERSION ${DBUS_MAJOR_VERSION},${DBUS_MINOR_VERSION},${DBUS_MICRO_VERSION},${DBUS_PATCH_VERSION})
set (BUILD_TIMESTAMP ${DBUS_BUILD_TIMESTAMP})
########### basic vars ###############
......
......@@ -90,6 +90,14 @@ include_directories(
${EXPAT_INCLUDE_DIR}
)
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-daemon")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(${CMAKE_SOURCE_DIR}/../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND BUS_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
endif()
add_executable(dbus-daemon ${BUS_SOURCES} ${BUS_DIR}/main.c)
target_link_libraries(dbus-daemon ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES})
set_target_properties(dbus-daemon PROPERTIES OUTPUT_NAME ${DBUS_DAEMON_NAME})
......@@ -110,13 +118,18 @@ if(NOT WIN32)
endif()
if (DBUS_SERVICE)
set (dbus_service_SOURCES
${BUS_DIR}/bus-service-win.c
set (dbus_service_SOURCES
${BUS_DIR}/bus-service-win.c
# TODO: add additional files
# ${BUS_DIR}/service-main.c
# ${BUS_SOURCES}
# ${BUS_SOURCES}
)
set(DBUS_VER_INTERNAL_NAME "dbus-service")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(${CMAKE_SOURCE_DIR}/../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_service_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
add_executable(dbus-service ${dbus_service_SOURCES} )
target_link_libraries(dbus-service ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES})
set_target_properties(dbus-service PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
......
......@@ -243,11 +243,17 @@ set(libdbus_HEADERS
${DBUS_SHARED_HEADERS}
)
set (BUILD_FILEVERSION ${DBUS_MAJOR_VERSION},${DBUS_MINOR_VERSION},${DBUS_MICRO_VERSION},${DBUS_PATCH_VERSION})
set (BUILD_TIMESTAMP ${DBUS_BUILD_TIMESTAMP})
if(DEFINED DBUS_LIBRARY_REVISION)
math(EXPR DBUS_LIBRARY_MAJOR "${DBUS_LIBRARY_CURRENT} - ${DBUS_LIBRARY_AGE}")
endif()
configure_file(${DBUS_DIR}/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo.rc)
list(APPEND libdbus_SOURCES versioninfo.rc)
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "${CMAKE_SHARED_LIBRARY_PREFIX}dbus-1-${DBUS_LIBRARY_MAJOR}")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_DLL")
configure_file(${DBUS_DIR}/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo.rc)
list(APPEND libdbus_SOURCES versioninfo.rc)
endif()
if(MSVC_IDE)
project_source_group(${GROUP_CODE} DBUS_LIB_SOURCES DBUS_LIB_HEADERS)
......@@ -266,9 +272,6 @@ add_library(dbus-1 SHARED
${libdbus_SOURCES}
${libdbus_HEADERS}
)
if(DEFINED DBUS_LIBRARY_REVISION)
math(EXPR DBUS_LIBRARY_MAJOR "${DBUS_LIBRARY_CURRENT} - ${DBUS_LIBRARY_AGE}")
endif()
if(WIN32)
if(DEFINED DBUS_LIBRARY_REVISION)
......
......@@ -54,14 +54,38 @@ set (dbus_cleanup_sockets_SOURCES
../../tools/dbus-cleanup-sockets.c
)
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-send")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(${CMAKE_SOURCE_DIR}/../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_send_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
endif()
add_executable(dbus-send ${dbus_send_SOURCES})
target_link_libraries(dbus-send ${DBUS_LIBRARIES})
install(TARGETS dbus-send ${INSTALL_TARGETS_DEFAULT_ARGS})
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-test-tool")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(${CMAKE_SOURCE_DIR}/../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_test_tool_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
endif()
add_executable(dbus-test-tool ${dbus_test_tool_SOURCES})
target_link_libraries(dbus-test-tool ${DBUS_LIBRARIES})
install(TARGETS dbus-test-tool ${INSTALL_TARGETS_DEFAULT_ARGS})
if(WIN32)
# version info and uac manifest can be combined in a binary because they use different resource types
set(DBUS_VER_INTERNAL_NAME "dbus-update-activation-environment")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(${CMAKE_SOURCE_DIR}/../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_update_activation_environment_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
endif()
if(WIN32 AND NOT MSVC)
# avoid dbus-update-activation-environment triggering UAC
# 1 is the resource ID, ID_MANIFEST
......@@ -75,6 +99,14 @@ add_executable(dbus-update-activation-environment ${dbus_update_activation_envir
target_link_libraries(dbus-update-activation-environment ${DBUS_LIBRARIES})
install(TARGETS dbus-update-activation-environment ${INSTALL_TARGETS_DEFAULT_ARGS})
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-launch")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(${CMAKE_SOURCE_DIR}/../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_launch_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
endif()
add_executable(dbus-launch ${dbus_launch_SOURCES})
target_link_libraries(dbus-launch ${DBUS_LIBRARIES})
if (DBUS_BUILD_X11)
......@@ -82,6 +114,14 @@ if (DBUS_BUILD_X11)
endif (DBUS_BUILD_X11)
install(TARGETS dbus-launch ${INSTALL_TARGETS_DEFAULT_ARGS})
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-monitor")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(${CMAKE_SOURCE_DIR}/../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_monitor_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
endif()
add_executable(dbus-monitor ${dbus_monitor_SOURCES})
target_link_libraries(dbus-monitor ${DBUS_LIBRARIES})
install(TARGETS dbus-monitor ${INSTALL_TARGETS_DEFAULT_ARGS})
......
......@@ -151,6 +151,13 @@ if test "$dbus_win" = yes; then
# Assume DBUS_VERSION is always three numbers
BUILD_FILEVERSION=`echo "$DBUS_VERSION" | sed -e 's/\./,/g'`,0
AC_SUBST(BUILD_FILEVERSION)
# In the CMake build system we generate multiple files, versioninfo-*.rc, with a
# different "internal name" and "original filename", for embedding in multiple
# executables. In the Autotools build system, we currently only generate
# versioninfo.rc and embed it in libdbus-1-${SOVERSION}.dll.
AC_SUBST([DBUS_VER_INTERNAL_NAME], [libdbus-1-${SOVERSION}])
AC_SUBST([DBUS_VER_ORIGINAL_NAME], [libdbus-1-${SOVERSION}.dll])
AC_SUBST([DBUS_VER_FILE_TYPE], [VFT_DLL])
AS_IF([test -z "$RC"],
[AC_MSG_ERROR([An implementation of windres is required])])
if test "$dbus_wince" = yes; then
......
......@@ -24,7 +24,7 @@ VS_VERSION_INFO VERSIONINFO
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILETYPE @DBUS_VER_FILE_TYPE@
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
......@@ -32,14 +32,14 @@ BEGIN
/* string need to match concated hex values in 'VarFileInfo' block */
BLOCK "040904e4"
BEGIN
VALUE "Comments", "Provided under the terms of the GNU Lesser General Public License >= 2.0 or Academic Free License version 2.1\0"
VALUE "Comments", "Provided under the terms of the GNU General Public License >= 2.0 or Academic Free License version 2.1\0"
VALUE "CompanyName", "freedesktop.org\0"
VALUE "FileDescription", "dbus - FreeDesktop message bus system\0"
VALUE "FileVersion", "@DBUS_VERSION@\0"
VALUE "InternalName", "libdbus-1-3\0"
VALUE "LegalCopyright", "Copyright 1994-2017 dbus contributors, see dbus source code for details\0"
VALUE "InternalName", "@DBUS_VER_INTERNAL_NAME@\0"
VALUE "LegalCopyright", "Copyright 1994-2018 dbus contributors, see dbus source code for details\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libdbus-1-3.dll\0"
VALUE "OriginalFilename", "@DBUS_VER_ORIGINAL_NAME@\0"
VALUE "ProductName", "dbus\0"
VALUE "ProductVersion", "@DBUS_VERSION@\0"
VALUE "SpecialBuild", "@BUILD_TIMESTAMP@\0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment