aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-12-07 02:01:28 +0100
committerJoão Valverde <j@v6e.pt>2018-12-07 02:01:40 +0000
commitf7def1d07f39c8b90245a20d09a4b56ae23de077 (patch)
treef8bb5f30127ca6e6f2f2aca639f5a011f3972e39 /CMakeLists.txt
parentceef87c5507388a789af18366b896a88c4a9861b (diff)
Revert "CMake: Fix Windows help install target"
This reverts commit 8992760c68f3e508a0e5a25307c246a75f7c2ae2. Breaks the "make clean" target as it tries to remove the "help" directory. Since this change, the macOS builds started failing tests as well (init.lua and colorfilters seems not to be applied). Change-Id: I3fce346e04875e667680a4ed9ba3beca8054a168 Reviewed-on: https://code.wireshark.org/review/30950 Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt97
1 files changed, 75 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0cbca5c297..c755b156c3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,26 +156,6 @@ if(NOT LIBRARY_OUTPUT_PATH)
"Single output directory for building all libraries.")
endif()
-# Location of our data files. This should be set to a value that allows
-# running from the build directory on Windows, on macOS when building an
-# application bundle, and on UNIX in general if
-# WIRESHARK_RUN_FROM_BUILD_DIRECTORY is set.
-if(ENABLE_APPLICATION_BUNDLE)
- if(CMAKE_CFG_INTDIR STREQUAL ".")
- set(_datafile_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Resources/share/wireshark")
- else()
- # Xcode
- set(_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}/Wireshark.app/Contents/Resources/share/wireshark")
- endif()
-elseif(NOT CMAKE_CFG_INTDIR STREQUAL ".")
- # Visual Studio, Xcode, etc.
- set(_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}")
-else()
- # Makefile, Ninja, etc.
- set(_datafile_dir "${CMAKE_BINARY_DIR}/run")
-endif()
-set(DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.")
-
#
# The release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG for
# the Unix Makefile generator.
@@ -1390,12 +1370,35 @@ add_subdirectory( doc )
add_subdirectory( docbook EXCLUDE_FROM_ALL )
add_subdirectory( epan )
add_subdirectory( extcap )
-add_subdirectory( help )
add_subdirectory( randpkt_core )
add_subdirectory( tools/lemon )
add_subdirectory( ui )
add_subdirectory( wiretap )
add_subdirectory( writecap )
+
+# Location of our data files. This should be set to a value that allows
+# running from the build directory on Windows, on macOS when building an
+# application bundle, and on UNIX in general if
+# WIRESHARK_RUN_FROM_BUILD_DIRECTORY is set.
+if(ENABLE_APPLICATION_BUNDLE)
+ if(CMAKE_CFG_INTDIR STREQUAL ".")
+ set(_datafile_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Resources/share/wireshark")
+ else()
+ # Xcode
+ set(_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}/Wireshark.app/Contents/Resources/share/wireshark")
+ endif()
+elseif(NOT CMAKE_CFG_INTDIR STREQUAL ".")
+ # Visual Studio, Xcode, etc.
+ set(_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}")
+else()
+ # Makefile, Ninja, etc.
+ set(_datafile_dir "${CMAKE_BINARY_DIR}/run")
+endif()
+
+set(DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.")
+
+# wsutil must be added after DATAFILE_DIR is set such that filesystem.c can
+# learn about the directory location.
add_subdirectory( wsutil )
if(NOT WIN32)
@@ -1634,6 +1637,15 @@ set(INSTALL_DIRS
wimaxasncp
)
+# FIXME: The help files are textfified on Windows into the staging dir.
+# The DATAFILE_DIR depends on CMAKE_CFG_INTDIR therefore it cannot be
+# added to an install() command with build systems supporting multiple
+# configurations in the build tree (e.g.: Visual Studio).
+if(NOT WIN32)
+ list(APPEND INSTALL_DIRS help)
+endif()
+
+
set(INSTALL_FILES
cfilters
colorfilters
@@ -1859,7 +1871,9 @@ set(copy_data_files_depends)
# glob patterns relative to the source directory that should be copied to
# ${DATAFILE_DIR} (including directory prefixes)
-set(DATA_FILES_SRC)
+set(DATA_FILES_SRC
+ "help/toc"
+)
if(WIN32)
foreach(_text_file ${TEXTIFY_FILES})
@@ -1901,6 +1915,45 @@ foreach(_install_file ${INSTALL_FILES})
list(APPEND copy_data_files_depends "${_output_file}")
endforeach()
+# faq.txt is handled separately below.
+set(_help_source_files
+ help/capture_filters.txt
+ help/capturing.txt
+ help/display_filters.txt
+ help/getting_started.txt
+ help/overview.txt
+)
+
+if(WIN32)
+ file(TO_NATIVE_PATH "${DATAFILE_DIR}/help" _help_dest_dir)
+ foreach(_help_file IN LISTS _help_source_files)
+ add_custom_command(OUTPUT "${DATAFILE_DIR}/${_help_file}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
+ COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
+ -Destination "${_help_dest_dir}"
+ "${CMAKE_SOURCE_DIR}/${_help_file}"
+ DEPENDS
+ "${CMAKE_SOURCE_DIR}/${_help_file}"
+ )
+ list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_help_file}")
+ endforeach()
+else()
+ list(APPEND DATA_FILES_SRC ${_help_source_files})
+endif(WIN32)
+
+# Create help/faq.txt when missing
+add_custom_command(OUTPUT "${DATAFILE_DIR}/help/faq.txt"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/help/faq.py -b > faq.tmp.html
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
+ faq.tmp.html > "${DATAFILE_DIR}/help/faq.txt"
+ COMMAND ${CMAKE_COMMAND} -E remove faq.tmp.html
+ DEPENDS
+ "${CMAKE_SOURCE_DIR}/help/faq.py"
+ "${CMAKE_SOURCE_DIR}/tools/html2text.py"
+)
+list(APPEND copy_data_files_depends "${DATAFILE_DIR}/help/faq.txt")
+
# Install LUA files in staging directory such that LUA can used when Wireshark
# is ran from the build directory. For install targets, see
# epan/wslua/CMakeLists.txt