Commit Graph

17 Commits

Author SHA1 Message Date
guoshichao ff4ad07576 greenhills: add cmake support
1. refactor the ghs/gcc/clang/armclang toolchain management in CMake
2. unify the cmake toolchain naming style
3. support greenhills build procedure with CMake
4. add protect build for greenhills and gnu toolchain with CMake

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-10-01 11:48:09 +08:00
xuxin19 5095955591 cmake(bugfix):make sure the extra lib only added once
avoid duplicate definitions of target when
`nuttx_add_extra_library` is called between different models at the same time

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-24 21:06:26 +08:00
xuxin19 ab488800bb cmake:enhance the module for adding extra libraries
change the extra library from a file to an import target;
this will avoid differences in the handling of static libraries
between different versions of cmake and different platforms.

after unifying as a target, extra libraries can be
handled as the same as other compiled libraries

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:07 +08:00
xuxin19 9cbdf69fb0 cmake:refactor cmake binary include_arch dir into include
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:07 +08:00
Alin Jerpelea 41537fe90f cmake: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-09-10 11:34:40 +08:00
xuxin19 b1b66ce491 cmake:add unified timing control phase apps_context for apps build
solve the interdependency problem of cross-target dependency generation.
like Makefile base, a PHONY context target is used as a dependency for timing order.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-21 01:53:09 +08:00
chao an fc716802c0 cmake/add_library: enable library install by default
enable library install by default to support nuttx export for cmake

nuttx$ cmake --install build  --prefix $PWD/build/staging/
-- Install configuration: ""
-- Installing: nuttx/build/staging/lib/libarch.a
-- Installing: nuttx/build/staging/lib/libbinfmt.a
-- Installing: nuttx/build/staging/lib/libdrivers.a
-- Installing: nuttx/build/staging/lib/libfs.a
...

Signed-off-by: chao an <anchao@lixiang.com>
2024-07-02 16:50:18 +08:00
xuxin19 9eac74330a cmake:bugfix __KERNEL__ should not be defined in libc,mm.. in FLAT mode
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-05-02 16:03:09 +08:00
xuxin19 4b11d37cf7 cmake-bugfix:add santity check for target depends and change
inter_library header inheritance level

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-04-18 14:57:58 -03:00
xuxin19 2c9d46f176 cmake:enable libxx for CMake build
distinguish whether to add the CXX header file search path
according to the target Language.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-03-15 01:28:53 +08:00
Neo Xu 0b448b35f4 fix(cmake): fix external library mode
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-02-24 09:21:29 -08:00
xuxin19 5452f013df cmake/nuttx_add_library.cmake:add target that define in external module CMakeLists.txt
when nuttx's CMake build system calls an external module that already supports CMake,
since `add_library` may have been called internally,
it needs to provide a way to add its internally defined target to the final link.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-02-21 19:58:34 +08:00
chao an a3eb42f469 cmake: split extra library from library group
Signed-off-by: chao an <anchao@xiaomi.com>
2023-12-06 07:56:17 -08:00
xuxin19 d18988521f cmake:fix add_user_library module archive issue
STATIC target export in BINDIR/staging/ directory by `cmake --install`

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-14 08:06:56 +02:00
raiden00pl 5c9c518f7f cmake: format docstrings 2023-07-27 02:32:49 -07:00
raiden00pl 97309dd22d cmake: fix nrf91 modem static library build 2023-07-15 00:56:33 +08:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00