epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / packaging / portableapps / CMakeLists.txt
blobad84fd12ed11dfbfb859c0c33d994de75e49dd15
1 # CMakeLists.txt
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)
27 set(PORTABLEAPPS_DIRS
28         ${_launcher_dir}
29         ${_launcher_dir}/App
30         ${_launcher_dir}/App/AppInfo
31         ${_launcher_dir}/App/AppInfo/Launcher
32         ${_launcher_dir}/Data
33         ${_launcher_dir}/Other
34         ${_launcher_dir}/Other/Source
35         PARENT_SCOPE
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}
52         )
54         set_target_properties(wireshark_portableapps_app_dir PROPERTIES
55                 FOLDER "Packaging"
56                 EXCLUDE_FROM_DEFAULT_BUILD True
57         )
59         if(MSVCR_DLL)
60                 add_custom_target(wireshark_portableapps_runtime
61                         COMMAND xcopy "${MSVCR_DLL}" ${_wireshark_portableapps_app_dir_native} /D /I /Y
62                 )
63         else(MSVCR_DLL)
64                 add_custom_target(wireshark_portableapps_runtime
65                         COMMAND ${CMAKE_COMMAND} -E echo "C Runtime MUST be installed on target system."
66                 )
67         endif(MSVCR_DLL)
69         set_target_properties(wireshark_portableapps_runtime PROPERTIES
70                 FOLDER "Packaging"
71                 EXCLUDE_FROM_DEFAULT_BUILD True
72         )
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
80                 DEPENDS
81                         wireshark_portableapps_runtime
82                         ${_portableapps_package}
83         )
84         set_target_properties(wireshark_portableapps PROPERTIES
85                 FOLDER "Packaging"
86                 EXCLUDE_FROM_DEFAULT_BUILD True
87         )
89         set(PORTABLEAPPS_PACKAGE_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.0")
90         configure_file(
91                 ${CMAKE_SOURCE_DIR}/packaging/portableapps/appinfo.tmpl
92                 ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appinfo.ini
93                 NEWLINE_STYLE WIN32
94         )
96         foreach(_portableapps_dir ${PORTABLEAPPS_DIRS})
97                 file(MAKE_DIRECTORY ${_portableapps_dir})
98         endforeach()
100         set(_portableapps_launcher_ini ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/Launcher/${PORTABLEAPPS_NAME}.ini)
101         configure_file(
102                 ${CMAKE_SOURCE_DIR}/packaging/portableapps/${CMAKE_PROJECT_NAME}Portable.tmpl
103                 ${_portableapps_launcher_ini}
104                 NEWLINE_STYLE WIN32
105         )
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}
110                 DEPENDS
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}
119         )
121         add_custom_command(OUTPUT ${_portableapps_package}
122                 DEPENDS
123                         ${PORTABLEAPPS_LAUNCHER_STAGING_DIR}/App/AppInfo/appinfo.ini
124                         ${_portableapps_launcher_ini}
125                         ${_portableapps_launcher_exe}
126                 COMMAND ${PORTABLEAPPS_INSTALLER_EXECUTABLE} ${_portableapps_native}
127         )
128 endmacro( ADD_PORTABLEAPPS_PACKAGE_TARGET )
130 #set(CLEAN_FILES
131 #       ${_launcher_dir}
132 #       ${_portableapps_package}