1 Explain the cmake build system for wireshark
5 To find out the current state of the cmake implementation for
6 Wireshark, please take a look at "What needs to be done?" below.
11 How to get started with cmake (Unix/Linux and Win32/64)?
14 What needs to be done?
17 How to get started with cmake (Unix/Linux and Win32/64)?
18 ========================================================
20 You can find documentation on cmake at: http://www.cmake.org/
22 cmake is designed to support out of tree builds. So much so, that
23 in tree builds do not work properly in all cases.
25 How to do out of tree build (Unix/Linux):
27 2) Assuming, you are in the top directory of the wireshark source
31 5) cmake [options] ../<Name_of_WS_source_dir>
32 6) make (or cmake --build .)
33 7) (as root) umask 0022 && make install
36 In step 5) you may need to override the defaults for features. Common
39 # Disable the POSIX capbabilities check
42 # Enable debugging symbols
43 -DCMAKE_BUILD_TYPE=Debug
49 -DENABLE_HTML_GUIDES=ON
50 -DENABLE_PDF_GUIDES=ON
52 # Make ccache and clang work together
53 -DCMAKE_C_FLAGS='-Qunused-arguments'
55 # Force Python path on Windows. May be needed if Cygwin's
56 # /usr/bin/python is present and is a symlink
57 # http://public.kitware.com/Bug/view.php?id=13818
58 -DPYTHON_EXECUTABLE=c:/Python27/python
60 # Disable building an application bundle (Wireshark.app) on Mac OS X
61 -DENABLE_APPLICATION_BUNDLE=OFF
64 After running cmake, you can always run "make help" to see
65 a list of all possible make targets.
68 Cmake honors user umask for creating directories as of now:
69 http://public.kitware.com/Bug/view.php?id=9620
70 To get predictable results please set umask explicitly.
72 How to do an out of tree build using Visual C++ 2013:
73 [This is advanced alpha and should build all executables except the GTK3
74 Wireshark for 32-bit.]
75 1) Follow https://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html
77 1a) Set the library search path.
78 If you set WIRESHARK_LIB_DIR, it will be used as the top-level library
80 If you set WIRESHARK_BASE_DIR,
81 %WIRESHARK_BASE_DIR%\wireshark-%WIRESHARK_TARGET_PLATFORM%-libs will
82 be used as the top-level library directory.
83 1b) set WIRESHARK_TARGET_PLATFORM=win32 (or win64)
84 1c) set QT5_BASE_DIR=C:\Qt\5.3\msvc2013_opengl (must match the Qt component path
86 1d) If you want to use Visual Studio make sure that the paths to Python and
87 Cygwin are available to GUI applications. The Python path MUST come first.
89 2a) Build the zlib library, e.g.
90 cd %WIRESHARK_BASE_DIR%\wireshark-%WIRESHARK_TARGET_PLATFORM%-libs\zlib125
91 cmake -G "NMake Makefiles" . # msbuild will not do because of configuration path
93 3) mkdir c:\wireshark\build
94 4) cd c:\wireshark\build
95 5) Run one of the following to create the build environment:
96 cmake -G "NMake Makefiles" path\to\sources (i.e. in case your sources are located at c:\wireshark\trunk, use "..\trunk")
97 cmake path\to\sources (this will build for the latest Visual Studio version found)
98 cmake -G "Visual Studio 12" ("12" builds for VS2103. Use "11" for VS2012 or "10" for VS2010.)
99 cmake -G "Visual Studio 12 Win64" (Win32 is the default)
100 6) Run one of the following to build Wireshark:
101 nmake /X- VERBOSE=1 (or cmake --build . -- VERBOSE=1 )
102 Open Wireshark.sln in Windows Explorer to build in Visual Studio
103 msbuild wireshark.sln /m /p:Configuration=RelWithDebInfo
104 7) The executables can be run from the appropriate directory, e.g. run\RelWithDebInfo
108 - Can create project files for many IDEs including Qt Creator, Visual Studio,
111 - Easier to understand/learn
112 - Doesn't create any files in the source tree in case of out of tree builds
113 - One build infrastructure for all of our tier 1 platforms (including Windows)
118 - Everyone who wants to build from source needs cmake
119 - Current state of documentation isn't really better than
120 Autotools documentation. In some respects it's even worse
121 (you need to buy a book to get an explanation as to how
128 All the executables now build from clean source on:
129 * 32 bit openSUSE 11.3: (gnu)make and gcc
132 * 32 bit Ubuntu 10.04
133 * 64 bit Ubuntu 14.04
134 * 64 bit Debian Wheezy
137 * 32 bit Windows using Visual C++ 2013
138 * 64 bit Windows using Visual C++ 2013
141 The Buildbot runs CMake steps on Ubuntu, Win32, Win64, OS X, and Solaris.
142 Windows packages are built using CMake steps.
144 What needs to be done?
145 ======================
147 - Add back platform specific objects.
148 - Fix places in the cmake files marked as todo.
149 - Guides are not installed.
150 - Build source package (using CPack).
151 This is obsolete if we decide to release VCS snapshots instead
152 - Build packages using CPack: tarball, Windows installer + PortableApps, OS X
153 installer dmg, RPM, SVR4. This includes setting OS target version stuff
154 appropriately for OS X. We currently use NSIS for the Windows installer but
155 should probably use WiX instead.
156 - Add support for cmake configurations.
157 - Automatically figure out if *shark is running from the build directory
158 (making WIRESHARK_RUN_FROM_BUILD_DIRECTORY unnecessary like it is with
163 run/qtshark: Mach-O 64-bit x86_64 executable
165 so what you're running from the build directory is the executable
166 itself. autofoo includes libtool in our case, so what you're running
167 from the build directory is a script that then runs the executable,
168 and the executable is in a .libs directory; the code that checks for
169 "running from the build directory?" checks for that. The actual
170 executable isn't supposed to be run directly - it's expected to be run
171 by the wrapper script and might not even work if run directly, as it
172 won't find the relevant shared libraries.
174 We could perhaps check for the executable being in a "run" directory
175 instead, if the build drops it there. However, it's possible, at
176 least on OS X, to copy the executable to another directory and have
177 it run, so the guarantee that it's in a "run" directory is not as
179 - Get plugins loading when running *shark from the build directory.
180 That might involve handling ".libs" and "run" differently. The chance
181 that a random directory the executable was ultimately placed in would
182 be named "run" might also be a bit bigger than the chance that it's
184 - Get cross-compilation working (or ensure it does). It works with autofoo--and
186 - Handle -DFORTIFY_SOURCE=2 appropriately. (Do a Web search for
187 "cmake fortify" for some information.)
188 - Define the GTK_DISABLE_ and GDK_DISABLE_ values as appropriate if we
189 care about supporting the GTK+ version.
190 - Install the freedesktop integration files (wireshark.desktop,
191 wireshark-mime-package.xml, etc.).
194 Links regarding cmake
195 =====================
196 The home page of the cmake project
197 http://www.cmake.org/
199 The home page of the cmake project documentation
200 http://www.cmake.org/Wiki/CMake
202 About cmake in general and why KDE4 uses it
203 http://lwn.net/Articles/188693/
205 Introductory/tutorial presentation
206 http://ait.web.psi.ch/services/linux/hpc/hpc_user_cookbook/tools/cmake/docs/Cmake_VM_2007.pdf
208 Introductory article in Linux Journal
209 http://www.linuxjournal.com/node/6700/print
212 http://www.cmake.org/Wiki/CMake_Useful_Variables
215 http://www.cmake.org/Wiki/CMake_FAQ
217 Additional cmake modules
218 http://code.google.com/p/cmake-modules/