1# SPDX-License-Identifier: Apache-2.0
2
3cmake_minimum_required(VERSION 3.20.0)
4find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5project(tls)
6
7set(BASE_PATH "../../../../../subsys/net/lib/http/")
8include_directories(${BASE_PATH}/headers)
9
10set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/)
11
12if (${CONFIG_TLS_CREDENTIALS})
13  generate_inc_file_for_target(
14    app
15    ${ZEPHYR_BASE}/samples/net/sockets/http_server/src/certs/ca_cert.der
16    ${gen_dir}/ca.inc
17  )
18
19  generate_inc_file_for_target(
20    app
21    ${ZEPHYR_BASE}/samples/net/sockets/http_server/src/certs/server_cert.der
22    ${gen_dir}/server.inc
23  )
24
25  generate_inc_file_for_target(
26    app
27    ${ZEPHYR_BASE}/samples/net/sockets/http_server/src/certs/server_privkey.der
28    ${gen_dir}/server_privkey.inc
29  )
30
31  # we reuse the same certificate / private key for client
32  # since it seems to be the only one that is signed by a ca
33  generate_inc_file_for_target(
34    app
35    ${ZEPHYR_BASE}/samples/net/sockets/http_server/src/certs/server_cert.der
36    ${gen_dir}/client.inc
37  )
38
39  generate_inc_file_for_target(
40    app
41    ${ZEPHYR_BASE}/samples/net/sockets/http_server/src/certs/server_privkey.der
42    ${gen_dir}/client_privkey.inc
43  )
44endif()
45
46set(source_file_index src/index.html)
47generate_inc_file_for_target(app ${source_file_index} ${gen_dir}/index.html.inc)
48generate_inc_file_for_target(app ${source_file_index} ${gen_dir}/index.html.gz.inc --gzip)
49
50FILE(GLOB app_sources src/main.c)
51target_sources(app PRIVATE ${app_sources})
52
53zephyr_linker_sources(SECTIONS sections-rom.ld)
54zephyr_iterable_section(NAME http_resource_desc_test_http_service KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
55