Skip to content

audioutils: Add CMake build support for morsey and rtttl-c - #3920

Open
Swatantra-66 wants to merge 1 commit into
apache:masterfrom
Swatantra-66:cmake/audioutils
Open

Swatantra-66 wants to merge 1 commit into
apache:masterfrom
Swatantra-66:cmake/audioutils

Conversation

@Swatantra-66

Copy link
Copy Markdown
Contributor

Summary

Addresses apache/nuttx#19549 by closing the CMake build-system parity gap in apps/audioutils

  1. audioutils/morsey:
    Adds CMakeLists.txt using CMake FetchContent to download the upstream v1.0.1 release tarball.
    Implements automated SHA-256 integrity verification for morsey.c and morsey.h matching Makefile.
    Exports the public header via symlink to ${NUTTX_APPS_BINDIR}/include/audioutils/morsey.h.
    Compiles morsey.c and registers private include paths with the apps library target.

  2. audioutils/rtttl-c:
    Adds CMakeLists.txt using CMake FetchContent to shallow clone tag v0.1.0.
    Implements automated SHA-256 integrity verification for rtttl.c and rtttl.h matching Makefile.
    Exports the public header via symlink to ${NUTTX_APPS_BINDIR}/include/audioutils/rtttl.h.
    Compiles rtttl.c and registers private include paths with the apps library target.

  3. Robustness & Edge-Case Safety (both modules):
    Preapps Safety: Conditioned on if(CONFIG_* AND TARGET apps) to prevent premature evaluation during early Kconfig generation.
    Offline Build Overrides: Honors FETCHCONTENT_SOURCE_DIR_MORSEY_FETCH and FETCHCONTENT_SOURCE_DIR_RTTTL_C_FETCH without attempting network access.
    Local Edit Preservation: Rejects missing/incomplete checkouts with a fatal error if local files exist, refusing to delete developer modifications or Make checkouts.
    Subbuild Reset: Wipes sub-build state under ${FETCHCONTENT_BASE_DIR} to ensure recovery when a fresh download is needed.
    Symlink Refresh: Unconditionally invokes nuttx_create_symlink to refresh exported header links whenever the active source directory changes.

Impact

New feature added: Yes, CMake build support for audioutils/morsey and audioutils/rtttl-c.
Existing behavior changed: No, existing Make builds remain 100% untouched.
Build process: Enables building both modules when configuring with CMake (-DCONFIG_AUDIOUTILS_MORSEY=y and -DCONFIG_AUDIOUTILS_RTTTL_C=y).
Compatibility: Fully compliant with cmake-format (0 warnings/errors).

Testing

Host: Ubuntu 24.04 (WSL2 / Windows 11 x86_64), GCC 15.2.0, CMake 4.2.3, Ninja 1.13.2
Target: sim:nsh (-DCONFIG_AUDIOUTILS_MORSEY=y -DCONFIG_AUDIOUTILS_RTTTL_C=y)

Build Logs:

-- Populating morsey_fetch
[1/9] Performing download step (download, verify and extract) for 'morsey_fetch-populate'
-- extracting... done
[9/9] Completed 'morsey_fetch-populate'
-- Populating rtttl_c_fetch
[1/9] Performing download step (git clone) for 'rtttl_c_fetch-populate'
Cloning into 'rtttl-c'...
HEAD is now at a093e61 Release under Apache-2.0, too
[9/9] Completed 'rtttl_c_fetch-populate'
-- Build files have been written to: .../build_audiotest
ninja: Entering directory `build_audiotest'
[3/35] Building C object apps/CMakeFiles/apps.dir/audioutils/morsey/morsey/morsey.c.o
[8/35] Building C object apps/CMakeFiles/apps.dir/audioutils/rtttl-c/rtttl-c/rtttl.c.o
[35/35] Linking C static library apps/libapps.a

Style & Format Verification:

cmake-format --check apps/audioutils/morsey/CMakeLists.txt
cmake-format --check apps/audioutils/rtttl-c/CMakeLists.txt
100% CMAKE-FORMAT COMPLIANT

Comment thread audioutils/rtttl-c/CMakeLists.txt Outdated
Comment thread audioutils/morsey/CMakeLists.txt Outdated
Closes the CMake build-system parity gap in apps/audioutils:
- audioutils/morsey: Adds CMakeLists.txt with FetchContent tarball
  download, public header symlinking, and library integration into apps.
- audioutils/rtttl-c: Adds CMakeLists.txt with FetchContent shallow
  clone, public header symlinking, and library integration into apps.
- Follows standard NuttX FetchContent conventions matching other
  submodules, with preapps configuration safety and public header
  symlink generation under include/audioutils.

Signed-off-by: Swatantra Yadav <maverickswatantra@gmail.com>
@Swatantra-66

Copy link
Copy Markdown
Contributor Author

Removed the SHA checks and streamlined both CMakeLists.txt to follow the standard NuttX FetchContent pattern matching other submodules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants