From f6f2124d2df2ef0c7e1472c97a5b16f5ce7c0f35 Mon Sep 17 00:00:00 2001 From: Eddy Ashton Date: Mon, 4 Nov 2019 17:25:37 +0000 Subject: [PATCH] Remove "all" target (#513) --- cmake/common.cmake | 12 ++++++------ cmake/crypto.cmake | 4 ++-- cmake/pbft.cmake | 4 ++-- cmake/secp256k1.cmake | 2 +- sphinx/source/quickstart/build.rst | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmake/common.cmake b/cmake/common.cmake index cdb1f97a7ba3..5824f047591d 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -106,7 +106,7 @@ include_directories( ${MSGPACK_INCLUDE_DIR} ) -set(TARGET "all" CACHE STRING "One of sgx, virtual, all") +set(TARGET "sgx" CACHE STRING "One of sgx, virtual, or 'sgx;virtual'") set(OE_PREFIX "/opt/openenclave" CACHE PATH "Path to Open Enclave install") message(STATUS "Open Enclave prefix set to ${OE_PREFIX}") @@ -142,7 +142,7 @@ configure_file(${CCF_DIR}/tests/tests.sh ${CMAKE_CURRENT_BINARY_DIR}/tests.sh CO configure_file(${CCF_DIR}/tests/cimetrics_env.sh ${CMAKE_CURRENT_BINARY_DIR}/cimetrics_env.sh COPYONLY) configure_file(${CCF_DIR}/tests/upload_pico_metrics.py ${CMAKE_CURRENT_BINARY_DIR}/upload_pico_metrics.py COPYONLY) -if(NOT ${TARGET} STREQUAL "virtual") +if("sgx" IN_LIST TARGET) # If OE was built with LINK_SGX=1, then we also need to link SGX execute_process(COMMAND "ldd" ${OESIGN} COMMAND "grep" "-c" "sgx" @@ -349,7 +349,7 @@ function(add_enclave_lib name app_oe_conf_path enclave_sign_key_path) "SRCS;INCLUDE_DIRS;LINK_LIBS" ) - if(NOT ${TARGET} STREQUAL "virtual") + if("sgx" IN_LIST TARGET) add_library(${name} SHARED ${ENCLAVE_FILES} ${PARSED_ARGS_SRCS} @@ -396,7 +396,7 @@ function(add_enclave_lib name app_oe_conf_path enclave_sign_key_path) endif() endif() - if(${TARGET} STREQUAL "virtual" OR ${TARGET} STREQUAL "all") + if("virtual" IN_LIST TARGET) ## Build a virtual enclave, loaded as a shared library without OE set(virt_name ${name}.virtual) add_library(${virt_name} SHARED @@ -480,7 +480,7 @@ target_link_libraries(keygenerator PRIVATE secp256k1.host ) -if(NOT ${TARGET} STREQUAL "virtual") +if("sgx" IN_LIST TARGET) # Host Executable add_executable(cchost ${CCF_DIR}/src/host/main.cpp @@ -507,7 +507,7 @@ if(NOT ${TARGET} STREQUAL "virtual") enable_quote_code(cchost) endif() -if(${TARGET} STREQUAL "virtual" OR ${TARGET} STREQUAL "all") +if("virtual" IN_LIST TARGET) # Virtual Host Executable add_executable(cchost.virtual ${CCF_DIR}/src/host/main.cpp) diff --git a/cmake/crypto.cmake b/cmake/crypto.cmake index 015bc8ddefec..ee3628a51cf8 100644 --- a/cmake/crypto.cmake +++ b/cmake/crypto.cmake @@ -14,7 +14,7 @@ file(GLOB_RECURSE EVERCRYPT_SRC "${EVERCRYPT_PREFIX}/*.[cS]") # We need two versions of EverCrypt, because it depends on libc -if(NOT ${TARGET} STREQUAL "virtual") +if("sgx" IN_LIST TARGET) add_library(evercrypt.enclave STATIC ${EVERCRYPT_SRC}) target_compile_options(evercrypt.enclave PRIVATE -nostdinc -U__linux__ -Wno-everything) target_compile_definitions(evercrypt.enclave PRIVATE INSIDE_ENCLAVE KRML_HOST_PRINTF=oe_printf KRML_HOST_EXIT=oe_abort) @@ -37,7 +37,7 @@ set(CCFCRYPTO_SRC set(CCFCRYPTO_INC ${CCF_DIR}/src/crypto/ ${EVERCRYPT_INC}) -if(NOT ${TARGET} STREQUAL "virtual") +if("sgx" IN_LIST TARGET) add_library(ccfcrypto.enclave STATIC ${CCFCRYPTO_SRC}) target_compile_definitions(ccfcrypto.enclave PRIVATE INSIDE_ENCLAVE diff --git a/cmake/pbft.cmake b/cmake/pbft.cmake index a5ef64b1a0d5..660d787c7693 100644 --- a/cmake/pbft.cmake +++ b/cmake/pbft.cmake @@ -50,7 +50,7 @@ set(PBFT_SRC ${CMAKE_SOURCE_DIR}/src/consensus/pbft/libbyz/Network_open.cpp ) -if(NOT ${TARGET} STREQUAL "virtual") +if("sgx" IN_LIST TARGET) add_library(libbyz.enclave STATIC ${PBFT_SRC}) target_compile_options(libbyz.enclave PRIVATE -nostdinc @@ -78,7 +78,7 @@ add_e2e_test( PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/e2e_logging_pbft.py ) -if(${TARGET} STREQUAL "virtual") +if("virtual" IN_LIST TARGET) add_library(libbyz.host STATIC ${PBFT_SRC}) target_compile_options(libbyz.host PRIVATE -stdlib=libc++) diff --git a/cmake/secp256k1.cmake b/cmake/secp256k1.cmake index cf0eb3432484..173f5da5f856 100644 --- a/cmake/secp256k1.cmake +++ b/cmake/secp256k1.cmake @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the Apache 2.0 License. -if(NOT ${TARGET} STREQUAL "virtual") +if("sgx" IN_LIST TARGET) add_library(secp256k1.enclave STATIC ${CCF_DIR}/3rdparty/secp256k1/src/secp256k1.c) target_include_directories(secp256k1.enclave PUBLIC ${CCF_DIR}/3rdparty/secp256k1) target_compile_options(secp256k1.enclave PRIVATE -fvisibility=hidden -nostdinc -U__linux__ -Wno-everything) diff --git a/sphinx/source/quickstart/build.rst b/sphinx/source/quickstart/build.rst index 770c0b8c7550..8dd69eb74383 100644 --- a/sphinx/source/quickstart/build.rst +++ b/sphinx/source/quickstart/build.rst @@ -48,7 +48,7 @@ The full list of build switches can be obtained by running: * **NO_STRICT_TLS_CIPHERSUITES**: Boolean. Relax the list of accepted TLS ciphersuites. Default to OFF. * **OE_PREFIX**: Path. Open Enclave install prefix. Default to ``/opt/openenclave``. * **SAN**: Boolean. Build unit tests with Address and Undefined behaviour sanitizers enabled. Default to OFF. -* **TARGET**: String, one of ``all``, ``sgx``, ``virtual``. Defaults to ``all``, which builds both "virtual" enclaves and actual SGX enclaves. +* **TARGET**: String, one of ``sgx``, ``virtual``, or ``sgx;virtual``. Defaults to ``sgx;virtual``, which builds both "virtual" enclaves and actual SGX enclaves. * **VERBOSE_LOGGING**: Boolean. Enable all logging levels. Default to OFF. Running Tests