Просмотр исходного кода

Keep fix the CMake compatibility issue (#4180)

```
CMake Error at CMakeLists.txt:4 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
```
liang.he 9 месяцев назад
Родитель
Сommit
d085d1ccf7
30 измененных файлов с 104 добавлено и 26 удалено
  1. 6 6
      .github/workflows/compilation_on_android_ubuntu.yml
  2. 7 0
      core/iwasm/aot/iwasm_aot.cmake
  3. 7 1
      core/iwasm/fast-jit/iwasm_fast_jit.cmake
  4. 7 0
      core/iwasm/libraries/lib-rats/lib_rats.cmake
  5. 7 0
      core/iwasm/libraries/libc-uvwasi/libc_uvwasi.cmake
  6. 7 0
      core/iwasm/libraries/simde/simde.cmake
  7. 7 0
      core/iwasm/libraries/wasi-nn/cmake/Findcjson.cmake
  8. 7 0
      core/iwasm/libraries/wasi-nn/cmake/Findllamacpp.cmake
  9. 7 0
      core/iwasm/libraries/wasi-nn/cmake/Findtensorflow_lite.cmake
  10. 1 0
      samples/wasi-threads/CMakeLists.txt
  11. 1 1
      tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt
  12. 1 1
      tests/fuzz/wasm-mutator-fuzz/workspace/CMakeLists.txt
  13. 1 1
      tests/standalone/test-module-malloc/wasm-app/CMakeLists.txt
  14. 8 1
      tests/unit/CMakeLists.txt
  15. 1 1
      tests/unit/aot-stack-frame/CMakeLists.txt
  16. 1 1
      tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt
  17. 1 1
      tests/unit/aot/CMakeLists.txt
  18. 1 1
      tests/unit/compilation/CMakeLists.txt
  19. 1 1
      tests/unit/custom-section/CMakeLists.txt
  20. 1 1
      tests/unit/custom-section/wasm-apps/CMakeLists.txt
  21. 1 1
      tests/unit/gc/CMakeLists.txt
  22. 1 1
      tests/unit/interpreter/CMakeLists.txt
  23. 1 1
      tests/unit/libc-builtin/CMakeLists.txt
  24. 1 1
      tests/unit/linear-memory-aot/CMakeLists.txt
  25. 1 1
      tests/unit/linear-memory-wasm/CMakeLists.txt
  26. 1 1
      tests/unit/runtime-common/CMakeLists.txt
  27. 1 1
      tests/unit/shared-utils/CMakeLists.txt
  28. 7 0
      tests/unit/unit_common.cmake
  29. 9 1
      tests/unit/wasm-c-api/CMakeLists.txt
  30. 1 1
      tests/unit/wasm-vm/CMakeLists.txt

+ 6 - 6
.github/workflows/compilation_on_android_ubuntu.yml

@@ -317,7 +317,7 @@ jobs:
         os: [ubuntu-22.04]
         wasi_sdk_release:
           [
-            "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
+            "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz"
           ]
         wabt_release:
           [
@@ -351,7 +351,7 @@ jobs:
           cd /opt
           sudo wget ${{ matrix.wasi_sdk_release }}
           sudo tar -xzf wasi-sdk-*.tar.gz
-          sudo ln -sf wasi-sdk-20.0 wasi-sdk
+          sudo ln -sf wasi-sdk-25.0-x86_64-linux wasi-sdk
 
       - name: download and install wabt
         run: |
@@ -466,7 +466,7 @@ jobs:
         os: [ubuntu-22.04]
         wasi_sdk_release:
           [
-            "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
+            "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz"
           ]
         wabt_release:
           [
@@ -484,7 +484,7 @@ jobs:
           cd /opt
           sudo wget ${{ matrix.wasi_sdk_release }}
           sudo tar -xzf wasi-sdk-*.tar.gz
-          sudo ln -sf wasi-sdk-20.0 wasi-sdk
+          sudo ln -sf wasi-sdk-25.0-x86_64-linux wasi-sdk
 
       - name: download and install wabt
         run: |
@@ -636,7 +636,7 @@ jobs:
           ]
         wasi_sdk_release:
           [
-            "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
+            "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz"
           ]
         include:
           - os: ubuntu-22.04
@@ -710,7 +710,7 @@ jobs:
           cd /opt
           sudo wget ${{ matrix.wasi_sdk_release }}
           sudo tar -xzf wasi-sdk-*.tar.gz
-          sudo mv wasi-sdk-20.0 wasi-sdk
+          sudo ln -sf wasi-sdk-25.0-x86_64-linux wasi-sdk
 
       # It is a temporary solution until new wasi-sdk that includes bug fixes is released
       - name: build wasi-libc from source

+ 7 - 0
core/iwasm/aot/iwasm_aot.cmake

@@ -1,6 +1,13 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
+
 set (IWASM_AOT_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 add_definitions (-DWASM_ENABLE_AOT=1)

+ 7 - 1
core/iwasm/fast-jit/iwasm_fast_jit.cmake

@@ -1,8 +1,14 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-set (IWASM_FAST_JIT_DIR ${CMAKE_CURRENT_LIST_DIR})
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
 
+set (IWASM_FAST_JIT_DIR ${CMAKE_CURRENT_LIST_DIR})
 add_definitions(-DWASM_ENABLE_FAST_JIT=1)
 if (WAMR_BUILD_FAST_JIT_DUMP EQUAL 1)
     add_definitions(-DWASM_ENABLE_FAST_JIT_DUMP=1)

+ 7 - 0
core/iwasm/libraries/lib-rats/lib_rats.cmake

@@ -2,6 +2,13 @@
 # Copyright (c) 2020-2021 Alibaba Cloud
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
+
 set (LIB_RATS_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 if ("$ENV{SGX_SSL_DIR}" STREQUAL "")

+ 7 - 0
core/iwasm/libraries/libc-uvwasi/libc_uvwasi.cmake

@@ -1,6 +1,13 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
+
 set (LIBC_WASI_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 set (LIBUV_VERSION v1.46.0)

+ 7 - 0
core/iwasm/libraries/simde/simde.cmake

@@ -2,6 +2,13 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 # simde is a header only library
 
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
+
 set (LIB_SIMDE_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 add_definitions (-DWASM_ENABLE_SIMDE=1)

+ 7 - 0
core/iwasm/libraries/wasi-nn/cmake/Findcjson.cmake

@@ -1,6 +1,13 @@
 # Copyright (C) 2019 Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
+
 include(FetchContent)
 
 set(CJSON_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/cjson")

+ 7 - 0
core/iwasm/libraries/wasi-nn/cmake/Findllamacpp.cmake

@@ -1,6 +1,13 @@
 # Copyright (C) 2019 Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
+
 include(FetchContent)
 
 set(LLAMA_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/llama.cpp")

+ 7 - 0
core/iwasm/libraries/wasi-nn/cmake/Findtensorflow_lite.cmake

@@ -1,6 +1,13 @@
 # Copyright (C) 2019 Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
+
 include(FetchContent)
 
 set(TFLITE_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/tensorflow-src")

+ 1 - 0
samples/wasi-threads/CMakeLists.txt

@@ -49,6 +49,7 @@ set(WAMR_BUILD_LIBC_BUILTIN 1)
 set(WAMR_BUILD_FAST_INTERP 1)
 set(WAMR_BUILD_LIBC_WASI 1)
 set(WAMR_BUILD_LIB_WASI_THREADS 1)
+set(WAMR_BUILD_REF_TYPES 1)
 
 # compiling and linking flags
 if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))

+ 1 - 1
tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 3.14)
 
 if (NOT DEFINED CMAKE_C_COMPILER)
 set (CMAKE_C_COMPILER "clang")

+ 1 - 1
tests/fuzz/wasm-mutator-fuzz/workspace/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 3.14)
 
 project(wasm_mutator)
 

+ 1 - 1
tests/standalone/test-module-malloc/wasm-app/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.14)
 project(wasm-app)
 
 set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)

+ 8 - 1
tests/unit/CMakeLists.txt

@@ -1,10 +1,17 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project(unit-test)
 
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
+
 SET(CMAKE_BUILD_TYPE Debug)
 
 # add_definitions (-m32)

+ 1 - 1
tests/unit/aot-stack-frame/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-aot-stack-frame)
 

+ 1 - 1
tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project(wasm-apps-aot-stack-frame)
 

+ 1 - 1
tests/unit/aot/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-aot)
 

+ 1 - 1
tests/unit/compilation/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-compilation)
 

