1# SPDX-License-Identifier: Apache-2.0
2
3zephyr_library()
4zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/ip)
5zephyr_library_include_directories_ifdef(
6  CONFIG_NET_L2_WIFI_SHELL ${ZEPHYR_BASE}/subsys/net/lib/shell
7  )
8zephyr_library_compile_definitions_ifdef(
9  CONFIG_NEWLIB_LIBC __LINUX_ERRNO_EXTENSIONS__
10  )
11zephyr_library_include_directories_ifdef(
12  CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE test_certs
13  )
14
15zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_MGMT wifi_mgmt.c)
16zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_SHELL wifi_shell.c)
17zephyr_library_sources_ifdef(CONFIG_WIFI_NM wifi_nm.c)
18zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_UTILS wifi_utils.c)
19
20# Linker section placement for wifi_nm_instance iterable structure
21zephyr_linker_sources_ifdef(CONFIG_WIFI_NM DATA_SECTIONS wifi_nm.ld)
22if (CONFIG_WIFI_NM)
23zephyr_iterable_section(NAME wifi_nm_instance GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
24endif()
25
26if(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE AND CONFIG_NET_L2_WIFI_SHELL)
27  # Wi-Fi Enterprise test certificates handling
28  set(gen_inc_dir ${ZEPHYR_BINARY_DIR}/misc/generated)
29  set(gen_dir ${gen_inc_dir}/wifi_enterprise_test_certs)
30  # Create output directory for test certs
31  file(MAKE_DIRECTORY ${gen_dir})
32
33  # convert .pem files to array data at build time
34  zephyr_include_directories(${gen_inc_dir})
35
36  generate_inc_file_for_target(
37      app
38      ${ZEPHYR_BASE}/samples/net/wifi/test_certs/client.pem
39      ${gen_dir}/client.pem.inc
40      )
41
42  generate_inc_file_for_target(
43      app
44      ${ZEPHYR_BASE}/samples/net/wifi/test_certs/client-key.pem
45      ${gen_dir}/client-key.pem.inc
46      )
47
48  generate_inc_file_for_target(
49      app
50      ${ZEPHYR_BASE}/samples/net/wifi/test_certs/ca.pem
51      ${gen_dir}/ca.pem.inc
52      )
53
54  generate_inc_file_for_target(
55      app
56      ${ZEPHYR_BASE}/samples/net/wifi/test_certs/client2.pem
57      ${gen_dir}/client2.pem.inc
58      )
59
60  generate_inc_file_for_target(
61      app
62      ${ZEPHYR_BASE}/samples/net/wifi/test_certs/client-key2.pem
63      ${gen_dir}/client-key2.pem.inc
64      )
65
66  generate_inc_file_for_target(
67      app
68      ${ZEPHYR_BASE}/samples/net/wifi/test_certs/ca2.pem
69      ${gen_dir}/ca2.pem.inc
70      )
71
72  generate_inc_file_for_target(
73      app
74      ${ZEPHYR_BASE}/samples/net/wifi/test_certs/server.pem
75      ${gen_dir}/server.pem.inc
76      )
77
78  generate_inc_file_for_target(
79      app
80      ${ZEPHYR_BASE}/samples/net/wifi/test_certs/server-key.pem
81      ${gen_dir}/server-key.pem.inc
82      )
83
84  # Add explicit dependency on app target for ZEPHYR_CURRENT_LIBRARY, so these
85  # headers are generated at the correct point in the build
86  add_dependencies(${ZEPHYR_CURRENT_LIBRARY} app)
87endif() #CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE AND CONFIG_NET_L2_WIFI_SHELL
88