Commit Graph

6 Commits

Author SHA1 Message Date
xuxin19 cd46d27489 cmake:Remove Unix-specific code and replace it with cmake script to support cross-platform
the Unix-specific commands used in the CMake implementation of savedefconfig are not
supported on the Windows platform, which will cause compatibility issues.

replace it with CMake implementation, which can be cross-platform and has been verified on Windows.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 14:02:28 +08:00
chao an 7e2b25d45e cmake/boards: fix build break on custom board
Special string filters can be ignored normally

Loaded configuration '.config'
Minimal configuration saved to 'defconfig.tmp'
gmake[3]: *** [CMakeFiles/savedefconfig.dir/build.make:73: CMakeFiles/savedefconfig] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:17869: CMakeFiles/savedefconfig.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:17876: CMakeFiles/savedefconfig.dir/rule] Error 2
gmake: *** [Makefile:208: savedefconfig] Error 2

Signed-off-by: chao an <anchao@lixiang.com>
2024-07-17 15:09:07 +08:00
chao an a506f9fb70 Revert "cmake: restore old behavior for savedefconfig"
@raiden00pl I'm surprised why this commit was reverted. It maintains the same functionality as tools/refresh.sh. this change is a good improvement because overwriting the original defconfig to prevent developers from missing out on enabled or disabled features during the development process. If you find any changes in the defconfig after saving it, you should manually restore it, git diff will tell you what has happened. and also this feature prevents more junior developers from forgetting to save their own defconfig

This reverts commit 751bc1528a.

Signed-off-by: chao an <anchao@lixiang.com>
2023-12-20 16:05:19 +01:00
raiden00pl 751bc1528a cmake: restore old behavior for savedefconfig
savedefconfig shouldn't overwrite the original defconfig, but only create a new
defconfig in the current directory. Otherwise, creating new configs based on
existing ones becomes irritating, because every time we use savedefconfig,
the original configuration is overwritten which is not the excepted behavior
2023-12-16 07:12:08 -08:00
chao an 375959eac1 cmake/menuconfig: keep comment to original style to avoid unnecessary refreshes
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-15 23:32:36 +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