SylixOS嵌入式操作系统|论坛

标题: cmake scripts for SylixOS [打印本页]

作者: lyzh    时间: 2015-6-28 08:43
标题: cmake scripts for SylixOS
本帖最后由 lyzh 于 2015-6-28 09:10 编辑

I'm writing cmake scripts for SylixOS, using the the scripts, building third party software will be easier.
Currently the script can compile libsylixos.a it-self, will come sooooooooooooooooooooooooooon.
If anybody is being interesting about this, ...cmake-gui config& generator Unix Makefiles
[attach]234[/attach]

make target sylixos
[attach]236[/attach]

building, color, percent.
[attach]237[/attach]

done:
[attach]238[/attach]


作者: king    时间: 2015-6-28 16:00

作者: lyzh    时间: 2015-6-28 16:59
本帖最后由 lyzh 于 2015-6-28 17:07 编辑

下面使用这些脚本编译SylixOS自带的example
在example目录下编写CMakeLists.txt文件如:[attach]239[/attach]

从这个CMakeLists.txt可以看到,除了内核模块不是标准cmake定义的外,其他函数都是标准的,比如add_executable()。其中最大的意义是在编译第三方使用cmake发布的源码时,可以使用cmake定义的标准方法进行配置和编译,而不需要主动添加SylixOS的头文件或者库


打开cmake-gui
[attach]240[/attach]
Configure
[attach]241[/attach]

选择toolchains-arm-none-eabi.cmake
[attach]242[/attach]

Generate
[attach]243[/attach]

已经生成Makefile成功
[attach]244[/attach]

执行make,成功后:
[attach]245[/attach]

