From e9eabb0dcdb2fd8084135e02a1ad63047f8ae772 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Thu, 24 Mar 2022 09:52:39 +0000 Subject: ADSP: Configure compiler in compiler module --- Help/release/dev/adsp-platform-and-compilers.rst | 4 +++- Modules/CMakeDetermineCompilerId.cmake | 11 +++++++++- Modules/CMakePlatformId.h.in | 9 ++++++++ Modules/Compiler/ADSP-C.cmake | 11 ++++++++++ Modules/Compiler/ADSP-CXX.cmake | 16 +++++++++++++++ Modules/Compiler/ADSP.cmake | 26 ++++++++++++++++++++++++ 6 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 Modules/Compiler/ADSP-C.cmake create mode 100644 Modules/Compiler/ADSP-CXX.cmake create mode 100644 Modules/Compiler/ADSP.cmake diff --git a/Help/release/dev/adsp-platform-and-compilers.rst b/Help/release/dev/adsp-platform-and-compilers.rst index 0eeda43..3b8ac5a 100644 --- a/Help/release/dev/adsp-platform-and-compilers.rst +++ b/Help/release/dev/adsp-platform-and-compilers.rst @@ -2,4 +2,6 @@ adsp-platform-and-compilers --------------------------- * The ADSP compiler (SHARC and Blackfin) now supports - both CCES and VDSP++ installations. + both CCES and VDSP++ installations, + with required configuration now done in the compiler module itself + rather than the Generic-ADSP platform module. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 0317f34..a90fa5d 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -841,15 +841,24 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(ARCHITECTURE_ID) set(SIMULATE_ID) set(SIMULATE_VERSION) + set(CMAKE_${lang}_COMPILER_ID_STRING_REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]") foreach(encoding "" "ENCODING;UTF-16LE" "ENCODING;UTF-16BE") file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 38 ${encoding} - REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]") + REGEX "${CMAKE_${lang}_COMPILER_ID_STRING_REGEX}") if(NOT CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "") break() endif() endforeach() + # Some ADSP processors result in characters being detected as separate strings + if(CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "") + file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS LENGTH_MAXIMUM 1) + string(REGEX REPLACE ";" "" CMAKE_${lang}_COMPILER_ID_STRING "${CMAKE_${lang}_COMPILER_ID_STRINGS}") + string(REGEX MATCHALL "${CMAKE_${lang}_COMPILER_ID_STRING_REGEX}" + CMAKE_${lang}_COMPILER_ID_STRINGS "${CMAKE_${lang}_COMPILER_ID_STRING}") + endif() + # With the IAR Compiler, some strings are found twice, first time as incomplete # list like "?". Remove the incomplete copies. list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\? ${_CMAKE_${lang}_ADSP_FLAGS} -o -c ") + + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY + " ${_CMAKE_${lang}_ADSP_FLAGS} -build-lib -o ") + + set(CMAKE_${lang}_LINK_EXECUTABLE + " ${_CMAKE_${lang}_ADSP_FLAGS} -o ") + + unset(_CMAKE_${lang}_ADSP_FLAGS) + + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY) + set(CMAKE_${lang}_CREATE_MODULE_LIBRARY) +endmacro() -- cgit v0.12