CMakeLists.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # CMake 最低版本号要求
  2. cmake_minimum_required (VERSION 3.5)
  3. set(CMAKE_BUILD_TYPE "Release")
  4. set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
  5. set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
  6. set(CMAKE_EXE_LINKER_FLAGS "-Wl,-Map=luatos.map")
  7. set(TOPROOT "../..")
  8. # 项目信息
  9. project (luatos)
  10. # 一定一定要先添加本地的头文件
  11. include_directories(./include)
  12. include_directories(${TOPROOT}/lua/include
  13. ${TOPROOT}/luat/include
  14. ./lv_drivers
  15. ${TOPROOT}/components/lfs
  16. ${TOPROOT}/components/qrcode
  17. ${TOPROOT}/components/lcd
  18. ${TOPROOT}/components/luatfonts
  19. ${TOPROOT}/components/lvgl/src/lv_font
  20. ${TOPROOT}/components/miniz
  21. ${TOPROOT}/components/mempool/tlsf
  22. ${TOPROOT}/components/serialization/protobuf
  23. )
  24. aux_source_directory(./port PORT_SRCS)
  25. aux_source_directory(${TOPROOT}/lua/src LUA_SRCS)
  26. aux_source_directory(${TOPROOT}/components/lua-cjson CJSON_SRCS)
  27. aux_source_directory(${TOPROOT}/components/miniz MINIZ_SRCS)
  28. aux_source_directory(${TOPROOT}/components/qrcode QRCODE_SRCS)
  29. # aux_source_directory(${TOPROOT}/components/lcd LCD_SRCS)
  30. aux_source_directory(./components/iotauth IOTAUTH_SRCS)
  31. aux_source_directory(./components/mempool/tlsf TLSF_SRCS)
  32. aux_source_directory(${TOPROOT}/components/serialization/protobuf PB_SRCS)
  33. add_library(lua ${LUA_SRCS})
  34. add_library(luatos_msys ${PORT_SRCS})
  35. add_library(cjson ${CJSON_SRCS})
  36. add_library(luat ${TOPROOT}/luat/modules/luat_main.c
  37. ${TOPROOT}/luat/modules/luat_base.c
  38. ${TOPROOT}/luat/modules/luat_ota.c
  39. ${TOPROOT}/luat/modules/luat_luat_bin.c
  40. ${TOPROOT}/luat/modules/luat_lib_rtos.c
  41. ${TOPROOT}/luat/modules/luat_lib_timer.c
  42. ${TOPROOT}/luat/modules/luat_lib_log.c
  43. ${TOPROOT}/luat/modules/luat_lib_gpio.c
  44. ${TOPROOT}/luat/modules/luat_lib_spi.c
  45. ${TOPROOT}/luat/modules/luat_lib_pack.c
  46. ${TOPROOT}/luat/modules/luat_lib_zbuff.c
  47. ${TOPROOT}/luat/modules/luat_lib_mqttcore.c
  48. ${TOPROOT}/luat/modules/luat_lib_libcoap.c
  49. ${TOPROOT}/luat/modules/luat_lib_crypto.c
  50. ${TOPROOT}/luat/modules/luat_lib_vmx.c
  51. ${TOPROOT}/luat/modules/luat_lib_uart.c
  52. ${TOPROOT}/components/sfd/luat_lib_sfd.c
  53. ${TOPROOT}/components/sfd/luat_sfd_mem.c
  54. ${TOPROOT}/components/sfd/luat_sfd_w25q.c
  55. ${TOPROOT}/components/luf/luat_lib_luf.c
  56. ${TOPROOT}/components/luf/luat_luf_dump.c
  57. ${TOPROOT}/components/luf/luat_luf_undump.c
  58. ${TOPROOT}/components/luf/luat_luf_cmp.c
  59. ${TOPROOT}/components/crypto/luat_crypto_mbedtls.c
  60. ${TOPROOT}/luat/modules/crc.c
  61. ${TOPROOT}/luat/vfs/luat_vfs.c
  62. ${TOPROOT}/luat/vfs/luat_fs_luadb.c
  63. ${TOPROOT}/luat/vfs/luat_fs_posix.c
  64. ${TOPROOT}/luat/vfs/luat_fs_lfs2.c
  65. ${TOPROOT}/luat/vfs/luat_inline_libs.c
  66. ${TOPROOT}/luat/vfs/luat_fs_inline.c
  67. ${TOPROOT}/luat/vfs/luat_fs_romfs.c
  68. ${TOPROOT}/luat/vfs/luat_inline_libs_64bit_size32.c
  69. ${TOPROOT}/luat/vfs/luat_inline_libs_64bit_size64.c
  70. ${TOPROOT}/luat/vfs/luat_luadb_mock.c
  71. ${TOPROOT}/components/lfs/lfs_sfd.c
  72. ${TOPROOT}/components/lfs/lfs_util.c
  73. ${TOPROOT}/components/lfs/lfs.c
  74. ${TOPROOT}/components/lfs/luat_lib_lfs2.c
  75. ${TOPROOT}/components/iotauth/luat_lib_iotauth.c
  76. ${TOPROOT}/luat/vfs/luat_inline_libs.c
  77. ./lv_drivers/win_drv.c
  78. ${QRCODE_SRCS}
  79. ${MINIZ_SRCS}
  80. #${LCD_SRCS}
  81. ${PB_SRCS}
  82. )
  83. include_directories(${TOPROOT}/components/fatfs)
  84. add_library(fatfs ${TOPROOT}/components/fatfs/ff.c
  85. ${TOPROOT}/components/fatfs/ffsystem.c
  86. ${TOPROOT}/components/fatfs/ffunicode.c
  87. ${TOPROOT}/components/fatfs/diskio_impl.c
  88. ${TOPROOT}/components/fatfs/diskio_ramdisk.c
  89. ${TOPROOT}/components/fatfs/diskio_spitf.c
  90. ${TOPROOT}/luat/vfs/luat_fs_fatfs.c
  91. ${TOPROOT}/components/fatfs/luat_lib_fatfs.c)
  92. #-----------------------
  93. # mbedtls
  94. include_directories(${TOPROOT}/components/mbedtls/include)
  95. add_subdirectory(${TOPROOT}/components/mbedtls mbedtls.out)
  96. #-----------------------
  97. #-----------------------
  98. # lvgl
  99. include_directories(${TOPROOT}/components/lvgl)
  100. add_subdirectory(${TOPROOT}/components/lvgl lvgl.out)
  101. #-----------------------
  102. # lvgl v8
  103. # include_directories(${TOPROOT}/components/lvgl_v8)
  104. # add_subdirectory(${TOPROOT}/components/lvgl_v8 lvgl.out)
  105. #-----------------------
  106. # 指定生成目标
  107. add_executable(luatos src/main_win32.c src/lua.c)
  108. #target_link_libraries(luat winmm luatos_msys fatfs lvgl lua)
  109. target_link_libraries(luatos lua luat luatos_msys lua luat lvgl cjson
  110. mbedtls fatfs winmm luat lua luatos_msys
  111. )