diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index d7590a214f..169a4e4445 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -183,6 +183,26 @@ if(ARCH STREQUAL "aarch64") test/trampoline-armv8.${ASM_EXT} cipher_extra/chacha20_poly1305_armv8.${ASM_EXT} ) + if(MSVC) + foreach(ASM_FILE ${CRYPTO_ARCH_SOURCES}) + get_filename_component(ASM_NAME ${ASM_FILE} NAME_WE) + set(OBJ_FILE "${CMAKE_CURRENT_BINARY_DIR}/${ASM_NAME}.obj") + # message(FATAL_ERROR "${CMAKE_ASM_COMPILER} /I ${PROJECT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/${ASM_FILE}") + add_custom_command( + OUTPUT ${OBJ_FILE} + COMMAND "${CMAKE_ASM_COMPILER}" --target=arm64-pc-windows-msvc /c /I "${PROJECT_SOURCE_DIR}/include" "${ASM_FILE}" + DEPENDS ${ASM_FILE} + COMMENT "Assembling ${CMAKE_ASM_COMPILER} /I ${PROJECT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/${ASM_FILE}" + ) + set_source_files_properties(${ASM_FILE} PROPERTIES OBJECT_OUTPUTS ${OBJ_FILE}) + list(APPEND CRYPTO_ARCH_OBJ_FILES ${OBJ_FILE}) + endforeach() + set( + CRYPTO_ARCH_SOURCES + + ${CRYPTO_ARCH_OBJ_FILES} + ) + endif() endif() if(ARCH STREQUAL "ppc64le") diff --git a/util/build_compilation_database.sh b/util/build_compilation_database.sh index 2cf9b48c08..64d9673d2b 100755 --- a/util/build_compilation_database.sh +++ b/util/build_compilation_database.sh @@ -1,19 +1,32 @@ #!/usr/bin/env bash -set -ex +set -e BASE_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}/" )/.." &> /dev/null && pwd ) TMP_DIR=`mktemp -d` echo ${TMP_DIR} AWS_LC_BUILD="${TMP_DIR}/AWS-LC-BUILD" +AWS_LC_INSTALL=${TMP_DIR}/AWS-LC-INSTALL + +for arg in "$@"; do + if [[ "$arg" == -G* ]]; then + echo + echo "################" + echo "#### WARNING: Currently CMake only supports compilation database creation using the Ninja and Makefile generators: $arg" + echo "################" + echo + fi +done -MY_CMAKE_FLAGS=("-GNinja" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON") +MY_CMAKE_FLAGS=("-GNinja" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" "-DCMAKE_INSTALL_PREFIX=${AWS_LC_INSTALL}") + +set -ex mkdir -p "${AWS_LC_BUILD}" +mkdir -p "${AWS_LC_INSTALL}" cmake "${BASE_DIR}" -B "${AWS_LC_BUILD}" ${MY_CMAKE_FLAGS[@]} "${@}" - -cmake --build "${AWS_LC_BUILD}" --target all +cmake --build "${AWS_LC_BUILD}" --target install cp "${AWS_LC_BUILD}"/compile_commands.json "${BASE_DIR}"/