mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 21:27:30 +00:00 
			
		
		
		
	 d085d1ccf7
			
		
	
	
		d085d1ccf7
		
			
		
	
	
	
	
		
			
			``` 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. ```
		
			
				
	
	
		
			107 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
			
		
		
	
	
			107 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
| # 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)
 | |
| 
 | |
| include_directories (${IWASM_AOT_DIR})
 | |
| 
 | |
| list (APPEND c_source_all
 | |
|   ${IWASM_AOT_DIR}/aot_intrinsic.c
 | |
|   ${IWASM_AOT_DIR}/aot_loader.c
 | |
|   ${IWASM_AOT_DIR}/aot_runtime.c
 | |
| )
 | |
| 
 | |
| if (WAMR_BUILD_LINUX_PERF EQUAL 1)
 | |
|   list (APPEND c_source_all ${IWASM_AOT_DIR}/aot_perf_map.c)
 | |
| endif ()
 | |
| 
 | |
| if (WAMR_BUILD_AOT_VALIDATOR EQUAL 1)
 | |
|   list (APPEND c_source_all ${IWASM_AOT_DIR}/aot_validator.c)
 | |
| endif ()
 | |
| 
 | |
| if (WAMR_BUILD_WAMR_COMPILER EQUAL 1)
 | |
|   # AOT reloc functions are not used during AOT compilation
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_dummy.c)
 | |
| elseif (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_x86_64.c)
 | |
| elseif (WAMR_BUILD_TARGET STREQUAL "X86_32")
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_x86_32.c)
 | |
| elseif (WAMR_BUILD_TARGET MATCHES "AARCH64.*")
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_aarch64.c)
 | |
| elseif (WAMR_BUILD_TARGET MATCHES "ARM.*")
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_arm.c)
 | |
| elseif (WAMR_BUILD_TARGET MATCHES "THUMB.*")
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_thumb.c)
 | |
| elseif (WAMR_BUILD_TARGET STREQUAL "MIPS")
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_mips.c)
 | |
| elseif (WAMR_BUILD_TARGET STREQUAL "XTENSA")
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_xtensa.c)
 | |
| elseif (WAMR_BUILD_TARGET MATCHES "RISCV*")
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_riscv.c)
 | |
| elseif (WAMR_BUILD_TARGET STREQUAL "ARC")
 | |
|   set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_arc.c)
 | |
| else ()
 | |
|   message (FATAL_ERROR "Build target isn't set")
 | |
| endif ()
 | |
| 
 | |
| if (WAMR_BUILD_DEBUG_AOT EQUAL 1)
 | |
|   add_definitions(-DWASM_ENABLE_DEBUG_AOT=1)
 | |
|   file(GLOB debug_source ${IWASM_AOT_DIR}/debug/*.c)
 | |
| endif()
 | |
| 
 | |
| if ((WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
 | |
|     AND (WAMR_BUILD_PLATFORM STREQUAL "windows")
 | |
|     AND (NOT WAMR_DISABLE_HW_BOUND_CHECK EQUAL 1))
 | |
|   include(FetchContent)
 | |
| 
 | |
|   FetchContent_Declare(
 | |
|     zycore
 | |
|     GIT_REPOSITORY https://github.com/zyantific/zycore-c.git
 | |
|   )
 | |
|   FetchContent_GetProperties(zycore)
 | |
|   if (NOT zycore_POPULATED)
 | |
|     message ("-- Fetching zycore ..")
 | |
|     FetchContent_Populate(zycore)
 | |
|     include_directories("${zycore_SOURCE_DIR}/include")
 | |
|     include_directories("${zycore_BINARY_DIR}")
 | |
|     add_definitions(-DZYCORE_STATIC_BUILD=1)
 | |
|     add_subdirectory(${zycore_SOURCE_DIR} ${zycore_BINARY_DIR} EXCLUDE_FROM_ALL)
 | |
|     file (GLOB_RECURSE c_source_zycore ${zycore_SOURCE_DIR}/src/*.c)
 | |
|   endif ()
 | |
| 
 | |
|   FetchContent_Declare(
 | |
|     zydis
 | |
|     GIT_REPOSITORY https://github.com/zyantific/zydis.git
 | |
|     GIT_TAG e14a07895136182a5b53e181eec3b1c6e0b434de
 | |
|   )
 | |
|   FetchContent_GetProperties(zydis)
 | |
|   if (NOT zydis_POPULATED)
 | |
|     message ("-- Fetching zydis ..")
 | |
|     FetchContent_Populate(zydis)
 | |
|     option(ZYDIS_FEATURE_ENCODER "" OFF)
 | |
|     option(ZYDIS_BUILD_TOOLS "" OFF)
 | |
|     option(ZYDIS_BUILD_EXAMPLES "" OFF)
 | |
|     option(ZYDIS_BUILD_MAN "" OFF)
 | |
|     option(ZYDIS_BUILD_DOXYGEN "" OFF)
 | |
|     include_directories("${zydis_BINARY_DIR}")
 | |
|     include_directories("${zydis_SOURCE_DIR}/include")
 | |
|     include_directories("${zydis_SOURCE_DIR}/src")
 | |
|     add_definitions(-DZYDIS_STATIC_BUILD=1)
 | |
|     add_subdirectory(${zydis_SOURCE_DIR} ${zydis_BINARY_DIR} EXCLUDE_FROM_ALL)
 | |
|     file (GLOB_RECURSE c_source_zydis ${zydis_SOURCE_DIR}/src/*.c)
 | |
|   endif ()
 | |
| endif ()
 | |
| 
 | |
| 
 | |
| set (IWASM_AOT_SOURCE ${c_source_all} ${arch_source} ${debug_source}
 | |
| 	              ${c_source_zycore} ${c_source_zydis})
 |