wiki:CMake

CMake

This article describes how to use  CMake tool to build and install libLAS as well as run unit tests.

The CMake build configuration is available from the libLAS repository, in branch main.

Building libLAS using CMake on Unix

  • Check out source code
$ hg clone http://hg.liblas.org/main/
  • Prepare build directory, possibly out of source tree
$ mkdir build
$ cd build
  • Configure basic core library only
$ cmake ../main
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Enable libLAS utilities to build - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mloskot/dev/liblas/_hg/build
  • Inspect available targets
$ make help
The following are some of the valid targets for this Makefile:
... all (the default if no target is provided)
... clean
... depend
... edit_cache
... install
... install/local
... install/strip
... list_install_components
... rebuild_cache
... las
... las_c
... las2las
... las2txt
... lasinfo
... lasmerge
... txt2las
  • Build
$ make

Building libLAS and running unit tests using CMake on Unix

Users are encourage to run libLAS unit tests and submit test results to dedicated  CDash - uality dashboard hosted by  http://cdash.org website:

The CDash is another tool liblAS uses to perform  continuous integration during development process.

Note, in order to enable  CTest support it is required to use  CMake 2.8.0+ version (it is Beta currently).

  • Configure libLAS core library with unit tests and CTest enabled
$ cmake ../main -DWITH_TESTS=ON -DENABLE_CTEST=ON
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Enable libLAS utilities to build - done
-- Enable libLAS unit tests to build - done
-- Enable CTest to support submissions of results to CDash at http://cdash.org
-- Enable CTest to support submissions of results to CDash at http://cdash.org - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mloskot/dev/liblas/_hg/build

  • Inspect available targets
$ make help
The following are some of the valid targets for this Makefile:
... all (the default if no target is provided)
... clean
... depend
... Continuous
... ContinuousBuild
... ContinuousConfigure
... ContinuousCoverage
... ContinuousMemCheck
... ContinuousStart
... ContinuousSubmit
... ContinuousTest
... ContinuousUpdate
... Experimental
... ExperimentalBuild
... ExperimentalConfigure
... ExperimentalCoverage
... ExperimentalMemCheck
... ExperimentalStart
... ExperimentalSubmit
... ExperimentalTest
... ExperimentalUpdate
... Nightly
... NightlyBuild
... NightlyConfigure
... NightlyCoverage
... NightlyMemCheck
... NightlyMemoryCheck
... NightlyStart
... NightlySubmit
... NightlyTest
... NightlyUpdate
... edit_cache
... install
... install/local
... install/strip
... list_install_components
... rebuild_cache
... test
... las
... las_c
... las2las
... las2txt
... lasinfo
... lasmerge
... txt2las
... liblas_test
  • Run Continuous target
mloskot@dog:~/dev/liblas/_hg/build$ make Continuous
   Site: dog
   Build name: Linux-c++
Create new tag: 20091025-0003 - Continuous
Updating the repository
   Updating the repository: /home/mloskot/dev/liblas/_hg/main
   Use HG repository type
   Old revision of repository is: aa303d670d1a
   New revision of repository is: 690df0a6df0b
   Gathering version information (one . per revision):
    .
   Found 1 updated files
Configure project
   Each . represents 1024 bytes of output
    . Size of output: 0K
Build project
   Each symbol represents 1024 bytes of output.
   '!' represents an error and '*' a warning.
    ......****.* Size of output: 11K
   0 Compiler errors
   7 Compiler warnings
Test project /home/mloskot/dev/liblas/_hg/build
    Start 1: liblas_test
1/1 Test #1: liblas_test ......................   Passed    0.02 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.03 sec
Performing coverage
 Cannot find any coverage files. Ignoring Coverage request.
Submit files (using http)
   Using HTTP submit method
   Drop site:http://my.cdash.org/submit.php?project=libLAS
   Uploaded: /home/mloskot/dev/liblas/_hg/build/Testing/20091025-0003/Build.xml
   Uploaded: /home/mloskot/dev/liblas/_hg/build/Testing/20091025-0003/Configure.xml
   Uploaded: /home/mloskot/dev/liblas/_hg/build/Testing/20091025-0003/Test.xml
   Uploaded: /home/mloskot/dev/liblas/_hg/build/Testing/20091025-0003/Update.xml
   Submission successful
Built target Continuous