~aleteoryx/muditaos

943fef9643ba6f4dd399f90f1da11e53d82301a7 — Radoslaw Wicik 4 years ago 50cd42b
[BH-353] Add Documentation for main targets

* clean up mimimu required cmake version
* fixes for release workflow

Add documentation for targets, fixes for cmake
and release workflow.
M .github/workflows/releases.yaml => .github/workflows/releases.yaml +3 -3
@@ 38,9 38,9 @@ jobs:
        echo "JOBS=${JOBS}" &&  \
        ./configure.sh rt1051 RelWithDebInfo -G Ninja && \
        pushd build-rt1051-RelWithDebInfo && \
        ninja -j ${JOBS} && \
        ninja -j ${JOBS} package-update && \
        ninja -j ${JOBS} package-standalone && \
        ninja -j ${JOBS} Pure&& \
        ninja -j ${JOBS} PurePhone-UpdatePackage && \
        ninja -j ${JOBS} PurePhone-StandaloneImage && \
        popd && \
        ./print_last_changes.sh && \
        uptime

M CMakeLists.txt => CMakeLists.txt +1 -2
@@ 1,4 1,4 @@
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.19.5)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)


@@ 159,4 159,3 @@ add_custom_target(
fetch_ecoboot()
add_subdirectory(products)

include(GitHubWorkerMessages)

M board/linux/libiosyscalls/test/CMakeLists.txt => board/linux/libiosyscalls/test/CMakeLists.txt +0 -2
@@ 1,5 1,3 @@
cmake_minimum_required(VERSION 3.12)

# iosyscalls tests
add_catch2_executable(
    NAME

M cmake/modules/AddHexTarget.cmake => cmake/modules/AddHexTarget.cmake +2 -1
@@ 4,7 4,8 @@ function(add_hex_target SOURCE_TARGET)
        COMMENT "Generate ${HEX_FILE}"
        OUTPUT ${CMAKE_BINARY_DIR}/${HEX_FILE}
        DEPENDS ${SOURCE_TARGET}
        COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${SOURCE_TARGET}>
        COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${SOURCE_TARGET}> ${CMAKE_BINARY_DIR}/${HEX_FILE}

        )
    add_custom_target(
        ${HEX_FILE}-target ALL

M cmake/modules/AddPackage.cmake => cmake/modules/AddPackage.cmake +8 -5
@@ 1,5 1,3 @@


macro(set_cpack_vars)
    if (${PROJECT_TARGET} STREQUAL "TARGET_Linux")
        set(CPACK_SYSTEM_NAME "Linux")


@@ 33,11 31,12 @@ function(add_standalone_image SOURCE_TARGET)
    set(CPACK_PACKAGE_NAME ${SOURCE_TARGET})
    set_cpack_vars()

    set(PACKAGE_STANDALONE_MIME "application/x-xz")
    set(PACKAGE_STANDALONE_FILE_NAME ${PACKAGE_COMMON_NAME}-image.tar.xz)
    set(STANDALONE_PKG ${PACKAGE_COMMON_NAME}-image.tar.xz)
    set(PACKAGE_STANDALONE_FILE_NAME ${STANDALONE_PKG} PARENT_SCOPE)
    set(PACKAGE_STANDALONE_MIME "application/x-xz" PARENT_SCOPE)

    add_custom_target(${PACKAGE_COMMON_NAME}-package-standalone
        COMMAND tar -ScJf ${PACKAGE_STANDALONE_FILE_NAME} ${SOURCE_TARGET}.img
        COMMAND tar -ScJf ${STANDALONE_PKG} ${SOURCE_TARGET}.img
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
        DEPENDS ${BIN_FILE} ${ECOBOOT_FILE}-target ${VERSION_JSON_FILE}-target ${SOURCE_TARGET}.img
        )


@@ 55,6 54,10 @@ function(add_update_package SOURCE_TARGET)
    set(CPACK_PACKAGE_NAME ${SOURCE_TARGET})
    set_cpack_vars()
    set(UPDATE_PKG "${SOURCE_TARGET}-${CMAKE_PROJECT_VERSION}-${CPACK_SYSTEM_NAME}-Update.tar")

    set(PACKAGE_UPDATE_FILE_NAME ${UPDATE_PKG} PARENT_SCOPE)
    set(PACKAGE_UPDATE_MIME "application/x-tar" PARENT_SCOPE)

    add_custom_command(
        OUTPUT ${UPDATE_PKG}
        DEPENDS ${SOURCE_TARGET}

M cmake/modules/GitHubWorkerMessages.cmake => cmake/modules/GitHubWorkerMessages.cmake +6 -1
@@ 1,4 1,4 @@
function(github_worker_message)
function(github_message_standalone)
    if (NOT DEFINED ENV{GITHUB_WORKSPACE})
        return()
    endif()


@@ 6,7 6,12 @@ function(github_worker_message)
        message("::set-output name=package-standalone::${PACKAGE_STANDALONE_FILE_NAME}")
        message("set-output name=standalone-mime_type::${PACKAGE_STANDALONE_MIME}")
        message("::set-output name=standalone-mime_type::${PACKAGE_STANDALONE_MIME}")
endfunction()

function(github_message_update)
    if (NOT DEFINED ENV{GITHUB_WORKSPACE})
        return()
    endif()
        message("set-output name=package-update::${PACKAGE_UPDATE_FILE_NAME}")
        message("::set-output name=package-update::${PACKAGE_UPDATE_FILE_NAME}")
        message("set-output name=update-mime_type::${PACKAGE_UPDATE_MIME}")

A doc/build_targets.md => doc/build_targets.md +33 -0
@@ 0,0 1,33 @@
# Products

In one source tree we have two products:

* PurePhone
* BellHybrid

For simplicity, we have defined a few CMake targets that will create
all required images and prepare update packages.

# Architectures

We support two target architectures:

* Linux x86_64
* RT1051

Some build targets are enabled/disabled based on the selected target architecture.

# Targets


| Arch | Name | Alias | Description |
|------|------|-------|-------------|
|common| Pure | | Main target for PurePhone |
|common| Bell | | Main target for BellHybrid |
|common| PurePhone-disk-img  | PurePhone.img  | Disk image for PurePhone  |
|common| BellHybrid-disk-img | BellHybrid.img | Disk image for BellHybrid | 
|RT1051| PurePhone-StandaloneImage  | PurePhone-\<version\>-RT1051-package-standalone  | Creates image that can be `dd` or `pureflash` to the device|
|RT1051| PurePhone-UpdatePackage    | PurePhone-\<version\>-RT1051-Update.tar          | Creates Update package, that can be used by Mudita Center or an update script|
|RT1051| BellHybrid-StandaloneImage | BellHybrid-\<version\>-RT1051-package-standalone | Creates image that can be `dd` or `pureflash` to the device|
|RT1051| BellHybrid-UpdatePackage   | BellHybrid-\<version\>-RT1051-Update.tar         | Creates Update package, that can be used by Mudita Center or an update script|


M doc/quickstart.md => doc/quickstart.md +4 -13
@@ 74,8 74,8 @@ git submodule update --init --recursive                        # initialize subm
cd ./config/ && ./bootstrap.sh 0- && cd ../                    # bootstrap requirements
./configure.sh rt1051|linux Debug|Release|RelWithDebInfo       # configure build
cd <build-dir>                                                 # build dir depends on configuration
make -j                                                        # build
./PurePhone                                                    # run PurePhone - simulator screen will pop up (on the Linux filesystem)
make Pure                                               # build
./PurePhone.elf                                                # run PurePhone - simulator screen will pop up (on the Linux filesystem)
```

If you want to run the simulator with image and our VFS implementation


@@ 105,7 105,7 @@ git submodule update --init --recursive
cd ./config/ && ./bootstrap.sh 0- && cd ../
./configure.sh rt1051 RelWithDebInfo
cd build-arm-RelWithDebInfo
make -j
make Pure

```



@@ 270,16 270,7 @@ Please be aware that when building custom image you'll have to give it some tag 

## Preparing packages

If you need a package, containing everything needed to run the application (on target device or Linux), in the build directory run the following command: `make package`

After executing this command, the name of the package that was created will be displayed on the screen.

Package name is: `PurePhone-<version>-<target>.<extension>`
where:

- `<version>`   - is read from the latest "release-x.y.z" tag
- `<target>`    - RT1051 or Linux 
- `<extension>` - `zip` for RT1051 and `tar.gz` for Linux
If you need a package, containing everything needed to run the application, please check (build_targests.md)[./doc/build_targests.md] document.

## Generating code coverage reports


M module-apps/CMakeLists.txt => module-apps/CMakeLists.txt +0 -2
@@ 1,8 1,6 @@
# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

cmake_minimum_required(VERSION 3.14)

project(module-apps VERSION 1.0
        DESCRIPTION "Library with all applications.")


M module-audio/Audio/test/CMakeLists.txt => module-audio/Audio/test/CMakeLists.txt +0 -1
@@ 1,4 1,3 @@
cmake_minimum_required(VERSION 3.12)

# audio tests
add_catch2_executable(

M module-audio/CMakeLists.txt => module-audio/CMakeLists.txt +0 -2
@@ 1,8 1,6 @@
# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

cmake_minimum_required(VERSION 3.12)

project(module-audio VERSION 1.0
        DESCRIPTION "Audio module library")


M module-bsp/CMakeLists.txt => module-bsp/CMakeLists.txt +0 -2
@@ 1,8 1,6 @@
# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

cmake_minimum_required(VERSION 3.12)

project(module-bsp VERSION 1.0
        DESCRIPTION "VFS module library")


M module-cellular/CMakeLists.txt => module-cellular/CMakeLists.txt +1 -3
@@ 1,6 1,4 @@
cmake_minimum_required(VERSION 3.12)

project(module-cellular VERSION 1.0
project(module-cellular VERSION 1.0
        DESCRIPTION "Cellular module library")

include(SerialPort)

M module-cellular/test/CMakeLists.txt => module-cellular/test/CMakeLists.txt +0 -2
@@ 1,5 1,3 @@
cmake_minimum_required(VERSION 3.12)

# Phone number tests
add_catch2_executable(
    NAME

M module-db/CMakeLists.txt => module-db/CMakeLists.txt +1 -3
@@ 1,6 1,4 @@
cmake_minimum_required(VERSION 3.12)

project(module-db VERSION 1.0
project(module-db VERSION 1.0
        DESCRIPTION "Database module library")

module_is_test_entity()

M module-gui/CMakeLists.txt => module-gui/CMakeLists.txt +1 -3
@@ 1,6 1,4 @@
cmake_minimum_required(VERSION 3.12)

project(module-gui VERSION 1.0
project(module-gui VERSION 1.0
        DESCRIPTION "GUI library dedicated for pure phone.")

module_is_test_entity()

M module-os/CMakeLists.txt => module-os/CMakeLists.txt +0 -2
@@ 1,5 1,3 @@
cmake_minimum_required(VERSION 3.12)

project(module-os VERSION 1.0
        DESCRIPTION "OS module library")


M module-services/CMakeLists.txt => module-services/CMakeLists.txt +1 -3
@@ 1,6 1,4 @@
cmake_minimum_required(VERSION 3.14)

project(module-services VERSION 1.0
project(module-services VERSION 1.0
        DESCRIPTION "Library with all services.")

module_is_test_entity()

M module-services/service-cellular/tests/CMakeLists.txt => module-services/service-cellular/tests/CMakeLists.txt +0 -2
@@ 1,5 1,3 @@
cmake_minimum_required(VERSION 3.12)

add_catch2_executable(
        NAME
        cellular-request-factory

M module-services/service-fileindexer/CMakeLists.txt => module-services/service-fileindexer/CMakeLists.txt +0 -2
@@ 1,5 1,3 @@
cmake_minimum_required(VERSION 3.12)

project(service-fileindexer VERSION 1.0
	DESCRIPTION "File indexer service ")


M module-services/service-time/tests/CMakeLists.txt => module-services/service-time/tests/CMakeLists.txt +0 -2
@@ 1,5 1,3 @@
cmake_minimum_required(VERSION 3.12)

add_catch2_executable(
        NAME
        timezone-handler

M module-sys/CMakeLists.txt => module-sys/CMakeLists.txt +1 -3
@@ 1,6 1,4 @@
cmake_minimum_required(VERSION 3.14)

project(module-sys VERSION 1.0
project(module-sys VERSION 1.0
        DESCRIPTION "Core module library")

module_is_test_entity()

M module-utils/CMakeLists.txt => module-utils/CMakeLists.txt +1 -3
@@ 1,6 1,4 @@
cmake_minimum_required(VERSION 3.12)

if(NOT WIN32)
if(NOT WIN32)
    include(Colours)
endif()


M module-utils/bootconfig/CMakeLists.txt => module-utils/bootconfig/CMakeLists.txt +0 -2
@@ 1,5 1,3 @@
cmake_minimum_required(VERSION 3.12)

project( utils-bootconfig VERSION 1.0
        DESCRIPTION "Library for processing boot config"
)

M module-utils/test/CMakeLists.txt => module-utils/test/CMakeLists.txt +1 -3
@@ 1,6 1,4 @@
cmake_minimum_required(VERSION 3.12)

add_catch2_executable(
add_catch2_executable(
    NAME
        utils-conditional-invoke-tests
    SRCS

M module-vfs/CMakeLists.txt => module-vfs/CMakeLists.txt +0 -2
@@ 1,5 1,3 @@
cmake_minimum_required(VERSION 3.12)

project(module-vfs VERSION 1.0
        DESCRIPTION "VFS module library")


M module-vfs/tests/CMakeLists.txt => module-vfs/tests/CMakeLists.txt +0 -2
@@ 1,5 1,3 @@
cmake_minimum_required(VERSION 3.12)

add_custom_target("test_disk_image")
add_custom_command(
        PRE_BUILD

M products/PurePhone/CMakeLists.txt => products/PurePhone/CMakeLists.txt +4 -0
@@ 82,3 82,7 @@ add_hex_target(PurePhone)
add_standalone_image(PurePhone)
add_update_package(PurePhone)

include(GitHubWorkerMessages)
github_message_standalone()
github_message_update()