Conan Client: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(32 intermediate revisions by the same user not shown) | |||
Line 23: | Line 23: | ||
pip install conan | pip install conan | ||
conan --help | conan --help | ||
</source> | |||
==Profile== | |||
''If you are using '''GCC compiler >= 5.1''', Conan will set the compiler.libcxx to the old ABI for backwards compatibility. In the context of this getting started example, this is a bad choice though: Recent gcc versions will compile the example by default with the new ABI and linking will fail without further customization of your cmake configuration. You can avoid this with the following commands:'' | |||
<source lang="bash" highlight="5,6"> | |||
# generates default profile | |||
conan profile new default --detect | |||
# sets libcxx to C++11 ABI | |||
conan profile update settings.compiler.libcxx=libstdc++11 default | |||
conan profile remove settings.compiler.libcxx default | |||
cat ~/.conan/profiles/default | |||
ls -la ~/.conan/profiles/ | |||
</source> | |||
==Getting Started== | |||
cmake_minimum_required(VERSION 3.19) | |||
'''Example: 1''' | |||
<source lang="bash"> | |||
cd $ACADEMIA_HOME/wss/ccpp_wss/ | |||
git clone https://github.com/conan-io/examples.git | |||
cd examples/libraries/poco/md5/ | |||
conan search poco --remote=conancenter | |||
conan inspect poco/1.9.4 | |||
cat conanfile.txt | |||
mkdir cmake-build-debug; cd cmake-build-debug | |||
conan install .. -s compiler="Visual Studio" -s compiler.runtime=MDd -s build_type=Debug -s compiler.version=16 | |||
conan info .. --graph=graph.html | |||
graph.html | |||
mkdir ../build; cd ../build | |||
conan install .. | |||
</source> | |||
'''Example: 2''' | |||
<source lang="bash" highlight="3,12-19"> | |||
cd $ACADEMIA_HOME/wss/ccpp_wss/ | |||
git clone https://github.com/drodri/clion_conan.git;cd clion_conan/boost_poco_md5 | |||
conan profile remove settings.compiler.libcxx default | |||
mkdir cmake-build-debug; cd cmake-build-debug | |||
conan search poco--remote=conancenter | |||
conan inspect poco/1.11.0 | |||
conan search boost --remote=conancenter | |||
conan inspect boost/1.76.0 | |||
cat <<EOF > ../conanfile.txt | |||
[requires] | |||
poco/1.11.0 | |||
boost/1.76.0 | |||
[generators] | |||
cmake | |||
EOF | |||
conan install .. -s compiler="Visual Studio" -s compiler.runtime=MDd -s build_type=Debug -s compiler.version=16 | |||
conan info .. --graph=graph.html | |||
graph.html | |||
</source> | </source> | ||
Line 29: | Line 93: | ||
cd conan; python -m pip install -e . | cd conan; python -m pip install -e . | ||
pip install conan --upgrade | pip install conan --upgrade | ||
ls -la ~/.conan/profiles/ | |||
cat ~/.conan/profiles/default | |||
conan info .. | |||
conan search "*" | |||
conan search poco/1.9.4@ | |||
conan info .. --graph=file.html | |||
conan install .. --profile=gcc_x86 | |||
conan install .. --settings arch=x86 | |||
conan install .. --settings os="Linux" --settings compiler="gcc" | |||
==References== | ==References== | ||
Line 34: | Line 109: | ||
| valign="top" | | | valign="top" | | ||
* [https://medium.com/@hoan.nguyen.it/how-did-g1gc-tuning-flags-affect-our-back-end-web-app-c121d38dfe56 Affected Performance of First Garbage Collector (G1GC)] | * [https://medium.com/@hoan.nguyen.it/how-did-g1gc-tuning-flags-affect-our-back-end-web-app-c121d38dfe56 Affected Performance of First Garbage Collector (G1GC)] | ||
* [https://docs.conan.io/en/latest/getting_started.html An MD5 hash calculator using the Poco Libraries] | |||
* [https://blog.conan.io/2018/06/11/Transparent-CMake-Integration.html Conan-CMake Transparent Integration] | * [https://blog.conan.io/2018/06/11/Transparent-CMake-Integration.html Conan-CMake Transparent Integration] | ||
* [https://conan.io/ Conan, the C / C++ Package Manager] | * [https://conan.io/ Conan, the C / C++ Package Manager] | ||
Line 41: | Line 117: | ||
* [https://github.com/memsharded/hello Conan Hello World] | * [https://github.com/memsharded/hello Conan Hello World] | ||
* [https://conan.io/downloads.html Downloads] | * [https://conan.io/downloads.html Downloads] | ||
* [[Conan]] | * [[Conan]] | ||
| valign="top" | | | valign="top" | | ||
* [https://gamesfromwithin.com/exploring-the-c-unit-testing-framework-jungle Exploring the C++ Unit Testing Framework] | |||
* [https://stackoverflow.com/questions/242926/ Comparison of C++ unit test frameworks] | |||
* [https://stackoverflow.com/questions/65408676/ Default Profile Error for <code>libstdc++11</code>] | |||
* [https://stackoverflow.com/questions/3150/ Unit testing for Visual Studio C++] | |||
* [https://docs.conan.io/en/latest/faq/troubleshooting.html Conan Troubleshooting] | |||
* [https://docs.conan.io/en/latest/reference/config_files/default_profile.html Conan Default Profile] | |||
* [[CPP OOP]] | |||
|} | |} |
Latest revision as of 21:17, 24 July 2021
Linux
apt install python3-all python3-pip python3-venv
python3 -m venv ~/.venv/conan
source ~/.venv/conan/bin/activate
python -m pip install -U pip
pip install conan
conan --help
Windows
run as administrator 1. Press ⊞ + R 2. Type in cmd 3. Press Ctrl + Shift + Enter 4. Choose Yes and Press Enter
python -m pip install virtualenv
python -m venv ~\.venv\conan
~\.venv\conan\Scripts\activate
python -m pip install -U pip
pip install conan
conan --help
Profile
If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. In the context of this getting started example, this is a bad choice though: Recent gcc versions will compile the example by default with the new ABI and linking will fail without further customization of your cmake configuration. You can avoid this with the following commands:
# generates default profile
conan profile new default --detect
# sets libcxx to C++11 ABI
conan profile update settings.compiler.libcxx=libstdc++11 default
conan profile remove settings.compiler.libcxx default
cat ~/.conan/profiles/default
ls -la ~/.conan/profiles/
Getting Started
cmake_minimum_required(VERSION 3.19)
Example: 1
cd $ACADEMIA_HOME/wss/ccpp_wss/
git clone https://github.com/conan-io/examples.git
cd examples/libraries/poco/md5/
conan search poco --remote=conancenter
conan inspect poco/1.9.4
cat conanfile.txt
mkdir cmake-build-debug; cd cmake-build-debug
conan install .. -s compiler="Visual Studio" -s compiler.runtime=MDd -s build_type=Debug -s compiler.version=16
conan info .. --graph=graph.html
graph.html
mkdir ../build; cd ../build
conan install ..
Example: 2
cd $ACADEMIA_HOME/wss/ccpp_wss/
git clone https://github.com/drodri/clion_conan.git;cd clion_conan/boost_poco_md5
conan profile remove settings.compiler.libcxx default
mkdir cmake-build-debug; cd cmake-build-debug
conan search poco--remote=conancenter
conan inspect poco/1.11.0
conan search boost --remote=conancenter
conan inspect boost/1.76.0
cat <<EOF > ../conanfile.txt
[requires]
poco/1.11.0
boost/1.76.0
[generators]
cmake
EOF
conan install .. -s compiler="Visual Studio" -s compiler.runtime=MDd -s build_type=Debug -s compiler.version=16
conan info .. --graph=graph.html
graph.html
Knowledge
git clone https://github.com/conan-io/conan.git conan;\ cd conan; python -m pip install -e . pip install conan --upgrade
ls -la ~/.conan/profiles/ cat ~/.conan/profiles/default
conan info .. conan search "*" conan search poco/1.9.4@ conan info .. --graph=file.html conan install .. --profile=gcc_x86 conan install .. --settings arch=x86 conan install .. --settings os="Linux" --settings compiler="gcc"