CMakeLists.txt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. cmake_minimum_required(VERSION 3.14)
  4. project(wasm-apps)
  5. set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../wamr)
  6. if (APPLE)
  7. set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
  8. set (CMAKE_C_LINK_FLAGS "")
  9. set (CMAKE_CXX_LINK_FLAGS "")
  10. endif ()
  11. # have to be debug for peterson lock algorithm
  12. set(CMAKE_BUILD_TYPE Debug)
  13. set(CMAKE_SYSTEM_PROCESSOR wasm32)
  14. set (CMAKE_SYSROOT ${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot)
  15. if (NOT DEFINED WASI_SDK_DIR)
  16. set (WASI_SDK_DIR "/opt/wasi-sdk")
  17. endif ()
  18. set (CMAKE_C_FLAGS "-nostdlib -pthread -Qunused-arguments")
  19. set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -z stack-size=32768")
  20. set (CMAKE_C_COMPILER_TARGET "wasm32")
  21. set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
  22. set (DEFINED_SYMBOLS
  23. "${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot/share/defined-symbols.txt")
  24. set (CMAKE_EXE_LINKER_FLAGS
  25. "-Wl,--shared-memory,--max-memory=131072, \
  26. -Wl,--no-entry,--strip-all, \
  27. -Wl,--export=__heap_base,--export=__data_end \
  28. -Wl,--export=__wasm_call_ctors \
  29. -Wl,--export=main -Wl,--export=__main_argc_argv \
  30. -Wl,--allow-undefined"
  31. #-Wl,--allow-undefined-file=${DEFINED_SYMBOLS}"
  32. )
  33. add_executable(atomic_add_sub.wasm atomic_add_sub.c)
  34. target_link_libraries(atomic_add_sub.wasm)
  35. # use peterson lock to test the atomicity of opcode: fence store xchg
  36. add_executable(peterson_native.wasm peterson_native.c)
  37. target_link_libraries(peterson_native.wasm)
  38. add_executable(atomic_fence.wasm atomic_fence.c)
  39. target_link_libraries(atomic_fence.wasm)
  40. add_executable(atomic_store.wasm atomic_store.c)
  41. target_link_libraries(atomic_store.wasm)
  42. add_executable(atomic_xchg.wasm atomic_xchg.c)
  43. target_link_libraries(atomic_xchg.wasm)
  44. add_executable(atomic_logical.wasm atomic_logical.c)
  45. target_link_libraries(atomic_logical.wasm)
  46. add_executable(atomic_wait_notify.wasm atomic_wait_notify.c)
  47. target_link_libraries(atomic_wait_notify.wasm)