1d4afb5ceSopenharmony_ciproject(lws-minimal-secure-streams-cpp CXX)
2d4afb5ceSopenharmony_cicmake_minimum_required(VERSION 2.8.12)
3d4afb5ceSopenharmony_cifind_package(libwebsockets CONFIG REQUIRED)
4d4afb5ceSopenharmony_cilist(APPEND CMAKE_MODULE_PATH ${LWS_CMAKE_DIR})
5d4afb5ceSopenharmony_ciinclude(CheckCSourceCompiles)
6d4afb5ceSopenharmony_ciinclude(LwsCheckRequirements)
7d4afb5ceSopenharmony_ci
8d4afb5ceSopenharmony_ciset(SAMP lws-minimal-secure-streams-cpp)
9d4afb5ceSopenharmony_ci
10d4afb5ceSopenharmony_ciset(requirements 1)
11d4afb5ceSopenharmony_cirequire_lws_config(LWS_ROLE_H1 1 requirements)
12d4afb5ceSopenharmony_cirequire_lws_config(LWS_WITHOUT_CLIENT 0 requirements)
13d4afb5ceSopenharmony_cirequire_lws_config(LWS_WITH_MBEDTLS 0 requirements)
14d4afb5ceSopenharmony_cirequire_lws_config(LWS_WITH_SECURE_STREAMS 1 requirements)
15d4afb5ceSopenharmony_cirequire_lws_config(LWS_WITH_SECURE_STREAMS_CPP 1 requirements)
16d4afb5ceSopenharmony_cirequire_lws_config(LWS_WITH_SECURE_STREAMS_STATIC_POLICY_ONLY 0 requirements)
17d4afb5ceSopenharmony_ci
18d4afb5ceSopenharmony_ciif (requirements)
19d4afb5ceSopenharmony_ci	add_executable(${SAMP} main.cxx)
20d4afb5ceSopenharmony_ci
21d4afb5ceSopenharmony_ci	if (LWS_CTEST_INTERNET_AVAILABLE)
22d4afb5ceSopenharmony_ci		add_test(NAME sscpp-warmcat COMMAND lws-minimal-secure-streams-cpp)
23d4afb5ceSopenharmony_ci		set_tests_properties(sscpp-warmcat
24d4afb5ceSopenharmony_ci				     PROPERTIES
25d4afb5ceSopenharmony_ci				     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/secure-streams/minimal-secure-streams-cpp
26d4afb5ceSopenharmony_ci				     TIMEOUT 20)
27d4afb5ceSopenharmony_ci	endif()
28d4afb5ceSopenharmony_ci
29d4afb5ceSopenharmony_ci	if (websockets_shared)
30d4afb5ceSopenharmony_ci		target_link_libraries(${SAMP} websockets_shared ${LIBWEBSOCKETS_DEP_LIBS})
31d4afb5ceSopenharmony_ci		add_dependencies(${SAMP} websockets_shared)
32d4afb5ceSopenharmony_ci	else()
33d4afb5ceSopenharmony_ci		target_link_libraries(${SAMP} websockets ${LIBWEBSOCKETS_DEP_LIBS})
34d4afb5ceSopenharmony_ci	endif()
35d4afb5ceSopenharmony_ci
36d4afb5ceSopenharmony_ci	CHECK_C_SOURCE_COMPILES("#include <libwebsockets.h>\nint main(void) {\ni#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API)\n return 0;\n #else\n fail\n #endif\n return 0;\n}\n" HAS_LWS_WITH_SECURE_STREAMS_PROXY_API)
37d4afb5ceSopenharmony_ci
38d4afb5ceSopenharmony_ci	if (HAS_LWS_WITH_SECURE_STREAMS_PROXY_API OR LWS_WITH_SECURE_STREAMS_PROXY_API)
39d4afb5ceSopenharmony_ci		add_compile_options(-DLWS_SS_USE_SSPC)
40d4afb5ceSopenharmony_ci
41d4afb5ceSopenharmony_ci		add_executable(${SAMP}-client main.cxx)
42d4afb5ceSopenharmony_ci		if (websockets_shared)
43d4afb5ceSopenharmony_ci			target_link_libraries(${SAMP}-client websockets_shared ${LIBWEBSOCKETS_DEP_LIBS})
44d4afb5ceSopenharmony_ci			add_dependencies(${SAMP}-client websockets_shared)
45d4afb5ceSopenharmony_ci		else()
46d4afb5ceSopenharmony_ci			target_link_libraries(${SAMP}-client websockets ${LIBWEBSOCKETS_DEP_LIBS})
47d4afb5ceSopenharmony_ci		endif()
48d4afb5ceSopenharmony_ci	endif()
49d4afb5ceSopenharmony_ci
50d4afb5ceSopenharmony_ciendif()
51