All Projects → sakra → Cotire

sakra / Cotire

Licence: mit
CMake module to speed up builds.

Labels

Projects that are alternatives of or similar to Cotire

Vs.language.cmake
Syntax highlighting for Cmake in Visual Studio Code
Stars: ✭ 64 (-94.72%)
Mutual labels:  cmake
Magnum Bootstrap
Bootstrap projects for Magnum C++11/C++14 graphics engine
Stars: ✭ 69 (-94.31%)
Mutual labels:  cmake
Cmake Modules
CMake modules for some scientific libraries
Stars: ✭ 75 (-93.81%)
Mutual labels:  cmake
Kaidan
[Replaced by https://invent.kde.org/network/kaidan] Kaidan, a simple and user-friendly Jabber/XMPP client for every device and platform.
Stars: ✭ 67 (-94.47%)
Mutual labels:  cmake
Tristeon3d
A 3D Engine built by two Game Engineering students.
Stars: ✭ 68 (-94.39%)
Mutual labels:  cmake
Hacktoberfest2020
Contribute for hacktoberfest 2020
Stars: ✭ 72 (-94.06%)
Mutual labels:  cmake
Android Cmake
CMake toolchain file and other scripts for the Android NDK
Stars: ✭ 1,123 (-7.34%)
Mutual labels:  cmake
Helloworld
A C++ Hello World project, using CMake, and GitHub Actions
Stars: ✭ 77 (-93.65%)
Mutual labels:  cmake
Didi challenge ros
Roslaunch to visualize a rosbag file from Udacity (DiDi Challenge)
Stars: ✭ 69 (-94.31%)
Mutual labels:  cmake
Fcnpc
FCNPC - Fully Controllable NPC
Stars: ✭ 73 (-93.98%)
Mutual labels:  cmake
Spirit
Atomistic Spin Simulation Framework
Stars: ✭ 67 (-94.47%)
Mutual labels:  cmake
Nitroshare Desktop
Network file transfer application for Windows, OS X, & Linux
Stars: ✭ 1,150 (-5.12%)
Mutual labels:  cmake
Burst
То, чего нет в Бусте
Stars: ✭ 72 (-94.06%)
Mutual labels:  cmake
Magnum Plugins
Plugins for the Magnum C++11/C++14 graphics engine
Stars: ✭ 66 (-94.55%)
Mutual labels:  cmake
Openssl Cmake
Build OpenSSL with CMake on MacOS, Win32, Win64 and cross compile for Android, IOS
Stars: ✭ 76 (-93.73%)
Mutual labels:  cmake
Remodel
Data and class remodeling library
Stars: ✭ 63 (-94.8%)
Mutual labels:  cmake
Ncnn Benchmark
The benchmark of ncnn that is a high-performance neural network inference framework optimized for the mobile platform
Stars: ✭ 70 (-94.22%)
Mutual labels:  cmake
Findtbb
CMake find module for Intel Threading Building Blocks
Stars: ✭ 77 (-93.65%)
Mutual labels:  cmake
Cmake.vim
🔨 CMake functionality within Vim.
Stars: ✭ 76 (-93.73%)
Mutual labels:  cmake
Gpu Icp Slam
Stars: ✭ 73 (-93.98%)
Mutual labels:  cmake

cotire

Cotire (compile time reducer) is a CMake module that speeds up the build process of CMake based build systems by fully automating techniques as precompiled header usage and single compilation unit builds for C and C++.

The functionality provided by cotire has been superseded by features added to CMake 3.16. Support for pre-compiling and unity builds is now built into CMake. Thus, there will not be any further updates or support for this project.

features

  • Non-intrusive. Requires no source code modification and only minimal changes to CMake list files.
  • Automatically generates a single compilation unit (aka unity source file) for a CMake target.
  • Automatically generates a prefix header by tracking includes used by a CMake target.
  • Automatically precompiles prefix header and applies resulting precompiled header to a CMake target.
  • Alternatively, allows for using manually maintained unity source and prefix header files.
  • Supports C/C++ compilers Clang, GCC, Intel and Visual Studio C++.
  • Supports mixed language CMake targets.
  • Supports console (Makefile generator) and IDE (Visual Studio and Xcode) based builds.
  • Compatible with CMake single build type and CMake multi-configuration builds.
  • Compatible with most CMake generators (including Ninja).
  • Supports multi-core unity builds for some generators (make -j, jom, Visual Studio, Ninja).
  • Leverages native precompiled header generation features of IDEs (Visual Studio and Xcode).
  • Compatible with CMake's cross-compiling support.
  • Compatible with compiler wrappers like ccache.
  • Tested with Windows, Linux and OS X.
  • MIT licensed.

requirements

installation

Copy the file CMake/cotire.cmake to the module directory of your CMake project. In the top-level CMakeList.txt file, add the module directory to the CMake module search path:

set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")

usage

To use cotire in your CMake project, add the following include directive to the beginning of the top-level CMakeList.txt:

include(cotire)

To speed the build process of a CMake library or executable target, just apply the cotire function to the target:

add_executable(MyExecutable ${MyExecutableSources})
target_link_libraries(MyExecutable ${MyExecutableLibraries})
cotire(MyExecutable)

Cotire looks at the properties of the target provided by CMake (e.g., target type, source files, compile flags, preprocessor defines, include directories, ...) and sets up custom commands that will generate a unity source file, a prefix header and a precompiled header at build time specially tailored to the target.

For the generation of the prefix header, cotire will automatically choose headers used by the target that are outside of the project directory and thus are likely to change infrequently. The precompiled prefix header is then applied to the target to speed up the compilation process.

To use an existing manually maintained prefix header instead of the automatically generated one, set the COTIRE_CXX_PREFIX_HEADER_INIT property before invoking cotire:

set_target_properties(MyExecutable PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h")
cotire(MyExecutable)

As a side effect, cotire generates a new target named MyExecutable_unity, which lets you perform a unity build for the original target. The unity target inherits all build settings from the original target, including linked library dependencies.

For Makefile based generators you can then invoke a unity build that produces the same output as the original target, but does so much faster by entering:

$ make MyExecutable_unity

See the advanced usage section of the cotire manual for information on how to configure the cotire process (e.g., how to make the unity build use all available processor cores).

The directory Patches contains patch files to enable cotire for some popular open sources packages that use CMake as a build system.

speedup

Depending on factors like hardware, compiler, the number of files in the target and the complexity of the C/C++ code, the build process of targets that use a cotire generated precompiled header will be sped up from 10 to 40 percent. Using precompiled headers however is not without issues and may not work for some programs.

A unity build may be up to 90 percent faster than the one file at a time build of the original target. Single compilation unit builds however are very unlikely to work without source code modifications, because they break the use of some C and C++ language features.

Generally, modern C++ code which makes heavy use of header-only libraries will profit the most from cotiring.

This blog post discusses speedup results obtained for real-world projects.

known issues

  • CMake configure time will increase for cotired targets.
  • The size of the CMake build folder will increase, because precompiled headers are large binaries.
  • It is not possible to share precompiled headers generated by cotire between CMake targets. Multiple targets can share a generated prefix header, though (see the cotire manual).
  • Cotire is not compatible with Xoreax IncrediBuild.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].