CMakeLists.txt 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. # Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. # All rights reserved.
  3. #
  4. # This software is supplied "AS IS" without any warranties.
  5. # RDA 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. RDA reserves the right to make changes in the
  8. # software without notification. RDA also make no representation or
  9. # warranty that such application will be suitable for the specified use
  10. # without further testing or modification.
  11. cmake_minimum_required(VERSION 3.13)
  12. set(SOURCE_TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR})
  13. set(BINARY_TOP_DIR ${CMAKE_CURRENT_BINARY_DIR})
  14. set(CMAKE_C_COMPILER_FORCED 1)
  15. set(CMAKE_CXX_COMPILER_FORCED 1)
  16. set(WITH_WERROR ON)
  17. include(cmake/extension.cmake)
  18. # Use a global property to collect all application libraries
  19. define_property(GLOBAL PROPERTY app_libraries
  20. BRIEF_DOCS "app libraries"
  21. FULL_DOCS "app libraries"
  22. )
  23. set(out_hex_dir ${CMAKE_CURRENT_BINARY_DIR}/hex)
  24. set(out_hex_example_dir ${CMAKE_CURRENT_BINARY_DIR}/hex/examples)
  25. set(out_hex_unittest_dir ${CMAKE_CURRENT_BINARY_DIR}/hex/unittests)
  26. set(out_lib_dir ${CMAKE_CURRENT_BINARY_DIR}/lib)
  27. set(out_quec_lib_dir ${CMAKE_CURRENT_BINARY_DIR}/lib)
  28. set(out_app_lib_dir ${CMAKE_CURRENT_BINARY_DIR}/lib)
  29. set(out_rpc_dir ${CMAKE_CURRENT_BINARY_DIR}/rpcgen)
  30. set(out_inc_dir ${CMAKE_CURRENT_BINARY_DIR}/include)
  31. set(tools_dir ${CMAKE_CURRENT_SOURCE_DIR}/tools)
  32. set(ql_app_dir ${CMAKE_CURRENT_SOURCE_DIR}/components/ql-application)
  33. set (QL_CCSDK_QUEC_PROJECT $ENV{ql_buildproj})
  34. set(ql_dm_dir ${SOURCE_TOP_DIR}/components/ql-config/build/${QL_CCSDK_QUEC_PROJECT}/dm_libs)
  35. set(build_target_dir ${CMAKE_CURRENT_SOURCE_DIR}/components/ql-config/build/${QL_CCSDK_QUEC_PROJECT}/$ENV{BUILD_TARGET})
  36. message("\n target dir: ${CMAKE_CURRENT_SOURCE_DIR}/components/ql-config/build/${QL_CCSDK_QUEC_PROJECT}/$ENV{BUILD_TARGET}\n")
  37. set(elf2symld_py ${tools_dir}/elf2symld.py)
  38. set(elf2incld_py ${tools_dir}/elf2incld.py)
  39. set(pacgen_py ${tools_dir}/pacgen.py)
  40. set(signature_py ${tools_dir}/signature/signature.py)
  41. set(iomuxgen_py ${tools_dir}/iomuxgen.py)
  42. set(keypadgen_py ${tools_dir}/keypadgen.py)
  43. set(partinfogen_py ${tools_dir}/partinfogen.py)
  44. set(modemgen_py ${tools_dir}/modemgen.py)
  45. set(romtablegen_py ${tools_dir}/romtablegen.py)
  46. set(symdefgen_py ${tools_dir}/symdefgen.py)
  47. set(groupgen_py ${tools_dir}/groupgen.py)
  48. set(norpropgen_py ${tools_dir}/norpropgen.py)
  49. set(libs2one_py ${tools_dir}/libs2one.py)
  50. set(corestubgen dtools expgen)
  51. set(cmd_mkuimage dtools mkuimage)
  52. set(cmd_mksimage dtools mksimage)
  53. set(cmd_mkappimg dtools mkappimg)
  54. set(cmd_elf2lod dtools elf2lod)
  55. set(cmd_elf2bin dtools elf2bin)
  56. set(cmd_elf2romhex dtools elf2romhex)
  57. set(cmd_lzmare2 dtools lzmare2)
  58. set(cmd_ssign dtools ssign)
  59. set(cmd_ssignchain dtools ssignchain)
  60. set(cmd_ssigndebug dtools ssigndebug)
  61. set(cmd_ssigndevel dtools ssigndevel)
  62. set(cmd_sencrypt dtools sencrypt)
  63. set(cmd_lzmacomp lzma -f -k -9)
  64. set(cmd_re2c re2c)
  65. set(partinfo_bin ${out_hex_dir}/partinfo.bin)
  66. set(core_stub_o ${out_lib_dir}/core_stub.o)
  67. set(dummy_c_file ${SOURCE_TOP_DIR}/cmake/dummy.c)
  68. set(dummy_cxx_file ${SOURCE_TOP_DIR}/cmake/dummy.cpp)
  69. if(WIN32)
  70. set(shell_cmd busybox sh)
  71. else()
  72. set(shell_cmd /bin/sh)
  73. endif()
  74. set(AUTO_GENERATION_NOTICE "Auto generated. Don't edit it manually!")
  75. find_package(Git)
  76. if(GIT_FOUND)
  77. execute_process(COMMAND "${GIT_EXECUTABLE}" describe --abbrev=8 --always --dirty
  78. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  79. OUTPUT_VARIABLE BUILD_GIT_REVISION
  80. OUTPUT_STRIP_TRAILING_WHITESPACE)
  81. endif()
  82. # BUILD_REVISION: A string to identify the build. When not specified, which
  83. # is common in development, it will be "DEVEL". CI will define it in
  84. # command line, such as "8915_W19.32.2"
  85. set (BUILD_REVISION "1_0_W22.16.2")
  86. if(NOT BUILD_REVISION)
  87. set(BUILD_REVISION $ENV{BUILD_REVISION})
  88. if(NOT BUILD_REVISION)
  89. set(BUILD_REVISION DEVEL)
  90. endif()
  91. endif()
  92. # BUILD_AUTO_REVISION: A string to identify the source codes revision.
  93. # When it is built under git working directory, it will be "g1234abcd"
  94. # or "g1234abcd-dirty" if the working directory is dirty. When not in
  95. # git working directory, it will be "unknown". And it can be overrided
  96. # in command line.
  97. if(NOT BUILD_AUTO_REVISION)
  98. if(BUILD_GIT_REVISION)
  99. set(BUILD_AUTO_REVISION "g${BUILD_GIT_REVISION}")
  100. endif()
  101. endif()
  102. if(NOT BUILD_AUTO_REVISION)
  103. set(BUILD_AUTO_REVISION "unknown")
  104. endif()
  105. # BUILD_REVISION_NUMBER: A number to identify the source codes revision.
  106. # When it is built under git working directory, and the working
  107. # directory is clean, it will be "0x1234abcd". Otherwise, it is "0".
  108. # And it can be overrided in command line.
  109. if(NOT BUILD_REVISION_NUMBER)
  110. if(BUILD_GIT_REVISION)
  111. set(BUILD_REVISION_NUMBER "0x${BUILD_GIT_REVISION}")
  112. endif()
  113. if(BUILD_REVISION_NUMBER MATCHES "-dirty")
  114. set(BUILD_REVISION_NUMBER "0")
  115. endif()
  116. endif()
  117. if(NOT BUILD_REVISION_NUMBER)
  118. set(BUILD_REVISION_NUMBER "0")
  119. endif()
  120. # BUILD_TARGET
  121. if(NOT BUILD_TARGET)
  122. set(BUILD_TARGET $ENV{BUILD_TARGET})
  123. endif()
  124. # BUILD_RELEASE_TYPE
  125. if (NOT BUILD_RELEASE_TYPE)
  126. set (BUILD_RELEASE_TYPE $ENV{BUILD_RELEASE_TYPE})
  127. endif()
  128. if("${BUILD_RELEASE_TYPE}" STREQUAL "release")
  129. set(CONFIG_WDT_ENABLE ON)
  130. endif()
  131. if(NOT BUILD_TARGET)
  132. message(FATAL_ERROR "BUILD_TARGET is empty")
  133. endif()
  134. #include(components/ql-config/build/${QL_CCSDK_QUEC_PROJECT}/ql_target.cmake)
  135. #if (NOT CONFIG_QUEC_PROJECT_FEATURE_VOLTE)
  136. # if ($ENV{quec_ims_feature})
  137. # message(FATAL_ERROR "\nVOLTE is disabled at CCSDK!!!")
  138. # endif()
  139. #endif()
  140. set (ql_dsim_enable "n")
  141. if ($ENV{ql_dsim_cfg})
  142. if(EXISTS ${SOURCE_TOP_DIR}/components/ql-config/build/${QL_CCSDK_QUEC_PROJECT}/ql_diff_ctx.cmake)
  143. include(${SOURCE_TOP_DIR}/components/ql-config/build/${QL_CCSDK_QUEC_PROJECT}/ql_diff_ctx.cmake)
  144. endif()
  145. if (CONFIG_QUEC_DIFF_CTX_DSIM)
  146. set (ql_dsim_enable "y")
  147. else()
  148. set (ql_dsim_enable "n")
  149. message("\n")
  150. #FATAL_ERROR
  151. message(WARNING "*********************************************\nDOUBLESIM is not supported for your project ${QL_CCSDK_QUEC_PROJECT}, ignore...\n*********************************************\n")
  152. endif()
  153. endif()
  154. set (QL_BUILD_CHIP_DEF $ENV{hardware_type})
  155. set (QL_CCSDK_BUILD $ENV{_ccsdk_build})
  156. set (QL_CORE_BUILD_VER $ENV{buildver})
  157. set (QL_APP_BUILD_VER $ENV{ql_app_ver})
  158. set (QL_APP2_BUILD_VER $ENV{ql_app2_ver})
  159. # Process and include target config
  160. set(CONFIG_BUILD_IDENTIFY "${BUILD_REVISION}")
  161. set(SRC_CONFIG ${SOURCE_TOP_DIR}/components/ql-config/build/${QL_CCSDK_QUEC_PROJECT}/${BUILD_TARGET}/target.config)
  162. set(TARGET_CONFIG ${BINARY_TOP_DIR}/target.config)
  163. file(COPY ${SRC_CONFIG} DESTINATION ${BINARY_TOP_DIR})
  164. file(APPEND ${TARGET_CONFIG} "\nCONFIG_APP_RAM_OFFSET=$ENV{ap_ram_offset}\n")
  165. file(APPEND ${TARGET_CONFIG} "CONFIG_APP_TOTAL_RAM_SIZE=$ENV{ap_ram_size}\n")
  166. file(APPEND ${TARGET_CONFIG} "CONFIG_SUPPORT_IMS_DELTA_NV=$ENV{ims_delta_nv}\n")
  167. file(APPEND ${TARGET_CONFIG} "CONFIG_DUAL_SIM_SUPPORT=${ql_dsim_enable}\n")
  168. file(APPEND ${TARGET_CONFIG} "CONFIG_QUEC_PROJECT_FEATURE_QDSIM=${ql_dsim_enable}\n")
  169. file(APPEND ${TARGET_CONFIG} "CONFIG_QUEC_PROJECT_FEATURE_VOLTE=$ENV{quec_ims_feature}\n")
  170. # Process and include partition config
  171. set (CONFIG_PARTINFO_JSON_PATH $ENV{partitionfile})
  172. execute_process(
  173. COMMAND python3 ${partinfogen_py} ${CONFIG_PARTINFO_JSON_PATH} ${partinfo_bin} ${BINARY_TOP_DIR}/partinfo.cmake
  174. WORKING_DIRECTORY ${SOURCE_TOP_DIR}
  175. )
  176. include(${BINARY_TOP_DIR}/partinfo.cmake)
  177. set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${partinfogen_py} ${CONFIG_PARTINFO_JSON_PATH})
  178. if(CONFIG_TZ_SML_FLASH_ADDRESS AND CONFIG_TZ_SML_FLASH_SIZE AND CONFIG_TZ_TOS_FLASH_ADDRESS AND CONFIG_TZ_TOS_FLASH_SIZE)
  179. if(${CONFIG_TZ_SML_FLASH_SIZE} AND ${CONFIG_TZ_TOS_FLASH_SIZE})
  180. #if((${CONFIG_TZ_SML_FLASH_SIZE} GREATER 0) AND (${CONFIG_TZ_TOS_FLASH_SIZE} GREATER 0))
  181. file(APPEND ${TARGET_CONFIG} "CONFIG_TRUSTZONE_SUPPORT=y\n")
  182. else()
  183. file(APPEND ${TARGET_CONFIG} "CONFIG_APP_TRUSTZONE_TOS_RAM_SIZE=0x0\n")
  184. endif()
  185. else()
  186. file(APPEND ${TARGET_CONFIG} "CONFIG_APP_TRUSTZONE_TOS_RAM_SIZE=0x0\n")
  187. endif()
  188. # 1.If you load APPIMG in FLASH mode, you can determine whether to enable APPIMG2 function according to partition information.
  189. # However, the CONFIG_APP2_FLASHIMG_RAM_SIZE value needs to be modified according to customer requirements.
  190. # 2.To load AAPPIMG in FILE mode, you need to manually open CONFIG_QUEC_PROJECT_FEATURE_APPIMG2 and change the CONFIG_APP2_FILEIMG_RAM_SIZE value as required.
  191. if(CONFIG_APPIMG2_FLASH_ADDRESS AND CONFIG_APPIMG2_FLASH_SIZE)
  192. if(${CONFIG_APPIMG2_FLASH_ADDRESS} AND ${CONFIG_APPIMG2_FLASH_SIZE})
  193. file(APPEND ${TARGET_CONFIG} "CONFIG_QUEC_PROJECT_FEATURE_APPIMG2=y\n")
  194. else()
  195. file(APPEND ${TARGET_CONFIG} "CONFIG_APP2_FLASHIMG_RAM_SIZE=0x0\n")
  196. endif()
  197. endif()
  198. set(TARGET_CMAKE ${BINARY_TOP_DIR}/target.cmake)
  199. execute_process(
  200. COMMAND python3 ${tools_dir}/cmakeconfig.py ${TARGET_CONFIG} ${TARGET_CMAKE}
  201. WORKING_DIRECTORY ${SOURCE_TOP_DIR}
  202. )
  203. include(${TARGET_CMAKE})
  204. message("\nCurr Proj: ${CONFIG_QL_PROJECT_DEF}${CONFIG_QL_PROJECT_DEF_SUB}, QL_CCSDK_BUILD ${QL_CCSDK_BUILD}\n")
  205. message("\n${CONFIG_NVM_VARIANTS}, ${CONFIG_PARTINFO_JSON_PATH}, ${CONFIG_TRUSTZONE_SML_TOS_DIR}, ${CONFIG_APP_RAM_OFFSET}, ${CONFIG_APP_TOTAL_RAM_SIZE}, ${CONFIG_SUPPORT_IMS_DELTA_NV}, ${CONFIG_DUAL_SIM_SUPPORT}, ${CONFIG_BOARD_WITH_EXT_FLASH}, ${CONFIG_TRUSTZONE_SUPPORT}\n")
  206. configure_file(${SOURCE_TOP_DIR}/components/ql-kernel/inc/quec_proj_config.h.in ${out_inc_dir}/quec_proj_config.h)
  207. # Include chip config
  208. include(components/chip/chip.cmake)
  209. # Process and include Kconfig dependency
  210. set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${TARGET_CONFIG})
  211. set(KCONFIG_DEP ${BINARY_TOP_DIR}/kconfig_dep.cmake)
  212. execute_process(
  213. COMMAND python3 ${tools_dir}/cmakedep.py ${KCONFIG_DEP}
  214. WORKING_DIRECTORY ${SOURCE_TOP_DIR}
  215. )
  216. include(${KCONFIG_DEP})
  217. # Include toolchain config
  218. include(cmake/toolchain-gcc.cmake)
  219. include(components/ql-application/ql_app_feature_config.cmake)
  220. set(BUILD_SHARED_LIBS OFF)
  221. # Check DSDS and DSSS
  222. if(CONFIG_QUEC_PROJECT_FEATURE_QDSIM AND CONFIG_QUEC_PROJECT_FEATURE_DSSS)
  223. message(FATAL_ERROR "\n >>>>>>>>>> Feature DSDS is in conflict with DSSS! <<<<<<<<<<")
  224. endif()
  225. # Check STK_AT and APP_STK
  226. if(CONFIG_QUEC_PROJECT_FEATURE_STK_AT AND QL_APP_FEATURE_STK)
  227. message(FATAL_ERROR "\n >>>>>>>>>> Feature STK_AT is in conflict with APP_STK! <<<<<<<<<<")
  228. endif()
  229. project(${BUILD_TARGET} C CXX ASM)
  230. include_directories(${out_inc_dir})
  231. include_directories(${SOURCE_TOP_DIR}/components/include)
  232. include_directories(${SOURCE_TOP_DIR}/components/newlib/include)
  233. include_directories(${SOURCE_TOP_DIR}/components/hal/include)
  234. include_directories(${SOURCE_TOP_DIR}/components/fs/include)
  235. include_directories(${SOURCE_TOP_DIR}/components/fs/fsmount/include)
  236. include_directories(${SOURCE_TOP_DIR}/components/cfw/include)
  237. include_directories(${SOURCE_TOP_DIR}/components/net/lwip/include)
  238. include_directories(${SOURCE_TOP_DIR}/components/net/lwip/src/include)
  239. include_directories(${SOURCE_TOP_DIR}/components/net/lwip/src/include/lwip)
  240. include_directories(${SOURCE_TOP_DIR}/components/net/lwip/src/include/compat/posix)
  241. include_directories(${SOURCE_TOP_DIR}/components/net/mbedtls/include)
  242. include_directories(${SOURCE_TOP_DIR}/components/net/include)
  243. include_directories(${SOURCE_TOP_DIR}/components/kernel/include)
  244. include_directories(${SOURCE_TOP_DIR}/components/driver/include)
  245. include_directories(${SOURCE_TOP_DIR}/components/driver/include/usb)
  246. include_directories(${SOURCE_TOP_DIR}/components/driver/src/usb)
  247. include_directories(${SOURCE_TOP_DIR}/components/driver/src/usb_host/include)
  248. include_directories(${SOURCE_TOP_DIR}/components/ql-kernel/inc)
  249. #add_custom_target(quectel)
  250. add_custom_target(beautify)
  251. add_custom_target(unittests)
  252. #add_custom_target(examples ALL)
  253. if(CONFIG_QL_OPEN_EXPORT_PKG)
  254. add_custom_target(ql_examples ALL)
  255. endif()
  256. add_custom_target(rpcgen)
  257. add_appimg_delete()
  258. add_subdirectory_if_exist(components)
  259. add_subdirectory_if_exist(unittest)
  260. #add_subdirectory_if_exist(examples)
  261. pacvariant_gen()
  262. #file(GLOB QL_LIBS_PATH ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libq*.a ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboq*.a)
  263. #message("\nQL_LIBS_PATH ${QL_LIBS_PATH}\n")
  264. # "all_libs" is a target to link all app libraries
  265. set(target all_libs)
  266. set(all_libs_out ${out_lib_dir}/all_libs.a)
  267. get_property(app_libraries GLOBAL PROPERTY app_libraries)
  268. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_dev.a)
  269. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_adc.a)
  270. if(EXISTS ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboql_pin_init.a)
  271. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboql_pin_init.a)
  272. endif()
  273. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_gpio.a)
  274. if(EXISTS ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboql_api_power.a)
  275. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboql_api_power.a)
  276. endif()
  277. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_power.a)
  278. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_bsp.a)
  279. if(CONFIG_QUEC_PROJECT_FEATURE_FILE_AT)
  280. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_file_at.a)
  281. endif()
  282. if(CONFIG_QUEC_PROJECT_FEATURE_SMS_AT)
  283. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_sms_at.a)
  284. endif()
  285. if(CONFIG_QUEC_PROJECT_FEATURE_STK_AT)
  286. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_stk_at.a)
  287. endif()
  288. if(CONFIG_QUEC_PROJECT_FEATURE_UNIOT_AT)
  289. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_unify_at.a)
  290. endif()
  291. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_at.a)
  292. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_at_table.a)
  293. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_urc.a)
  294. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libquectel.a)
  295. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_common.a)
  296. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_utils.a)
  297. #list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_rtos.a)
  298. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_osi.a)
  299. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libq_modem.a)
  300. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_sim.a)
  301. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_nw.a)
  302. if(CONFIG_QUEC_PROJECT_FEATURE_USBNET)
  303. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libq_usbnet.a)
  304. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_usbnet.a)
  305. endif()
  306. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_net.a)
  307. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_datacall.a)
  308. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_fs.a)
  309. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_file.a)
  310. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_fatfs_ex.a)
  311. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_nvitem.a)
  312. if(CONFIG_QUEC_PROJECT_FEATURE_FILE_ZIP)
  313. # FILE_ZIP depends on FILE
  314. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_zip.a)
  315. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_zip.a)
  316. endif()
  317. if((CONFIG_QUEC_PROJECT_FEATURE_FOTA) AND (CONFIG_QUEC_PROJECT_FEATURE_HTTP))
  318. if(CONFIG_QUEC_PROJECT_FEATURE_CLOUDOTA)
  319. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_cloudota.a)
  320. endif()
  321. endif()
  322. if(CONFIG_QUEC_PROJECT_FEATURE_RTC)
  323. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_rtc.a)
  324. endif()
  325. if(CONFIG_QUEC_PROJECT_FEATURE_VIRT_AT)
  326. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_virt_at.a)
  327. endif()
  328. if(CONFIG_QUEC_PROJECT_FEATURE_FOTA)
  329. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_fota.a)
  330. endif()
  331. if (CONFIG_QUEC_PROJECT_FEATURE_SMS)
  332. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_sms.a)
  333. endif()
  334. if (CONFIG_QUEC_PROJECT_FEATURE_PBK)
  335. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_pbk.a)
  336. endif()
  337. if (CONFIG_QUEC_PROJECT_FEATURE_STK)
  338. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_stk.a)
  339. endif()
  340. if (CONFIG_QUEC_PROJECT_FEATURE_VOICE_CALL)
  341. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_voice_call.a)
  342. endif()
  343. if (CONFIG_QUEC_PROJECT_FEATURE_VOLTE)
  344. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_volte.a)
  345. endif()
  346. if (CONFIG_QUEC_PROJECT_FEATURE_VSIM_ADAPT)
  347. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_vsim_adapt.a)
  348. endif()
  349. if (CONFIG_QUEC_PROJECT_FEATURE_SSL)
  350. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_apptcpip.a)
  351. endif()
  352. if (CONFIG_QUEC_PROJECT_FEATURE_FTP)
  353. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_curl.a)
  354. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_ftp.a)
  355. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_ftp.a)
  356. endif()
  357. if (CONFIG_QUEC_PROJECT_FEATURE_SSH2)
  358. # SSH2 depends on ssl
  359. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_ssh2.a)
  360. endif()
  361. if (CONFIG_QUEC_PROJECT_FEATURE_HTTP)
  362. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_http.a)
  363. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_http.a)
  364. if (CONFIG_QUEC_PROJECT_FEATURE_MMS)
  365. # MMS depends on HTTP
  366. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_mms.a)
  367. endif()
  368. if (CONFIG_QUEC_PROJECT_FEATURE_LBS)
  369. # LBS depends on HTTP
  370. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_tlv.a)
  371. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_lbs.a)
  372. endif()
  373. endif()
  374. if (CONFIG_QUEC_PROJECT_FEATURE_MQTT)
  375. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_mqtt.a)
  376. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_mqtt.a)
  377. endif()
  378. if (CONFIG_QUEC_PROJECT_FEATURE_PING)
  379. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_ping.a)
  380. endif()
  381. if (CONFIG_QUEC_PROJECT_FEATURE_NTP)
  382. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_ntp.a)
  383. endif()
  384. if (CONFIG_QUEC_PROJECT_FEATURE_QTHSDK)
  385. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_qthsdk.a)
  386. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_qth_mqtt.a)
  387. endif()
  388. if (CONFIG_QUEC_PROJECT_FEATURE_FIREWALL)
  389. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_firewall.a)
  390. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_firewall.a)
  391. endif()
  392. if(CONFIG_QUEC_PROJECT_FEATURE_AUDIO)
  393. if(EXISTS ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboql_api_audio.a)
  394. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboql_api_audio.a)
  395. endif()
  396. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_ext_codec.a)
  397. endif()
  398. if (CONFIG_QUEC_PROJECT_FEATURE_TTS_IN_KERNEL)
  399. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/newlib/armca5/libql_api_tts.a)
  400. endif()
  401. if(CONFIG_QUEC_PROJECT_FEATURE_UART)
  402. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_uart.a)
  403. endif()
  404. if(CONFIG_QUEC_PROJECT_FEATURE_USB)
  405. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_usb.a)
  406. endif()
  407. if(CONFIG_QUEC_PROJECT_FEATURE_LEDCFG)
  408. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_pwm.a)
  409. endif()
  410. if(CONFIG_QUEC_PROJECT_FEATURE_I2C)
  411. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_i2c.a)
  412. endif()
  413. if (CONFIG_QUEC_PROJECT_FEATURE_KEYPAD)
  414. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_keypad.a)
  415. endif()
  416. if (CONFIG_QUEC_PROJECT_FEATURE_LCD)
  417. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_lcd.a)
  418. endif()
  419. if (CONFIG_QUEC_PROJECT_FEATURE_WIFISCAN)
  420. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_wifiscan.a)
  421. endif()
  422. if (CONFIG_QUEC_PROJECT_FEATURE_BT)
  423. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_bt.a)
  424. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_ble.a)
  425. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_bt_ble.a)
  426. if (CONFIG_QUEC_PROJECT_FEATURE_BLE_GATT)
  427. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_ble_gatt.a)
  428. endif()
  429. endif()
  430. if (CONFIG_QUEC_PROJECT_FEATURE_GNSS)
  431. # GNSS depends on UART/GPIO
  432. # GNSS depends on HTTP to support AGPS.
  433. if (CONFIG_QUEC_PROJECT_FEATURE_INTERNAL_GNSS)
  434. if(EXISTS ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboql_gnss.a)
  435. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboql_gnss.a)
  436. endif()
  437. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_gnss_aux.a)
  438. endif()
  439. if (CONFIG_QUEC_PROJECT_FEATURE_HD_GNSS)
  440. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/liboql_hd_gnss.a)
  441. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_hd_gnss_aux.a)
  442. endif()
  443. endif()
  444. if (CONFIG_QUEC_PROJECT_FEATURE_CAMERA)
  445. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_camera.a)
  446. endif()
  447. if (CONFIG_QUEC_PROJECT_FEATURE_SPI)
  448. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_spi.a)
  449. if (CONFIG_QUEC_PROJECT_FEATURE_SPI_FLASH)
  450. # SPI_FLASH depends on SPI
  451. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_spi_flash.a)
  452. if (CONFIG_QUEC_PROJECT_FEATURE_SPI_NOR_FLASH)
  453. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_spi_nor_flash.a)
  454. endif()
  455. if (CONFIG_QUEC_PROJECT_FEATURE_SPI_NAND_FLASH)
  456. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_spi_nand_flash.a)
  457. endif()
  458. if (CONFIG_QUEC_PROJECT_FEATURE_SPI6_NAND_FLASH)
  459. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_spi6_nand_flash.a)
  460. endif()
  461. if (CONFIG_QUEC_PROJECT_FEATURE_FS_NAND_FLASH)
  462. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_fs_nand_flash.a)
  463. endif()
  464. if (CONFIG_QUEC_PROJECT_FEATURE_SPI4_EXT_NOR_SFFS)
  465. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_spi4_ext_nor_sffs.a)
  466. endif()
  467. if (CONFIG_QUEC_PROJECT_FEATURE_FS_NOR_FLASH)
  468. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_fs_nor_flash.a)
  469. endif()
  470. endif()
  471. endif()
  472. if (CONFIG_QUEC_PROJECT_FEATURE_SPI6_EXT_NOR)
  473. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_spi6_ext_nor_flash.a)
  474. endif()
  475. if(CONFIG_QUEC_PROJECT_FEATURE_SDMMC OR CONFIG_QUEC_PROJECT_FEATURE_EMMC OR CONFIG_QUEC_PROJECT_FEATURE_SDMMC2 OR CONFIG_QUEC_PROJECT_FEATURE_EMMC2)
  476. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_sdmmc.a)
  477. endif()
  478. if (CONFIG_QUEC_PROJECT_FEATURE_GPRS_DATA_TRANSFER)
  479. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_gprs_data_transfer.a)
  480. endif()
  481. if (CONFIG_QUEC_PROJECT_FEATURE_TP)
  482. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_tp.a)
  483. endif()
  484. if (CONFIG_QUEC_PROJECT_FEATURE_ALIIOTSMARTCARD)
  485. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_aliotsmartcard.a)
  486. endif()
  487. if (CONFIG_QUEC_PROJECT_FEATURE_ALIPAY_IOT_SDK)
  488. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_alipay_iot_sdk.a)
  489. endif()
  490. if (CONFIG_QUEC_PROJECT_FEATURE_WEBSOCKET)
  491. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_websocket.a)
  492. endif()
  493. if (CONFIG_QUEC_PROJECT_FEATURE_NTRIP_RTK)
  494. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_ntrip_rtk.a)
  495. endif()
  496. if (CONFIG_QUEC_PROJECT_FEATURE_ETHERNET)
  497. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_ethernet.a)
  498. endif()
  499. if (CONFIG_QUEC_PROJECT_FEATURE_WIFI)
  500. list(APPEND app_libraries ${SOURCE_TOP_DIR}/components/ql-kernel/libs/libql_api_wifi.a)
  501. endif()
  502. list(APPEND app_libraries ${libc_file_name} ${libm_file_name} ${libgcc_file_name} ${QL_LIBS_PATH})
  503. add_custom_command(OUTPUT ${all_libs_out}
  504. COMMAND python3 ${groupgen_py} --base ${BINARY_TOP_DIR} ${all_libs_out} ${app_libraries}
  505. DEPENDS ${groupgen_py} ${app_libraries}
  506. WORKING_DIRECTORY ${BINARY_TOP_DIR}
  507. )
  508. add_custom_target(build_${target} DEPENDS ${all_libs_out})
  509. add_library(${target} STATIC IMPORTED GLOBAL)
  510. set_target_properties(${target} PROPERTIES IMPORTED_LOCATION ${all_libs_out})
  511. add_dependencies(${target} build_${target})