Upload
cynapses
View
1.613
Download
3
Tags:
Embed Size (px)
DESCRIPTION
The talk gives an overview about the CMake components. It was held in the SUSE Office to educate employees.
Citation preview
CMake CPack CTest and CDash
CMake - a cross-platform, open-source buildsystem
Andreas Schneider <[email protected]>Daniel Gollub <[email protected]>
SUSE Linux Products GmbH
8th July 2008
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake CPack CTest and CDash
CMake
1 CMakeAbout CMakeWorkflowDetailsExternal dependencies
2 CPack
3 CTest and CDashCTestCDash
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 CMakeAbout CMakeWorkflowDetailsExternal dependencies
2 CPack
3 CTest and CDashCTestCDash
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 andVisual Studio
gives the developer the ability to use the tool they are mostproductive with
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 CMakeAbout CMakeWorkflowDetailsExternal dependencies
2 CPack
3 CTest and CDashCTestCDash
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake CPack CTest and CDash
Workflow
Simple example
Hello world!
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 5min)
Stores all kind of values you can change
Can be modified via commandline, ccmake, cmake-gui (qt4)
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 CMakeAbout CMakeWorkflowDetailsExternal dependencies
2 CPack
3 CTest and CDashCTestCDash
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 intosemi-colon spearated
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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)...command1command2...endmacro (NAME arg1 arg2 ...argN)
They perform text substituions like #define does in C
WARNING: variable name clashing is possible. Prefix yourvariables!
Functions have been introduced with CMake 2.6
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 CMakeAbout CMakeWorkflowDetailsExternal dependencies
2 CPack
3 CTest and CDashCTestCDash
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 orhttp://opensync.org/browser
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 CMakeAbout CMakeWorkflowDetailsExternal dependencies
2 CPack
3 CTest and CDashCTestCDash
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 CMakeAbout CMakeWorkflowDetailsExternal dependencies
2 CPack
3 CTest and CDashCTestCDash
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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/errorsTestcase PASS/FAIL resultsTestcase timing resultsCode CoverageValgrind/Memcheck results
Notifies about regressions (build failures, failed tests, ...)
Supports multiple projects
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> 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 <[email protected]> Daniel Gollub <[email protected]> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake CPack CTest and CDash
CDash
Questions & Answers
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system
CMake CPack CTest and CDash
CDash
Thanks for listenting
Andreas Schneider <[email protected]> Daniel Gollub <[email protected]> SUSE Linux Products GmbH
CMake - a cross-platform, open-source build system