dotfiles/dev/conan-project/README.org

61 lines
2.4 KiB
Org Mode
Raw Normal View History

2019-07-21 01:27:31 +00:00
[[http://spacemacs.org][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]]
* PROJECTNAME
PROJECTNAME is a C++17 project written for and built with CMake and Ninja.
* How to build PROJECTNAME
You will ned to have Ninja and Conan installed. To install Ninja, install the
appropriate package offered by your package manager (~ninja-build~ on Debian,
~ninja~ on Arch Linux and Void Linux), and to install conan, use ~pip~.
#+begin_src shell
pip install --user conan
#+end_src
This project is built with conan, ninja and cmake using clang-7 for C++17. To
use it, first install clang-7 and lldb 7, then run this:
#+begin_src shell
conan profile new default --detect
conan profile update settings.compiler=clang default
conan profile update settings.compiler.version=7.0 default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan profile update env.CC=/bin/clang default
conan profile update env.CXX=/bin/clang++ default
#+end_src
If you do not wish to overwrite your ~default~ profile, you can instead create a
new one, for instance ~clang~. To do so, write the name of your new profile (in
this example ~clang~) instead of ~default~ in the commands shown above.
Then, To build and run the program, go to the root of the project and run this:
#+begin_src shell
mkdir build && cd build
conan install .. --build missing
cmake -DCMAKE_CXX_COMPILER=clang++ .. -G Ninja
cmake --build .
#+end_src
If you want to use another profile than your default one, you should run the
following line instead of the second line:
#+begin_src shell
conan install .. --build missing --profile <your_profile>
#+end_src
If you wish to build the projects tests in addition to the project itself, you
can add the option ~-DTESTS=True~ to the first ~cmake~ command to build the
projects tests too.
#+begin_src shell
cmake -DCMAKE_CXX_COMPILER=clang++ -DTESTS=True .. -G Ninja
#+end_src
If you do not wish to build your project with Ninja but with another generator,
such as Unix Makefiles, simply replace ~Ninja~ in the second to last ~cmake~
command with the name of your generator. For instance:
#+begin_src shell
cmake -DCMAKE_CXX_COMPILER=clang++ .. -G "Unix Makefiles"
#+end_src
You can still build your project by running ~cmake --build .~ or by running
~make~ manually.
* Credits
Awesome C++ Template by [[https://github.com/devkoriel/AwesomeCppTemplate][devkoriel]].