已经顺利生成app, ko, lib。
下面是make VERBOSE=1的输出,可以看到编译链接所使用的指令。
[lyzh@lyzhdte3v3 sylixos-example]$ make VERBOSE=1
/usr/bin/cmake -H/home/lyzh/projects/sylixos/workspace/examples -B/tmp/sylixos-example --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /tmp/sylixos-example/CMakeFiles /tmp/sylixos-example/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/tmp/sylixos-example'
make -f CMakeFiles/hello_library.dir/build.make CMakeFiles/hello_library.dir/depend
make[2]: Entering directory '/tmp/sylixos-example'
cd /tmp/sylixos-example && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/lyzh/projects/sylixos/workspace/examples /home/lyzh/projects/sylixos/workspace/examples /tmp/sylixos-example /tmp/sylixos-example /tmp/sylixos-example/CMakeFiles/hello_library.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/tmp/sylixos-example'
make -f CMakeFiles/hello_library.dir/build.make CMakeFiles/hello_library.dir/build
make[2]: Entering directory '/tmp/sylixos-example'
/usr/bin/cmake -E cmake_progress_report /tmp/sylixos-example/CMakeFiles 1
[ 33%] Building C object CMakeFiles/hello_library.dir/hello_library/hello_library.c.obj
/home/lyzh/gcc-sylixos/bin/arm-none-eabi-gcc  -DSYLIXOS=1 -D__SYLIXOS_LITE -Wall -fmessage-length=0 -fsigned-char -fno-short-enums -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include/inet -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include/inet/ipv4 -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include/inet/ipv6    -mfloat-abi=softfp -mfpu=vfpv3 -mcpu=arm920t -o CMakeFiles/hello_library.dir/hello_library/hello_library.c.obj   -c /home/lyzh/projects/sylixos/workspace/examples/hello_library/hello_library.c
Linking C static library libhello_library.a
/usr/bin/cmake -P CMakeFiles/hello_library.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_library.dir/link.txt --verbose=1
/home/lyzh/gcc-sylixos/bin/arm-none-eabi-ar cq libhello_library.a  CMakeFiles/hello_library.dir/hello_library/hello_library.c.obj
/home/lyzh/gcc-sylixos/bin/arm-none-eabi-ranlib libhello_library.a
make[2]: Leaving directory '/tmp/sylixos-example'
/usr/bin/cmake -E cmake_progress_report /tmp/sylixos-example/CMakeFiles  1
[ 33%] Built target hello_library
make -f CMakeFiles/hello_module.dir/build.make CMakeFiles/hello_module.dir/depend
make[2]: Entering directory '/tmp/sylixos-example'
cd /tmp/sylixos-example && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/lyzh/projects/sylixos/workspace/examples /home/lyzh/projects/sylixos/workspace/examples /tmp/sylixos-example /tmp/sylixos-example /tmp/sylixos-example/CMakeFiles/hello_module.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/tmp/sylixos-example'
make -f CMakeFiles/hello_module.dir/build.make CMakeFiles/hello_module.dir/build
make[2]: Entering directory '/tmp/sylixos-example'
/usr/bin/cmake -E cmake_progress_report /tmp/sylixos-example/CMakeFiles 2
[ 66%] Building C object CMakeFiles/hello_module.dir/hello_module/hello_module.c.obj
/home/lyzh/gcc-sylixos/bin/arm-none-eabi-gcc  -DSYLIXOS=1 -D__SYLIXOS_LITE -Wall -fmessage-length=0 -fsigned-char -fno-short-enums -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include/inet -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include/inet/ipv4 -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include/inet/ipv6    -fPIC -mfloat-abi=softfp -mfpu=vfpv3 -mcpu=arm920t -o CMakeFiles/hello_module.dir/hello_module/hello_module.c.obj   -c /home/lyzh/projects/sylixos/workspace/examples/hello_module/hello_module.c
Linking C static library hello_module.ko
/usr/bin/cmake -P CMakeFiles/hello_module.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_module.dir/link.txt --verbose=1
/home/lyzh/gcc-sylixos/bin/arm-none-eabi-ar cq hello_module.ko  CMakeFiles/hello_module.dir/hello_module/hello_module.c.obj
/home/lyzh/gcc-sylixos/bin/arm-none-eabi-ranlib hello_module.ko
make[2]: Leaving directory '/tmp/sylixos-example'
/usr/bin/cmake -E cmake_progress_report /tmp/sylixos-example/CMakeFiles  2
[ 66%] Built target hello_module
make -f CMakeFiles/hello_world.dir/build.make CMakeFiles/hello_world.dir/depend
make[2]: Entering directory '/tmp/sylixos-example'
cd /tmp/sylixos-example && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/lyzh/projects/sylixos/workspace/examples /home/lyzh/projects/sylixos/workspace/examples /tmp/sylixos-example /tmp/sylixos-example /tmp/sylixos-example/CMakeFiles/hello_world.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/tmp/sylixos-example'
make -f CMakeFiles/hello_world.dir/build.make CMakeFiles/hello_world.dir/build
make[2]: Entering directory '/tmp/sylixos-example'
/usr/bin/cmake -E cmake_progress_report /tmp/sylixos-example/CMakeFiles 3
[100%] Building C object CMakeFiles/hello_world.dir/hello_world/hello_world.c.obj
/home/lyzh/gcc-sylixos/bin/arm-none-eabi-gcc  -DSYLIXOS=1 -D__SYLIXOS_LITE -Wall -fmessage-length=0 -fsigned-char -fno-short-enums -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include/inet -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include/inet/ipv4 -I/home/lyzh/projects/sylixos/workspace/libsylixos/SylixOS/include/inet/ipv6    -mfloat-abi=softfp -mfpu=vfpv3 -mcpu=arm920t -o CMakeFiles/hello_world.dir/hello_world/hello_world.c.obj   -c /home/lyzh/projects/sylixos/workspace/examples/hello_world/hello_world.c
Linking C executable hello_world
/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_world.dir/link.txt --verbose=1
/home/lyzh/gcc-sylixos/bin/arm-none-eabi-gcc    -Wall -fmessage-length=0 -fsigned-char -fno-short-enums     CMakeFiles/hello_world.dir/hello_world/hello_world.c.obj -o hello_world -fPIC -shared -nostdlib -nostartfiles -L/tmp/ok  -lvpmpdm   -lm -lgcc
make[2]: Leaving directory '/tmp/sylixos-example'
/usr/bin/cmake -E cmake_progress_report /tmp/sylixos-example/CMakeFiles  3
[100%] Built target hello_world
make[1]: Leaving directory '/tmp/sylixos-example'
/usr/bin/cmake -E cmake_progress_start /tmp/sylixos-example/CMakeFiles 0





作者: lyzh    时间: 2015-6-28 17:39
本帖最后由 lyzh 于 2015-6-28 21:02 编辑

当前脚本

作者: lyzh    时间: 2015-6-28 17:40
原来还可以设置金钱啊?!
作者: flags    时间: 2015-6-29 09:13
支持一下
作者: tiger    时间: 2015-6-29 14:06
好贴




欢迎光临 SylixOS嵌入式操作系统|论坛 (https://bbs.sylixos.com/) Powered by Discuz! X3.2