Successfully reported this slideshow.
Your SlideShare is downloading. ×

GitHub/git+Cmake+Clion

Ad

GitHub/git +GitHub/git +
CMake +CMake +
CLionCLion

Ad

GitGit

Ad

25.04.17 Igor Khokhriakov 3
Git
“Git was created by Linus Torvalds in 2005 for
development of the Linux kernel, with other...

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Upcoming SlideShare
Git and GitHub
Git and GitHub
Loading in …3
×

Check these out next

1 of 41 Ad
1 of 41 Ad
Advertisement

More Related Content

Advertisement

GitHub/git+Cmake+Clion

  1. 1. GitHub/git +GitHub/git + CMake +CMake + CLionCLion
  2. 2. GitGit
  3. 3. 25.04.17 Igor Khokhriakov 3 Git “Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development.” Wikipedia.org According to StackOverflow survey 2017 ~70% of developers are using git
  4. 4. 25.04.17 Igor Khokhriakov 4 Key points about Git ● Strong support for non-linear development – a core assumption is that a change will be merged more often than it is written ● Distributed development – Git gives each developer a local copy of the full development history ● Efficient handling of large projects – an order of magnitude faster than some version control systems
  5. 5. GitHubGitHub
  6. 6. 25.04.17 Igor Khokhriakov 6 GitHub ● Hosting that provides git service ● Suddenly became a central feature in git ecosystem – My personal experience is that back in 2012 they did not have even in-line commit comment (vs bitbucket)
  7. 7. 25.04.17 Igor Khokhriakov 7 Summary SourceForge/svn = GitHub/git aka Hosting/repository SourceForge/svn ≠ GitHub/git GitHub provides tons of features and integrations: travis, appveyor, read-the- docs, ...
  8. 8. PRACTICEPRACTICE
  9. 9. 25.04.17 Igor Khokhriakov 9 Git concept ● Simple case: one user; direct access to the remote repo – Create new file:
  10. 10. 25.04.17 Igor Khokhriakov 10 Git concept – Working with branches: ● $> git branch my_branch ● $> git checkout my_branch – Shortcut: git checkout -b my_branch ● Do stuff ● $> git push -u my_branch origin – Merging branch into the master ● $> git checkout master ● $> git merge my_branch
  11. 11. 25.04.17 Igor Khokhriakov 11 Git cheat sheet http://files.zeroturnaround.com/pdf/zt_git_cheat_sheet.pdf
  12. 12. GitHub/git workflowGitHub/git workflow
  13. 13. 25.04.17 Igor Khokhriakov 13 GitHub concept ● Contributing via Pull-Request (PR)
  14. 14. 25.04.17 Igor Khokhriakov 14 GitHub concept – Creating a Pull-Request ● GitHub fork ● $> git clone … ● $> git checkout -b feature ● Do stuff ● $> git push ● GitHub create a Pull-Request ● Do more pushes
  15. 15. 25.04.17 Igor Khokhriakov 15 GitHub concept – Rebasing onto master ● $> git pull –rebase upstream master ● $> git push – Closing the PR ● maintainer(s) approval(s) + tests passed ● GitHub megre PR ● $> git branch -d feature ● Sync fork master (origin) with upstream master – $> git checkout master; git pull upstream master
  16. 16. 25.04.17 Igor Khokhriakov 16 gitk
  17. 17. 25.04.17 Igor Khokhriakov 17 https://www.atlassian.com/git/tutorials
  18. 18. 25.04.17 Igor Khokhriakov 18 Keep in mind ● Git is very powerful and flexible – github.com/tango-controls/cppTango ● Merged 4 repositories ● Preserved commits history ● Preserved branches Do not hesitate to google the most astounding ideas aka How can I do X in git
  19. 19. CMakeCMake
  20. 20. 25.04.17 Igor Khokhriakov 20 CMake ● Cross-platform build automatization tool ● Declarative scripting language for managing native projects ● Dependency management (via pkg-config or cmake modules) ● Testing ● Packaging
  21. 21. 25.04.17 Igor Khokhriakov 21 CmakeLists.txt
  22. 22. 25.04.17 Igor Khokhriakov 22 Build using cmake ● $> mkdir build ● $> cd build ● $> cmake .. ● $> make ● $> make install … better use IDE like CLion
  23. 23. 25.04.17 Igor Khokhriakov 23 CMake guide lines ● Use the following directory structure: – configure – include – docs – src – test ● Use dedicated project when configuration is totally different from the root project
  24. 24. 25.04.17 Igor Khokhriakov 24 CMake guide lines ● Split complex project into modules – add_library(my_module OBJECT …) ● Use CTest for integration testing. Unit tests must be independent ● Use CPack to generate packages and custom targets to deploy them – add_custom_target(COMMAND curl ...)
  25. 25. 25.04.17 Igor Khokhriakov 25 Where get help? ● No good book :( ● Find some open-source project and explore it – https://github.com/pni-libraries/libpnicore – https://github.com/ufo-kit/ufo-core ● CMake itself... for gurus
  26. 26. CLionCLion
  27. 27. 25.04.17 Igor Khokhriakov 27
  28. 28. 25.04.17 Igor Khokhriakov 28 Agenda ● CMake support ● Navigation ● Refactoring ● Git integration ● Debugging ● Creating live templates
  29. 29. 25.04.17 Igor Khokhriakov 29 CMake support File → settings OR ctrl+alt+s
  30. 30. 25.04.17 Igor Khokhriakov 30 CMake support ● Run targets
  31. 31. 25.04.17 Igor Khokhriakov 31 Navigation ● Find class: ctrl+n ● Find file: ctrl+shift+n ● Subclasses: ● Implementation &Override:
  32. 32. 25.04.17 Igor Khokhriakov 32 Navigation ● Method lookup: ctrl+F12 OR structure tab ● Code navigation: ctrl+click on an item ● Find usages: Alt+F7
  33. 33. 25.04.17 Igor Khokhriakov 33 Refactoring ● Rename: shift+F6 ● Change signature: ctrl+F6 ● Move entity: F6 ● Generate definitions: ctrl+shift+d ● Generate … : alt+insert ● Generate constructor that matches super
  34. 34. 25.04.17 Igor Khokhriakov 34 Refactoring ● Extract method: highlight and ctrl+alt+m ● Extract variable: highlight and ctrl+alt+v ● Extract …: Refactoring → Extract – Constant – Parameter – Define – Typedef – Superclass – Subclass
  35. 35. 25.04.17 Igor Khokhriakov 35 Git integration ● Compare with branch... ● Make pull request ● Resolve conflicts ● Rebase ● Etc: VCS → Git; context menu → Git ● Local changes&history:
  36. 36. 25.04.17 Igor Khokhriakov 36 Debugging
  37. 37. 25.04.17 Igor Khokhriakov 37 Live template creation
  38. 38. 25.04.17 Igor Khokhriakov 38 https://www.jetbrains.com/help/clion/2017.1/reference.html
  39. 39. Live coding!Live coding!
  40. 40. Questions?Questions?
  41. 41. Thank you!!!Thank you!!!

Editor's Notes

  • $> git init
    $> git pull === $> git fetch & git merge
    $> git remote -v
  • Switch to browser
  • cppTango test/test_suite is a dedicated project
  • Live template variables: https://www.jetbrains.com/help/clion/2017.1/creating-and-editing-template-variables.html

×