neutree / c_cpp_project_framework Goto Github PK
View Code? Open in Web Editor NEWCMake build system( framework) with kconfig support for C/CPP projects
Home Page: https://neucrack.com/p/276
License: MIT License
CMake build system( framework) with kconfig support for C/CPP projects
Home Page: https://neucrack.com/p/276
License: MIT License
每次新建项目阶段需要进行几个固定文件的复制;编译完成后需要手动去 ./build/ 中运行可执行程序
能否添加一个脚本去管理,或者改进一下 project.py
实现类似这样的功能:https://github.com/skb666/c_sdk/blob/base/manage.py
建议组件 components 分为 3 类:
场景说明: 多个独立项目,每个独立项目包含几个子项目,子项目用到一些组件可以放项目私有组件目录[3],多个子项目共享组件放到项目共享组件目录[2],每个独立项目都用的 SDK 的组件放到全局 SDK 组件目录[1]。
其他说明:
项目共享组件的使用场景:独立项目的 test 代码以及 examples,用到与改项目相同的组件;
这个编译框架作为跟 vcpkg 这样的基础设施,独立于项目之外工作,更方便复用和推广;
方便后期定制 vscode 插件;
I am trying to build a dynamic library using libmaix but I cannot.
I want to build libZMQ library,
I copied the hello_world example in libmaix, I have put al sources in main/src and includes in main/include
I have added to /libmaix/examples/libzmq/main/CMakeLists.txt
list(APPEND ADD_DEFINITIONS -fPIC)
and register_component(SHARED)
I see in the logs that compile.cmake has activated to_dynamic_lib flag.
But, after compiling everything, it ends with the following error:
.....
[ 95%] Building CXX object main/CMakeFiles/main.dir/src/zmq_utils.cpp.o
[ 96%] Building CXX object main/CMakeFiles/main.dir/src/zmtp_engine.cpp.o
[ 97%] Linking CXX shared library libmain.so
[ 97%] Built target main
Scanning dependencies of target libzmq
[ 98%] Building C object CMakeFiles/libzmq.dir/exe_src.c.o
[ 99%] Linking C executable libzmq
/opt/toolchain-sunxi-musl/toolchain/bin/../lib/gcc/arm-openwrt-linux-muslgnueabi/6.4.1/../../../../arm-openwrt-linux-muslgnueabi/lib/crt1.o: In function _start_c': /home/caiyongheng/tina/out/astar-parrot/compile_dir/toolchain/musl-1.1.16/crt/crt1.c:17: undefined reference to
main'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/libzmq.dir/build.make:89: libzmq] Error 1
make[1]: *** [CMakeFiles/Makefile2:301: CMakeFiles/libzmq.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
.......
CMakeLists.txt
请问,要支持 ninja menuconfig 的话,该从哪里入手呢?
I am trying to build a dynamic library using libmaix but I cannot.
I want to build libZMQ library,
I copied the hello_world example in libmaix, I have put all sources in main/src and includes in main/include
I have added to /libmaix/examples/libzmq/main/CMakeLists.txt
list(APPEND ADD_DEFINITIONS -fPIC)
and register_component(SHARED)
I see in the logs that compile.cmake has activated to_dynamic_lib flag.
But, after compiling everything, it ends with the following error:
.....
[ 95%] Building CXX object main/CMakeFiles/main.dir/src/zmq_utils.cpp.o
[ 96%] Building CXX object main/CMakeFiles/main.dir/src/zmtp_engine.cpp.o
[ 97%] Linking CXX shared library libmain.so
[ 97%] Built target main
Scanning dependencies of target libzmq
[ 98%] Building C object CMakeFiles/libzmq.dir/exe_src.c.o
[ 99%] Linking C executable libzmq
/opt/toolchain-sunxi-musl/toolchain/bin/../lib/gcc/arm-openwrt-linux-muslgnueabi/6.4.1/../../../../arm-openwrt-linux-muslgnueabi/lib/crt1.o: In function _start_c': /home/caiyongheng/tina/out/astar-parrot/compile_dir/toolchain/musl-1.1.16/crt/crt1.c:17: undefined reference to
main'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/libzmq.dir/build.make:89: libzmq] Error 1
make[1]: *** [CMakeFiles/Makefile2:301: CMakeFiles/libzmq.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
....
如果想向 components 内添加其它开源组件
如 libevent、openssl 这种用 autoconfig 或者 make/cmake 自组织编译的复杂组件
应该如何与该项目配合编译呢
编译命令:
cd examples/demo1
cmake -S. -Bbuild
cmake --build build -t all
使用 cmake
而不是 python
进行编译时,若不指定 CMAKE_BUILD_TYPE
,遇到以下问题:
原因应该是 compile.cmake 中版本判断错误,导致 global_config.h
中 DEBUG
与 RELEASE
定义的值与传入的宏不一致。
当使用 --toolchain 指定文件时,是否有方法给该 .cmake 文件传递参数
Android 平台 termux 下该模板配合 vcpkg 进行使用,指定 --toolchain
为 ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake
;
使用 cmake
编译时,我可以这样进行参数传递:
cmake -S. -Bbuild -DVCPKG_HOST_TRIPLET=arm64-linux -DVCPKG_TARGET_TRIPLET=arm64-linux
但使用 project.py build
时,使用以下命令进行构建时会显示帮助信息,不能成功构建:
./project.py build -DVCPKG_HOST_TRIPLET=arm64-linux -DVCPKG_TARGET_TRIPLET=arm64-linux
通过修改 tools/cmake/project.py
中参数的解析方式:
# project_args = project_parser.parse_args()
project_args, other_args = project_parser.parse_known_args()
然后在 build
的处理中,将 other_args
里的参数补充传递给 cmake
去执行,使得可以使用上面的命令构建成功。
但是在 ./project.py build
时传参感觉不是那么优雅,怎样才可以使参数传递这个步骤在 ./project.py config
时完成
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.