Author : Akide Liu
The highly optimized and integrated template of Cmake Clion Conan for University of Adelaide C++ direction course. Educational purpose only
This template use cmake as build and complie support, conan build external framework (e.g. GTest), Clion integrated them together.
This template design for multiple sub-projects architecture and optimized conan with once build unlimited reuse.
Github Actions Continue Integration Example
├── CMakeLists.txt // top layer cmake setup
├── CNAME
├── LICENSE
├── README.md
├── _config.yml
├── include
│ └── bits
│ └── stdc++.h
├── main.cpp
├── src // example source code
│ ├── AVLTree
│ │ ├── AVLTree.cpp
│ │ ├── AVLTree.h
│ │ ├── CMakeLists.txt // sub dir cmake setup
│ │ ├── Node.cpp
│ │ ├── binarySearchTree.cpp
│ │ ├── binarySearchTree.h
│ │ └── inputTest // input test
│ │ ├── AVLTree_testSet.txt
│ │ ├── compare.txt
│ │ ├── input.txt
│ │ ├── main.cpp
│ │ ├── out.txt
│ │ └── test.bash
│ └── Test
│ └── AVLTree-Test.cpp // test file maintained in test folder
└── windows.md
What is Cmake?
Long Description - CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice. The suite of CMake tools were created by Kitware in response to the need for a powerful, cross-platform build environment for open-source projects such as ITK and VTK.
Short answer - build and complie tools for C++
What is Conan ?
The open source, decentralized and multi-platform package manager to create and share all your native binaries.
Build third party dependency, such as Google Test
What is Clion ?
A cross-platform IDE for C and C++
Notice : The Setup instructions below is for MacOS and Linux Users.
Looking for Windows Instructions? Windows setup Instructions
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
-
Register Jetbrains Account and generate Educational License
Note : Use Your School Email
-
Download and install Clion (Select corresponding system platform)
https://www.jetbrains.com/clion/download/#section=mac
Note : For Mac Users, M1 Series Chips have been supported by native Arm version
Ubuntu User Could use Snap package manager
sudo snap install clion --classic
-
Enter the Jetbrains Account to active the Clion
-
Install gcc / clang compiler
MacOS :
xcode-select --install
Linux :
sudo apt-get update sudo apt-get install build-essential
-
Install Conan
MacOS :
Install homebrew if missing
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update brew install conan
Linux :
make sure python3 is installed on the system ( if not
sudo apt install python3-pip
)sudo pip install conan
-
Install Cmake (Optional, due to clion bundled a cmake)
MacOS :
brew install cmake
Linux :
sudo apt install cmake
-
Fork and Clone this template from github
Note : Replace following url by your fork https://github.com/AkideLiu/CCCT.git
-
Try the sample test file, make sure it runs properly
src/Test/AVLTree-Test.cpp
Happy Coding : )
-
Add following configuration
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/ ) # including current .h header (do not modify) conan_basic_setup() # conan support add_executable(new_project # your sub-project name # add your source file (cpp file only) ../Test/new_project_test.cpp ) target_link_libraries(new_project # must identical to sub-project name ${CONAN_LIBS} )
-
In your ROOT Level Cmake file add following configuration
add_subdirectory(src/new_project)
-
Create your Class file
Select Add to target and select sub project's cmake file
-
AceJump ⭐️ -- AceJump allows you to quickly navigate the caret to any position visible in the editor. See a demo of AceJump in action! Simply hit "ctrl+;", type a character, then type the matching character to Ace Jump.
-
Atom Material Icons -- Custom File and IDE Icons for improved visual grepping
https://plugins.jetbrains.com/plugin/10044-atom-material-icons
-
BashSupport Pro -- BashSupport Pro is a plugin for advanced Bash and shell script development — debugger, test runner, code completion, find usages, rename, ShellCheck, shfmt, and more.
-
C/C++ Single File Execution -- When you want to build and run single c/cpp file in CLion,
CMakeLists.txt
needs to be configured to declareadd_executable()
. It is troublesome when you want to run many of the files independently within the same project.https://plugins.jetbrains.com/plugin/8352-c-c--single-file-execution
-
CMake Plus -- Ultimate Cmake support
-
IDE Eval Reset ⭐️ -- Discover Jetbrains Marketplace Paid Plugins
https://zhile.io/2020/11/18/jetbrains-eval-reset-da33a93d.html
-
Key Promoter X -- The Key Promoter X helps you to learn essential shortcuts while you are working.
-
Material Theme UI -- Material Theme UI Plugin
-
Nyan Progress Bar -- Pretty progress bars with nyan cat for IJ based IDEs.
-
Rainbow Brackets -- 🌈Rainbow Brackets for IntelliJ based IDEs/Android Studio/HUAWEI DevEco Studio
-
Tabnine ⭐️ -- Tabnine - AI Code Completion
Authors: Akide Liu
CCCT (Cmake Clion Conan Template)
Copyright (C) <2021> Akide Liu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.