File tree Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ cmake_minimum_required (VERSION 3.14)
66project (wamr-wasi-extensions LANGUAGES C)
77
88add_subdirectory (nn)
9+ add_subdirectory (socket)
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.14)
2+
3+ set (CMAKE_C_STANDARD 99)
4+ set (CMAKE_C_STANDARD_REQUIRED YES )
5+ set (CMAKE_C_EXTENSIONS NO )
6+
7+ project (socket-nslookup LANGUAGES C)
8+ add_executable (socket-nslookup ${CMAKE_CURRENT_SOURCE_DIR} /../../../core/iwasm/libraries/lib-socket/test /nslookup.c)
9+ find_package (wamr-wasi-socket REQUIRED)
10+ target_link_libraries (socket-nslookup wamr-wasi-socket)
11+ target_link_options (socket-nslookup PRIVATE -Wl,--max-memory=262144)
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.14)
2+
3+ set (CMAKE_C_STANDARD 99)
4+ set (CMAKE_C_STANDARD_REQUIRED YES )
5+
6+ project (socket-tcp-udp LANGUAGES C)
7+ add_executable (socket-tcp-udp ${CMAKE_CURRENT_SOURCE_DIR} /../../../core/iwasm/libraries/lib-socket/test /tcp_udp.c)
8+ find_package (wamr-wasi-socket REQUIRED)
9+ target_link_libraries (socket-tcp-udp wamr-wasi-socket)
10+ target_link_options (socket-tcp-udp PRIVATE -Wl,--max-memory=262144)
Original file line number Diff line number Diff line change 1+ set (wasi_socket_dir ${CMAKE_CURRENT_SOURCE_DIR} /../../core/iwasm/libraries/lib-socket)
2+ set (wasi_socket_header_dir ${wasi_socket_dir} /inc)
3+
4+ set (srcs ${wasi_socket_dir} /src/wasi/wasi_socket_ext.c)
5+ set (headers
6+ ${wasi_socket_header_dir} /wasi_socket_ext.h
7+ )
8+
9+ add_library (wamr-wasi-socket STATIC ${srcs} )
10+ set_property (TARGET wamr-wasi-socket PROPERTY PUBLIC_HEADER ${headers} )
11+ target_include_directories (wamr-wasi-socket
12+ PUBLIC
13+ $<BUILD_INTERFACE:${wasi_socket_header_dir} >
14+ $<INSTALL_INTERFACE:include >)
15+
16+ install (TARGETS wamr-wasi-socket
17+ EXPORT wamr-wasi-socket-config
18+ PUBLIC_HEADER DESTINATION include )
19+ install (EXPORT wamr-wasi-socket-config
20+ DESTINATION lib/cmake/wamr-wasi-socket)
Original file line number Diff line number Diff line change 33# Copyright (C) 2025 Midokura Japan KK. All rights reserved.
44# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55
6+ set -e
7+
68PREFIX=/tmp/wamr
79WASI_SDK=${WASI_SDK:-/ opt/ wasi-sdk}
810
@@ -17,3 +19,15 @@ cmake -B build-app-nn \
1719-DCMAKE_PREFIX_PATH=${PREFIX} \
1820samples/nn
1921cmake --build build-app-nn
22+
23+ cmake -B build-app-socket-nslookup \
24+ -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK} /share/cmake/wasi-sdk-pthread.cmake \
25+ -DCMAKE_PREFIX_PATH=${PREFIX} \
26+ samples/socket-nslookup
27+ cmake --build build-app-socket-nslookup
28+
29+ cmake -B build-app-socket-tcp-udp \
30+ -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK} /share/cmake/wasi-sdk-pthread.cmake \
31+ -DCMAKE_PREFIX_PATH=${PREFIX} \
32+ samples/socket-tcp-udp
33+ cmake --build build-app-socket-tcp-udp
You can’t perform that action at this time.
0 commit comments