diff options
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rw-r--r-- | CMakeOptions.txt | 19 | ||||
-rw-r--r-- | README.cmake | 4 | ||||
-rw-r--r-- | cmake/modules/FindGLIB2.cmake | 12 | ||||
-rw-r--r-- | cmake/modules/FindGTHREAD2.cmake | 12 | ||||
-rw-r--r-- | cmake/modules/FindWSWinLibs.cmake | 17 |
6 files changed, 61 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 35b6f7779e..fa9e619ceb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,9 @@ if( ${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 8 OR # Don't: Automatically link Qt executable to qtmain target on Windows cmake_policy(SET CMP0020 OLD) endif() +if (POLICY CMP0020) + cmake_policy(SET CMP0020 OLD) +endif() # This cannot be implemented via option(...) if( NOT CMAKE_BUILD_TYPE ) @@ -424,12 +427,15 @@ endif() # - set HAVE_XXX #The minimum package list -set(PACKAGELIST Gettext GLIB2 GMODULE2 GTHREAD2 M LEX YACC Perl SED SH PythonInterp) +if (NOT WIN32) + set(PACKAGELIST Gettext M) + set(M_REQUIRED TRUE) +endif() +set(PACKAGELIST GLIB2 GMODULE2 GTHREAD2 LEX YACC Perl SED SH PythonInterp) set(GLIB2_REQUIRED TRUE) set(GLIB2_FIND_REQUIRED TRUE) set(GLIB2_MIN_VERSION 2.14.0) set(GTHREAD2_REQUIRED TRUE) -set(M_REQUIRED TRUE) set(PythonInterp_FIND_VERSION 2) set(Python_ADDITIONAL_VERSIONS 3) @@ -458,20 +464,20 @@ endif() # Build the Qt GUI? if(BUILD_qtshark) if(ENABLE_QT5) - set(PACKAGELIST ${PACKAGELIST} Qt5Widgets Qt5PrintSupport Qt5LinguistTools) - if (APPLE) - set(PACKAGELIST ${PACKAGELIST} Qt5MacExtras) - endif() - set(QT_VERSION 5) # Untested, may not work if CMAKE_PREFIX_PATH gets overwritten # somewhere. The if WIN32 in this place is annoying as well. if( WIN32 ) set( QT5_BASE_PATH "$ENV{QT5_BASE_DIR}" ) set( CMAKE_PREFIX_PATH "${QT5_BASE_PATH}" ) # Used for the creation of setpath.bat - set( QT5_DLL_PATH "${CMAKE_PREFIX_PATH}/bin/dummy" ) + set( QT5_DLL_PATH "${QT5_BASE_PATH}\\bin" ) set( WS_ALL_LIBS ${WS_ALL_LIBS} ${QT5_DLL_PATH} ) endif() + set(PACKAGELIST ${PACKAGELIST} Qt5Widgets Qt5PrintSupport Qt5LinguistTools) + if (APPLE) + set(PACKAGELIST ${PACKAGELIST} Qt5MacExtras) + endif() + set(QT_VERSION 5) else() set(PACKAGELIST ${PACKAGELIST} Qt4) # set(Qt4_OPTIONS 4.7.1 REQUIRED QtCore QtGui) @@ -544,7 +550,9 @@ if(ENABLE_PYTHON) set(PACKAGELIST ${PACKAGELIST} PythonLibs) endif() -set(PACKAGELIST ${PACKAGELIST} YAPP) +if (NOT WIN32) + set(PACKAGELIST ${PACKAGELIST} YAPP) +endif() set(PACKAGELIST ${PACKAGELIST} POD) diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 2a5969f0c1..9ccba66a6c 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -48,7 +48,12 @@ option(ENABLE_GUIDES "Build Guides" OFF) option(ENABLE_PCAP_NG_DEFAULT "Enable pcap-ng as default file format" ON) option(ENABLE_ADNS "Build with adns support" ON) -option(ENABLE_PORTAUDIO "Build with PortAudio support" ON) +# Temp as Win32 CMake doesn't yet handle building PortAudio +if(WIN32) + option(ENABLE_PORTAUDIO "Build with PortAudio support" OFF) +else() + option(ENABLE_PORTAUDIO "Build with PortAudio support" ON) +endif() option(ENABLE_ZLIB "Build with zlib compression support" ON) option(ENABLE_LUA "Build with Lua dissector support" ON) option(ENABLE_PYTHON "Build with Python dissector support" OFF) @@ -56,14 +61,22 @@ option(ENABLE_SMI "Build with libsmi snmp support" ON) option(ENABLE_GNUTLS "Build with GNU TLS support" ON) option(ENABLE_GCRYPT "Build with GNU crypto support" ON) option(ENABLE_GEOIP "Build with GeoIP support" ON) -option(ENABLE_CAP "Build with Posix capabilities support" ON) +# Because Win32 isn't Posix +if(NOT WIN32) + option(ENABLE_CAP "Build with Posix capabilities support" ON) +endif() option(ENABLE_CARES "Build with c-ares support" ON) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") option(ENABLE_NETLINK "Build with libnl support" ON) endif() # todo Mostly hardcoded option(ENABLE_KERBEROS "Build with Kerberos support" ON) -option(ENABLE_SBC "Build with SBC Codec support in RTP Player" ON) +# Temp as Win32 CMake doesn't yet handle SBC Codec +if(WIN32) + option(ENABLE_SBC "Build with SBC Codec support in RTP Player" OFF) +else() + option(ENABLE_SBC "Build with SBC Codec support in RTP Player" ON) +endif() # How to install set(DUMPCAP_INSTALL_OPTION "normal" CACHE STRING "Permissions to install") set(DUMPCAP_INST_VALS "normal" "suid" "capabilities") diff --git a/README.cmake b/README.cmake index 8919412b69..c0ecbfc81e 100644 --- a/README.cmake +++ b/README.cmake @@ -73,9 +73,11 @@ How to do out of tree build (Win32/64): 5) cmake -G "NMake Makefiles" path\to\sources (i.e. in case your sources are located at c:\wireshark\trunk, use "..\trunk") 5a) cmake path\to\sources (this will build for the latest Visual Studio version found) +5b) cmake -G "Visual Studio xx" where xx = 10 for VS2010, 11 for VS2012 and 12 for VS2013 + will build a solution for a specfic version of VS (it must still be installed). 6) nmake /X- VERBOSE=1 (or cmake --build . -- VERBOSE=1 ) 6a) Wireshark.sln (this will run up Visual Studio with the cmake built solution - (or use msbuild: cmake --build . -- /p:Configuration=RelWithDebInfo) + (or using msbuild: msbuild wireshark.sln /m /p:Configuration=RelWithDebInfo) 7) In case you want to test the executable(s) inside the build tree: Run setpath.bat whenever it gets updated (there is a message in each cmake run whether it is necessary or not). diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake index 30fd04d45e..a500684949 100644 --- a/cmake/modules/FindGLIB2.cmake +++ b/cmake/modules/FindGLIB2.cmake @@ -35,12 +35,6 @@ else() set( _pkgconfig_REQUIRED "" ) endif() -if( GLIB2_MIN_VERSION ) - pkg_search_module( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} ) -else() - pkg_search_module( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 ) -endif() - find_path( GLIB2_MAIN_INCLUDE_DIR NAMES glib.h @@ -107,5 +101,11 @@ else() set( GLIB2_MAIN_INCLUDE_DIRS ) endif() +if( GLIB2_MIN_VERSION ) + pkg_search_module( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} ) +else() + pkg_search_module( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 ) +endif() + mark_as_advanced( GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES ) diff --git a/cmake/modules/FindGTHREAD2.cmake b/cmake/modules/FindGTHREAD2.cmake index 182df7c2ab..1e2079bc80 100644 --- a/cmake/modules/FindGTHREAD2.cmake +++ b/cmake/modules/FindGTHREAD2.cmake @@ -21,12 +21,6 @@ else() set( _pkgconfig_REQUIRED "" ) endif() -if( GTHREAD2_MIN_VERSION ) - PKG_SEARCH_MODULE( GTHREAD2 ${_pkgconfig_REQUIRED} gthread-2.0>=${GTHREAD2_MIN_VERSION} ) -else() - PKG_SEARCH_MODULE( GTHREAD2 ${_pkgconfig_REQUIRED} gthread-2.0 ) -endif() - if( NOT GTHREAD2_FOUND ) include( FindWSWinLibs ) if( BUILD_wireshark ) @@ -48,4 +42,10 @@ if( NOT GTHREAD2_FOUND ) find_package_handle_standard_args( GTHREAD2 DEFAULT_MSG GTHREAD2_LIBRARIES GTHREAD2_INCLUDE_DIRS ) endif() +if( GTHREAD2_MIN_VERSION ) + PKG_SEARCH_MODULE( GTHREAD2 ${_pkgconfig_REQUIRED} gthread-2.0>=${GTHREAD2_MIN_VERSION} ) +else() + PKG_SEARCH_MODULE( GTHREAD2 ${_pkgconfig_REQUIRED} gthread-2.0 ) +endif() + mark_as_advanced( GTHREAD2_LIBRARIES GTHREAD2_INCLUDE_DIRS ) diff --git a/cmake/modules/FindWSWinLibs.cmake b/cmake/modules/FindWSWinLibs.cmake index 4d970f9ef4..c1ec4b1d9b 100644 --- a/cmake/modules/FindWSWinLibs.cmake +++ b/cmake/modules/FindWSWinLibs.cmake @@ -26,14 +26,23 @@ function( FindWSWinLibs _WS_LIB_SEARCH_PATH _LIB_HINT_VAR ) endif() endfunction() +# Massage the list of paths to external libraries to output a batch file to update the PATH +# So that running an executable can load the DLL's + function( WSExtendPath _LIB_PATH_LIST _PATH_FILE ) if ( WIN32 ) #message( STATUS "All libs: ${_LIB_PATH_LIST}." ) + # Convert each path that ends in "lib" to "bin" as linking requires the lib, running requires the dll. foreach( THIS_LIB_PATH ${_LIB_PATH_LIST} ) - get_filename_component( LIB_PATH ${THIS_LIB_PATH} PATH ) - # lib is required for linking, the dlls are in bin - string( REGEX REPLACE "/lib$" "/bin" LIB_PATH "${LIB_PATH}" ) - #message( STATUS "Raw path ${THIS_LIB_PATH} processed to ${LIB_PATH}." ) + if ( THIS_LIB_PATH MATCHES "[.]lib$" ) + # lib is required for linking, the dlls are in bin so fix the path + # by chopping the library off the end and tacking "/bin" on + get_filename_component( LIB_PATH ${THIS_LIB_PATH} PATH ) + string( REGEX REPLACE "/lib$" "/bin" LIB_PATH "${LIB_PATH}" ) + else() + set ( LIB_PATH "${THIS_LIB_PATH}" ) + endif() + #message( STATUS "Raw path ${THIS_LIB_PATH} processed to ${LIB_PATH}" ) set( WS_LOCAL_LIB_PATHS "${WS_LOCAL_LIB_PATHS}" ${LIB_PATH} ) endforeach() list( REMOVE_DUPLICATES WS_LOCAL_LIB_PATHS ) |