1- # Copyright (C) 2019 Intel Corporation. All rights reserved.
1+ # Copyright (C) 2019-21 Intel Corporation and others . All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
44# from ESP-IDF 4.0 examples/build_system/cmake/idf_as_lib
55cmake_minimum_required (VERSION 3.5)
6- project (wamr_on_esp32c3)
76
8- enable_language (ASM )
7+ include ( $ENV{IDF_PATH} /tools/cmake/project.cmake )
98
10- if (NOT CMAKE_BUILD_TYPE )
11- set (CMAKE_BUILD_TYPE Release)
12- endif ()
9+ set (COMPONENTS ${IDF_TARGET} main freertos esptool_py wamr)
10+ list (APPEND EXTRA_COMPONENT_DIRS "$ENV{WAMR_PATH} /build-scripts/esp-idf" )
1311
14- if ("${IDF_TARGET} " STREQUAL "" )
15- message (FATAL_ERROR "You need to set IDF_TARGET to your target string" )
16- endif ()
17-
18- # Include for ESP-IDF build system functions
19- include ($ENV{IDF_PATH} /tools/cmake/idf.cmake)
20- # Create idf::esp32c3 and idf::freertos static libraries
21- idf_build_process(${IDF_TARGET}
22- # try and trim the build; additional components
23- # will be included as needed based on dependency tree
24- #
25- # although esptool_py does not generate static library,
26- # processing the component is needed for flashing related
27- # targets and file generation
28- COMPONENTS ${IDF_TARGET} freertos esptool_py
29- SDKCONFIG ${CMAKE_BINARY_DIR} /sdkconfig
30- BUILD_DIR ${CMAKE_BINARY_DIR} )
31-
32- # Set WAMR's build options
33- if ("${IDF_TARGET} " STREQUAL "esp32c3" )
34- set (WAMR_BUILD_TARGET "RISCV32" )
35- else ()
36- set (WAMR_BUILD_TARGET "XTENSA" )
37- add_compile_options (-DWAMR_BUILD_TARGET_XTENSA=1)
38- endif ()
39-
40- set (WAMR_BUILD_PLATFORM "esp-idf" )
41-
42- if (NOT DEFINED WAMR_BUILD_INTERP)
43- set (WAMR_BUILD_INTERP 0)
44- endif ()
45-
46- if (NOT DEFINED WAMR_BUILD_FAST_INTERP)
47- set (WAMR_BUILD_FAST_INTERP 0)
48- endif ()
49-
50- if (NOT DEFINED WAMR_BUILD_AOT)
51- set (WAMR_BUILD_AOT 1)
52- endif ()
53-
54- if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN)
55- set (WAMR_BUILD_LIBC_BUILTIN 1)
56- endif ()
57-
58- if (NOT DEFINED WAMR_BUILD_APP_FRAMEWORK)
59- set (WAMR_BUILD_APP_FRAMEWORK 0)
60- endif ()
61-
62-
63- # Set the compile time variable so that the right binary is selected
64- add_compile_options (-DWAMR_BUILD_INTERP=${WAMR_BUILD_INTERP} )
65-
66- set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} /../../..)
67- include (${WAMR_ROOT_DIR} /build -scripts/runtime_lib.cmake)
68-
69- # define WAMR as library and provide it the esp-idf srcs
70- add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE} )
71- target_link_libraries (vmlib PUBLIC idf::pthread idf::${IDF_TARGET} idf::freertos)
72-
73- # Define the final executable
74- set (elf_file ${CMAKE_PROJECT_NAME} .elf)
75- add_executable (${elf_file} main.c test_wasm.h)
76- target_link_libraries (${elf_file} idf::${IDF_TARGET} idf::freertos idf::spi_flash vmlib)
77- idf_build_executable(${elf_file} )
12+ project (wamr-simple)
0 commit comments