SlideShare uma empresa Scribd logo
1 de 17
CMake introduction
1- PRINCIPLES AND POTENTIALS 
1.1- INTRO 
1.2- WORKFLOW 
2- CROSSPLATEFORM USAGES 
2.1- USEFUL VARIABLES AND USE 
2.2- GUI AND CACHE 
3- FIND PACKAGE 
4- ADVANCED AND MORE 
5- INSTALLATION, EXPORT, PACKAGE 
(NOT PRESENTED HERE) 
jerome.esnault@inria.fr 02 July 2014 - 2
1- Principles and potentials 
1.1- Intro 
• Objectif : 
Crossplateform toolbox (linux/windows/mac) to help to the build / creation / 
compilation of C/C++ projects. 
• Usage : 
Hight level of script language 
• Generation : 
Files which are used for the chosen developement environnement in the current 
platform 
• Developped by KitWare in open source version and started in 1999 for ITK 
projects then used by VTK project. 
• At this moment at 3.0 version and used by many big projects like OGRE, 
OpenSceneGraph… 
http://www.ohloh.net/p/cmake?ref=sample 
jerome.esnault@inria.fr 02 July 2014 - 3
1- Principles and potentials 
CMake / Ctest / CPack 
Compiler 
jerome.esnault@inria.fr 02 July 2014 - 4 
Modules 
CMake 
[*.cmake] 
[*.in] 
Sources C/C++/Java CMakeLists.txt / Ctest scripts 
CMakeCache.txt 
Native build system files [MakeFiles, sln…] 
Targets [executables, libraries, plugins] 
1.2- Workflow
2- CROSSPLATEFORM USAGES 
Cmake [options] <path-to-source> 
$ cd projectName 
$ mkdir build && cd build 
$ cmake .. 
$ make install 
$ cd projectName 
$ mkdir build && cd build 
$ cmake-gui .. 
$ make install 
Generators / IDE compatibilities : 
• Borland 
• MinGW 
• Nmake 
• Unix 
• Visual Studio 6/7/8/9/10/11 
• Xcode 
• codeBlocks 
• Eclipse 
• QtCreator 
3 tree structures : 
• CMAKE_SOURCE_DIR 
• CMAKE_BINARY_DIR 
• CMAKE_INSTALL_PREFIX 
OR 
jerome.esnault@inria.fr 02 July 2014 - 5
2- CROSSPLATEFORM USAGES 
2.1- Useful variables and use CMake_presentation 
CMAKE_SOURCE_DIR CMAKE_BINARY_DIR CMAKE_INSTALL_PREFIX 
rootFolder 
CMakeLists.txt 
Cmake_minimum_required(VERSION 2.8) 
Project(foo) 
… 
Add_subdirectory(subFolder1) 
… 
subFolder1 
CMakeLists.txt 
build 
Same structure 
but with generated 
or temp files 
Project(bar) 
… 
Add_executable(myApp mySources) 
subFolder2 
CMakeLists.txt 
CMAKE_CURRENT_SOURCE_DIR CMAKE_CURRENT_BINARY_DIR 
(=subFolder2) 
CMakeFiles 
Structure defined by 
‘install()’ cmake 
instruction 
jerome.esnault@inria.fr 02 July 2014 - 6
2- CROSSPLATEFORM USAGES 
2.1- Useful variables and use CMake_Useful_Variables 
CMAKE_SOURCE_DIR 
(=path to rootFolder) 
CMAKE_BINARY_DIR 
(=path to build) 
CMAKE_PROJECT_NAME (=foo) CMAKE_LIBRARY_OUTPUT_DIRECTORY 
CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
CMAKE_RUNTIME_OUTPUT_DIRECTORY 
PROJECT_NAME (=bar) 
UNIX WIN32 APPLE 
MSVC 
jerome.esnault@inria.fr 02 July 2014 - 7 
bool 
Place where target name will be generated, see: 
Add_executable(name sources) 
Add_library(name srouces [STATIC|SHARED])
2- CROSSPLATEFORM USAGES 
2.1- Useful variables and use 
CMake instructions act on : 
• new project / sub-project creations 
CMake_Wiki 
• cmake variables and list (cached or not) 
(content of a cmake variableis ${myCmakeVar}) 
• system file manipulation 
• building out of source, installation and packaging an installer 
• the « automatique » research of dependencies package 
and files 
• the cmake function and macros creation (for reusable code) 
• the customization of target properties 
or systeme file properties 
Project(…) 
Add_subdirectory(…) 
Add_dependencies(…) 
Include_directories(…) 
Target_link_libraries(…) 
Set(…) – unset(…) 
List(…) 
Option(…) 
Foreach() … endforeach() 
If() … else() … endif() 
File(…) - String(…) 
Configure_file(…) 
Install(…) 
Find_package(…) 
Find_library(…) 
Find_file(…) – Find_path(…) 
Include(…) 
Function()…endfunction() 
Macro()…endmacro() 
Add_definition(…) 
Define_property(…) 
jerome.esnault@inria.fr 02 July 2014 - 8
2- CROSSPLATEFORM USAGES 
2.2- GUI and CACHE 
CMAKE_BINARY_DIR 
(=path to build) 
CMakeCache.txt 
Foo.sln 
Cmake generated 
or temp files 
jerome.esnault@inria.fr 02 July 2014 - 9
2- CROSSPLATEFORM USAGES 
QUESTION ? 
EXAMPLES with current IBR projects, 
Showing differences between 
spixel_warp 
Ulrvr 
Ibr_common 
jerome.esnault@inria.fr 02 July 2014 - 10
3- Find Package 
3.1- How to use 
CMake_find 
find_package(<package> [version] [EXACT] [QUIET] 
[REQUIRED] [[COMPONENTS] [components...]] 
[CONFIG|NO_MODULE] 
[NO_POLICY_SCOPE] 
[NAMES name1 [name2 ...]] 
[CONFIGS config1 [config2 ...]] 
[HINTS path1 [path2 ... ]] 
[PATHS path1 [path2 ... ]] 
[PATH_SUFFIXES suffix1 [suffix2 ...]] 
[NO_DEFAULT_PATH] 
[NO_CMAKE_ENVIRONMENT_PATH] 
[NO_CMAKE_PATH] 
[NO_SYSTEM_ENVIRONMENT_PATH] 
[NO_CMAKE_PACKAGE_REGISTRY] 
[NO_CMAKE_BUILDS_PATH] 
[NO_CMAKE_SYSTEM_PATH] 
[NO_CMAKE_SYSTEM_PACKAGE_REGISTRY] 
[CMAKE_FIND_ROOT_PATH_BOTH | 
ONLY_CMAKE_FIND_ROOT_PATH | 
NO_CMAKE_FIND_ROOT_PATH]) 
2 ways : 
1. With a Find<package>.cmake module file 
2. With a cmake config file provided by the dependency 
jerome.esnault@inria.fr 02 July 2014 - 11
3- Find Package 
3.1- How to use 
CMake_find 
2 ways : 
1. With a Find<package>.cmake module file 
find_package (foo) Will look for Findfoo.cmake into : 1- CMAKE_MODULE_PATH list of dirs if not empty 
2- ${CMAKE_ROOT}/Modules 
The objective of a Findfoo.cmake try to locate libraries and includes files (and executables) to 
let user then use cmake variable to abstract paths and names whatever is the platform. 
Findfoo.cmake may use : 
find_library (<VAR> name1 [path1 path2 ...]) 
find_path (<VAR> name1 [path1 path2 ...]) 
find_file (<VAR> name1 [path1 path2 ...]) 
find_program (<VAR> name1 [path1 path2 ...]) 
FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> 
Paths may be set using : 
* foo_DIR cmake variable 
* $ENV{name} cmake variable 
* [HKEY_LOCAL_MACHINE …] 
(DEFAULT_MSG|"Custom failure message") <var1>...<varN> ) 
For find_* cmake instructions, some additional global list of dirs may be set with : 
CMAKE_INCLUDE_PATH 
CMAKE_LIBRARY_PATH 
CMAKE_PREFIX_PATH 
jerome.esnault@inria.fr 02 July 2014 - 12
3- Find Package 
3.1- How to use 
CMake_find 
2 ways : 
1. With a Find<package>.cmake module file 
Inside Findfoo.cmake, we have some ‘ready to use’ cmake variable according to the 
arguments passed to the find_package(…), for example : 
foo_FIND_REQUIRED if REQUIRED was given 
foo_FIND_COMPONENTS list if COMPONENTS was given with list of modules to find 
EXAMPLES OR QUESTION ? 
See standard FindOpenAL.cmake or FindGDAL.cmake 
for simple examples. 
See standard FindBoost.cmake or FindQt4.cmake for 
complexe examples. 
jerome.esnault@inria.fr 02 July 2014 - 13
3- Find Package 
3.1- How to use 
CMake_find 
2 ways : 
2. With a cmake config file provided by the dependency 
The 3rdParty project may provide a cmake config file which was generated by 
cmake on installation time (using the EXPORT command) 
On your side, if no Findfoo.cmake was found, cmake try to locate instead : 
fooConfig.cmake or foo-config.cmake file (as you need at least to provide foo_DIR 
which point to this file). 
For advanced cmake user, 
Should be discussed latter. 
jerome.esnault@inria.fr 02 July 2014 - 14
4- ADVANCED AND MORE 
For compiler command line: 
CMAKE_CXX_FLAGS cmake var 
For preprocessors : 
add_definitions(-DFOO -DBAR ...) 
configure_file(<input> <output> 
For more examples: 
suitesparse-metis-for-windows 
[COPYONLY] [ESCAPE_QUOTES] [@ONLY] 
[NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) 
For custom targets : 
add_custom_target(Name [ALL] [command1 [args1...]] 
[COMMAND command2 [args2...] ...] 
[DEPENDS depend depend depend ... ] 
[WORKING_DIRECTORY dir] 
[COMMENT comment] [VERBATIM] 
[SOURCES src1 [src2...]]) 
For installation (see doxygen example) : 
Install(…) (multiples signatures) 
jerome.esnault@inria.fr 02 July 2014 - 15
5-INSTALLATION, EXPORT, PACKAGE 
TIPS here 
And here 
jerome.esnault@inria.fr 02 July 2014 - 16
ANDROID && iOS toolchain 
• ANDROID : https://github.com/taka-no-me/android-cmake 
• iOS : https://code.google.com/p/ios-cmake/ 
• Global integration with Qt and QtCreator topic : 
(http://qt-project.org/forums/viewthread/36359) 
jerome.esnault@inria.fr 02 July 2014 - 17

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

C++ for the Web
C++ for the WebC++ for the Web
C++ for the Web
 
Autotools
AutotoolsAutotools
Autotools
 
Introduction to Makefile
Introduction to MakefileIntroduction to Makefile
Introduction to Makefile
 
C make tutorial
C make tutorialC make tutorial
C make tutorial
 
Sahul
SahulSahul
Sahul
 
Introducing DeploYii 0.5
Introducing DeploYii 0.5Introducing DeploYii 0.5
Introducing DeploYii 0.5
 
Sah
SahSah
Sah
 
Sahu
SahuSahu
Sahu
 
Sunil phani's take on windows powershell
Sunil phani's take on windows powershellSunil phani's take on windows powershell
Sunil phani's take on windows powershell
 
Powershell alias
Powershell aliasPowershell alias
Powershell alias
 
Makefile
MakefileMakefile
Makefile
 
Introduction to GNU Make Programming Language
Introduction to GNU Make Programming LanguageIntroduction to GNU Make Programming Language
Introduction to GNU Make Programming Language
 
Introduction To Makefile
Introduction To MakefileIntroduction To Makefile
Introduction To Makefile
 
$ make install
$ make install$ make install
$ make install
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
 
Sql Injection 0wning Enterprise
Sql Injection 0wning EnterpriseSql Injection 0wning Enterprise
Sql Injection 0wning Enterprise
 
T3CON11: Lazy Development using the Extension Builder
T3CON11: Lazy Development using the Extension BuilderT3CON11: Lazy Development using the Extension Builder
T3CON11: Lazy Development using the Extension Builder
 
ZopeSkel & Buildout packages
ZopeSkel & Buildout packagesZopeSkel & Buildout packages
ZopeSkel & Buildout packages
 
Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4
 
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTSCertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
 

Semelhante a short_intro_to_CMake_(inria_REVES_team)

How Helm, The Package Manager For Kubernetes, Works
How Helm, The Package Manager For Kubernetes, WorksHow Helm, The Package Manager For Kubernetes, Works
How Helm, The Package Manager For Kubernetes, WorksMatthew Farina
 
Struts2 tutorial
Struts2 tutorialStruts2 tutorial
Struts2 tutorializdihara
 
Where's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind PloneWhere's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind PloneVincenzo Barone
 
An Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemAn Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemLinaro
 
An Overview of Config4*
An Overview of Config4*An Overview of Config4*
An Overview of Config4*Ciaran McHale
 
Final Project Presentation
Final Project PresentationFinal Project Presentation
Final Project Presentationzroserie
 
OpenWRT guide and memo
OpenWRT guide and memoOpenWRT guide and memo
OpenWRT guide and memo家榮 吳
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondNuvole
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructuredAmi Mahloof
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules RestructuredDoiT International
 
C# and Borland StarTeam Connectivity
C# and Borland StarTeam ConnectivityC# and Borland StarTeam Connectivity
C# and Borland StarTeam ConnectivityShreesha Rao
 
A Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceA Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceohadlevy
 

Semelhante a short_intro_to_CMake_(inria_REVES_team) (20)

CMake best practices
CMake best practicesCMake best practices
CMake best practices
 
CMake_Tutorial.pdf
CMake_Tutorial.pdfCMake_Tutorial.pdf
CMake_Tutorial.pdf
 
How Helm, The Package Manager For Kubernetes, Works
How Helm, The Package Manager For Kubernetes, WorksHow Helm, The Package Manager For Kubernetes, Works
How Helm, The Package Manager For Kubernetes, Works
 
Struts2 tutorial
Struts2 tutorialStruts2 tutorial
Struts2 tutorial
 
Struts2 tutorial
Struts2 tutorialStruts2 tutorial
Struts2 tutorial
 
Struts2 tutorial
Struts2 tutorialStruts2 tutorial
Struts2 tutorial
 
Autotools
AutotoolsAutotools
Autotools
 
Where's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind PloneWhere's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind Plone
 
An Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemAn Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating System
 
An Overview of Config4*
An Overview of Config4*An Overview of Config4*
An Overview of Config4*
 
Final Project Presentation
Final Project PresentationFinal Project Presentation
Final Project Presentation
 
OpenWRT guide and memo
OpenWRT guide and memoOpenWRT guide and memo
OpenWRT guide and memo
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
 
F3X12 FLOW3 Project Lifecycle
F3X12 FLOW3 Project LifecycleF3X12 FLOW3 Project Lifecycle
F3X12 FLOW3 Project Lifecycle
 
What's new in p2 (2009)?
What's new in p2 (2009)?What's new in p2 (2009)?
What's new in p2 (2009)?
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules Restructured
 
C# and Borland StarTeam Connectivity
C# and Borland StarTeam ConnectivityC# and Borland StarTeam Connectivity
C# and Borland StarTeam Connectivity
 
Docker Tutorial.pdf
Docker Tutorial.pdfDocker Tutorial.pdf
Docker Tutorial.pdf
 
A Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceA Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conference
 

Último

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 

Último (20)

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 

short_intro_to_CMake_(inria_REVES_team)

  • 2. 1- PRINCIPLES AND POTENTIALS 1.1- INTRO 1.2- WORKFLOW 2- CROSSPLATEFORM USAGES 2.1- USEFUL VARIABLES AND USE 2.2- GUI AND CACHE 3- FIND PACKAGE 4- ADVANCED AND MORE 5- INSTALLATION, EXPORT, PACKAGE (NOT PRESENTED HERE) jerome.esnault@inria.fr 02 July 2014 - 2
  • 3. 1- Principles and potentials 1.1- Intro • Objectif : Crossplateform toolbox (linux/windows/mac) to help to the build / creation / compilation of C/C++ projects. • Usage : Hight level of script language • Generation : Files which are used for the chosen developement environnement in the current platform • Developped by KitWare in open source version and started in 1999 for ITK projects then used by VTK project. • At this moment at 3.0 version and used by many big projects like OGRE, OpenSceneGraph… http://www.ohloh.net/p/cmake?ref=sample jerome.esnault@inria.fr 02 July 2014 - 3
  • 4. 1- Principles and potentials CMake / Ctest / CPack Compiler jerome.esnault@inria.fr 02 July 2014 - 4 Modules CMake [*.cmake] [*.in] Sources C/C++/Java CMakeLists.txt / Ctest scripts CMakeCache.txt Native build system files [MakeFiles, sln…] Targets [executables, libraries, plugins] 1.2- Workflow
  • 5. 2- CROSSPLATEFORM USAGES Cmake [options] <path-to-source> $ cd projectName $ mkdir build && cd build $ cmake .. $ make install $ cd projectName $ mkdir build && cd build $ cmake-gui .. $ make install Generators / IDE compatibilities : • Borland • MinGW • Nmake • Unix • Visual Studio 6/7/8/9/10/11 • Xcode • codeBlocks • Eclipse • QtCreator 3 tree structures : • CMAKE_SOURCE_DIR • CMAKE_BINARY_DIR • CMAKE_INSTALL_PREFIX OR jerome.esnault@inria.fr 02 July 2014 - 5
  • 6. 2- CROSSPLATEFORM USAGES 2.1- Useful variables and use CMake_presentation CMAKE_SOURCE_DIR CMAKE_BINARY_DIR CMAKE_INSTALL_PREFIX rootFolder CMakeLists.txt Cmake_minimum_required(VERSION 2.8) Project(foo) … Add_subdirectory(subFolder1) … subFolder1 CMakeLists.txt build Same structure but with generated or temp files Project(bar) … Add_executable(myApp mySources) subFolder2 CMakeLists.txt CMAKE_CURRENT_SOURCE_DIR CMAKE_CURRENT_BINARY_DIR (=subFolder2) CMakeFiles Structure defined by ‘install()’ cmake instruction jerome.esnault@inria.fr 02 July 2014 - 6
  • 7. 2- CROSSPLATEFORM USAGES 2.1- Useful variables and use CMake_Useful_Variables CMAKE_SOURCE_DIR (=path to rootFolder) CMAKE_BINARY_DIR (=path to build) CMAKE_PROJECT_NAME (=foo) CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_RUNTIME_OUTPUT_DIRECTORY PROJECT_NAME (=bar) UNIX WIN32 APPLE MSVC jerome.esnault@inria.fr 02 July 2014 - 7 bool Place where target name will be generated, see: Add_executable(name sources) Add_library(name srouces [STATIC|SHARED])
  • 8. 2- CROSSPLATEFORM USAGES 2.1- Useful variables and use CMake instructions act on : • new project / sub-project creations CMake_Wiki • cmake variables and list (cached or not) (content of a cmake variableis ${myCmakeVar}) • system file manipulation • building out of source, installation and packaging an installer • the « automatique » research of dependencies package and files • the cmake function and macros creation (for reusable code) • the customization of target properties or systeme file properties Project(…) Add_subdirectory(…) Add_dependencies(…) Include_directories(…) Target_link_libraries(…) Set(…) – unset(…) List(…) Option(…) Foreach() … endforeach() If() … else() … endif() File(…) - String(…) Configure_file(…) Install(…) Find_package(…) Find_library(…) Find_file(…) – Find_path(…) Include(…) Function()…endfunction() Macro()…endmacro() Add_definition(…) Define_property(…) jerome.esnault@inria.fr 02 July 2014 - 8
  • 9. 2- CROSSPLATEFORM USAGES 2.2- GUI and CACHE CMAKE_BINARY_DIR (=path to build) CMakeCache.txt Foo.sln Cmake generated or temp files jerome.esnault@inria.fr 02 July 2014 - 9
  • 10. 2- CROSSPLATEFORM USAGES QUESTION ? EXAMPLES with current IBR projects, Showing differences between spixel_warp Ulrvr Ibr_common jerome.esnault@inria.fr 02 July 2014 - 10
  • 11. 3- Find Package 3.1- How to use CMake_find find_package(<package> [version] [EXACT] [QUIET] [REQUIRED] [[COMPONENTS] [components...]] [CONFIG|NO_MODULE] [NO_POLICY_SCOPE] [NAMES name1 [name2 ...]] [CONFIGS config1 [config2 ...]] [HINTS path1 [path2 ... ]] [PATHS path1 [path2 ... ]] [PATH_SUFFIXES suffix1 [suffix2 ...]] [NO_DEFAULT_PATH] [NO_CMAKE_ENVIRONMENT_PATH] [NO_CMAKE_PATH] [NO_SYSTEM_ENVIRONMENT_PATH] [NO_CMAKE_PACKAGE_REGISTRY] [NO_CMAKE_BUILDS_PATH] [NO_CMAKE_SYSTEM_PATH] [NO_CMAKE_SYSTEM_PACKAGE_REGISTRY] [CMAKE_FIND_ROOT_PATH_BOTH | ONLY_CMAKE_FIND_ROOT_PATH | NO_CMAKE_FIND_ROOT_PATH]) 2 ways : 1. With a Find<package>.cmake module file 2. With a cmake config file provided by the dependency jerome.esnault@inria.fr 02 July 2014 - 11
  • 12. 3- Find Package 3.1- How to use CMake_find 2 ways : 1. With a Find<package>.cmake module file find_package (foo) Will look for Findfoo.cmake into : 1- CMAKE_MODULE_PATH list of dirs if not empty 2- ${CMAKE_ROOT}/Modules The objective of a Findfoo.cmake try to locate libraries and includes files (and executables) to let user then use cmake variable to abstract paths and names whatever is the platform. Findfoo.cmake may use : find_library (<VAR> name1 [path1 path2 ...]) find_path (<VAR> name1 [path1 path2 ...]) find_file (<VAR> name1 [path1 path2 ...]) find_program (<VAR> name1 [path1 path2 ...]) FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> Paths may be set using : * foo_DIR cmake variable * $ENV{name} cmake variable * [HKEY_LOCAL_MACHINE …] (DEFAULT_MSG|"Custom failure message") <var1>...<varN> ) For find_* cmake instructions, some additional global list of dirs may be set with : CMAKE_INCLUDE_PATH CMAKE_LIBRARY_PATH CMAKE_PREFIX_PATH jerome.esnault@inria.fr 02 July 2014 - 12
  • 13. 3- Find Package 3.1- How to use CMake_find 2 ways : 1. With a Find<package>.cmake module file Inside Findfoo.cmake, we have some ‘ready to use’ cmake variable according to the arguments passed to the find_package(…), for example : foo_FIND_REQUIRED if REQUIRED was given foo_FIND_COMPONENTS list if COMPONENTS was given with list of modules to find EXAMPLES OR QUESTION ? See standard FindOpenAL.cmake or FindGDAL.cmake for simple examples. See standard FindBoost.cmake or FindQt4.cmake for complexe examples. jerome.esnault@inria.fr 02 July 2014 - 13
  • 14. 3- Find Package 3.1- How to use CMake_find 2 ways : 2. With a cmake config file provided by the dependency The 3rdParty project may provide a cmake config file which was generated by cmake on installation time (using the EXPORT command) On your side, if no Findfoo.cmake was found, cmake try to locate instead : fooConfig.cmake or foo-config.cmake file (as you need at least to provide foo_DIR which point to this file). For advanced cmake user, Should be discussed latter. jerome.esnault@inria.fr 02 July 2014 - 14
  • 15. 4- ADVANCED AND MORE For compiler command line: CMAKE_CXX_FLAGS cmake var For preprocessors : add_definitions(-DFOO -DBAR ...) configure_file(<input> <output> For more examples: suitesparse-metis-for-windows [COPYONLY] [ESCAPE_QUOTES] [@ONLY] [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) For custom targets : add_custom_target(Name [ALL] [command1 [args1...]] [COMMAND command2 [args2...] ...] [DEPENDS depend depend depend ... ] [WORKING_DIRECTORY dir] [COMMENT comment] [VERBATIM] [SOURCES src1 [src2...]]) For installation (see doxygen example) : Install(…) (multiples signatures) jerome.esnault@inria.fr 02 July 2014 - 15
  • 16. 5-INSTALLATION, EXPORT, PACKAGE TIPS here And here jerome.esnault@inria.fr 02 July 2014 - 16
  • 17. ANDROID && iOS toolchain • ANDROID : https://github.com/taka-no-me/android-cmake • iOS : https://code.google.com/p/ios-cmake/ • Global integration with Qt and QtCreator topic : (http://qt-project.org/forums/viewthread/36359) jerome.esnault@inria.fr 02 July 2014 - 17

Notas do Editor

  1. http://qt-project.org/forums/viewthread/36359