|
|
@@ -52,6 +52,13 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
|
|
|
endforeach()
|
|
|
endif()
|
|
|
|
|
|
+ # If the compiler is still unknown, fallback to GHS
|
|
|
+ if(NOT CMAKE_${lang}_COMPILER_ID AND "${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
|
|
|
+ set(CMAKE_${lang}_COMPILER_ID GHS)
|
|
|
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
|
|
+ "The ${lang} compiler identification is falling back to GHS.\n\n")
|
|
|
+ endif()
|
|
|
+
|
|
|
# CUDA < 7.5 is missing version macros
|
|
|
if(lang STREQUAL "CUDA"
|
|
|
AND CMAKE_${lang}_COMPILER_ID STREQUAL "NVIDIA"
|
|
|
@@ -391,6 +398,40 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
|
|
|
separate_arguments(CMAKE_${lang}_XCODE_ARCHS)
|
|
|
set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_${lang}_XCODE_ARCHS}" PARENT_SCOPE)
|
|
|
endif()
|
|
|
+ elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
|
|
|
+ set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
|
|
|
+ set(id_src "${src}")
|
|
|
+ if (GHS_PRIMARY_TARGET)
|
|
|
+ set(ghs_primary_target "${GHS_PRIMARY_TARGET}")
|
|
|
+ else()
|
|
|
+ set(ghs_primary_target "${CMAKE_GENERATOR_PLATFORM}_${GHS_TARGET_PLATFORM}.tgt")
|
|
|
+ endif()
|
|
|
+ if ("${GHS_TARGET_PLATFORM}" MATCHES "integrity")
|
|
|
+ set(bsp_name "macro GHS_BSP=${GHS_BSP_NAME}")
|
|
|
+ set(os_dir "macro GHS_OS=${GHS_OS_DIR}")
|
|
|
+ endif()
|
|
|
+ set(command "${CMAKE_MAKE_PROGRAM}" "-commands" "-top" "GHS_default.gpj")
|
|
|
+ configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_default.gpj.in
|
|
|
+ ${id_dir}/GHS_default.gpj @ONLY)
|
|
|
+ configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_lib.gpj.in
|
|
|
+ ${id_dir}/GHS_lib.gpj @ONLY)
|
|
|
+ execute_process(COMMAND ${command}
|
|
|
+ WORKING_DIRECTORY ${id_dir}
|
|
|
+ OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
|
|
+ ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
|
|
+ RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
|
|
|
+ )
|
|
|
+ # Match the compiler location line printed out.
|
|
|
+ set(ghs_toolpath "${CMAKE_MAKE_PROGRAM}")
|
|
|
+ string(REPLACE "/gbuild.exe" "/" ghs_toolpath ${ghs_toolpath})
|
|
|
+ string(REPLACE / "\\\\" ghs_toolpath ${ghs_toolpath})
|
|
|
+ if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "(${ghs_toolpath}[^ ]*)")
|
|
|
+ set(_comp "${CMAKE_MATCH_1}.exe")
|
|
|
+ if(EXISTS "${_comp}")
|
|
|
+ file(TO_CMAKE_PATH "${_comp}" _comp)
|
|
|
+ set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
|
|
|
+ endif()
|
|
|
+ endif()
|
|
|
else()
|
|
|
execute_process(
|
|
|
COMMAND "${CMAKE_${lang}_COMPILER}"
|
|
|
@@ -550,7 +591,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
|
|
|
set(ARCHITECTURE_ID "${CMAKE_MATCH_1}")
|
|
|
endif()
|
|
|
if("${info}" MATCHES "INFO:compiler_version\\[([^]\"]*)\\]")
|
|
|
- string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
|
|
|
+ string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
|
|
|
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
|
|
|
endif()
|
|
|
if("${info}" MATCHES "INFO:compiler_version_internal\\[([^]\"]*)\\]")
|
|
|
@@ -602,26 +643,28 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
|
|
|
if(WIN32)
|
|
|
# The offset to the PE signature is stored at 0x3c.
|
|
|
file(READ ${file} peoffsethex LIMIT 1 OFFSET 60 HEX)
|
|
|
- string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1)
|
|
|
- string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2)
|
|
|
- set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}")
|
|
|
- string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}")
|
|
|
- string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}")
|
|
|
- string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}")
|
|
|
- string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}")
|
|
|
- string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}")
|
|
|
- string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}")
|
|
|
- math(EXPR peoffset "${peoffsetexpression}")
|
|
|
-
|
|
|
- file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX)
|
|
|
- if(peheader STREQUAL "50450000a201")
|
|
|
- set(ARCHITECTURE_ID "SH3")
|
|
|
- elseif(peheader STREQUAL "50450000a301")
|
|
|
- set(ARCHITECTURE_ID "SH3DSP")
|
|
|
- elseif(peheader STREQUAL "50450000a601")
|
|
|
- set(ARCHITECTURE_ID "SH4")
|
|
|
- elseif(peheader STREQUAL "50450000a801")
|
|
|
- set(ARCHITECTURE_ID "SH5")
|
|
|
+ if(NOT peoffsethex STREQUAL "")
|
|
|
+ string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1)
|
|
|
+ string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2)
|
|
|
+ set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}")
|
|
|
+ string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}")
|
|
|
+ string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}")
|
|
|
+ string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}")
|
|
|
+ string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}")
|
|
|
+ string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}")
|
|
|
+ string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}")
|
|
|
+ math(EXPR peoffset "${peoffsetexpression}")
|
|
|
+
|
|
|
+ file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX)
|
|
|
+ if(peheader STREQUAL "50450000a201")
|
|
|
+ set(ARCHITECTURE_ID "SH3")
|
|
|
+ elseif(peheader STREQUAL "50450000a301")
|
|
|
+ set(ARCHITECTURE_ID "SH3DSP")
|
|
|
+ elseif(peheader STREQUAL "50450000a601")
|
|
|
+ set(ARCHITECTURE_ID "SH4")
|
|
|
+ elseif(peheader STREQUAL "50450000a801")
|
|
|
+ set(ARCHITECTURE_ID "SH5")
|
|
|
+ endif()
|
|
|
endif()
|
|
|
endif()
|
|
|
|