SlideShare a Scribd company logo
1 of 42
Download to read offline
CMake                                                 CPack                        CTest and CDash




               CMake - a cross-platform, open-source build
                                 system

                        Andreas Schneider <anschneider@suse.de>
                            Daniel Gollub <dgollub@suse.de>

                                            SUSE Linux Products GmbH


                                                     8th July 2008




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash




CMake

        1 CMake
               About CMake
               Workflow
               Details
               External dependencies

        2 CPack

        3 CTest and CDash
               CTest
               CDash


Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

About CMake


CMake - a cross-platform, open-source build system

        1 CMake
               About CMake
               Workflow
               Details
               External dependencies

        2 CPack

        3 CTest and CDash
               CTest
               CDash


Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

About CMake


What is CMake?




        CMake is
               BSD licensed open-source package
               written in C++
               tools to build, test and package software




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

About CMake


More exactly



        CMake is a meta-build system
               doesn’t do the final build
               it generates files for other build systems
                       Makefiles, KDevelop, Eclipse, XCode, MinGW, Cygwin and
                       Visual Studio
               gives the developer the ability to use the tool they are most
               productive with




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

About CMake


Who is using it



        Projects using CMake are
               KDE4
               libzypp
               Qutecom (formly known as WengoPhone)
               csync, OpenSync




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

About CMake


Important features


        CMake supports
               complex custom commands (qt moc, yacc)
               optional component support
               shared libraries and DSOs with version support
               automatic dependency generation (C, C++, Fortran)
               out-of-source builds
               cross-compiling support




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Workflow


CMake - a cross-platform, open-source build system

        1 CMake
               About CMake
               Workflow
               Details
               External dependencies

        2 CPack

        3 CTest and CDash
               CTest
               CDash


Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Workflow


Simple example




        Hello world!




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Workflow


CMake configure process




               Read the CMakeCache.txt if it is already there
               Read the CMake input files (CMakeLists.txt, ..)
               Write the cache back out
               Generate the Makefiles




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Workflow


CMake Cache




               Faster compilation with the cache (KDE4 with cmake in 5
               min)
               Stores all kind of values you can change
               Can be modified via commandline, ccmake, cmake-gui (qt4)




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Details


CMake - a cross-platform, open-source build system

          1 CMake
               About CMake
               Workflow
               Details
               External dependencies

          2 CPack

          3 CTest and CDash
               CTest
               CDash


Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Details


Variables



               You don’t have to declare them
               simply set(VARNAME arg1 arg2 ...argN)
               list() is sometimes better
               Use SPERATE ARGUMENTS to split space sparated into
               semi-colon spearated




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Details


Build types



               None (default)
               Debug
               Release
               RelWithDebInfo
               MinSizeRel
               You can define your own




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Details


Build parameters



               add definition(-Wall)
               CMAKE C FLAGS or CMAKE CXX FLAGS
               or it could be CMAKE C FLAGS DEBUG for the Debug build type
               For packagers:
               CFLAGS="%{optflags} -g -DNDEBUG" 
               CXXFLAGS="%{optflags} -g -DNDEBUG" 
               cmake -DCMAKE BUILD TYPE=None /path/to/source




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Details


Flow control

               if (expression)
               ...
               else (expression)
               ...
               endif (expression)
               foreach (loop list)
               ...
               endforeach (loop list)
               while (condition)
               ...
               while (condition)


Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

Details


Macros and functions


               macro (NAME arg1 arg2 ...argN)
               ...
               command1
               command2
               ...
               endmacro (NAME arg1 arg2 ...argN)
               They perform text substituions like #define does in C
               WARNING: variable name clashing is possible. Prefix your
               variables!
               Functions have been introduced with CMake 2.6


Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

External dependencies


CMake - a cross-platform, open-source build system

        1 CMake
               About CMake
               Workflow
               Details
               External dependencies

        2 CPack

        3 CTest and CDash
               CTest
               CDash


Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

External dependencies


Find packages



               find package(Iniparser REQURIED)
               CMake ships approx. 100 FindXXX.cmake modules
               You can create your own FindXXX.cmake module
               Put them in your source dir and set CMAKE MODULE PATH
               Think of find package as an #include




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

External dependencies


Your own find module




               Script: https://dev.csync.org/browser/cmake/
               Scripts/generate_findpackage_file
               Creates simple FindXXX.cmake module




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

External dependencies


