ublas icon indicating copy to clipboard operation
ublas copied to clipboard

Add CMake Build System File Generator Support

Open coder3101 opened this issue 4 years ago • 1 comments

CMake is a widely used Build System Files Generator. This PR adds the support for CMake into Boost.uBLAS. As a result following things can be built with CMake

  • Examples
  • Benchmarks (Requires Boost.PROGRAM_OPTIONS)
  • Tensor Tests (Requires Boost.UNIT_TEST_FRAMEWORK)

Configuration Controls

In order to build with CMake, you need to have either Boost installed or boost headers build from source using b2 headers. You can pass an option to CMake -DBOOST_HEADERS_DIR=<path_to_boost_headers> and ublas will use those headers. If you skip this option, CMake will try to find a system installed Boost and use its include directories. If both of the above fails, CMake will fail and no build system files will be generated.

Control the targets to build

By default, CMake will build system files for all of the above three (examples, test, benchmarks). If you want to quickly test something or want to build some specific targets. You can use the following flags:

$ cmake .. -DBUILD_TENSOR_TEST=OFF # It Will not build tensor unit tests
$ cmake .. -DBUILD_EXAMPLES=ON # It Will build examples. (By default it will build all but if you disable any target once, you need to explicitly enable it again. We use cache to remember your last runs configurations)
$ cmake .. -DBUILD_BENCHMARKS=OFF # It Will not build benchmarks, You will need to pass ON next time to again enable it.

Build Tensor and Benchmarks

b2 headers only collects the header files. This is not sufficient to build Tensor examples or Benchmarks as they need to be linked against Boost.Test Framework and Boost.ProgramOptions. Regardless of whether you use a custom Boost header directory or let cmake find it. You will need installed boost to link against those libraries.

coder3101 avatar Jul 15 '20 08:07 coder3101

Codecov Report

Merging #94 into develop will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop      #94   +/-   ##
========================================
  Coverage    95.33%   95.33%           
========================================
  Files           22       22           
  Lines         1223     1223           
========================================
  Hits          1166     1166           
  Misses          57       57           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7cc02bf...e2d9ab0. Read the comment docs.

codecov[bot] avatar Jul 15 '20 08:07 codecov[bot]