diff options
author | Narayan Kamath <narayan@google.com> | 2012-11-02 10:59:05 +0000 |
---|---|---|
committer | Xiaotao Duan <xiaotao@google.com> | 2012-11-07 14:17:48 -0800 |
commit | c981c48f5bc9aefeffc0bcb0cc3934c2fae179dd (patch) | |
tree | 54d1c7d66098154c1d7c5bd414394ef4cf255810 /cmake/CMakeDetermineVSServicePack.cmake | |
parent | 63f67d748682b46d58be31235a0a2d64d81b998c (diff) | |
download | eigen-jb-mr1.1-release.tar.gz |
Initial import of eigen 3.1.1android-cts-4.4_r4android-cts-4.2_r2android-4.4_r1.2.0.1android-4.4_r1.2android-4.4_r1.1.0.1android-4.4_r1.1android-4.4_r1.0.1android-4.4_r1android-4.4_r0.9android-4.4_r0.8android-4.3_r2.3android-4.3_r2.2android-4.3_r2.1android-4.3_r2android-4.3_r1.1android-4.3_r1android-4.3_r0.9.1android-4.3_r0.9android-4.2.2_r1.2android-4.2.2_r1.1android-4.2.2_r1kitkat-releasekitkat-cts-releasejb-mr2.0-releasejb-mr2-releasejb-mr1.1-releasejb-mr1.1-dev
Added a README.android and a MODULE_LICENSE_MPL2 file.
Added empty Android.mk and CleanSpec.mk to optimize Android build.
Non MPL2 license code is disabled in ./Eigen/src/Core/util/NonMPL2.h.
Trying to include such files will lead to an error.
Change-Id: I0e148b7c3e83999bcc4dfaa5809d33bfac2aac32
Diffstat (limited to 'cmake/CMakeDetermineVSServicePack.cmake')
-rw-r--r-- | cmake/CMakeDetermineVSServicePack.cmake | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/cmake/CMakeDetermineVSServicePack.cmake b/cmake/CMakeDetermineVSServicePack.cmake new file mode 100644 index 000000000..b89462308 --- /dev/null +++ b/cmake/CMakeDetermineVSServicePack.cmake @@ -0,0 +1,103 @@ +# - Includes a public function for assisting users in trying to determine the +# Visual Studio service pack in use. +# +# Sets the passed in variable to one of the following values or an empty +# string if unknown. +# vc80 +# vc80sp1 +# vc90 +# vc90sp1 +# +# Usage: +# =========================== +# +# if(MSVC) +# include(CMakeDetermineVSServicePack) +# DetermineVSServicePack( my_service_pack ) +# +# if( my_service_pack ) +# message(STATUS "Detected: ${my_service_pack}") +# endif() +# endif() +# +# =========================== + +#============================================================================= +# Copyright 2009-2010 Kitware, Inc. +# Copyright 2009-2010 Philip Lowman <philip@yhbt.com> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# [INTERNAL] +# Please do not call this function directly +function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) + if (${_cl_version} VERSION_EQUAL "14.00.50727.42") + set(_version "vc80") + elseif(${_cl_version} VERSION_EQUAL "14.00.50727.762") + set(_version "vc80sp1") + elseif(${_cl_version} VERSION_EQUAL "15.00.21022.08") + set(_version "vc90") + elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01") + set(_version "vc90sp1") + elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01") + set(_version "vc100") + else() + set(_version "") + endif() + set(${_OUT_VAR} ${_version} PARENT_SCOPE) +endfunction() + +# +# A function to call to determine the Visual Studio service pack +# in use. See documentation above. +function(DetermineVSServicePack _pack) + if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack}) + if(${CMAKE_BUILD_TOOL} STREQUAL "nmake") + EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} "/?" + ERROR_VARIABLE _output) + set(DETERMINED_VS_SERVICE_PACK ${_output}) + else() + file(WRITE "${CMAKE_BINARY_DIR}/return0.cc" + "int main() { return 0; }\n") + + try_compile(DETERMINED_VS_SERVICE_PACK + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}/return0.cc" + OUTPUT_VARIABLE _output + COPY_FILE "${CMAKE_BINARY_DIR}/return0.cc") + + file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc") + endif() + + if(DETERMINED_VS_SERVICE_PACK AND _output) + string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" + _cl_version "${_output}") + if(_cl_version) + string(REGEX MATCHALL "[0-9]+" + _cl_version_list "${_cl_version}") + list(GET _cl_version_list 0 _major) + list(GET _cl_version_list 1 _minor) + list(GET _cl_version_list 2 _patch) + list(GET _cl_version_list 3 _tweak) + + set(_cl_version_string ${_major}.${_minor}.${_patch}.${_tweak}) + + # Call helper function to determine VS version + _DetermineVSServicePackFromCompiler(_sp "${_cl_version_string}") + if(_sp) + #set(${_pack} "${_sp}(${_cl_version_string})" CACHE INTERNAL + set(${_pack} "${_sp}" CACHE INTERNAL + "The Visual Studio Release with Service Pack") + endif() + endif() + endif() + endif() +endfunction() |