2006-09-05 09:50:45 +00:00
|
|
|
Explain the cmake build system for wireshark
|
|
|
|
|
2013-05-11 20:52:50 +00:00
|
|
|
Notice
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2013-10-10 17:23:12 +00:00
|
|
|
To find out the current state of the cmake implementation for
|
2009-09-11 13:30:01 +00:00
|
|
|
Wireshark, please take a look at "What needs to be done?" below.
|
2006-09-05 09:27:22 +00:00
|
|
|
|
|
|
|
Table of contents
|
|
|
|
=================
|
|
|
|
|
2014-06-14 07:36:45 +00:00
|
|
|
How to get started with cmake (Unix/Linux and Win32/64)?
|
2006-09-05 09:27:22 +00:00
|
|
|
Why cmake?
|
|
|
|
Why not cmake?
|
|
|
|
What needs to be done?
|
2006-09-05 12:04:46 +00:00
|
|
|
Links regarding cmake
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2014-06-14 07:36:45 +00:00
|
|
|
How to get started with cmake (Unix/Linux and Win32/64)?
|
|
|
|
========================================================
|
2006-09-05 09:27:22 +00:00
|
|
|
|
|
|
|
You can find documentation on cmake at: http://www.cmake.org/
|
|
|
|
|
|
|
|
cmake is designed to support out of tree builds. So much so, that
|
|
|
|
in tree builds do not work properly in all cases.
|
|
|
|
|
|
|
|
How to do out of tree build (Unix/Linux):
|
|
|
|
1) Install cmake.
|
2009-09-11 13:30:01 +00:00
|
|
|
2) Assuming, you are in the top directory of the wireshark source
|
2006-09-05 09:27:22 +00:00
|
|
|
cd ..
|
2009-09-11 13:30:01 +00:00
|
|
|
3) mkdir build
|
|
|
|
4) cd build
|
2014-08-15 23:52:40 +00:00
|
|
|
5) cmake [options] ../<Name_of_WS_source_dir>
|
2013-09-23 21:45:55 +00:00
|
|
|
6) make (or cmake --build .)
|
|
|
|
7) (as root) umask 0022 && make install
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2009-09-23 19:41:08 +00:00
|
|
|
Note 1:
|
2014-08-15 23:52:40 +00:00
|
|
|
In step 5) you may need to override the defaults for features. Common
|
|
|
|
options include:
|
|
|
|
|
2016-03-26 09:40:26 +00:00
|
|
|
# Disable the POSIX capabilities check
|
2014-08-15 23:52:40 +00:00
|
|
|
-DENABLE_CAP=OFF
|
|
|
|
|
|
|
|
# Enable debugging symbols
|
|
|
|
-DCMAKE_BUILD_TYPE=Debug
|
|
|
|
|
|
|
|
# Disable GTK+ 3
|
|
|
|
-DENABLE_GTK3=OFF
|
|
|
|
|
2014-08-31 01:02:52 +00:00
|
|
|
# Build documentation
|
2014-12-11 00:50:56 +00:00
|
|
|
-DENABLE_HTML_GUIDES=ON
|
|
|
|
-DENABLE_PDF_GUIDES=ON
|
2014-08-31 01:02:52 +00:00
|
|
|
|
2014-08-15 23:52:40 +00:00
|
|
|
# Make ccache and clang work together
|
|
|
|
-DCMAKE_C_FLAGS='-Qunused-arguments'
|
|
|
|
|
|
|
|
# Force Python path on Windows. May be needed if Cygwin's
|
|
|
|
# /usr/bin/python is present and is a symlink
|
|
|
|
# http://public.kitware.com/Bug/view.php?id=13818
|
|
|
|
-DPYTHON_EXECUTABLE=c:/Python27/python
|
2009-09-23 19:41:08 +00:00
|
|
|
|
2015-11-10 21:07:54 +00:00
|
|
|
# Disable building an application bundle (Wireshark.app) on OS X
|
2014-10-10 22:03:26 +00:00
|
|
|
-DENABLE_APPLICATION_BUNDLE=OFF
|
|
|
|
|
2015-08-24 17:56:04 +00:00
|
|
|
# Qt Creator expects .cbp files when used with CMake.
|
|
|
|
-G "CodeBlocks - Unix Makefiles"
|
|
|
|
-G "CodeBlocks - NMake Makefiles"
|
|
|
|
|
2016-03-25 18:23:16 +00:00
|
|
|
# We call try_compile many times, particularly via ConfigureChecks.cmake.
|
|
|
|
# Setting a lightweight try_compile configuration can speed up cmake,
|
|
|
|
# particularly for MSBuild.
|
|
|
|
-DCMAKE_TRY_COMPILE_CONFIGURATION=Release
|
|
|
|
|
2009-09-23 19:41:08 +00:00
|
|
|
Note 2:
|
2009-12-29 12:12:26 +00:00
|
|
|
After running cmake, you can always run "make help" to see
|
|
|
|
a list of all possible make targets.
|
|
|
|
|
2014-08-01 17:23:49 +00:00
|
|
|
Note 3:
|
2013-02-23 22:54:17 +00:00
|
|
|
Cmake honors user umask for creating directories as of now:
|
|
|
|
http://public.kitware.com/Bug/view.php?id=9620
|
|
|
|
To get predictable results please set umask explicitly.
|
|
|
|
|
2014-08-01 17:23:49 +00:00
|
|
|
How to do an out of tree build using Visual C++ 2013:
|
2016-01-26 23:18:46 +00:00
|
|
|
[This is used for the 2.x release builds, support for VS2010 and VS2012
|
2015-04-29 19:15:16 +00:00
|
|
|
is included, but hasn't been tested.]
|
|
|
|
0) Install cmake (currently 3.1.3 or later is recommended). You can use chocolatey,
|
|
|
|
choco inst cmake.
|
2014-10-20 23:11:48 +00:00
|
|
|
1) Follow https://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html
|
2013-09-23 21:45:55 +00:00
|
|
|
Steps 1-9
|
2014-10-20 23:11:48 +00:00
|
|
|
1a) Set the library search path.
|
|
|
|
If you set WIRESHARK_BASE_DIR,
|
|
|
|
%WIRESHARK_BASE_DIR%\wireshark-%WIRESHARK_TARGET_PLATFORM%-libs will
|
|
|
|
be used as the top-level library directory.
|
2015-04-30 14:00:29 +00:00
|
|
|
If you set WIRESHARK_LIB_DIR, it will be used as the top-level library
|
|
|
|
directory. This definition will require changing for different builds (x86 & x64).
|
2013-10-05 08:02:17 +00:00
|
|
|
1b) set WIRESHARK_TARGET_PLATFORM=win32 (or win64)
|
2015-04-29 19:15:16 +00:00
|
|
|
1c) set QT5_BASE_DIR=C:\Qt\5.4.1\5.4\msvc2013_opengl (must match the Qt component path
|
2014-08-01 17:23:49 +00:00
|
|
|
on your system)
|
2015-04-29 19:15:16 +00:00
|
|
|
1d) If you want to use Visual Studio to build rather than msbuild from the command line,
|
2015-10-15 21:45:45 +00:00
|
|
|
make sure that the path to Cygwin is available to GUI applications.
|
2015-04-29 19:15:16 +00:00
|
|
|
2) mkdir c:\wireshark\build or as appropriate for you.
|
|
|
|
You will need one build directory for each bitness (win32, win64) you wish to build.
|
|
|
|
3) cd into the directory from 2) above.
|
2015-04-30 14:00:29 +00:00
|
|
|
4) Run the following to generate the build files:
|
2015-10-15 21:45:45 +00:00
|
|
|
cmake -DENABLE_CHM_GUIDES=on xxx path\to\sources
|
|
|
|
where path\to\sources is the absolute or relative path to the wireshark source tree
|
2015-04-29 19:15:16 +00:00
|
|
|
and xxx is replaced with one of the following:
|
2015-04-30 14:00:29 +00:00
|
|
|
nothing - This will build a VS solution for win32 using the latest version of VS found (preferred).
|
2015-04-29 19:15:16 +00:00
|
|
|
-G "Visual Studio 12" ("12" builds for VS2013. Use "11" for VS2012 or "10" for VS2010.)
|
2015-04-30 14:00:29 +00:00
|
|
|
-G "NMake Makefiles" - to build an nmake makefile.
|
2016-01-26 23:18:46 +00:00
|
|
|
-G "Visual Studio 12 Win64" (to build an x64 version you must add the "Win64", Win32 is the default)
|
2015-04-29 19:15:16 +00:00
|
|
|
5) Run one of the following to build Wireshark:
|
2015-04-30 14:00:29 +00:00
|
|
|
msbuild /m /p:Configuration=RelWithDebInfo wireshark.sln (preferred).
|
2014-08-01 17:23:49 +00:00
|
|
|
Open Wireshark.sln in Windows Explorer to build in Visual Studio
|
2015-04-30 14:00:29 +00:00
|
|
|
nmake /X- VERBOSE=1 (or cmake --build . -- VERBOSE=1 ) (if you generated nmake files).
|
|
|
|
Subsequent changes to source files and CMakeLists.txt will be automagically detected
|
2015-04-29 19:15:16 +00:00
|
|
|
and new build files generated, i.e. step 4) doesn't need to be run again.
|
|
|
|
Changes to the build environment, e.g. QT_BASE_DIR aren't detected so you must delete the
|
|
|
|
build dir and start form step 2) again.
|
2015-04-30 14:00:29 +00:00
|
|
|
6) The executables can be run from the appropriate directory, e.g. run\RelWithDebInfo for VS solutions
|
|
|
|
or run\ for NMake files.
|
2016-06-28 17:35:27 +00:00
|
|
|
On macOS CMake creates an application bundle by default and places executables in
|
|
|
|
run/Wireshark.app/Contents/MacOS. It also creates a convenience wrapper script
|
|
|
|
(run/wireshark) which will run the Wireshark executable in the bundle.
|
2016-01-26 23:18:46 +00:00
|
|
|
7) To build an installer, build the nsis_package_prep and then the nsis_package projects, e.g.
|
|
|
|
msbuild /m /p:Configuration=RelWithDebInfo nsis_package_prep.vcxproj
|
2015-04-29 19:15:16 +00:00
|
|
|
msbuild /m /p:Configuration=RelWithDebInfo nsis_package.vcxproj
|
|
|
|
nmake ???
|
2013-09-23 21:45:55 +00:00
|
|
|
|
2006-09-05 09:27:22 +00:00
|
|
|
Why cmake?
|
|
|
|
==========
|
2014-08-01 17:23:49 +00:00
|
|
|
- Can create project files for many IDEs including Qt Creator, Visual Studio,
|
|
|
|
and XCode.
|
2016-01-26 23:18:46 +00:00
|
|
|
- Fast, builds in parallel in Visual Studio or msbuild with the /m flag
|
2006-09-05 09:27:22 +00:00
|
|
|
- Easier to understand/learn
|
2014-08-01 17:23:49 +00:00
|
|
|
- Doesn't create any files in the source tree in case of out of tree builds
|
|
|
|
- One build infrastructure for all of our tier 1 platforms (including Windows)
|
2016-01-26 23:18:46 +00:00
|
|
|
- Out of tree builds permits both Win32 and Win64 builds without requiring a "clean" when swapping.
|
2006-09-05 09:27:22 +00:00
|
|
|
|
|
|
|
Why not cmake?
|
|
|
|
==============
|
|
|
|
- Lots of work to do
|
|
|
|
- Everyone who wants to build from source needs cmake
|
|
|
|
- Current state of documentation isn't really better than
|
2014-08-01 17:23:49 +00:00
|
|
|
Autotools documentation. In some respects it's even worse
|
2006-09-05 09:27:22 +00:00
|
|
|
(you need to buy a book to get an explanation as to how
|
|
|
|
cmake really works).
|
|
|
|
...
|
|
|
|
|
2009-09-11 13:30:01 +00:00
|
|
|
What works?
|
|
|
|
===========
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2009-10-09 20:14:56 +00:00
|
|
|
All the executables now build from clean source on:
|
2014-08-25 16:37:35 +00:00
|
|
|
* 32 bit openSUSE 11.3: (gnu)make and gcc
|
|
|
|
* 64 bit FedoraXXX
|
|
|
|
* 32 bit Ubuntu 9.04
|
|
|
|
* 32 bit Ubuntu 10.04
|
|
|
|
* 64 bit Ubuntu 14.04
|
|
|
|
* 64 bit Debian Wheezy
|
|
|
|
* 32 bit OS X
|
|
|
|
* 64 bit OS X
|
|
|
|
* 32 bit Windows using Visual C++ 2013
|
|
|
|
* 64 bit Windows using Visual C++ 2013
|
|
|
|
* 64 bit Solaris 10
|
|
|
|
|
|
|
|
The Buildbot runs CMake steps on Ubuntu, Win32, Win64, OS X, and Solaris.
|
2015-04-16 19:42:57 +00:00
|
|
|
Windows packages are built using CMake steps.
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2009-09-11 13:30:01 +00:00
|
|
|
What needs to be done?
|
|
|
|
======================
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2009-09-11 13:30:01 +00:00
|
|
|
- Add back platform specific objects.
|
|
|
|
- Fix places in the cmake files marked as todo.
|
2013-02-23 22:54:17 +00:00
|
|
|
- Guides are not installed.
|
2009-09-11 13:30:01 +00:00
|
|
|
- Build source package (using CPack).
|
2013-02-25 18:12:28 +00:00
|
|
|
This is obsolete if we decide to release VCS snapshots instead
|
2014-08-25 16:37:35 +00:00
|
|
|
- Build packages using CPack: tarball, Windows installer + PortableApps, OS X
|
|
|
|
installer dmg, RPM, SVR4. This includes setting OS target version stuff
|
|
|
|
appropriately for OS X. We currently use NSIS for the Windows installer but
|
|
|
|
should probably use WiX instead.
|
2013-10-29 15:28:49 +00:00
|
|
|
- Add support for cmake configurations.
|
2015-03-04 19:21:28 +00:00
|
|
|
- Get cross-compilation working (or ensure it does). It works with autofoo--and
|
|
|
|
people use it.
|
2014-08-03 20:13:23 +00:00
|
|
|
- Handle -DFORTIFY_SOURCE=2 appropriately. (Do a Web search for
|
|
|
|
"cmake fortify" for some information.)
|
|
|
|
- Define the GTK_DISABLE_ and GDK_DISABLE_ values as appropriate if we
|
|
|
|
care about supporting the GTK+ version.
|
2009-09-11 13:30:01 +00:00
|
|
|
...
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2006-09-05 12:04:46 +00:00
|
|
|
Links regarding cmake
|
|
|
|
=====================
|
|
|
|
The home page of the cmake project
|
|
|
|
http://www.cmake.org/
|
|
|
|
|
|
|
|
The home page of the cmake project documentation
|
|
|
|
http://www.cmake.org/Wiki/CMake
|
|
|
|
|
|
|
|
About cmake in general and why KDE4 uses it
|
|
|
|
http://lwn.net/Articles/188693/
|
|
|
|
|
2009-09-11 13:30:01 +00:00
|
|
|
Introductory/tutorial presentation
|
|
|
|
http://ait.web.psi.ch/services/linux/hpc/hpc_user_cookbook/tools/cmake/docs/Cmake_VM_2007.pdf
|
|
|
|
|
2011-09-01 04:35:57 +00:00
|
|
|
Introductory article in Linux Journal
|
2006-09-05 12:04:46 +00:00
|
|
|
http://www.linuxjournal.com/node/6700/print
|
|
|
|
|
|
|
|
Useful variables
|
|
|
|
http://www.cmake.org/Wiki/CMake_Useful_Variables
|
|
|
|
|
|
|
|
cmake FAQ
|
|
|
|
http://www.cmake.org/Wiki/CMake_FAQ
|
|
|
|
|
2006-09-06 22:14:20 +00:00
|
|
|
Additional cmake modules
|
|
|
|
http://code.google.com/p/cmake-modules/
|