CMakeLists.txt 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. set(preset_dir ./preset)
  12. set(app_dir ./app)
  13. set(app_file ./hpocapp.c
  14. ${app_dir}/board.c
  15. ${app_dir}/app.c
  16. ${app_dir}/poc.c
  17. ${app_dir}/setting.c
  18. ${app_dir}/uio.c
  19. ${app_dir}/uiEntry.c
  20. ${app_dir}/uiBlock.c
  21. ${app_dir}/gpsCtl.c
  22. ${app_dir}/GpsData.c
  23. ${app_dir}/message.c
  24. ${app_dir}/hook.c
  25. ${app_dir}/appAuth.c
  26. ${app_dir}/common.c
  27. ${app_dir}/AppFota.c
  28. )
  29. set(log_dir ${app_dir}/log)
  30. set(log_file ${log_dir}/log.c)
  31. set(lcd_dir ${app_dir}/GUI)
  32. set(lcd_file ${lcd_dir}/fonts.c
  33. ${lcd_dir}/gui.c
  34. ${lcd_dir}/lcdDrv.c)
  35. set(interface_dir ${app_dir}/Interface)
  36. set(interface_file ${interface_dir}/Palace.c
  37. ${interface_dir}/uiMenu.c
  38. ${interface_dir}/ListBox.c
  39. ${interface_dir}/ListBoxSMS.c
  40. ${interface_dir}/NumEdit.c
  41. ${interface_dir}/ManageMessage.c)
  42. set(md5_dir ${app_dir}/md5)
  43. set(md5_file ${md5_dir}/mymd5.c)
  44. set(GWSDinc_dir ${app_dir}/GWSDinc)
  45. set(GWSDinc_file ${GWSDinc_dir}/bsp.c)
  46. set(all_dir ${app_dir}
  47. ${log_dir}
  48. ${lcd_dir}
  49. ${interface_dir}
  50. ${md5_dir}
  51. ${GWSDinc_dir}
  52. )
  53. set(all_file ${app_file}
  54. ${log_file}
  55. ${lcd_file}
  56. ${interface_file}
  57. ${md5_file}
  58. ${GWSDinc_file}
  59. )
  60. option(USE_HPOC_POC "enable USE_HPOC_POC" OFF)
  61. option(USE_GWSD_POC "enable USE_GWSD_POC" ON)
  62. if(USE_GWSD_POC)
  63. add_definitions(-D ENABLE_GWSD_POC)
  64. set(gwsd_dir ./lib/gwsd)
  65. set(gwsd_lib ${CMAKE_CURRENT_SOURCE_DIR}/lib/gwsd/POC_OPEN.lib m)
  66. set(language_lib ${CMAKE_CURRENT_SOURCE_DIR}/lib/libfontlib.a)
  67. set(qr_lib ${CMAKE_CURRENT_SOURCE_DIR}/lib/libqrcode.a)
  68. endif(USE_GWSD_POC)
  69. ##################################################################################
  70. #aux_source_directory(${SOURCE_TOP_DIR}/hpoc/app SRC_LIST)
  71. include_directories(${all_dir})
  72. #add_definitions(-Wall)
  73. add_definitions(-w)
  74. set(preset_dir ${CMAKE_CURRENT_SOURCE_DIR}/preset)
  75. if(CONFIG_APPIMG_LOAD_FLASH)
  76. set(target X6)
  77. add_appimg(${target} ${flash_ldscript} ${all_file})
  78. #app usr hgs_lib has to be link first
  79. target_link_libraries(${target} PRIVATE ${qr_lib})
  80. target_link_libraries(${target} PRIVATE ${gwsd_lib})
  81. target_link_libraries(${target} PRIVATE ${language_lib})
  82. target_link_libraries(${target} PRIVATE ${libc_file_name} ${libm_file_name} ${libgcc_file_name})
  83. set(pac_file ${out_hex_dir}/${target}.pac)
  84. set(target_img_file ${out_hex_dir}/${target}.img)
  85. pac_init_fdl(init_fdl)
  86. if(preset_dir)
  87. file(REMOVE ${preset_dir}/.gitkeep)
  88. file(GLOB_RECURSE preset_files ${preset_dir}/*)
  89. foreach(preset ${preset_files})
  90. string(REGEX REPLACE ${preset_dir}/ "" preset_file ${preset})
  91. message("find preset file ${preset_file} in dir ${preset_dir}")
  92. set(pkt_preset_flies
  93. ${pkt_preset_flies}
  94. cfg-pack-file -i ${preset_file} -p ${preset_dir}/${preset_file} -n /${preset_file}
  95. )
  96. message("cmd ${pkt_preset_flies}")
  97. endforeach(preset)
  98. endif(preset_dir)
  99. add_custom_command(OUTPUT ${pac_file}
  100. COMMAND python3 ${pacgen_py} ${init_fdl}
  101. cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS}
  102. -s ${CONFIG_APPIMG_FLASH_SIZE}
  103. -p ${target_img_file}
  104. ${pkt_preset_flies}
  105. pac-gen ${pac_file}
  106. DEPENDS ${pacgen_py} ${target_img_file}
  107. WORKING_DIRECTORY ${SOURCE_TOP_DIR}
  108. )
  109. add_custom_target(${target}_pacgen ALL DEPENDS ${pac_file})
  110. endif()