Important addresses



               #cmake @ irc.freenode.net
               http://www.cmake.org/
               http://www.cmake.org/Wiki/CMake Useful Variables
               http://www.cmake.org/Wiki/CMake FAQ
               Examples: http://dev.csync.org/browser or
               http://opensync.org/browser




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash




CPack




               Package Generator
               Independent of CMake
               Abstracts Packaging
               Packaging of sources and builds/binaries




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash




Available Package Generators
               TGZ
               STGZ
               NSIS (Null Soft Installer)
               ZIP
               TBZ2
               TZ
               PackageMaker (MacOSX)
               OSXX11
               CygwinBinary
               CygwinSource
               DEB
               RPM
Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash




CPack Example: Release Tarballs




        include(CPack)
        set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
        set(CPACK_SOURCE_PACKAGE_FILE_NAME "${NAME}-${VERSION}")




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash




CPack




                           It’s like make dist-check, without -check :(
                                      make package source




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CTest


CMake - a cross-platform, open-source build system

        1 CMake
               About CMake
               Workflow
               Details
               External dependencies

        2 CPack

        3 CTest and CDash
               CTest
               CDash


Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CTest


CTest




               Testing driver
               Independent of CMake




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CTest


Features


               Updating from repositories (CVS, SVN ... no GIT support)
               Configuration of the project
               Building
               Running the tests
               Performs memory checking
               Performs code coverage analyse
               Logging (stdout/stderr/time/...)




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CTest


Example: CTest standalone




        Create DartTestfile.txt and just run ctest:

        add_test(TestcaseName1 "command1" "param1" "param2")
        add_test(TestcaseName2 "command1" "param1" "param2")
        ...




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CTest


Example: CTest integrated in CMake



        include(CTest)
        enable_testing()

        add_test(TestcaseName1 "command1" "param1" "param2")
        add_test(TestcaseName2 "command1" "param1" "param2")
        ...

        This will generate a make target called “test”.




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CTest


Test-Model




               Nightly
               Experimental
               Continous




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CTest


Test-Mode


               Start
               Update
               Configure
               Build
               Test
               MemCheck
               Coverage
               Submit



Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CTest


Why CTest?




        Test driven development!




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CDash


CMake - a cross-platform, open-source build system

        1 CMake
               About CMake
               Workflow
               Details
               External dependencies

        2 CPack

        3 CTest and CDash
               CTest
               CDash


Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CDash


CDash




               Cross-Platform Dashboard System
               PHP & MySQL




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CDash


CDash


               Retrieves testing logfiles
               Summaries testing results
                       Build warnings/errors
                       Testcase PASS/FAIL results
                       Testcase timing results
                       Code Coverage
                       Valgrind/Memcheck results
               Notifies about regressions (build failures, failed tests, ...)
               Supports multiple projects



Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CDash


CDash




        Doesn’t build or test the projects!




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CDash


CTest & CDash




        ”Make it work as one!”




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CDash


CTest & CDash



               Continous Buildhosts of different platforms
               Checking the SCM for updates
               Build the projects from scratch
               Run tests
               Archive results
               Report regressions




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CDash


CTest & CDash - Benefits



               Detect immeditally build breaking commits
               Testing on several platforms
               Tracking performance regressions
               Hopefully increases qualtiy of the project
               No time-wasting manual testing
               More time for development




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CDash




        Questions & Answers




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake                                                CPack                         CTest and CDash

CDash




        Thanks for listenting




Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de>   SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system

More Related Content

What's hot

Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Drush in the Composer Era
Drush in the Composer EraDrush in the Composer Era
Drush in the Composer EraPantheon
 
Into The Box 2018 | Content box + docker
Into The Box 2018 | Content box + dockerInto The Box 2018 | Content box + docker
Into The Box 2018 | Content box + dockerOrtus Solutions, Corp
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with AugeasPuppet
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe BookTim Riley
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Michele Orselli
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerMarcus Lönnberg
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Composeraccoony
 
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기raccoony
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleRoman Rodomansky
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 

What's hot (19)

C++ for the Web
C++ for the WebC++ for the Web
C++ for the Web
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
C make tutorial
C make tutorialC make tutorial
C make tutorial
 
Native Hadoop with prebuilt spark
Native Hadoop with prebuilt sparkNative Hadoop with prebuilt spark
Native Hadoop with prebuilt spark
 
Drush in the Composer Era
Drush in the Composer EraDrush in the Composer Era
Drush in the Composer Era
 
Into The Box 2018 | Content box + docker
Into The Box 2018 | Content box + dockerInto The Box 2018 | Content box + docker
Into The Box 2018 | Content box + docker
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
 
Puppet evolutions
Puppet evolutionsPuppet evolutions
Puppet evolutions
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
kubernetes practice
kubernetes practicekubernetes practice
kubernetes practice
 
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with Ansible
 
Introducing Docker
Introducing DockerIntroducing Docker
Introducing Docker
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
Docker Compose Explained
Docker Compose ExplainedDocker Compose Explained
Docker Compose Explained
 

Similar to Build System CMake Guide Covers Workflow, Packaging & Testing

C make tutorial
C make tutorialC make tutorial
C make tutorialzeng724
 
Kitware: Qt and Scientific Computing
Kitware: Qt and Scientific ComputingKitware: Qt and Scientific Computing
Kitware: Qt and Scientific Computingaccount inactive
 
Systemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveSystemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveAlison Chaiken
 
Flexible design systems by Charlie Robbins
Flexible design systems by Charlie RobbinsFlexible design systems by Charlie Robbins
Flexible design systems by Charlie RobbinsOdessaJS Conf
 
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...Codemotion
 
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...Codemotion
 
Altinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
Altinity Cluster Manager: ClickHouse Management for Kubernetes and CloudAltinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
Altinity Cluster Manager: ClickHouse Management for Kubernetes and CloudAltinity Ltd
 
Ubuntu Cloud at Florida Linux Show
Ubuntu Cloud at Florida Linux ShowUbuntu Cloud at Florida Linux Show
Ubuntu Cloud at Florida Linux Showzoopster
 
ThereminQ - a Cloud Native Toolbox for Quantum Workloads and Visualisations
ThereminQ -  a Cloud Native Toolbox for Quantum Workloads and Visualisations ThereminQ -  a Cloud Native Toolbox for Quantum Workloads and Visualisations
ThereminQ - a Cloud Native Toolbox for Quantum Workloads and Visualisations Aryan Blaauw
 
Monitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapMonitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapPadraig O'Sullivan
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushPantheon
 
Immutable kubernetes architecture by linuxkit
Immutable kubernetes architecture by linuxkitImmutable kubernetes architecture by linuxkit
Immutable kubernetes architecture by linuxkit어형 이
 
LinuxTraining_3.pptx
LinuxTraining_3.pptxLinuxTraining_3.pptx
LinuxTraining_3.pptxeyob51
 
An Introduction to CMake
An Introduction to CMakeAn Introduction to CMake
An Introduction to CMakeICS
 
Cme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration filesCme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration filesDominique Dumont
 
Deploying Windows Apps to Kubernetes with Draft and Helm
Deploying Windows Apps to Kubernetes with Draft and HelmDeploying Windows Apps to Kubernetes with Draft and Helm
Deploying Windows Apps to Kubernetes with Draft and HelmJessica Deen
 

Similar to Build System CMake Guide Covers Workflow, Packaging & Testing (20)

CMake best practices
CMake best practicesCMake best practices
CMake best practices
 
C make tutorial
C make tutorialC make tutorial
C make tutorial
 
Kitware: Qt and Scientific Computing
Kitware: Qt and Scientific ComputingKitware: Qt and Scientific Computing
Kitware: Qt and Scientific Computing
 
Systemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveSystemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to love
 
Flexible design systems by Charlie Robbins
Flexible design systems by Charlie RobbinsFlexible design systems by Charlie Robbins
Flexible design systems by Charlie Robbins
 
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
 
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
 
Altinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
Altinity Cluster Manager: ClickHouse Management for Kubernetes and CloudAltinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
Altinity Cluster Manager: ClickHouse Management for Kubernetes and Cloud
 
Lecture 4 Cluster Computing
Lecture 4 Cluster ComputingLecture 4 Cluster Computing
Lecture 4 Cluster Computing
 
The state of the swarm
The state of the swarmThe state of the swarm
The state of the swarm
 
Ubuntu Cloud at Florida Linux Show
Ubuntu Cloud at Florida Linux ShowUbuntu Cloud at Florida Linux Show
Ubuntu Cloud at Florida Linux Show
 
ThereminQ - a Cloud Native Toolbox for Quantum Workloads and Visualisations
ThereminQ -  a Cloud Native Toolbox for Quantum Workloads and Visualisations ThereminQ -  a Cloud Native Toolbox for Quantum Workloads and Visualisations
ThereminQ - a Cloud Native Toolbox for Quantum Workloads and Visualisations
 
Monitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapMonitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTap
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Using Docker in CI process
Using Docker in CI processUsing Docker in CI process
Using Docker in CI process
 
Immutable kubernetes architecture by linuxkit
Immutable kubernetes architecture by linuxkitImmutable kubernetes architecture by linuxkit
Immutable kubernetes architecture by linuxkit
 
LinuxTraining_3.pptx
LinuxTraining_3.pptxLinuxTraining_3.pptx
LinuxTraining_3.pptx
 
An Introduction to CMake
An Introduction to CMakeAn Introduction to CMake
An Introduction to CMake
 
Cme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration filesCme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration files
 
Deploying Windows Apps to Kubernetes with Draft and Helm
Deploying Windows Apps to Kubernetes with Draft and HelmDeploying Windows Apps to Kubernetes with Draft and Helm
Deploying Windows Apps to Kubernetes with Draft and Helm
 

Build System CMake Guide Covers Workflow, Packaging & Testing

  • 1. CMake CPack CTest and CDash CMake - a cross-platform, open-source build system Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH 8th July 2008 Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 2. CMake CPack CTest and CDash CMake 1 CMake About CMake Workflow Details External dependencies 2 CPack 3 CTest and CDash CTest CDash Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 3. CMake CPack CTest and CDash About CMake CMake - a cross-platform, open-source build system 1 CMake About CMake Workflow Details External dependencies 2 CPack 3 CTest and CDash CTest CDash Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 4. CMake CPack CTest and CDash About CMake What is CMake? CMake is BSD licensed open-source package written in C++ tools to build, test and package software Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 5. CMake CPack CTest and CDash About CMake More exactly CMake is a meta-build system doesn’t do the final build it generates files for other build systems Makefiles, KDevelop, Eclipse, XCode, MinGW, Cygwin and Visual Studio gives the developer the ability to use the tool they are most productive with Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 6. CMake CPack CTest and CDash About CMake Who is using it Projects using CMake are KDE4 libzypp Qutecom (formly known as WengoPhone) csync, OpenSync Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 7. CMake CPack CTest and CDash About CMake Important features CMake supports complex custom commands (qt moc, yacc) optional component support shared libraries and DSOs with version support automatic dependency generation (C, C++, Fortran) out-of-source builds cross-compiling support Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 8. CMake CPack CTest and CDash Workflow CMake - a cross-platform, open-source build system 1 CMake About CMake Workflow Details External dependencies 2 CPack 3 CTest and CDash CTest CDash Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 9. CMake CPack CTest and CDash Workflow Simple example Hello world! Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 10. CMake CPack CTest and CDash Workflow CMake configure process Read the CMakeCache.txt if it is already there Read the CMake input files (CMakeLists.txt, ..) Write the cache back out Generate the Makefiles Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 11. CMake CPack CTest and CDash Workflow CMake Cache Faster compilation with the cache (KDE4 with cmake in 5 min) Stores all kind of values you can change Can be modified via commandline, ccmake, cmake-gui (qt4) Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 12. CMake CPack CTest and CDash Details CMake - a cross-platform, open-source build system 1 CMake About CMake Workflow Details External dependencies 2 CPack 3 CTest and CDash CTest CDash Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 13. CMake CPack CTest and CDash Details Variables You don’t have to declare them simply set(VARNAME arg1 arg2 ...argN) list() is sometimes better Use SPERATE ARGUMENTS to split space sparated into semi-colon spearated Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 14. CMake CPack CTest and CDash Details Build types None (default) Debug Release RelWithDebInfo MinSizeRel You can define your own Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 15. CMake CPack CTest and CDash Details Build parameters add definition(-Wall) CMAKE C FLAGS or CMAKE CXX FLAGS or it could be CMAKE C FLAGS DEBUG for the Debug build type For packagers: CFLAGS="%{optflags} -g -DNDEBUG" CXXFLAGS="%{optflags} -g -DNDEBUG" cmake -DCMAKE BUILD TYPE=None /path/to/source Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 16. CMake CPack CTest and CDash Details Flow control if (expression) ... else (expression) ... endif (expression) foreach (loop list) ... endforeach (loop list) while (condition) ... while (condition) Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 17. CMake CPack CTest and CDash Details Macros and functions macro (NAME arg1 arg2 ...argN) ... command1 command2 ... endmacro (NAME arg1 arg2 ...argN) They perform text substituions like #define does in C WARNING: variable name clashing is possible. Prefix your variables! Functions have been introduced with CMake 2.6 Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 18. CMake CPack CTest and CDash External dependencies CMake - a cross-platform, open-source build system 1 CMake About CMake Workflow Details External dependencies 2 CPack 3 CTest and CDash CTest CDash Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 19. CMake CPack CTest and CDash External dependencies Find packages find package(Iniparser REQURIED) CMake ships approx. 100 FindXXX.cmake modules You can create your own FindXXX.cmake module Put them in your source dir and set CMAKE MODULE PATH Think of find package as an #include Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 20. CMake CPack CTest and CDash External dependencies Your own find module Script: https://dev.csync.org/browser/cmake/ Scripts/generate_findpackage_file Creates simple FindXXX.cmake module Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 21. CMake CPack CTest and CDash External dependencies Important addresses #cmake @ irc.freenode.net http://www.cmake.org/ http://www.cmake.org/Wiki/CMake Useful Variables http://www.cmake.org/Wiki/CMake FAQ Examples: http://dev.csync.org/browser or http://opensync.org/browser Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 22. CMake CPack CTest and CDash CPack Package Generator Independent of CMake Abstracts Packaging Packaging of sources and builds/binaries Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 23. CMake CPack CTest and CDash Available Package Generators TGZ STGZ NSIS (Null Soft Installer) ZIP TBZ2 TZ PackageMaker (MacOSX) OSXX11 CygwinBinary CygwinSource DEB RPM Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 24. CMake CPack CTest and CDash CPack Example: Release Tarballs include(CPack) set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${NAME}-${VERSION}") Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 25. CMake CPack CTest and CDash CPack It’s like make dist-check, without -check :( make package source Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 26. CMake CPack CTest and CDash CTest CMake - a cross-platform, open-source build system 1 CMake About CMake Workflow Details External dependencies 2 CPack 3 CTest and CDash CTest CDash Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 27. CMake CPack CTest and CDash CTest CTest Testing driver Independent of CMake Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 28. CMake CPack CTest and CDash CTest Features Updating from repositories (CVS, SVN ... no GIT support) Configuration of the project Building Running the tests Performs memory checking Performs code coverage analyse Logging (stdout/stderr/time/...) Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 29. CMake CPack CTest and CDash CTest Example: CTest standalone Create DartTestfile.txt and just run ctest: add_test(TestcaseName1 "command1" "param1" "param2") add_test(TestcaseName2 "command1" "param1" "param2") ... Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 30. CMake CPack CTest and CDash CTest Example: CTest integrated in CMake include(CTest) enable_testing() add_test(TestcaseName1 "command1" "param1" "param2") add_test(TestcaseName2 "command1" "param1" "param2") ... This will generate a make target called “test”. Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 31. CMake CPack CTest and CDash CTest Test-Model Nightly Experimental Continous Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 32. CMake CPack CTest and CDash CTest Test-Mode Start Update Configure Build Test MemCheck Coverage Submit Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 33. CMake CPack CTest and CDash CTest Why CTest? Test driven development! Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 34. CMake CPack CTest and CDash CDash CMake - a cross-platform, open-source build system 1 CMake About CMake Workflow Details External dependencies 2 CPack 3 CTest and CDash CTest CDash Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 35. CMake CPack CTest and CDash CDash CDash Cross-Platform Dashboard System PHP & MySQL Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 36. CMake CPack CTest and CDash CDash CDash Retrieves testing logfiles Summaries testing results Build warnings/errors Testcase PASS/FAIL results Testcase timing results Code Coverage Valgrind/Memcheck results Notifies about regressions (build failures, failed tests, ...) Supports multiple projects Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 37. CMake CPack CTest and CDash CDash CDash Doesn’t build or test the projects! Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 38. CMake CPack CTest and CDash CDash CTest & CDash ”Make it work as one!” Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 39. CMake CPack CTest and CDash CDash CTest & CDash Continous Buildhosts of different platforms Checking the SCM for updates Build the projects from scratch Run tests Archive results Report regressions Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 40. CMake CPack CTest and CDash CDash CTest & CDash - Benefits Detect immeditally build breaking commits Testing on several platforms Tracking performance regressions Hopefully increases qualtiy of the project No time-wasting manual testing More time for development Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 41. CMake CPack CTest and CDash CDash Questions & Answers Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system
  • 42. CMake CPack CTest and CDash CDash Thanks for listenting Andreas Schneider <anschneider@suse.de> Daniel Gollub <dgollub@suse.de> SUSE Linux Products GmbH CMake - a cross-platform, open-source build system