|
1 | 1 | cmake_minimum_required (VERSION 3.20.0) |
2 | 2 |
|
3 | | -# Set the WASI SDK toolchain file |
4 | | -include(${CMAKE_CURRENT_LIST_DIR}/../../ocre.cmake) |
| 3 | +include(${CMAKE_CURRENT_LIST_DIR}/../../../ocre.cmake) |
5 | 4 |
|
6 | | -set(CMAKE_BUILD_TYPE Release) |
| 5 | +project(modbus-server) |
7 | 6 |
|
8 | | -set(APPNAME modbus-server) |
9 | | -project(${APPNAME}) |
| 7 | +add_executable(modbus-server.wasm main.c mongoose.c) |
10 | 8 |
|
11 | | -# Include the WAMR socket library CMake file (adjust path as needed) |
12 | | -include(../../../wasm-micro-runtime/core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake) |
| 9 | +add_subdirectory(../../../ocre-sdk ocre-sdk) |
13 | 10 |
|
14 | | -add_compile_options( |
15 | | -# --target=wasm32-wasm-unknown # Target WebAssembly |
16 | | - -Os -Wno-unknown-attributes |
17 | | -) |
18 | | - |
19 | | -# Set compilation flags |
20 | | -add_link_options( |
21 | | - -Wl,--strip-all # Strip all symbol/debug information from the binary |
22 | | - -Wl,--allow-undefined # Let the ocre api functions be undefined |
23 | | - -z stack-size=16384 |
24 | | - -Wl,--initial-memory=65536 # Minimum size of linear memory\ |
25 | | - -Wl,--max-memory=65536 # Maximum size of linear memory |
26 | | -) |
27 | | - |
28 | | -# Add the ocre-sdk as a subdirectory and build it |
29 | | -add_subdirectory(../../../ocre-sdk ocre-sdk-build) |
30 | | - |
31 | | -add_executable(${APPNAME}.wasm main.c mongoose.c) |
32 | | - |
33 | | -# Include + link the Ocre API and WAMR socket library |
34 | | -target_include_directories(${APPNAME}.wasm PRIVATE |
35 | | - ../../../wasm-micro-runtime/core/iwasm/libraries/lib-socket |
| 11 | +target_link_libraries(modbus-server.wasm |
| 12 | + PUBLIC |
36 | 13 | ocre_api |
| 14 | + socket_wasi_ext |
37 | 15 | ) |
38 | | -target_link_libraries(${APPNAME}.wasm socket_wasi_ext ocre_api) |
0 commit comments