From d09b60f563902bd2197d88a3e83b119c09e62428 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 10 Jun 2014 11:30:28 -0400 Subject: VS: Detect compiler id of Nsight Tegra-Android toolchains Teach CMakeDetermineCompilerId to recognize the Tegra-Android platform and generate a test project for Nsight Tegra tools. Locate the full path to CMAKE__COMPILER by computing it within the test project build environment. Also teach CMakeFindBinUtils that this variant of the Visual Studio generator uses UNIX-like instead of MS-like archiving and linking tools. --- Modules/CMakeDetermineCompilerId.cmake | 22 +++++++++-- Modules/CMakeFindBinUtils.cmake | 3 +- Modules/CompilerId/VS-NsightTegra.vcxproj.in | 56 ++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 Modules/CompilerId/VS-NsightTegra.vcxproj.in diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index e00f22a..a7b5760 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -142,7 +142,17 @@ Id flags: ${testflags} set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") set(id_cl cl.exe) - if(lang STREQUAL Fortran) + if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") + set(v NsightTegra) + set(ext vcxproj) + if(lang STREQUAL CXX) + set(id_gcc g++) + set(id_clang clang++) + else() + set(id_gcc gcc) + set(id_clang clang) + endif() + elseif(lang STREQUAL Fortran) set(v Intel) set(ext vfproj) set(id_cl ifort.exe) @@ -161,9 +171,13 @@ Id flags: ${testflags} set(id_platform ia64) endif() if(CMAKE_VS_PLATFORM_TOOLSET) - set(id_toolset "${CMAKE_VS_PLATFORM_TOOLSET}") - if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") - set(id_cl icl.exe) + if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") + set(id_toolset "${CMAKE_VS_PLATFORM_TOOLSET}") + else() + set(id_toolset "${CMAKE_VS_PLATFORM_TOOLSET}") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") + set(id_cl icl.exe) + endif() endif() else() set(id_toolset "") diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index dda28bd..e0ba131 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -35,7 +35,8 @@ if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC" OR "${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "MSVC" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" - OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") + OR ("${CMAKE_GENERATOR}" MATCHES "Visual Studio" + AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")) find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) diff --git a/Modules/CompilerId/VS-NsightTegra.vcxproj.in b/Modules/CompilerId/VS-NsightTegra.vcxproj.in new file mode 100644 index 0000000..b7389eb --- /dev/null +++ b/Modules/CompilerId/VS-NsightTegra.vcxproj.in @@ -0,0 +1,56 @@ + + + + 6 + + + + Debug + @id_platform@ + + + + {CAE07175-D007-4FC3-BFE8-47B392814159} + CompilerId@id_lang@ + + + + StaticLibrary + @id_toolset@ + + + + <_ProjectFileVersion>10.0.30319.1 + .\ + $(Configuration)\ + false + + + + %(PreprocessorDefinitions) + + + + + +if "$(ToolchainName)"=="gcc" ( + for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_gcc@.exe) do ( + @echo CMAKE_@id_lang@_COMPILER=%%i + goto :done + ) +) +if "$(ToolchainName)"=="clang" ( + for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_clang@.exe) do ( + @echo CMAKE_@id_lang@_COMPILER=%%i + goto :done + ) +) +:done + + + + + + + + -- cgit v0.12