forked from osmocom/wireshark
Fix build paths for cmake's Xcode project generator on macOS.
Multi-configuration generators (such as Xcode or VS) append the current build configuration to most paths (eg. Debug/Release). Currently this results in inconsistent paths for the application bundle and the included command line tools. This commit sets the correct path information for multi-configuration generators for macOS application bundles. The standard Makefile behaviour is untouched. One Windows specific configuration was changed, as it was conflicting with these changes. This needs to be checked before merging. Additionally the wrapper scripts are omitted for Xcode, as the path to the binaries depends on the configuration chosen in Xcode. Therefore it is not viable to create these scripts in the cmake run. Bug: 11816 Change-Id: Ib43d82eb04600a0e2f2b020afb44b579ffc7a7c9 Reviewed-on: https://code.wireshark.org/review/28291 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>thomas/dect
parent
17604f15a1
commit
11ba10dd4b
|
@ -1307,7 +1307,12 @@ add_subdirectory( writecap )
|
|||
# application bundle, and on UNIX in general if
|
||||
# WIRESHARK_RUN_FROM_BUILD_DIRECTORY is set.
|
||||
if(ENABLE_APPLICATION_BUNDLE)
|
||||
set(_datafile_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Resources/share/wireshark")
|
||||
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}")
|
||||
|
@ -1346,7 +1351,7 @@ if(ENABLE_PLUGINS)
|
|||
# Target platform locations
|
||||
# UN*X in general, including macOS if not building an app bundle:
|
||||
# $DESTDIR/lib/wireshark/plugins/$VERSION
|
||||
# Windows: $DESTDIR/wireshark/plubins/$VERSION
|
||||
# Windows: $DESTDIR/wireshark/plugins/$VERSION
|
||||
# macOS app bundle: Wireshark.app/Contents/PlugIns/wireshark
|
||||
set(HAVE_PLUGINS 1)
|
||||
add_custom_target(plugins)
|
||||
|
@ -1382,7 +1387,14 @@ else()
|
|||
endif()
|
||||
|
||||
if(ENABLE_APPLICATION_BUNDLE)
|
||||
set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark/${PROJECT_RELEASE_VERSION}")
|
||||
if(CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark/${PROJECT_RELEASE_VERSION}")
|
||||
else()
|
||||
# Xcode
|
||||
set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/PlugIns/wireshark/${PROJECT_RELEASE_VERSION}")
|
||||
endif()
|
||||
elseif(WIN32 AND NOT CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/${PLUGIN_VERSION_DIR}")
|
||||
else()
|
||||
set(_plugin_dir "${DATAFILE_DIR}/${PLUGIN_VERSION_DIR}")
|
||||
endif()
|
||||
|
@ -2179,13 +2191,16 @@ if(BUILD_wireshark AND QT_FOUND)
|
|||
wireshark PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/packaging/macosx/Info.plist
|
||||
)
|
||||
# Add a wrapper script which opens the bundle. This adds
|
||||
# convenience but makes debugging more difficult.
|
||||
file(REMOVE ${CMAKE_BINARY_DIR}/run/wireshark)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/run/wireshark "#!/bin/sh\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "# Generated by ${CMAKE_CURRENT_LIST_FILE}\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/Wireshark \"\$\@\"\n")
|
||||
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
|
||||
if(CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
# Add a wrapper script which opens the bundle. This adds
|
||||
# convenience but makes debugging more difficult.
|
||||
# It is not created if using Xcode
|
||||
file(REMOVE ${CMAKE_BINARY_DIR}/run/wireshark)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/run/wireshark "#!/bin/sh\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "# Generated by ${CMAKE_CURRENT_LIST_FILE}\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/Wireshark \"\$\@\"\n")
|
||||
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(wireshark ${wireshark_LIBS})
|
||||
|
@ -2224,16 +2239,23 @@ macro(set_extra_executable_properties _executable _folder)
|
|||
set(PROGLIST ${PROGLIST} ${_executable})
|
||||
|
||||
if(ENABLE_APPLICATION_BUNDLE)
|
||||
set_target_properties(${_executable} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS
|
||||
)
|
||||
# Add a wrapper script which runs each executable from the
|
||||
# correct location. This adds convenience but makes debugging
|
||||
# more difficult.
|
||||
file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/${_executable} \"\$\@\"\n")
|
||||
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
|
||||
if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
# Xcode
|
||||
set_target_properties(${_executable} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY run/$<CONFIG>/Wireshark.app/Contents/MacOS
|
||||
)
|
||||
else ()
|
||||
set_target_properties(${_executable} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS
|
||||
)
|
||||
# Add a wrapper script which runs each executable from the
|
||||
# correct location. This adds convenience but makes debugging
|
||||
# more difficult.
|
||||
file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/${_executable} \"\$\@\"\n")
|
||||
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
|
16
README.macos
16
README.macos
|
@ -74,6 +74,22 @@ directory;
|
|||
cmake ..
|
||||
make
|
||||
|
||||
It is also possible to use the Xcode IDE to build and debug Wireshark
|
||||
using cmake's Xcode generator. Create a separate build directory, as
|
||||
described above and run cmake with the "-G Xcode" argument to create
|
||||
a Xcode project file in the current directory.
|
||||
|
||||
cmake -G Xcode ..
|
||||
|
||||
1. Double click Wireshark.xcodeproj
|
||||
|
||||
2. Choose to create schemes manually
|
||||
|
||||
3. Create a scheme for the ALL_BUILD target
|
||||
|
||||
4. Edit the scheme, go to the run configuration and select Wireshark.app
|
||||
as executable
|
||||
|
||||
If you upgrade the major release of macOS on which you are building
|
||||
Wireshark, we advise that, before you do any builds after the upgrade,
|
||||
you remove the build directory and all its subdiretories, and repeat the
|
||||
|
|
|
@ -44,15 +44,6 @@ macro(ADD_PLUGIN_LIBRARY _plugin _subfolder)
|
|||
LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_DIR}/${_subfolder}
|
||||
)
|
||||
|
||||
# Try to force output to ${PLUGIN_DIR} without the configuration
|
||||
# type appended. Needed on Windows.
|
||||
foreach(_config_type ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(TOUPPER ${_config_type} _config_upper)
|
||||
set_target_properties(${_plugin} PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY_${_config_upper} ${CMAKE_BINARY_DIR}/run/${_config_type}/${PLUGIN_VERSION_DIR}/${_subfolder}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
add_dependencies(plugins ${_plugin})
|
||||
endmacro()
|
||||
|
||||
|
|
|
@ -66,6 +66,16 @@ if(ENABLE_APPLICATION_BUNDLE)
|
|||
set_target_properties(wscodecs PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
# Xcode
|
||||
set_target_properties(wscodecs PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
else()
|
||||
set_target_properties(wscodecs PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(wscodecs ${wscodecs_LIBS})
|
||||
|
|
|
@ -313,9 +313,16 @@ set_target_properties(epan PROPERTIES
|
|||
)
|
||||
|
||||
if(ENABLE_APPLICATION_BUNDLE)
|
||||
set_target_properties(epan PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
# Xcode
|
||||
set_target_properties(epan PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
else()
|
||||
set_target_properties(epan PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ABICHECK(libwireshark)
|
||||
|
|
|
@ -47,16 +47,23 @@ macro(set_extcap_executable_properties _executable)
|
|||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
|
||||
)
|
||||
if(ENABLE_APPLICATION_BUNDLE)
|
||||
set_target_properties(${_executable} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS/extcap
|
||||
)
|
||||
# Add a wrapper script which runs each executable from the
|
||||
# correct location. This adds convenience but makes debugging
|
||||
# more difficult.
|
||||
file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap/${_executable} \"\$\@\"\n")
|
||||
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
|
||||
if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
# Xcode
|
||||
set_target_properties(${_executable} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/MacOS/extcap
|
||||
)
|
||||
else()
|
||||
set_target_properties(${_executable} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap
|
||||
)
|
||||
# Add a wrapper script which runs each executable from the
|
||||
# correct location. This adds convenience but makes debugging
|
||||
# more difficult.
|
||||
file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap/${_executable} \"\$\@\"\n")
|
||||
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
|
@ -127,9 +127,16 @@ set_target_properties(wiretap PROPERTIES
|
|||
)
|
||||
|
||||
if(ENABLE_APPLICATION_BUNDLE)
|
||||
set_target_properties(wiretap PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
# Xcode
|
||||
set_target_properties(wiretap PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
else()
|
||||
set_target_properties(wiretap PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ABICHECK(libwiretap)
|
||||
|
|
|
@ -267,9 +267,17 @@ set_target_properties(wsutil PROPERTIES
|
|||
)
|
||||
|
||||
if(ENABLE_APPLICATION_BUNDLE)
|
||||
set_target_properties(wsutil PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
|
||||
if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
# Xcode
|
||||
set_target_properties(wsutil PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
else()
|
||||
set_target_properties(wsutil PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ABICHECK(libwsutil)
|
||||
|
|
Loading…
Reference in New Issue