3 # Wireshark - Network traffic analyzer
4 # By Gerald Combs <gerald@wireshark.org>
5 # Copyright 1998 Gerald Combs
7 # SPDX-License-Identifier: GPL-2.0-or-later
10 # PortableApps.com appears to use "FooAppPortable" for 32-bit packages
11 # and "FooAppPortable64" for 64-bit packages. We deviate from that here
12 # by always appending a bit suffix.
14 # PA.com also tends to ship 32-bit and 64-bit executables in combined
15 # packages. We don't do that because a) we're large and b) we build
16 # our 32-bit and 64-bit packages independently in separate pipelines.
18 set(PORTABLEAPPS_BITS 64)
19 set(PORTABLEAPPS_BITS ${PORTABLEAPPS_BITS} PARENT_SCOPE)
21 set(PORTABLEAPPS_NAME "${CMAKE_PROJECT_NAME}Portable${PORTABLEAPPS_BITS}")
22 set(PORTABLEAPPS_NAME ${PORTABLEAPPS_NAME} PARENT_SCOPE)
24 set (_launcher_dir "${CMAKE_CURRENT_BINARY_DIR}/${PORTABLEAPPS_NAME}")
25 set (PORTABLEAPPS_LAUNCHER_STAGING_DIR ${_launcher_dir} PARENT_SCOPE)
30 ${_launcher_dir}/App/AppInfo
31 ${_launcher_dir}/App/AppInfo/Launcher
33 ${_launcher_dir}/Other
34 ${_launcher_dir}/Other/Source
38 macro( ADD_PORTABLEAPPS_PACKAGE_TARGET )
39 # Copy our binaries, libraries, and data files to the PortableApps build directory.
40 set(_wireshark_portableapps_app_dir "${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/${CMAKE_PROJECT_NAME}")
41 file(TO_NATIVE_PATH "${_wireshark_portableapps_app_dir}" _wireshark_portableapps_app_dir_native)
42 file(TO_NATIVE_PATH "${DATAFILE_DIR}" _datafile_dir_native)
43 file(TO_NATIVE_PATH "${_wireshark_portableapps_app_dir}/extcap" _wireshark_portableapps_extcap_dir_native)
44 file(TO_NATIVE_PATH "${DATAFILE_DIR}/extcap/${CMAKE_PROJECT_NAME}" _extcap_dir_native)
45 file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/packaging/portableapps/xcopy-deploy-exclude-pdb.txt" _xcopy_deploy_exclude_pdb)
46 file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/packaging/portableapps/xcopy-deploy-exclude-other.txt" _xcopy_deploy_exclude_other)
48 add_custom_target(wireshark_portableapps_app_dir
49 # We "Deploy using XCopy," which is described at
50 # https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/ms235291(v=vs.90)
51 # We also assume that the project has been built at this point.
52 COMMAND ${CMAKE_COMMAND} -E remove_directory ${_wireshark_portableapps_app_dir}
53 COMMAND ${CMAKE_COMMAND} -E make_directory ${_wireshark_portableapps_app_dir}
54 COMMAND xcopy ${_datafile_dir_native} ${_wireshark_portableapps_app_dir_native} /D /I /E /Y /exclude:${_xcopy_deploy_exclude_pdb}+${_xcopy_deploy_exclude_other}
55 COMMAND xcopy ${_extcap_dir_native} ${_wireshark_portableapps_extcap_dir_native} /D /I /E /Y /exclude:${_xcopy_deploy_exclude_pdb}
58 set_target_properties(wireshark_portableapps_app_dir PROPERTIES
60 EXCLUDE_FROM_DEFAULT_BUILD True
64 add_custom_target(wireshark_portableapps_runtime
65 COMMAND xcopy "${MSVCR_DLL}" ${_wireshark_portableapps_app_dir_native} /D /I /Y
68 add_custom_target(wireshark_portableapps_runtime
69 COMMAND ${CMAKE_COMMAND} -E echo "C Runtime MUST be installed on target system."
73 set_target_properties(wireshark_portableapps_runtime PROPERTIES
75 EXCLUDE_FROM_DEFAULT_BUILD True
77 add_dependencies(wireshark_portableapps_runtime wireshark_portableapps_app_dir)
79 # Build the PortableApps package.
80 # wireshark_nsis_prep must be built prior to this.
81 # XXX Rename this to wireshark_portableapps
82 set (_portableapps_package ${CMAKE_BINARY_DIR}/packaging/portableapps/${PORTABLEAPPS_NAME}_${PROJECT_VERSION}.paf.exe)
83 add_custom_target(wireshark_portableapps
85 wireshark_portableapps_runtime
86 ${_portableapps_package}
88 set_target_properties(wireshark_portableapps PROPERTIES
90 EXCLUDE_FROM_DEFAULT_BUILD True
93 set(PORTABLEAPPS_PACKAGE_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.0")
95 ${CMAKE_SOURCE_DIR}/packaging/portableapps/appinfo.tmpl
96 ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appinfo.ini
100 foreach(_portableapps_dir ${PORTABLEAPPS_DIRS})
101 file(MAKE_DIRECTORY ${_portableapps_dir})
104 set(_portableapps_launcher_ini ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/Launcher/${PORTABLEAPPS_NAME}.ini)
106 ${CMAKE_SOURCE_DIR}/packaging/portableapps/${CMAKE_PROJECT_NAME}Portable.tmpl
107 ${_portableapps_launcher_ini}
111 set(_portableapps_launcher_exe ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/${PORTABLEAPPS_NAME}.exe)
112 file(TO_NATIVE_PATH "${PORTABLEAPPS_LAUNCHER_STAGING_DIR}" _portableapps_native )
113 add_custom_command(OUTPUT ${_portableapps_launcher_exe}
115 ${_portableapps_launcher_ini}
116 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/packaging/portableapps/help.html ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/help.html
117 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/packaging/portableapps/help.html ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/help.html
118 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/resources/icons/wireshark.ico ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appicon.ico
119 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/resources/icons/wsicon16.png ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appicon_16.png
120 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/resources/icons/wsicon32.png ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appicon_32.png
121 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/resources/icons/wsicon128.png ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appicon_128.png
122 COMMAND ${PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE} ${_portableapps_native}
125 add_custom_command(OUTPUT ${_portableapps_package}
127 ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appinfo.ini
128 ${_portableapps_launcher_ini}
129 ${_portableapps_launcher_exe}
130 COMMAND ${PORTABLEAPPS_INSTALLER_EXECUTABLE} ${_portableapps_native}
132 endmacro( ADD_PORTABLEAPPS_PACKAGE_TARGET )
136 # ${_portableapps_package}