CMake Tasks

From Inkscape Wiki
Revision as of 07:40, 21 January 2016 by BryceHarrington (talk | contribs)
Jump to navigation Jump to search

Priorities for 0.92

  • Remove the hardcoded defines in CMakeLists.txt. These are marked out in the "BAD HACKS" section with add_definitions() calls. I suspect many of these are simply unnecessary, like HAVE_CONFIG_H and _FORTIFY_SOURCE. None are documented as to why they were added - perhaps investigate these further, or just test that the build works without them and drop them for now until their need becomes clearer?
  • Add locale installation support to the UNIX section in CMakeLists.txt. These are the po files in Inkscape's po/ subdirectory, and at least for me this appears to be working properly. We already have a simple po/CMakeLists.txt that looks like it does the basics already, including a GETTEXT_PROCESS_PO_FILES() call appears to be putting the files in the binary build's share/locale directory, and we're already hooking it in via the add_subdirectory() call in the top level CMakeLists.txt. Probably worth just checking that inkscape with localization turned on is able to find the appropriate po file and provide translated strings in its user interface, and just verify locales are working as expected. (Related: bug #1514588)
  • Compare dists created by cmake with dists created by autoconf. Set up parallel build trees for cmake and autoconf, and do a make dist in each. Then unpack the tarballs created by each method, create a sorted recursive file listing for each, and diff them. Filter out the cmake-specific and automake-specific files. Look for files autoconf is including in the dist that cmake isn't, and files that cmake includes that autoconf doesn't. For each file determine if it's needed, and adjust the cmake rules accordingly.
  • Drop the checks for getopt.h, since we no longer use that.
  • Review and for other configurable or required features and libraries. For each of these dependencies, verify that cmake is checking for it in the root CMakeLists.txt or one of the included files in CMakeScripts/*.cmake.
  • Get 'make check' to work. Presently it generates an error "No test configuration file found!" A lot of the test harness appears to already be set up, so presumably there's just a bit more configuration needed to get it activated.
  • Convert the WIN32 build system to use cmake

Misc. Cleanup and Nice To Haves

These tasks are not priorities for 0.92 but don't risk breaking anything beyond cmake so are safe to land any time.

  • Avoid clobbering CMAKE_* variables. set(CMAKE_FOO "bar") is wrong, it should be set(CMAKE_FOO "${CMAKE_FOO} bar)
  • DefineDependsandFlags.cmake explicitly includes GTK2_* stuff, but would just GTK2_INCLUDE_DIRS and GTK2_LIBRARY_DIRS work?
  • Automatically update the author dialog using AUTHORS. Look at how the man pages are updated from AUTHORS in the cmake scripts; the dialog can be updated in a similar manner, just that the names need to be formatted differently for the C++ compilation. TRANSLATORS can be done the same way. Probably COPYING as well.
  • Rename FindPANGOMM.cmake to FindPangoMM.cmake, to make file name casing consistent. Perhaps there are other modules that should be renamed for consistency too? Be sure any renames don't break the build when those modules are in use.
  • Ensure the man pages rebuild when edited. I don't think I set up the dependency tracking correctly for and the other pod files, because they don't rebuild automatically when modified.
  • Improve the pango/cairo configuration logic. DefineDependsandFlags.cmake contains platform checks for which libraries to include specifically, which should be generalized and perhaps moved into FindCairo*.cmake and/or FindPango*.cmake modules. (bug #1512379)
  • Restructure the helper cmake scripts. Presently a lot of configuration logic is broken out into CMakeScripts/*.cmake files. Where these contain helper routines or otherwise self-contained chunks of functionality that is reasonably abstracted from Inkscape this is fine, but some of these are really just Inkscape-specific logic that probably would be better to just leave inline in the top CMakeLists.txt file. E.g. DefineDependsandFlags.cmake, ConfigCompileFlags.cmake, and ConfigPaths.cmake should be considered to merge back in. Having them broken out separately just obscures configuration logic, and likely will just make things more inconvenient for developers trying to get a handle on the application's configuration.
  • Improve the GTK3 Experimental logic. DefineDependsandFlags.cmake contains a large chunk of code for handling GTK3 libraries. As inkscape itself gets ported to Gtk3, I'm guessing a lot of this build configuration logic will need redone or improved. Probably worthwhile to examine GIMP and other gtk/cmake based projects that may be further along in their Gtk3 conversion.
  • ConfigChecks.cmake includes tests for a bunch of basic C functions. Many of these are things I believe we can reasonably assume to be present in modern compilers. It hurts little to retain these if they provide tangible benefits, but they do take up time during configuration, so if they're completely redundant we should just drop them. I think as long as we are requiring minimum versions on particular compilers, or if we're checking for certain C++ standards level compliance of the compilers, we can assume a lot of these functions are already there.
  • As a corollary to the previous task, ConfigChecks.cmake should perhaps include checks for header files and function calls that we use, that may not be present in every compiler. C++-11 features, for example, might fit here, or anything that is platform-dependent.
  • We include a UsePkgConfig.cmake file, but I wonder if this is actually necessary. Reasonably modern cmake has pkgconfig support built-in, so perhaps with a bit of adjustment we could drop this file? I think we should be able to just do "find_package(PkgConfig REQUIRED)"
  • Cleanup rendundant stuff in the root CMakeLists.txt no longer needed in recent versions of cmake. I wonder if some of our cmake_policy() statements are redundant with setting cmake's minimum version to 2.8. Other stuff may simply be restating default values, such as CMAKE_MODULE_PATH.
  • Cleanup the version specification and insertion. We set the version in INKSCAPE_VERSION, but cmake allows setting the version via project() now, which might be better. We have some plumbing to communicate the version number into the application's code, namely src/inkscape-version.cpp, which supposedly is generated by inkscape-version.cmake (this should probably be doublechecked, I'm not 100% certain it's actually triggered.) I wonder if much of this is superfluous: cmake is creating config.h from config.h.cmake to supply defines for PACKAGE_VERSION, and we could also add the broken down version bits by using cmake's PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR, and PROJECT_VERSION_PATCH if we need that.


The following cmake related projects should be left until after autoconf is dropped, else they'll likely break autoconf or require it to be updated in turn. Easier to wait until after 0.92 when autoconf is scheduled to be dropped.

  • Drop the autoconf files:,, etc. etc.
  • Move fix-roff-punct to the packaging/ directory. This is used only by the man page creation routines, and doesn't need to be kept at the top level so long as it can be found by the cmake script that uses it.
  • Drop btool-related files. Doublecheck that the win32 and osx packaging tools have switched over to cmake before doing this.