Lines Matching +full:in +full:- +full:application

6 The Zephyr `CMake package`_ is a convenient way to create a Zephyr-based application.
9 The :ref:`zephyr-app-types` section introduces the application types
10 used in this page.
13 the application, whether it is a :ref:`Zephyr repository application <zephyr-repo-app>`,
14 a :ref:`Zephyr workspace application <zephyr-workspace-app>`, or a
15 :ref:`Zephyr freestanding application <zephyr-freestanding-app>`.
17 When developing a Zephyr-based application, then a developer simply needs to write
18 ``find_package(Zephyr)`` in the beginning of the application :file:`CMakeLists.txt` file.
27 .. group-tab:: Ubuntu
29 In Linux, the CMake user package registry is found in:
33 .. group-tab:: macOS
35 In macOS, the CMake user package registry is found in:
39 .. group-tab:: Windows
41 In Windows, the CMake user package registry is found in:
49 Zephyr freestanding applications, Zephyr workspace application with vendor forks, etc..
56 to export Zephyr using ``west zephyr-export``.
65 .. code-block:: bash
67 cmake -P <PATH-TO-ZEPHYR>/share/zephyr-package/cmake/zephyr_export.cmake
71 To also export the Zephyr Unittest CMake package, run the following command in addition:
73 .. code-block:: bash
75 cmake -P <PATH-TO-ZEPHYR>/share/zephyrunittest-package/cmake/zephyr_export.cmake
87 .. code-block:: cmake
102 * A Zephyr repository application will use the Zephyr in which it is located.
105 .. code-block:: none
107 <projects>/zephyr-workspace/zephyr
111 in this example, ``hello_world`` will use ``<projects>/zephyr-workspace/zephyr``.
114 * Zephyr workspace application will use the Zephyr that share the same workspace.
117 .. code-block:: none
119 <projects>/zephyr-workspace
125 in this example, ``my_first_app`` will use ``<projects>/zephyr-workspace/zephyr`` as this Zephyr
126 is located in the same workspace as the Zephyr workspace application.
132 * Zephyr freestanding application will use the Zephyr registered in the CMake user package registry.
135 .. code-block:: none
137 <projects>/zephyr-workspace-1
140 <projects>/zephyr-workspace-2
149 in this example, only ``<projects>/zephyr-workspace-2/zephyr`` is exported to the CMake package
150 registry and therefore this Zephyr will be used by the Zephyr freestanding application
153 If user wants to test the application with ``<projects>/zephyr-workspace-1/zephyr``, this can be
155 ``ZEPHYR_BASE=<projects>/zephyr-workspace-1/zephyr``, before
161 builds. To change the Zephyr package, for example to test the application using Zephyr base
168 When writing an application then it is possible to specify a Zephyr version number ``x.y.z`` that
169 must be used in order to build the application.
171 Specifying a version is especially useful for a Zephyr freestanding application as it ensures the
172 application is built with a minimal Zephyr version.
175 Zephyr installations in the system.
179 .. code-block:: cmake
193 .. code-block:: none
195 <projects>/zephyr-workspace-2.a
198 <projects>/zephyr-workspace-2.b
207 in this case, there are two released versions of Zephyr installed at their own workspaces.
213 .. code-block:: cmake
222 In this case, the application CMakeLists.txt could be written as:
224 .. code-block:: cmake
229 In case no Zephyr is found which satisfies the version required, as example, the application specif…
231 .. code-block:: cmake
238 .. code-block:: none
245 …<projects>/zephyr-workspace-2.a/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake, version: 2.a…
246 …<projects>/zephyr-workspace-2.b/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake, version: 2.b…
250 and Zephyr workspace applications. Specifying a version in those cases ensures the
251 application will only build if the Zephyr repository or workspace is matching.
259 Testing out a new Zephyr version, while at the same time keeping the existing Zephyr in the
262 Or having both an upstream Zephyr, Vendor specific, and a custom Zephyr in same workspace.
266 .. code-block:: none
268 <projects>/zephyr-workspace
270 ├── zephyr-vendor
271 ├── zephyr-custom
277 in this setup, ``find_package(Zephyr)`` has the following order of precedence for selecting
281 * First project, when Zephyr projects are ordered lexicographical, in this case.
283 * ``zephyr-custom``
284 * ``zephyr-vendor``
286 This means that ``my_first_app`` will use ``<projects>/zephyr-workspace/zephyr``.
288 It is possible to specify a Zephyr preference list in the application.
292 .. code-block:: cmake
294 set(ZEPHYR_PREFER "zephyr-custom" "zephyr-vendor")
301 If a Zephyr is specified in the list, but not found in the system, it is simply ignored and
306 Zephyr. When testing is done, the ``zephyr-test`` folder can simply be removed.
309 .. code-block:: cmake
311 set(ZEPHYR_PREFER "zephyr-test")
322 settings in Zephyr in a more generic way. These packages are:
324 * **ZephyrBuildConfiguration**: Applies to all Zephyr applications in the workspace
325 * **ZephyrAppConfiguration**: Applies only to the application you are currently building
327 They are similar to the per-user :file:`.zephyrrc` file that can be used to set :ref:`env_vars`,
332 The Zephyr Build Configuration CMake packages will be loaded in the Zephyr boilerplate code after
335 application-specific package could override the workspace settings, if needed.
342 in the appropriate location. The CMake ``find_package`` mechanism will search for these files with
345 installed in the CMake package registry. The search steps are:
353 It is recommended to place the files in the default paths from step 2, but with the
356 ZephyrBuildConfiguration usually does not work. In this case the ``<PackageName>_ROOT`` variables
358 variable or from a CMake cache initialization file with the ``-C`` command line option.
372 .. code-block:: none
374 <projects>/zephyr-workspace
380 └── zephyr application
381 └── share/zephyrapp-package/cmake/ZephyrAppConfig.cmake
385 .. code-block:: cmake
389 # To ensure final path is absolute and does not contain ../.. in variable.
401 find_program(GNU_ARM_GCC arm-none-eabi-gcc)
402 if(NOT ${GNU_ARM_GCC} STREQUAL GNU_ARM_GCC-NOTFOUND)
411 The Zephyr CMake package source code in
412 :zephyr_file:`share/zephyr-package/cmake` and
413 :zephyr_file:`share/zephyrunittest-package/cmake` contains the CMake config
418 The following is an overview of the files in these directories:
447 .. _CMake package: https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html
448 …ge registry: https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#user-package-registry
449 .. _CMake package version: https://cmake.org/cmake/help/latest/command/find_package.html#version-se…
450 …ge search procedure: https://cmake.org/cmake/help/latest/command/find_package.html#search-procedure