CMakeLists.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # Copyright (C) 2018 LongSung Technologies Limited and/or its affiliates("LongSung").
  2. # All rights reserved.
  3. #
  4. # This software is supplied "AS IS" without any warranties.
  5. # LongSung assumes no responsibility or liability for the use of the software,
  6. # conveys no license or title under any patent, copyright, or mask work
  7. # right to the product. LongSung reserves the right to make changes in the
  8. # software without notification. LongSung also make no representation or
  9. # warranty that such application will be suitable for the specified use
  10. # without further testing or modification.
  11. option(ENABLE_DEBUG "enable_debug_fun" ON)
  12. if(ENABLE_DEBUG)
  13. add_definitions(-D ENABLE_DEBUG)
  14. set(debug_files ./app/debug.c)
  15. endif(ENABLE_DEBUG)
  16. #set(preset_dir ./preset)
  17. set(app_dir ./app)
  18. set(app_file ./hpocapp.c
  19. ${app_dir}/board.c
  20. ${app_dir}/app.c
  21. ${app_dir}/setting.c
  22. ${app_dir}/poc.c
  23. ${app_dir}/uio.c
  24. ${app_dir}/uiEntry.c
  25. ${app_dir}/uiBlock.c
  26. ${app_dir}/gpsCtl.c
  27. ${app_dir}/GpsData.c
  28. ${app_dir}/message.c
  29. ${app_dir}/hook.c
  30. ${app_dir}/appAuth.c
  31. ${app_dir}/common.c
  32. ${app_dir}/bsp.c
  33. ${app_dir}/ble.c
  34. ${app_dir}/xinbiao.c
  35. ${app_dir}/tupApi.c
  36. ${app_dir}/AppTcpPart.c
  37. ${debug_files})
  38. set(log_dir ${app_dir}/log)
  39. set(log_file ${log_dir}/log.c)
  40. set(lcd_dir ${app_dir}/GUI)
  41. set(lcd_file ${lcd_dir}/fonts.c
  42. ${lcd_dir}/gui.c
  43. ${lcd_dir}/lcdDrv.c)
  44. set(fonts_dir ${app_dir}/fonts)
  45. set(fonts_file ${fonts_dir}/GB2312UnicodeTable.c
  46. ${fonts_dir}/strnormalize.c
  47. ${fonts_dir}/unicode.c
  48. ${fonts_dir}/language.c)
  49. set(interface_dir ${app_dir}/Interface)
  50. set(interface_file ${interface_dir}/Palace.c
  51. ${interface_dir}/uiMenu.c
  52. ${interface_dir}/ListBox.c
  53. ${interface_dir}/ListBoxSMS.c
  54. ${interface_dir}/NumEdit.c
  55. ${interface_dir}/ManageMessage.c
  56. ${interface_dir}/checkbox.c
  57. ${interface_dir}/newMessage.c)
  58. set(md5_dir ${app_dir}/md5)
  59. set(md5_file ${md5_dir}/mymd5.c)
  60. set(all_dir ${app_dir}
  61. ${log_dir}
  62. ${lcd_dir}
  63. ${fonts_dir}
  64. ${interface_dir}
  65. ${md5_dir})
  66. set(all_file ${app_file}
  67. ${log_file}
  68. ${lcd_file}
  69. ${interface_file}
  70. ${md5_file}
  71. ${fonts_file})
  72. set(cy_lib ${CMAKE_CURRENT_SOURCE_DIR}/lib/libpoc.a)
  73. set(language_lib ${CMAKE_CURRENT_SOURCE_DIR}/lib/libfontlib.a)
  74. ##################################################################################
  75. #aux_source_directory(${SOURCE_TOP_DIR}/hpoc/app SRC_LIST)
  76. include_directories(${all_dir})
  77. #add_definitions(-Wall)
  78. add_definitions(-w)
  79. #set(preset_dir ${CMAKE_CURRENT_SOURCE_DIR}/preset)
  80. if(CONFIG_APPIMG_LOAD_FLASH)
  81. set(target LC_D29V)
  82. add_appimg(${target} ${flash_ldscript} ${all_file})
  83. #app usr hgs_lib has to be link first
  84. target_link_libraries(${target} PRIVATE ${cy_lib})
  85. target_link_libraries(${target} PRIVATE ${language_lib})
  86. target_link_libraries(${target} PRIVATE ${libc_file_name} ${libm_file_name} ${libgcc_file_name})
  87. set(pac_file ${out_hex_dir}/${target}.pac)
  88. set(target_img_file ${out_hex_dir}/${target}.img)
  89. set(prepack_cpio ${out_hex_dir}/${target}_prepack.cpio)
  90. pac_init_fdl(init_fdl)
  91. if(preset_dir)
  92. file(REMOVE ${preset_dir}/.gitkeep)
  93. file(GLOB_RECURSE preset_files ${preset_dir}/*)
  94. foreach(preset ${preset_files})
  95. string(REGEX REPLACE ${preset_dir}/ "" preset_file ${preset})
  96. message("find preset file ${preset_file} in dir ${preset_dir}")
  97. set(pkt_preset_flies
  98. ${pkt_preset_flies}
  99. cfg-pack-file -i ${preset_file} -p ${preset_dir}/${preset_file} -n /${preset_file}
  100. )
  101. message("cmd ${pkt_preset_flies}")
  102. endforeach(preset)
  103. endif(preset_dir)
  104. add_custom_command(OUTPUT ${prepack_cpio}
  105. COMMAND python3 ${modemgen_py} prepackgen
  106. --source-top ${SOURCE_TOP_DIR}
  107. --binary-top ${BINARY_TOP_DIR}
  108. --prepackfile ${CONFIG_PACKAGE_FILE_APPIMG_JSON_PATH}
  109. ${prepack_cpio}
  110. DEPENDS ${modemgen_py}
  111. WORKING_DIRECTORY ${SOURCE_TOP_DIR}
  112. )
  113. if(CONFIG_PACKAGE_FILE_APPIMG_JSON_PATH)
  114. set(cfg_pack_gpio cfg-pack-cpio -i PREPACK -p ${prepack_cpio})
  115. set(prepack_file ${prepack_cpio})
  116. endif()
  117. add_custom_command(OUTPUT ${pac_file}
  118. COMMAND python3 ${pacgen_py} ${init_fdl}
  119. cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS}
  120. -s ${CONFIG_APPIMG_FLASH_SIZE}
  121. -p ${target_img_file}
  122. ${cfg_pack_gpio}
  123. pac-gen ${pac_file}
  124. DEPENDS ${pacgen_py} ${target_img_file} ${prepack_file}
  125. WORKING_DIRECTORY ${SOURCE_TOP_DIR}
  126. )
  127. add_custom_target(${target}_pacgen ALL DEPENDS ${pac_file})
  128. endif()