Commit graph

10 commits

Author SHA1 Message Date
xuxin19
00e79122af cmake(enhance):cmake support DYNLIB build
add `DYNLIB` option for nuttx_add_application for dynamic loadable lib

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
xuxin19
6fa3031d9b cmake(feat):define elf option and enable apps module build
1.define elf option setting function ext;
2.unify loadable elf and kernel elf build config

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
xuxin19
70bddf61c3 cmake(bugfix):rename host tools binary dir to host_bin
we will use CMAKE_BINARY_DIR/bin for apps elf
so we need to change host tools to bin_host

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
xuxin19
b7582b8da1 cmake(feat):implements KERNEL mode in CMake build
1.add application link dependencies for all elf
2.add a global custom target to hold proptry in the toolchain file
3.add startup obj target
4.fix cpp lds error with kernel mod link elf lds

usage:
./build.sh qemu-armv7a:knsh --cmake
elf install in ${CMAKE_BINARY_DIR}/bin

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
xuxin19
f6db05a94f cmake(enhance):add target we can dump all CMake lib targets
`cmake --build -t dump_targets`
list all lib target current generator need to build

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-14 23:07:32 +08:00
xuxin19
bca7d17a1d cmake(enhance):make CMake extensions include path inherit PUBLIC
since we imply nuttx_link_libraries, nuttx_lib target can
inherit include path

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-14 23:07:32 +08:00
Junbo Zheng
2578638d52 cmake: correct nuttx_wildcard_sources cmake usage
reference:
https://cmake.org/cmake/help/latest/command/cmake_parse_arguments.html

add debug message for test
```diff
diff --git a/cmake/nuttx_extensions.cmake b/cmake/nuttx_extensions.cmake
index 9ed430b74a..baa22cf90d 100644

--- a/cmake/nuttx_extensions.cmake
+++ b/cmake/nuttx_extensions.cmake
@@ -116,6 +116,9 @@ endfunction()
 function(nuttx_wildcard_sources)
   cmake_parse_arguments(ARGS "" "" EXCLUDE ${ARGN})

+  message(STATUS "## UNPARSED ARGUMENTS ${ARGS_UNPARSED_ARGUMENTS}")
+  message(STATUS "## ARGN ${ARGN}")
+
   file(GLOB SRCS ${ARGS_UNPARSED_ARGUMENTS})
   if(ARGS_EXCLUDE)
     file(GLOB RM_SRCS ${ARGS_EXCLUDE})
```

cmake build test
```
➜  /home/mi/local/mycpp [25-10-15_14:11:41] git:(master) ✗ ls demo
1.c  2.c  3.c
➜  /home/mi/local/mycpp [25-10-15_14:11:57] git:(master) ✗ cmake -S . -B build -G Ninja
>> 14:12:42.161053 INFO    [demo] Time taken: 0ms
-- ## UNPARSED ARGUMENTS aaa/*.c
-- ## ARGN aaa/*.c;EXCLUDE;aaa/3.c
-- Configuring done (0.3s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mi/local/mycpp/build
➜  /home/mi/local/mycpp [25-10-15_14:12:47] git:(master) ✗
```

`SRCS` just collect all source files instead of EXCLUDE arguments

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2025-10-16 12:48:40 +08:00
Junbo Zheng
a88eb1fc6b cmake: enhance the function of cmake nuttx_wildcard_sources
align already used cmake ifdef/ifndef nuttx_xxx functions, reference:
- https://github.com/apache/nuttx/pull/14747

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2025-07-14 20:41:12 +08:00
xuxin19
cfe78ad74e cmake(enhance):enhance NuttX cmake target dependencies and link_library modules
Enhance CMake's add_dependencies for Nuttx so that
different targets can call dependencies without errors when they are not traversed.

In addition, since we do not call link_library directly,
we increment nuttx_link_library to inherit the PUBLIC property

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-22 15:16:07 -03:00
xuxin19
4f895b3300 cmake(enhance):add NuttX CMake extensions module
Wrapped CMake native method is nuttx_cmake module
It can be quickly called in the build system

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-12 15:30:21 -03:00