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 "${CMAKE_SOURCE_DIR}/packaging/portableapps/xcopy-deploy-exclude.txt" _xcopy_deploy_exclude)
45 add_custom_target(wireshark_portableapps_app_dir
46 # We "Deploy using XCopy," which is described at
47 # https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/ms235291(v=vs.90)
48 # We also assume that the project has been built at this point.
49 COMMAND ${CMAKE_COMMAND} -E remove_directory ${_wireshark_portableapps_app_dir}
50 COMMAND ${CMAKE_COMMAND} -E make_directory ${_wireshark_portableapps_app_dir}
51 COMMAND xcopy ${_datafile_dir_native} ${_wireshark_portableapps_app_dir_native} /D /I /E /Y /exclude:${_xcopy_deploy_exclude}
54 set_target_properties(wireshark_portableapps_app_dir PROPERTIES
56 EXCLUDE_FROM_DEFAULT_BUILD True
60 add_custom_target(wireshark_portableapps_runtime
61 COMMAND xcopy "${MSVCR_DLL}" ${_wireshark_portableapps_app_dir_native} /D /I /Y
64 add_custom_target(wireshark_portableapps_runtime
65 COMMAND ${CMAKE_COMMAND} -E echo "C Runtime MUST be installed on target system."
69 set_target_properties(wireshark_portableapps_runtime PROPERTIES
71 EXCLUDE_FROM_DEFAULT_BUILD True
73 add_dependencies(wireshark_portableapps_runtime wireshark_portableapps_app_dir)
75 # Build the PortableApps package.
76 # wireshark_nsis_prep must be built prior to this.
77 # XXX Rename this to wireshark_portableapps
78 set (_portableapps_package ${CMAKE_BINARY_DIR}/packaging/portableapps/${PORTABLEAPPS_NAME}_${PROJECT_VERSION}.paf.exe)
79 add_custom_target(wireshark_portableapps
81 wireshark_portableapps_runtime
82 ${_portableapps_package}
84 set_target_properties(wireshark_portableapps PROPERTIES
86 EXCLUDE_FROM_DEFAULT_BUILD True
89 set(PORTABLEAPPS_PACKAGE_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.0")
91 ${CMAKE_SOURCE_DIR}/packaging/portableapps/appinfo.tmpl
92 ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appinfo.ini
96 foreach(_portableapps_dir ${PORTABLEAPPS_DIRS})
97 file(MAKE_DIRECTORY ${_portableapps_dir})
100 set(_portableapps_launcher_ini ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/Launcher/${PORTABLEAPPS_NAME}.ini)
102 ${CMAKE_SOURCE_DIR}/packaging/portableapps/${CMAKE_PROJECT_NAME}Portable.tmpl
103 ${_portableapps_launcher_ini}
107 set(_portableapps_launcher_exe ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/${PORTABLEAPPS_NAME}.exe)
108 file(TO_NATIVE_PATH "${PORTABLEAPPS_LAUNCHER_STAGING_DIR}" _portableapps_native )
109 add_custom_command(OUTPUT ${_portableapps_launcher_exe}
111 ${_portableapps_launcher_ini}
112 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/packaging/portableapps/help.html ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/help.html
113 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/packaging/portableapps/help.html ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/help.html
114 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/resources/icons/wireshark.ico ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appicon.ico
115 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/resources/icons/wsicon16.png ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appicon_16.png
116 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/resources/icons/wsicon32.png ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appicon_32.png
117 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/resources/icons/wsicon128.png ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appicon_128.png
118 COMMAND ${PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE} ${_portableapps_native}
121 add_custom_command(OUTPUT ${_portableapps_package}
123 ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appinfo.ini
124 ${_portableapps_launcher_ini}
125 ${_portableapps_launcher_exe}
126 COMMAND ${PORTABLEAPPS_INSTALLER_EXECUTABLE} ${_portableapps_native}
128 endmacro( ADD_PORTABLEAPPS_PACKAGE_TARGET )
132 # ${_portableapps_package}