Skip to content

Commit

Permalink
Merge pull request #62 from bytecodealliance/master
Browse files Browse the repository at this point in the history
Fix issues when use linux-sgx as cmake subdirectory (#166)
  • Loading branch information
wenyongh authored Feb 17, 2020
2 parents dcaf670 + 20cf199 commit a1444ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
16 changes: 9 additions & 7 deletions product-mini/platforms/linux-sgx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ set (APP_FRAMEWORK_DIR ${WAMR_ROOT_DIR}/core/app-framework)
# include the build config template file
include (${WAMR_ROOT_DIR}/build-scripts/config_common.cmake)

if ("$ENV{SGX_SDK}" STREQUAL "")
set (SGX_SDK_DIR "/opt/intel/sgxsdk")
else()
set (SGX_SDK_DIR $ENV{SGX_SDK})
endif()

include_directories (${SHARED_DIR}/include
${IWASM_DIR}/include
$ENV{SGX_SDK}/include
$ENV{SGX_SDK}/include/tlibc
$ENV{SGX_SDK}/include/libcxx)
${SGX_SDK_DIR}/include
${SGX_SDK_DIR}/include/tlibc
${SGX_SDK_DIR}/include/libcxx)

enable_language (ASM)

Expand Down Expand Up @@ -107,7 +113,3 @@ add_library (vmlib
${IWASM_COMPL_SOURCE})

add_library (extlib ext_lib_export.c)

set (copy_libs_cmd cp -a libvmlib.a libextlib.a ../enclave-sample/)
add_custom_target (copy_libs_to_enclave ALL COMMAND ${copy_libs_cmd} DEPENDS vmlib extlib)

8 changes: 8 additions & 0 deletions product-mini/platforms/linux-sgx/enclave-sample/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ Enclave/%.o: Enclave/%.cpp
@$(CXX) $(Enclave_Cpp_Flags) -c $< -o $@
@echo "CXX <= $<"

libvmlib.a: ../build/libvmlib.a
@cp $< $@
@echo "CP $@ <= $<"

libextlib.a: ../build/libextlib.a
@cp $< $@
@echo "CP $@ <= $<"

$(Enclave_Name): Enclave/Enclave_t.o $(Enclave_Cpp_Objects) libvmlib.a libextlib.a
@$(CXX) $^ -o $@ $(Enclave_Link_Flags)
@echo "LINK => $@"
Expand Down

0 comments on commit a1444ec

Please # to comment.