+ 1 - 1
tests/unit/custom-section/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-custom-section)
 

+ 1 - 1
tests/unit/custom-section/wasm-apps/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project(wasm-apps-custom-section)
 

+ 1 - 1
tests/unit/gc/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-wamr-gc)
 

+ 1 - 1
tests/unit/interpreter/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-interpreter)
 

+ 1 - 1
tests/unit/libc-builtin/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-libc-builtin)
 

+ 1 - 1
tests/unit/linear-memory-aot/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-linear-memory-aot)
 

+ 1 - 1
tests/unit/linear-memory-wasm/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-linear-memory-wasm)
 

+ 1 - 1
tests/unit/runtime-common/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project(test-runtime-common)
 

+ 1 - 1
tests/unit/shared-utils/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-shared-utils)
 

+ 7 - 0
tests/unit/unit_common.cmake

@@ -1,6 +1,13 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
+
 if (NOT DEFINED WAMR_BUILD_PLATFORM)
   set (WAMR_BUILD_PLATFORM "linux")
 endif ()

+ 9 - 1
tests/unit/wasm-c-api/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required (VERSION 2.9)
+cmake_minimum_required (VERSION 3.14)
 project (wasm_c_api_test)
 
 ################  runtime settings  ################
@@ -34,6 +34,14 @@ add_library(vmlib STATIC ${WAMR_RUNTIME_LIB_SOURCE})
 ################################################
 
 ################  unit test related  ################
+
+# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
+# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
+# from 3rd parties that we should not alter. Therefore, in addition to
+# changing the `cmake_minimum_required()`, we should also add a configuration
+# here that is compatible with earlier versions.
+set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
+
 # Add googletest directly to our build. This defines
 # the gtest and gtest_main targets.
 

+ 1 - 1
tests/unit/wasm-vm/CMakeLists.txt

@@ -1,7 +1,7 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-cmake_minimum_required(VERSION 2.9)
+cmake_minimum_required(VERSION 3.14)
 
 project (test-wasm-vm)