|
11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | | -cmake_minimum_required(VERSION 3.8) |
15 | 14 |
|
16 | | -include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) |
| 15 | +cmake_minimum_required(VERSION 3.20.0) |
| 16 | + |
| 17 | +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) |
17 | 18 | project(NONE) |
18 | 19 |
|
19 | | -target_sources(app PRIVATE src/main-zephyr.c src/jerry-port.c src/getline-zephyr.c) |
| 20 | +set(JERRY_BASE ${CMAKE_SOURCE_DIR}/../..) |
| 21 | + |
| 22 | +# Build JerryScript |
| 23 | +execute_process(COMMAND ${JERRY_BASE}/tools/build.py |
| 24 | + --clean |
| 25 | + --lto=OFF |
| 26 | + --jerry-cmdline=OFF |
| 27 | + --jerry-math=ON |
| 28 | + --amalgam=ON |
| 29 | + --mem-heap=70 |
| 30 | + --profile=es.next |
| 31 | + --compile-flag=--sysroot=${ZEPHYR_BASE} |
| 32 | + --toolchain=${JERRY_BASE}/cmake/toolchain_mcu_stm32f4.cmake) |
20 | 33 |
|
| 34 | +# Define library targets |
21 | 35 | add_library(jerry-core STATIC IMPORTED) |
22 | 36 | add_library(jerry-ext STATIC IMPORTED) |
23 | | -set_target_properties(jerry-core PROPERTIES IMPORTED_LOCATION |
24 | | - ${CMAKE_CURRENT_BINARY_DIR}/../obj/lib/libjerry-core.a) |
25 | | -set_target_properties(jerry-core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES |
26 | | - ${CMAKE_CURRENT_SOURCE_DIR}/../../jerry-core/include) |
27 | | -set_target_properties(jerry-ext PROPERTIES IMPORTED_LOCATION |
28 | | - ${CMAKE_CURRENT_BINARY_DIR}/../obj/lib/libjerry-ext.a) |
29 | | -set_target_properties(jerry-ext PROPERTIES INTERFACE_INCLUDE_DIRECTORIES |
30 | | - ${CMAKE_CURRENT_SOURCE_DIR}/../../jerry-ext/include) |
31 | | -target_link_libraries(app PUBLIC jerry-core jerry-ext) |
32 | 37 |
|
33 | | -zephyr_get_include_directories_for_lang_as_string(C includes) |
34 | | -zephyr_get_system_include_directories_for_lang_as_string(C system_includes) |
35 | | -zephyr_get_compile_definitions_for_lang_as_string(C definitions) |
36 | | -zephyr_get_compile_options_for_lang_as_string(C options) |
37 | | - |
38 | | -add_custom_target( |
39 | | - outputexports |
40 | | - COMMAND echo CC="${CMAKE_C_COMPILER}" |
41 | | - COMMAND echo Z_CFLAGS=${system_includes} ${includes} ${definitions} ${options} |
42 | | - COMMAND echo NOSTDINC_FLAGS=${system_includes} |
43 | | - COMMAND echo ZEPHYRINCLUDE=${includes} |
44 | | - COMMAND echo KBUILD_CFLAGS=${definitions} ${options} |
45 | | - VERBATIM |
46 | | - USES_TERMINAL |
47 | | -) |
| 38 | +# Define include directories and archives |
| 39 | +set_target_properties(jerry-core PROPERTIES IMPORTED_LOCATION ${JERRY_BASE}/build/lib/libjerry-core.a) |
| 40 | +set_target_properties(jerry-core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${JERRY_BASE}/jerry-core/include) |
| 41 | +set_target_properties(jerry-ext PROPERTIES IMPORTED_LOCATION ${JERRY_BASE}/build/lib/libjerry-ext.a) |
| 42 | +set_target_properties(jerry-ext PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${JERRY_BASE}/jerry-ext/include) |
48 | 43 |
|
| 44 | +target_sources(app PRIVATE src/main-zephyr.c src/getline-zephyr.c src/jerry-port.c src/jerry-module.c) |
| 45 | +target_link_libraries(app PUBLIC jerry-core jerry-ext) |
0 commit comments