Commit Graph

22 Commits

Author SHA1 Message Date
Benbuck Nason
777121217e
CMakeLists.txt: Fix Android pthread linkage (#3591)
https://developer.android.com/ndk/guides/stable_apis#core_cc

> Note that on Android, unlike Linux, there are no separate libpthread or librt libraries.
That functionality is included directly in libc, which does not need to be explicitly linked against.

Set `THREADS_PREFER_PTHREAD_FLAG` ON and find package `Threads`, then link
`${CMAKE_THREAD_LIBS_INIT}` instead of `-lpthread`.

ps.
https://cmake.org/cmake/help/latest/module/FindThreads.html
2024-07-04 10:07:57 +08:00
Benbuck Nason
0ceffe74a7
Add cmake static/shared library build settings (#3443)
Allow builds to target either static library only, shared library only, or both (default).
2024-05-18 21:15:11 +08:00
dongheng
dacb3c4105
Add wamr to esp-idf components registry (#3287)
This PR is for the main branch, but only the released branch will be pushed
into Espressif component registry.

See also similar fixes in branch release/1.3.x:
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3264
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3288
2024-04-08 12:34:08 +08:00
lucianoiam
df57e70437
Fix compilation errors on MinGW (#3217)
Before PR compilation failed because of two errors:

1 - Usage of CMake target_link_libraries()

Make Error at CMakeLists.txt:154 (target_link_libraries):
  The keyword signature for target_link_libraries has already been used with
  the target "iwasm_shared".  All uses of target_link_libraries with a target
  must be either all-keyword or all-plain.

  The uses of the keyword signature are here:

   * CMakeLists.txt:148 (target_link_libraries)

See https://stackoverflow.com/questions/47737558/uses-of-target-link-libraries-must-be-either-all-keyword-or-all-plain

Fixed by adding keyword INTERFACE

2 - Undefined symbols during linkage, fixed by adding -lwsock32.
2024-03-12 17:38:07 +08:00
YAMAMOTO Takashi
9a5c777aff
Revert "Strip static and shared libraries of iwasm to reduce the binary size (#2431)" (#2669)
This reverts commit 7e3a29d5e4564406c91ada436b1e33d53d1232cf:
* it doesn't work for macOS. ("unrecognized option: --strip-all")
* it doesn't work for ubuntu.
  https://github.com/bytecodealliance/wasm-micro-runtime/issues/2665
2023-10-25 20:46:49 +08:00
Cengizhan Pasaoglu
7e3a29d5e4
Strip static and shared libraries of iwasm to reduce the binary size (#2431)
Reduce iwasm static and shared library size when CMAKE_STRIP is set and the
build type is "Release". It remains as it is when build type was selected Debug.
2023-08-09 09:34:21 +08:00
Wenyong Huang
1be202fad8
Fix several issues found (#1996)
- CMakeLists.txt: add lib_export.h to install list
- Fast JIT: enlarge spill cache size to enable several standalone cases
                when hw bound check is disabled
- Thread manager: wasm_cluster_exit_thread may destroy an invalid
               exec_env->module_inst when exec_env was destroyed before
- samples/socket-api: fix failure to run timeout_client.wasm
- enhance CI build wasi-libc and sample/wasm-c-api-imports CMakeLlist.txt
2023-03-03 15:00:54 +08:00
Wenyong Huang
9b9ae0cfac
Update cmake files and wamr-test-suites to support collect code coverage (#1992)
Support collecting code coverage with wamr-test-suites script by using
lcov and genhtml tools, eg.:
  cd tests/wamr-test-suites
  ./test_wamr.sh -s spec -b -P -C

The default code coverage and html files are generated at:
  tests/wamr-test-suites/workspace/wamr.lcov
  tests/wamr-test-suites/workspace/wamr-lcov.zip

And update wamr-test-suites scripts to support testing GC spec cases to
avoid frequent synchronization conflicts between branch main and dev/gc.
2023-02-28 17:38:18 +08:00
liang.he
91eafa1ead
Make a workaround for EGO when fstat returns NOT_SUPPORT (#1970)
The problem was found by a `Golang + WAMR (as CGO)` wrapped by EGO
in SGX Enclave.

`fstat()` in EGO returns dummy values:
- EGO uses a `mount` configuration to define the mount points that apply
  the host file system presented to the Encalve.
- EGO has a different programming model: the entire application runs inside
  the enclave. Manual ECALLs/OCALLs by application code are neither
  required nor possible.

Add platform ego and add macro control for the return value checking of
`fd_determine_type_rights` in libc-wasi to resolve the issue.
2023-02-21 11:11:27 +08:00
liang.he
b826a84cd6 Use boringssl instead of openssl to implement wasm cache loading (#1804) 2022-12-20 14:37:07 +08:00
Marcin Kolny
684ae6554d
Create a placeholder for WASI threads implementation (#1783)
This a simpler version of the PR: https://github.com/bytecodealliance/wasm-micro-runtime/pull/1638
2022-12-06 21:11:27 +08:00
liang.he
f6d67c1cda
Enable wasm cache loading in wasm-c-api (#1759)
Use sha256 to hash binary file content. If the incoming wasm binary is
cached before, wasm_module_new() simply returns the existed one.

Use -DWAMR_BUILD_WASM_CACHE=0/1 to control the feature.
OpenSSL 1.1.1 is required if the feature is enabled.
2022-12-05 12:25:26 +08:00
YAMAMOTO Takashi
15d645476a
Update the top level CMakeLists.txt a bit (#1642)
Disable -Wunused-parameter in the top level CMakeLists.txt as this repo
has tons of it. Note: We have this particular warning disabled in
build-scripts/runtime_lib.cmake too.

Bump minimum cmake version for the top level CMakeLists.txt to fix the
following warning on macOS.

```
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
  --help-policy CMP0042" for policy details. Use the cmake_policy command to
  set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets: iwasm_shared
This warning is for project developers.  Use -Wno-dev to suppress it.
```
2022-10-27 11:27:34 +08:00
YAMAMOTO Takashi
654ac5feca
Use cmake POSITION_INDEPENDENT_CODE instead of hardcoding -pie -fPIE (#1598)
This fixes unused option warnings on -pie for macOS.
(On macOS cmake produces "-fPIE -Xlinker -pie")

Bump required cmake version to 3.14 for CheckPIESupported.

References:
https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html
https://cmake.org/cmake/help/latest/module/CheckPIESupported.html#module:CheckPIESupported
2022-10-19 01:51:18 +08:00
Wenyong Huang
9cf7b88bad
Enhance cmake makefiles (#1390)
Upgrade `cmake_minimum_required` from `(VERSION 2.8)` to `(VERSION 2.9)` to
yield the warning:
"Compatibility with CMake < 2.8.12 will be removed from a future version of CMake"

Add "-Wno-unused" for CMAKE_CXX_FLAGS to yield the compilation warnings
when build LLVM JIT.

Fix the link error when code coverage is enabled.
2022-08-18 16:27:01 +08:00
Cengizhan Pasaoglu
2746d29751
Make robust on choosing target assumption for X86_32 support (#1241)
When WAMR_BUILD_TARGET isn't set, choosing right target is decided
by checking `CMAKE_SIZEOF_VOID_P` variable. However, choosing `X86_32`
target is not doing specifically checking size of void pointer. It is kind
a fallback target for others.

This patch explicitly checks the size of void pointer before setting the target
to `X86_32` to fix the issue.
2022-06-27 20:30:31 +08:00
lucianoiam
4bdeb909df
Enable Windows MinGW support (#1000)
Allow compilation on Windows MinGW, see build_wamr.md for more details.

Note that WASI and some other smallish details are still not supported, but
we have a starting point. See more discussion at #993
2022-02-06 13:20:38 +08:00
Timon Wong
6bcf048523
Fix aarch64 build support (#946)
CMAKE_SYSTEM_PROCESSOR by default uses `uname -m` which returns aarch64
for some arm64 hardware.
2022-01-11 14:08:21 +08:00
Piotr Sikora
6b733b8c5b
Automatically detect the host platform in CMakeLists.txt (#929)
Previously, "linux" was hardcoded in the root CMakeLists.txt, so it was
impossible to build on anything but Linux, even when specifying
WAMR_BUILD_PLATFORM.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2022-01-04 10:50:32 +08:00
Wenyong Huang
a14a4487bb
Re-org thread env init/destroy for HW bound check (#631)
And fix cmake_minimum_required() deprecation warning since envoy is using cmake 3.16 or higher version.
2021-05-14 11:13:12 +08:00
Wenyong Huang
17a2167485
Fix wasm-c-api JIT issue and update makefile (#630) 2021-05-13 15:13:52 +08:00
Wenyong Huang
eb29385963
Implement more wasm-c-apis and enable Envoy integration (#622)
Implement more wasm-c-api APIs to support Envoy integration:
- sync up with latest c-api definition
- change CMakeLists to export necessary headers and install the static library of iwasm
- enable to export tables and memories
- support memorytype and tabletype APIs
- update wasm-c-api sampels
- enable to export importtype APIs

And refine bazel scripts for sample XNNPACK workload, add license headers for sample simple.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-04-27 17:05:40 +08:00