CMakeLists.txt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 (aot-analyzer)
  5. set (CMAKE_CXX_STANDARD 17)
  6. ################ runtime settings ################
  7. string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
  8. if (APPLE)
  9. add_definitions(-DBH_PLATFORM_DARWIN)
  10. endif ()
  11. # Reset default linker flags
  12. set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  13. set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
  14. set (WAMR_STRINGREF_IMPL_SOURCE "STUB")
  15. # Set WAMR_BUILD_TARGET, currently values supported:
  16. # "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
  17. # "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
  18. if (NOT DEFINED WAMR_BUILD_TARGET)
  19. if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
  20. set (WAMR_BUILD_TARGET "AARCH64")
  21. elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
  22. set (WAMR_BUILD_TARGET "RISCV64")
  23. elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
  24. # Build as X86_64 by default in 64-bit platform
  25. set (WAMR_BUILD_TARGET "X86_64")
  26. elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
  27. # Build as X86_32 by default in 32-bit platform
  28. set (WAMR_BUILD_TARGET "X86_32")
  29. else ()
  30. message(SEND_ERROR "Unsupported build target platform!")
  31. endif ()
  32. endif ()
  33. if (NOT CMAKE_BUILD_TYPE)
  34. set(CMAKE_BUILD_TYPE Release)
  35. endif ()
  36. if (NOT DEFINED WAMR_BUILD_INTERP)
  37. # Enable Interpreter by default
  38. set (WAMR_BUILD_INTERP 1)
  39. endif ()
  40. if (NOT DEFINED WAMR_BUILD_AOT)
  41. # Enable AOT by default.
  42. set (WAMR_BUILD_AOT 1)
  43. endif ()
  44. if (NOT DEFINED WAMR_BUILD_MEMORY_PROFILING)
  45. # Enable reference types by default
  46. set (WAMR_BUILD_MEMORY_PROFILING 1)
  47. endif ()
  48. if (NOT DEFINED WAMR_BIG_ENDIAN)
  49. set (WAMR_BIG_ENDIAN 0)
  50. endif ()
  51. # build out vmlib
  52. set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
  53. include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
  54. add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
  55. ################ application related ################
  56. include_directories(./include)
  57. include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
  58. include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
  59. add_executable (aot-analyzer src/main.cc src/aot_file.cc src/binary_file.cc src/option_parser.cc src/wasm_file.cc ${UNCOMMON_SHARED_SOURCE})
  60. target_link_libraries (aot-analyzer vmlib -lm -ldl -lpthread)