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.
7 Basically this is an experiment and if we find out that it works
8 and we like cmake more than autofoo we might switch one day.
13 How to get started with cmake (Unix/Linux and Win32/64)?
16 What needs to be done?
19 How to get started with cmake (Unix/Linux and Win32/64)?
20 ========================================================
22 You can find documentation on cmake at: http://www.cmake.org/
24 cmake is designed to support out of tree builds. So much so, that
25 in tree builds do not work properly in all cases.
27 How to do out of tree build (Unix/Linux):
29 2) Assuming, you are in the top directory of the wireshark source
33 5) cmake [options] ../<Name_of_WS_source_dir>
34 6) make (or cmake --build .)
35 7) (as root) umask 0022 && make install
38 In step 5) you may need to override the defaults for features. Common
41 # Disable the POSIX capbabilities check
44 # Enable debugging symbols
45 -DCMAKE_BUILD_TYPE=Debug
51 -DENABLE_HTML_GUIDES=ON
52 -DENABLE_PDF_GUIDES=ON
54 # Make ccache and clang work together
55 -DCMAKE_C_FLAGS='-Qunused-arguments'
57 # Force Python path on Windows. May be needed if Cygwin's
58 # /usr/bin/python is present and is a symlink
59 # http://public.kitware.com/Bug/view.php?id=13818
60 -DPYTHON_EXECUTABLE=c:/Python27/python
62 # Disable building an application bundle (Wireshark.app) on Mac OS X
63 -DENABLE_APPLICATION_BUNDLE=OFF
66 After running cmake, you can always run "make help" to see
67 a list of all possible make targets.
70 Cmake honors user umask for creating directories as of now:
71 http://public.kitware.com/Bug/view.php?id=9620
72 To get predictable results please set umask explicitly.
74 How to do an out of tree build using Visual C++ 2013:
75 [This is advanced alpha and should build all executables except the GTK3
76 Wireshark for 32-bit.]
77 1) Follow https://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html
79 1a) Set the library search path.
80 If you set WIRESHARK_LIB_DIR, it will be used as the top-level library
82 If you set WIRESHARK_BASE_DIR,
83 %WIRESHARK_BASE_DIR%\wireshark-%WIRESHARK_TARGET_PLATFORM%-libs will
84 be used as the top-level library directory.
85 1b) set WIRESHARK_TARGET_PLATFORM=win32 (or win64)
86 1c) set QT5_BASE_DIR=C:\Qt\5.3\msvc2013_opengl (must match the Qt component path
88 1d) If you want to use Visual Studio make sure that the paths to Python and
89 Cygwin are available to GUI applications. The Python path MUST come first.
91 2a) Build the zlib library, e.g.
92 cd %WIRESHARK_BASE_DIR%\wireshark-%WIRESHARK_TARGET_PLATFORM%-libs\zlib125
93 cmake -G "NMake Makefiles" . # msbuild will not do because of configuration path
95 3) mkdir c:\wireshark\build
96 4) cd c:\wireshark\build
97 5) Run one of the following to create the build environment:
98 cmake -G "NMake Makefiles" path\to\sources (i.e. in case your sources are located at c:\wireshark\trunk, use "..\trunk")
99 cmake path\to\sources (this will build for the latest Visual Studio version found)
100 cmake -G "Visual Studio 12" ("12" builds for VS2103. Use "11" for VS2012 or "10" for VS2010.)
101 cmake -G "Visual Studio 12 Win64" (Win32 is the default)
102 6) Run one of the following to build Wireshark:
103 nmake /X- VERBOSE=1 (or cmake --build . -- VERBOSE=1 )
104 Open Wireshark.sln in Windows Explorer to build in Visual Studio
105 msbuild wireshark.sln /m /p:Configuration=RelWithDebInfo
106 7) In case you want to test the executable(s) inside the build tree:
107 Run setpath.bat whenever it gets updated (there is a message in each cmake
108 run whether it is necessary or not).
112 - Can create project files for many IDEs including Qt Creator, Visual Studio,
115 - Easier to understand/learn
116 - Doesn't create any files in the source tree in case of out of tree builds
117 - One build infrastructure for all of our tier 1 platforms (including Windows)
122 - Everyone who wants to build from source needs cmake
123 - Current state of documentation isn't really better than
124 Autotools documentation. In some respects it's even worse
125 (you need to buy a book to get an explanation as to how
132 All the executables now build from clean source on:
133 * 32 bit openSUSE 11.3: (gnu)make and gcc
136 * 32 bit Ubuntu 10.04
137 * 64 bit Ubuntu 14.04
138 * 64 bit Debian Wheezy
141 * 32 bit Windows using Visual C++ 2013
142 * 64 bit Windows using Visual C++ 2013
145 The Buildbot runs CMake steps on Ubuntu, Win32, Win64, OS X, and Solaris.
147 What needs to be done?
148 ======================
150 - Add back platform specific objects.
151 - Fix places in the cmake files marked as todo.
152 - Guides are not installed.
153 - Build source package (using CPack).
154 This is obsolete if we decide to release VCS snapshots instead
155 - Build packages using CPack: tarball, Windows installer + PortableApps, OS X
156 installer dmg, RPM, SVR4. This includes setting OS target version stuff
157 appropriately for OS X. We currently use NSIS for the Windows installer but
158 should probably use WiX instead.
159 - Add back checkAPI target.
160 - Add support for cmake configurations.
161 - Automatically figure out if *shark is running from the build directory
162 (making WIRESHARK_RUN_FROM_BUILD_DIRECTORY unnecessary like it is with
167 run/qtshark: Mach-O 64-bit x86_64 executable
169 so what you're running from the build directory is the executable
170 itself. autofoo includes libtool in our case, so what you're running
171 from the build directory is a script that then runs the executable,
172 and the executable is in a .libs directory; the code that checks for
173 "running from the build directory?" checks for that.
175 We could perhaps check for the pathname containing "run/", although
176 that wouldn't help if we ran it while *in* the "run" directory;
177 getting an absolute path for the executable would be necessary for
179 - Get plugins loading when running *shark from the build directory.
180 That might involve handling ".libs" and "run" differently.
181 - Get cross-compilation working (or ensure it does). It works with autofoo.
182 - Handle -DFORTIFY_SOURCE=2 appropriately. (Do a Web search for
183 "cmake fortify" for some information.)
184 - Add support for Visual Studio code anlaysis similar to ENABLE_CODE_ANALYSIS in
186 - Define the GTK_DISABLE_ and GDK_DISABLE_ values as appropriate if we
187 care about supporting the GTK+ version.
188 - Install the freedesktop integration files (wireshark.desktop,
189 wireshark-mime-package.xml, etc.).
192 Links regarding cmake
193 =====================
194 The home page of the cmake project
195 http://www.cmake.org/
197 The home page of the cmake project documentation
198 http://www.cmake.org/Wiki/CMake
200 About cmake in general and why KDE4 uses it
201 http://lwn.net/Articles/188693/
203 Introductory/tutorial presentation
204 http://ait.web.psi.ch/services/linux/hpc/hpc_user_cookbook/tools/cmake/docs/Cmake_VM_2007.pdf
206 Introductory article in Linux Journal
207 http://www.linuxjournal.com/node/6700/print
210 http://www.cmake.org/Wiki/CMake_Useful_Variables
213 http://www.cmake.org/Wiki/CMake_FAQ
215 Additional cmake modules
216 http://code.google.com/p/cmake-modules/