1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-21 23:00:50 +08:00

ADSP: Configure compiler in compiler module

This commit is contained in:
Chris Wright
2022-03-24 09:52:39 +00:00
parent 88b38f531a
commit e9eabb0dcd
6 changed files with 75 additions and 2 deletions

View File

@@ -2,4 +2,6 @@ adsp-platform-and-compilers
--------------------------- ---------------------------
* The ADSP compiler (SHARC and Blackfin) now supports * 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.

View File

@@ -841,15 +841,24 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(ARCHITECTURE_ID) set(ARCHITECTURE_ID)
set(SIMULATE_ID) set(SIMULATE_ID)
set(SIMULATE_VERSION) 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") foreach(encoding "" "ENCODING;UTF-16LE" "ENCODING;UTF-16BE")
file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS
LIMIT_COUNT 38 ${encoding} 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 "") if(NOT CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "")
break() break()
endif() endif()
endforeach() 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 # With the IAR Compiler, some strings are found twice, first time as incomplete
# list like "?<Constant "INFO:compiler[IAR]">". Remove the incomplete copies. # list like "?<Constant "INFO:compiler[IAR]">". Remove the incomplete copies.
list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\?<Constant \\\"") list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\?<Constant \\\"")

View File

@@ -105,6 +105,9 @@
# define PLATFORM_ID "Integrity" # define PLATFORM_ID "Integrity"
# endif # endif
# elif defined(_ADI_COMPILER)
# define PLATFORM_ID "ADSP"
#else /* unknown platform */ #else /* unknown platform */
# define PLATFORM_ID # define PLATFORM_ID
@@ -233,6 +236,12 @@
# define ARCHITECTURE_ID "" # define ARCHITECTURE_ID ""
# endif # endif
# elif defined(__ADSPSHARC__)
# define ARCHITECTURE_ID "SHARC"
# elif defined(__ADSPBLACKFIN__)
# define ARCHITECTURE_ID "Blackfin"
#else #else
# define ARCHITECTURE_ID # define ARCHITECTURE_ID
#endif #endif

View File

@@ -0,0 +1,11 @@
include(Compiler/CMakeCommonCompilerMacros)
include(Compiler/ADSP)
__compiler_adsp(C)
set(CMAKE_C90_STANDARD_COMPILE_OPTION -c89)
set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
__compiler_check_default_language_standard(C 8.0.0.0 99)

View File

@@ -0,0 +1,16 @@
include(Compiler/CMakeCommonCompilerMacros)
include(Compiler/ADSP)
__compiler_adsp(CXX)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -c++)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -g++)
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.3.0.0)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -c++11)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -c++11 -g++)
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
endif()
__compiler_check_default_language_standard(CXX 8.0.0.0 98)

View File

@@ -0,0 +1,26 @@
include_guard()
set(CMAKE_EXECUTABLE_SUFFIX ".dxe")
macro(__compiler_adsp lang)
set(CMAKE_${lang}_OUTPUT_EXTENSION ".doj")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-flags-link" " ")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
set(_CMAKE_${lang}_ADSP_FLAGS "-proc=${CMAKE_SYSTEM_PROCESSOR}")
set(CMAKE_${lang}_COMPILE_OBJECT
"<CMAKE_${lang}_COMPILER> ${_CMAKE_${lang}_ADSP_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
"<CMAKE_${lang}_COMPILER> ${_CMAKE_${lang}_ADSP_FLAGS} -build-lib -o <TARGET> <CMAKE_${lang}_LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_LINK_EXECUTABLE
"<CMAKE_${lang}_COMPILER> ${_CMAKE_${lang}_ADSP_FLAGS} <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
unset(_CMAKE_${lang}_ADSP_FLAGS)
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY)
set(CMAKE_${lang}_CREATE_MODULE_LIBRARY)
endmacro()