Skip to content

Commit a4cca4a

Browse files
Added settings_user.yml example (#2971)
* Added settings_user example * added list and different subfolder * wip * Added link to profiles
1 parent f48e90a commit a4cca4a

File tree

2 files changed

+253
-4
lines changed

2 files changed

+253
-4
lines changed
Lines changed: 250 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,253 @@
11
.. _examples_config_files_settings_user:
22

3-
Using settings_user.yml
4-
=======================
3+
Customize your settings: create your settings_user.yml
4+
======================================================
55

6-
TBD
6+
Please, first of all, clone the sources to recreate this project. You can find them in the
7+
`examples2.0 repository <https://github.com/conan-io/examples2>`_ in GitHub:
8+
9+
.. code-block:: bash
10+
11+
$ git clone https://github.com/conan-io/examples2.git
12+
$ cd examples2/examples/config_files/settings_user
13+
14+
15+
In this example we are going to see how to customize your settings without overwriting the original **settings.yml** file.
16+
17+
.. note::
18+
19+
To understand better this example, it is highly recommended to read previously the reference
20+
about :ref:`reference_config_files_settings_yml`.
21+
22+
23+
Locate the settings_user.yml
24+
----------------------------
25+
26+
First of all, let's have a look at the proposed ``source/settings_user.yml``:
27+
28+
.. code-block:: yaml
29+
:caption: **settings_user.yml**
30+
31+
os:
32+
webOS:
33+
sdk_version: [null, "7.0.0", "6.0.1", "6.0.0"]
34+
arch: ["cortexa15t2hf"]
35+
compiler:
36+
gcc:
37+
version: ["13.0-rc"]
38+
39+
40+
As you can see, we don't have to rewrite all the settings because they will be merged with the already defined in
41+
**settings.yml**.
42+
43+
Then, what are we adding through that ``settings_user.yml`` file?
44+
45+
* New OS: ``webOS``, and its sub-setting: ``sdk_version``.
46+
* New ``arch`` available: ``cortexa15t2hf``.
47+
* New gcc version: ``13.0-rc``.
48+
49+
Now, it's time to copy the file ``source/settings_user.yml`` into your ``[CONAN_HOME]/`` folder:
50+
51+
.. code-block:: bash
52+
53+
$ conan config install sources/settings_user.yml
54+
Copying file settings_user.yml to /Users/myuser/.conan2/.
55+
56+
57+
Use your new settings
58+
---------------------
59+
60+
After having copied the ``settings_user.yml``, you should be able to use them for your recipes. Add this simple one
61+
into your local folder:
62+
63+
.. code-block:: python
64+
:caption: **conanfile.py**
65+
66+
from conan import ConanFile
67+
68+
class PkgConan(ConanFile):
69+
name = "pkg"
70+
version = "1.0"
71+
settings = "os", "compiler", "build_type", "arch"
72+
73+
74+
Then, create several Conan packages (not binaries, as it does not have any source file for sure) to see
75+
that it's working correctly:
76+
77+
78+
.. code-block:: bash
79+
:caption: **Using the new OS and its sub-setting**
80+
:emphasize-lines: 11,12,34
81+
82+
$ conan create . -s os=webOS -s os.sdk_version=7.0.0
83+
...
84+
Profile host:
85+
[settings]
86+
arch=x86_64
87+
build_type=Release
88+
compiler=apple-clang
89+
compiler.cppstd=gnu98
90+
compiler.libcxx=libc++
91+
compiler.version=12.0
92+
os=webOS
93+
os.sdk_version=7.0.0
94+
95+
Profile build:
96+
[settings]
97+
arch=x86_64
98+
build_type=Release
99+
compiler=apple-clang
100+
compiler.cppstd=gnu98
101+
compiler.libcxx=libc++
102+
compiler.version=12.0
103+
os=Macos
104+
...
105+
-------- Installing (downloading, building) binaries... --------
106+
pkg/1.0: Copying sources to build folder
107+
pkg/1.0: Building your package in /Users/myuser/.conan2/p/t/pkg929d53a5f06b1/b
108+
pkg/1.0: Aggregating env generators
109+
pkg/1.0: Package 'a0d37d10fdb83a0414d7f4a1fb73da2c210211c6' built
110+
pkg/1.0: Build folder /Users/myuser/.conan2/p/t/pkg929d53a5f06b1/b
111+
pkg/1.0: Generated conaninfo.txt
112+
pkg/1.0: Generating the package
113+
pkg/1.0: Temporary package folder /Users/myuser/.conan2/p/t/pkg929d53a5f06b1/p
114+
pkg/1.0 package(): WARN: No files in this package!
115+
pkg/1.0: Package 'a0d37d10fdb83a0414d7f4a1fb73da2c210211c6' created
116+
pkg/1.0: Created package revision 6a947a7b5669d6fde1a35ce5ff987fc6
117+
pkg/1.0: Full package reference: pkg/1.0#637fc1c7080faaa7e2cdccde1bcde118:a0d37d10fdb83a0414d7f4a1fb73da2c210211c6#6a947a7b5669d6fde1a35ce5ff987fc6
118+
pkg/1.0: Package folder /Users/myuser/.conan2/p/pkgb3950b1043542/p
119+
120+
.. code-block:: bash
121+
:caption: **Using new gcc compiler version**
122+
:emphasize-lines: 9,32
123+
124+
$ conan create . -s compiler=gcc -s compiler.version=13.0-rc -s compiler.libcxx=libstdc++11
125+
...
126+
Profile host:
127+
[settings]
128+
arch=x86_64
129+
build_type=Release
130+
compiler=gcc
131+
compiler.libcxx=libstdc++11
132+
compiler.version=13.0-rc
133+
os=Macos
134+
135+
Profile build:
136+
[settings]
137+
arch=x86_64
138+
build_type=Release
139+
compiler=apple-clang
140+
compiler.cppstd=gnu98
141+
compiler.libcxx=libc++
142+
compiler.version=12.0
143+
os=Macos
144+
...
145+
-------- Installing (downloading, building) binaries... --------
146+
pkg/1.0: Copying sources to build folder
147+
pkg/1.0: Building your package in /Users/myuser/.conan2/p/t/pkg918904bbca9dc/b
148+
pkg/1.0: Aggregating env generators
149+
pkg/1.0: Package '44a4588d3fe63ccc6e7480565d35be38d405718e' built
150+
pkg/1.0: Build folder /Users/myuser/.conan2/p/t/pkg918904bbca9dc/b
151+
pkg/1.0: Generated conaninfo.txt
152+
pkg/1.0: Generating the package
153+
pkg/1.0: Temporary package folder /Users/myuser/.conan2/p/t/pkg918904bbca9dc/p
154+
pkg/1.0 package(): WARN: No files in this package!
155+
pkg/1.0: Package '44a4588d3fe63ccc6e7480565d35be38d405718e' created
156+
pkg/1.0: Created package revision d913ec060e71cc56b10768afb9620094
157+
pkg/1.0: Full package reference: pkg/1.0#637fc1c7080faaa7e2cdccde1bcde118:44a4588d3fe63ccc6e7480565d35be38d405718e#d913ec060e71cc56b10768afb9620094
158+
pkg/1.0: Package folder /Users/myuser/.conan2/p/pkg789b624c93fc0/p
159+
160+
.. code-block:: bash
161+
:caption: **Using the new OS and the new architecture**
162+
:emphasize-lines: 5,11,33
163+
164+
$ conan create . -s os=webOS -s arch=cortexa15t2hf
165+
...
166+
Profile host:
167+
[settings]
168+
arch=cortexa15t2hf
169+
build_type=Release
170+
compiler=apple-clang
171+
compiler.cppstd=gnu98
172+
compiler.libcxx=libc++
173+
compiler.version=12.0
174+
os=webOS
175+
176+
Profile build:
177+
[settings]
178+
arch=x86_64
179+
build_type=Release
180+
compiler=apple-clang
181+
compiler.cppstd=gnu98
182+
compiler.libcxx=libc++
183+
compiler.version=12.0
184+
os=Macos
185+
...
186+
-------- Installing (downloading, building) binaries... --------
187+
pkg/1.0: Copying sources to build folder
188+
pkg/1.0: Building your package in /Users/myuser/.conan2/p/t/pkgde9b63a6bed0a/b
189+
pkg/1.0: Aggregating env generators
190+
pkg/1.0: Package '19cf3cb5842b18dc78e5b0c574c1e71e7b0e17fc' built
191+
pkg/1.0: Build folder /Users/myuser/.conan2/p/t/pkgde9b63a6bed0a/b
192+
pkg/1.0: Generated conaninfo.txt
193+
pkg/1.0: Generating the package
194+
pkg/1.0: Temporary package folder /Users/myuser/.conan2/p/t/pkgde9b63a6bed0a/p
195+
pkg/1.0 package(): WARN: No files in this package!
196+
pkg/1.0: Package '19cf3cb5842b18dc78e5b0c574c1e71e7b0e17fc' created
197+
pkg/1.0: Created package revision f5739d5a25b3757254dead01b30d3af0
198+
pkg/1.0: Full package reference: pkg/1.0#637fc1c7080faaa7e2cdccde1bcde118:19cf3cb5842b18dc78e5b0c574c1e71e7b0e17fc#f5739d5a25b3757254dead01b30d3af0
199+
pkg/1.0: Package folder /Users/myuser/.conan2/p/pkgd154182aac59e/p
200+
201+
202+
As you could observe, each command has created a different package. That was completely right because we were using
203+
different settings for each one. If you want to see all the packages created, you can use the :ref:`reference_commands_list` command:
204+
205+
206+
.. code-block:: bash
207+
:caption: List all the *pkg/1.0*'s packages
208+
209+
$ conan list pkg/1.0:*
210+
Local Cache
211+
pkg
212+
pkg/1.0
213+
revisions
214+
637fc1c7080faaa7e2cdccde1bcde118 (2023-02-16 06:42:10 UTC)
215+
packages
216+
19cf3cb5842b18dc78e5b0c574c1e71e7b0e17fc
217+
info
218+
settings
219+
arch: cortexa15t2hf
220+
build_type: Release
221+
compiler: apple-clang
222+
compiler.cppstd: gnu98
223+
compiler.libcxx: libc++
224+
compiler.version: 12.0
225+
os: webOS
226+
44a4588d3fe63ccc6e7480565d35be38d405718e
227+
info
228+
settings
229+
arch: x86_64
230+
build_type: Release
231+
compiler: gcc
232+
compiler.libcxx: libstdc++11
233+
compiler.version: 13.0-rc
234+
os: Macos
235+
a0d37d10fdb83a0414d7f4a1fb73da2c210211c6
236+
info
237+
settings
238+
arch: x86_64
239+
build_type: Release
240+
compiler: apple-clang
241+
compiler.cppstd: gnu98
242+
compiler.libcxx: libc++
243+
compiler.version: 12.0
244+
os: webOS
245+
os.sdk_version: 7.0.0
246+
247+
248+
Try any other custom setting!
249+
250+
.. seealso::
251+
252+
- :ref:`reference_config_files_profiles`.
253+
- :ref:`creating_packages_configure_options_settings`

reference/extensions/profile_plugin.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ When a profile is computed, it will display something like:
4141
OrderedDict([('arch', 'x86_64'), ('build_type', 'Release'), ('compiler', 'msvc'), ('compiler.cppstd', '14'), ('compiler.runtime', 'dynamic'), ('compiler.runtime_type', 'Release'), ('compiler.version', '192'), ('os', 'Windows')])
4242
4343
44-
TBD: Document the whole ``profile`` object
44+
.. seealso::
45+
46+
- See the documentation about the :ref:`Conan profiles <reference_config_files_profiles>`.

0 commit comments

Comments
 (0)