Skip to content

Commit

Permalink
Custom clang-cl command
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Jul 8, 2024
1 parent bf992e7 commit 39e08d0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
20 changes: 20 additions & 0 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
21 changes: 17 additions & 4 deletions util/build_compilation_database.sh
Original file line number Diff line number Diff line change
@@ -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}"/

0 comments on commit 39e08d0

Please sign in to comment.