# SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) find_package(Python REQUIRED COMPONENTS Interpreter) project(http_server) if(CONFIG_NET_SOCKETS_SOCKOPT_TLS AND CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED AND (CONFIG_NET_SAMPLE_PSK_HEADER_FILE STREQUAL "dummy_psk.h")) add_custom_target(development_psk COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------" COMMAND ${CMAKE_COMMAND} -E echo "--- WARNING: Using dummy PSK! Only suitable for ---" COMMAND ${CMAKE_COMMAND} -E echo "--- development. Set NET_SAMPLE_PSK_HEADER_FILE to use ---" COMMAND ${CMAKE_COMMAND} -E echo "--- own pre-shared key. ---" COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------" ) add_dependencies(app development_psk) endif() option(INCLUDE_HTML_CONTENT "Include the HTML content" ON) target_sources(app PRIVATE src/main.c) set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/) set(source_file_index src/index.html) generate_inc_file_for_target(app ${source_file_index} ${gen_dir}/index.html.gz.inc --gzip) set(source_file_not_found src/not_found_page.html) generate_inc_file_for_target(app ${source_file_not_found} ${gen_dir}/not_found_page.html.gz.inc --gzip) target_sources_ifdef(CONFIG_NET_SAMPLE_WEBSOCKET_SERVICE app PRIVATE src/ws.c) target_link_libraries(app PRIVATE zephyr_interface zephyr) zephyr_linker_sources(SECTIONS sections-rom.ld) zephyr_linker_section_ifdef(CONFIG_NET_SAMPLE_HTTPS_SERVICE NAME http_resource_desc_test_https_service KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN Z_LINK_ITERABLE_SUBALIGN) zephyr_linker_section_ifdef(CONFIG_NET_SAMPLE_HTTP_SERVICE NAME http_resource_desc_test_http_service KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN Z_LINK_ITERABLE_SUBALIGN) foreach(inc_file ca.der server.der server_privkey.der https-server-cert.der https-server-key.der ) generate_inc_file_for_target( app src/${inc_file} ${gen_dir}/${inc_file}.inc ) endforeach()