cmake.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index 1c879949..8f8a73c7 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -109,10 +109,8 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
  6. include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
  7. -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter")
  8. # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
  9. -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused")
  10. if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
  11. if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
  12. @@ -131,31 +129,34 @@ endif ()
  13. include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
  14. # STATIC LIBRARY
  15. +if (NOT BUILD_SHARED_LIBS)
  16. add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE})
  17. set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib)
  18. target_include_directories(iwasm_static INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include)
  19. -target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread)
  20. +target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS})
  21. if (WAMR_BUILD_WASM_CACHE EQUAL 1)
  22. target_link_libraries(iwasm_static INTERFACE boringssl_crypto)
  23. endif ()
  24. install (TARGETS iwasm_static ARCHIVE DESTINATION lib)
  25. -
  26. +else ()
  27. # SHARED LIBRARY
  28. add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE})
  29. set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm)
  30. target_include_directories(iwasm_shared INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include)
  31. -target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread)
  32. +target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS})
  33. if (WAMR_BUILD_WASM_CACHE EQUAL 1)
  34. target_link_libraries(iwasm_shared INTERFACE boringssl_crypto)
  35. endif ()
  36. -
  37. +if (WIN32)
  38. + target_link_libraries (iwasm_shared ntdll)
  39. +endif ()
  40. if (MINGW)
  41. target_link_libraries (iwasm_shared -lWs2_32)
  42. endif ()
  43. install (TARGETS iwasm_shared LIBRARY DESTINATION lib)
  44. -
  45. +endif ()
  46. # HEADERS
  47. install (FILES
  48. ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h