Skip to content

Commit

Permalink
Feature/cmake eyrie (#299)
Browse files Browse the repository at this point in the history
This PR slightly changes the add_eyrie_runtime macro in order to
accommodate the new Cmake-based runtime build
(keystone-enclave/keystone-runtime#64)
  • Loading branch information
grg-haas committed Dec 5, 2022
1 parent 0b40beb commit 05ebf3e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sdk/examples/attestation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ target_include_directories(${host_bin}

set(eyrie_files_to_copy .options_log eyrie-rt)
add_eyrie_runtime(${eapp_bin}-eyrie
"v1.1.0"
"v1.2.1"
${eyrie_plugins}
${eyrie_files_to_copy})

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/hello-native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ target_include_directories(${host_bin}

set(eyrie_files_to_copy .options_log eyrie-rt)
add_eyrie_runtime(${eapp_bin}-eyrie
"v1.1.0"
"v1.2.1"
${eyrie_plugins}
${eyrie_files_to_copy})

Expand Down
6 changes: 3 additions & 3 deletions sdk/examples/hello/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ set(package_name "hello.ke")
set(package_script "./hello-runner hello eyrie-rt")

if(RISCV32)
set(eyrie_plugins "freemem untrusted_io_syscall linux_syscall env_setup rv32")
set(eyrie_plugins "freemem io_syscall linux_syscall env_setup rv32")
else()
set(eyrie_plugins "freemem untrusted_io_syscall linux_syscall env_setup")
set(eyrie_plugins "freemem io_syscall linux_syscall env_setup")
endif()

# eapp
Expand All @@ -25,7 +25,7 @@ target_link_libraries(${host_bin} ${KEYSTONE_LIB_HOST} ${KEYSTONE_LIB_EDGE})

set(eyrie_files_to_copy .options_log eyrie-rt)
add_eyrie_runtime(${eapp_bin}-eyrie
"v1.1.0"
"v1.2.1"
${eyrie_plugins}
${eyrie_files_to_copy})

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ target_link_libraries(${host_bin} ${KEYSTONE_LIB_HOST} ${KEYSTONE_LIB_EDGE} ${KE

set(eyrie_files_to_copy .options_log eyrie-rt)
add_eyrie_runtime(test-eyrie
"v1.1.0"
"v1.2.1"
${eyrie_plugins}
${eyrie_files_to_copy})

Expand Down
14 changes: 12 additions & 2 deletions sdk/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,24 @@ macro(add_eyrie_runtime target_name tag plugins) # the files are passed via ${AR
set(runtime_prefix runtime)
set (eyrie_src ${CMAKE_CURRENT_BINARY_DIR}/${runtime_prefix}/src/eyrie-${target_name})

separate_arguments(PLUGIN_ARGS UNIX_COMMAND ${plugins})
set(PLUGIN_FLAGS "")
foreach(plugin IN ITEMS ${PLUGIN_ARGS})
string(TOUPPER ${plugin} PLUGIN_UPPER)
list(APPEND PLUGIN_FLAGS "-D${PLUGIN_UPPER}=ON")
endforeach()

list(APPEND PLUGIN_FLAGS "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
list(APPEND PLUGIN_FLAGS "-DCMAKE_OBJCOPY=${CMAKE_OBJCOPY}")

ExternalProject_Add(eyrie-${target_name}
PREFIX ${runtime_prefix}
GIT_REPOSITORY https://github.com/keystone-enclave/keystone-runtime
GIT_TAG ${tag}
CONFIGURE_COMMAND ""
UPDATE_COMMAND git fetch
BUILD_COMMAND ./build.sh ${plugins}
CMAKE_ARGS "${PLUGIN_FLAGS}"
BUILD_IN_SOURCE TRUE
BUILD_BYPRODUCTS ${eyrie_src}/eyrie-rt ${eyrie_src}/.options_log
INSTALL_COMMAND "")

add_custom_target(${target_name} DEPENDS ${ARGN})
Expand Down

0 comments on commit 05ebf3e

Please sign in to comment.