CMakeLists.txt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. cmake_minimum_required (VERSION 2.9)
  4. project (iwasm)
  5. set (WAMR_BUILD_PLATFORM "vxworks")
  6. # Specify the compiler driver provided in the VSB
  7. SET(CMAKE_C_COMPILER vx-cc)
  8. SET(CMAKE_AR vx-ar)
  9. SET(CMAKE_RANLIB vx-ranlib)
  10. # Reset default linker flags
  11. set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  12. set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
  13. # Set WAMR_BUILD_TARGET, currently values supported:
  14. # "X86_64", "AMD_64", "X86_32", "ARM[sub]", "THUMB[sub]", "MIPS", "XTENSA"
  15. #set (WAMR_BUILD_TARGET "X86_64")
  16. if (NOT DEFINED WAMR_BUILD_TARGET)
  17. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  18. # Build as X86_64 by default in 64-bit platform
  19. set (WAMR_BUILD_TARGET "X86_64")
  20. elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
  21. # Build as X86_32 by default in 32-bit platform
  22. set (WAMR_BUILD_TARGET "X86_32")
  23. else ()
  24. message(SEND_ERROR "Unsupported build target platform!")
  25. endif ()
  26. endif ()
  27. if (NOT CMAKE_BUILD_TYPE)
  28. set(CMAKE_BUILD_TYPE Release)
  29. endif ()
  30. if (NOT DEFINED WAMR_BUILD_INTERP)
  31. # Enable Interpreter by default
  32. set (WAMR_BUILD_INTERP 1)
  33. endif ()
  34. if (NOT DEFINED WAMR_BUILD_AOT)
  35. # Disable AOT by default.
  36. set (WAMR_BUILD_AOT 0)
  37. endif ()
  38. if (NOT DEFINED WAMR_BUILD_JIT)
  39. # Disable JIT by default.
  40. set (WAMR_BUILD_JIT 0)
  41. endif ()
  42. if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN)
  43. # Enable libc builtin support by default
  44. set (WAMR_BUILD_LIBC_BUILTIN 1)
  45. endif ()
  46. if (NOT DEFINED WAMR_BUILD_LIBC_WASI)
  47. # Disable libc wasi support by default
  48. set (WAMR_BUILD_LIBC_WASI 0)
  49. endif ()
  50. if (NOT DEFINED WAMR_BUILD_DEBUG_INTERP)
  51. # Disable Debug feature by default
  52. set (WAMR_BUILD_DEBUG_INTERP 0)
  53. endif ()
  54. if (WAMR_BUILD_DEBUG_INTERP EQUAL 1)
  55. set (WAMR_BUILD_FAST_INTERP 0)
  56. set (WAMR_BUILD_MINI_LOADER 0)
  57. set (WAMR_BUILD_SIMD 0)
  58. endif ()
  59. set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
  60. set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
  61. include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
  62. add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
  63. set_version_info (vmlib)
  64. include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
  65. add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE})
  66. set_version_info (iwasm)
  67. install (TARGETS iwasm DESTINATION bin)
  68. target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} -lm -ldl -lunix)
  69. add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})
  70. set_version_info (libiwasm)
  71. install (TARGETS libiwasm DESTINATION lib)
  72. set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm)
  73. target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} -lm -ldl -lunix)