2020-06-15 11:04:04 +00:00
|
|
|
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
|
2024-10-15 08:04:58 +00:00
|
|
|
cmake_minimum_required(VERSION 3.14)
|
2020-06-15 11:04:04 +00:00
|
|
|
project(wasm-apps)
|
|
|
|
|
|
|
|
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
|
|
|
|
|
2020-08-21 07:14:04 +00:00
|
|
|
if (APPLE)
|
|
|
|
set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
|
|
|
|
set (CMAKE_C_LINK_FLAGS "")
|
|
|
|
set (CMAKE_CXX_LINK_FLAGS "")
|
|
|
|
endif ()
|
2020-06-15 11:04:04 +00:00
|
|
|
set(CMAKE_SYSTEM_PROCESSOR wasm32)
|
|
|
|
set (CMAKE_SYSROOT ${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot)
|
|
|
|
|
|
|
|
if (NOT DEFINED WASI_SDK_DIR)
|
|
|
|
set (WASI_SDK_DIR "/opt/wasi-sdk")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set (CMAKE_C_FLAGS "-nostdlib -pthread -Qunused-arguments")
|
|
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -z stack-size=32768")
|
|
|
|
set (CMAKE_C_COMPILER_TARGET "wasm32")
|
|
|
|
set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
|
|
|
|
|
|
|
|
set (DEFINED_SYMBOLS
|
|
|
|
"${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot/share/defined-symbols.txt")
|
|
|
|
|
|
|
|
set (CMAKE_EXE_LINKER_FLAGS
|
2020-12-28 02:46:31 +00:00
|
|
|
"-Wl,--shared-memory,--max-memory=131072, \
|
|
|
|
-Wl,--no-entry,--strip-all, \
|
|
|
|
-Wl,--export=__heap_base,--export=__data_end \
|
|
|
|
-Wl,--export=__wasm_call_ctors \
|
|
|
|
-Wl,--export=main -Wl,--export=__main_argc_argv \
|
|
|
|
-Wl,--allow-undefined"
|
|
|
|
#-Wl,--allow-undefined-file=${DEFINED_SYMBOLS}"
|
2020-06-15 11:04:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(test.wasm main.c)
|
2020-08-21 07:14:04 +00:00
|
|
|
target_link_libraries(test.wasm)
|
2023-01-20 00:54:27 +00:00
|
|
|
|
|
|
|
add_executable(main_thread_exception.wasm main_thread_exception.c)
|
|
|
|
target_link_libraries(main_thread_exception.wasm)
|
2023-02-16 03:54:19 +00:00
|
|
|
|
|
|
|
add_executable(main_global_atomic.wasm main_global_atomic.c)
|
2024-10-15 08:04:58 +00:00
|
|
|
target_link_libraries(main_global_atomic.wasm)
|