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)
6
6
project (wamr-wasi-extensions LANGUAGES C )
7
7
8
8
add_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 3
3
# Copyright (C) 2025 Midokura Japan KK. All rights reserved.
4
4
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5
5
6
+ set -e
7
+
6
8
PREFIX=/tmp/wamr
7
9
WASI_SDK=${WASI_SDK:-/ opt/ wasi-sdk}
8
10
@@ -17,3 +19,15 @@ cmake -B build-app-nn \
17
19
-DCMAKE_PREFIX_PATH=${PREFIX} \
18
20
samples/nn
19
21
cmake --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