CMakeLists_minimal.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 "linux-sgx")
  6. # Reset default linker flags
  7. set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  8. set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
  9. # Set WAMR_BUILD_TARGET
  10. if (NOT DEFINED WAMR_BUILD_TARGET)
  11. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  12. # Build as X86_64 by default in 64-bit platform
  13. set (WAMR_BUILD_TARGET "X86_64")
  14. elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
  15. # Build as X86_32 by default in 32-bit platform
  16. set (WAMR_BUILD_TARGET "X86_32")
  17. else ()
  18. message(SEND_ERROR "Unsupported build target platform!")
  19. endif ()
  20. endif ()
  21. if (NOT CMAKE_BUILD_TYPE)
  22. set(CMAKE_BUILD_TYPE Release)
  23. endif ()
  24. if (NOT DEFINED WAMR_BUILD_INTERP)
  25. # Enable Interpreter by default
  26. set (WAMR_BUILD_INTERP 1)
  27. endif ()
  28. if (NOT DEFINED WAMR_BUILD_AOT)
  29. # Enable AOT by default
  30. # Please install Intel SGX SDKv2.8 or later.
  31. set (WAMR_BUILD_AOT 1)
  32. endif ()
  33. if (NOT DEFINED WAMR_BUILD_JIT)
  34. # Disable JIT by default.
  35. set (WAMR_BUILD_JIT 0)
  36. endif ()
  37. if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN)
  38. # Enable libc builtin support by default
  39. set (WAMR_BUILD_LIBC_BUILTIN 1)
  40. endif ()
  41. if (NOT DEFINED WAMR_BUILD_LIBC_WASI)
  42. # Enable libc wasi support by default
  43. set (WAMR_BUILD_LIBC_WASI 0)
  44. endif ()
  45. if (NOT DEFINED WAMR_BUILD_FAST_INTERP)
  46. # Enable fast interpreter
  47. set (WAMR_BUILD_FAST_INTERP 1)
  48. endif ()
  49. if (NOT DEFINED WAMR_BUILD_MULTI_MODULE)
  50. # Enable multiple modules
  51. set (WAMR_BUILD_MULTI_MODULE 0)
  52. endif ()
  53. if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD)
  54. # Enable pthread library by default
  55. set (WAMR_BUILD_LIB_PTHREAD 0)
  56. endif ()
  57. set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
  58. set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -ffunction-sections -fdata-sections \
  59. -Wall -Wno-unused-parameter -Wno-pedantic \
  60. -nostdinc -fvisibility=hidden -fpie" )
  61. set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
  62. include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
  63. add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
  64. set_version_info (vmlib)
  65. add_custom_command (
  66. OUTPUT libvmlib_untrusted.a
  67. COMMAND mkdir -p untrusted && cd untrusted &&
  68. ${CMAKE_C_COMPILER} -c ${PLATFORM_SHARED_SOURCE_UNTRUSTED}
  69. COMMAND ${CMAKE_AR} rc libvmlib_untrusted.a untrusted/*.o)
  70. add_custom_target (vmlib_untrusted ALL DEPENDS libvmlib_untrusted.a)