From 4d42a1a5486505d051f199fcc2dfb63f73ea7275 Mon Sep 17 00:00:00 2001 From: abv Date: Thu, 17 Oct 2013 09:20:30 +0400 Subject: [PATCH] 0024227: Enable SSE2 instructions for OCCT building CMake script changed: SSE2 option is disabled for 64-bit MSVC compilers (redundant) --- CMakeLists.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70cc241074..9764bd591e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,18 +37,24 @@ else() set(SCRIPT_EXT sh) endif() +# set compiler short name and choose SSE2 option for appropriate MSVC compilers if (DEFINED MSVC70) SET(COMPILER vc7) - add_definitions(/arch:SSE2) elseif (DEFINED MSVC80) SET(COMPILER vc8) - add_definitions(/arch:SSE2) + if (${COMPILER_BITNESS} STREQUAL 32) + add_definitions(/arch:SSE2) + endif() elseif (DEFINED MSVC90) SET(COMPILER vc9) - add_definitions(/arch:SSE2) + if (${COMPILER_BITNESS} STREQUAL 32) + add_definitions(/arch:SSE2) + endif() elseif (DEFINED MSVC10) SET(COMPILER vc10) - add_definitions(/arch:SSE2) + if (${COMPILER_BITNESS} STREQUAL 32) + add_definitions(/arch:SSE2) + endif() elseif (DEFINED MSVC11) SET(COMPILER vc11) else() @@ -68,6 +74,7 @@ else() add_definitions(-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H -DLIN) endif() +# enable structured exceptions for MSVC string(REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}") IF(ISFLAG) STRING(REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") @@ -75,13 +82,14 @@ ELSEIF(WIN32) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHa") ENDIF() +# enable parallel compilation on MSVC 9 and above IF(WIN32) IF(NOT DEFINED MSVC70 AND NOT DEFINED MSVC80) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP") ENDIF() ENDIF() -# warning level 4 +# increase compiler warnings level (-W4 for MSVC, -Wall for GCC) IF(MSVC) if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -- 2.20.1