SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 

Kürzlich hochgeladen (20)

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 

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

Hinweis der Redaktion

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