0024227: Enable SS2 instructions for OCCT building
[occt.git] / CMakeLists.txt
index f765036..e2ad451 100644 (file)
@@ -13,16 +13,13 @@ set_property(GLOBAL PROPERTY 3RDPARTY_USE_FOLDERS ON)
 
 set(BUILD_SHARED_LIBS ON)
 
-IF("${BUILD_TYPE}" STREQUAL "${CMAKE_BUILD_TYPE}" AND "${BUILD_BITNESS}" STREQUAL "${BUILD_BITNESS1}")
+IF("${BUILD_TYPE}" STREQUAL "${CMAKE_BUILD_TYPE}")
   SET(CHANGES_ARE_NEEDED OFF)
 ELSE()
   SET(CHANGES_ARE_NEEDED ON)
 ENDIF()
 
-set(BUILD_BITNESS 32 CACHE STRING "Bitness of the OCCT project")
-SET_PROPERTY(CACHE BUILD_BITNESS PROPERTY STRINGS 32 64)
-
-SET(BUILD_BITNESS1 ${BUILD_BITNESS} CACHE INTERNAL "Temporary bitness is created to check whether change 3rdparty paths or not" FORCE)
+MATH(EXPR COMPILER_BITNESS "32 + 32*(${CMAKE_SIZEOF_VOID_P}/8)")
 
 SET( CMAKE_BUILD_TYPE ${BUILD_TYPE} CACHE INTERNAL "Build type of the OCCT" FORCE )
 
@@ -54,7 +51,7 @@ else()
   SET(COMPILER ${CMAKE_GENERATOR})
 endif()
 
-if (${BUILD_BITNESS} STREQUAL 64)
+if (${COMPILER_BITNESS} STREQUAL 64)
   add_definitions(-D_OCC64)
 endif()
 
@@ -80,7 +77,10 @@ IF(WIN32)
   ENDIF()
 ENDIF()
 
-# set warning level 4
+# sse2
+add_definitions(/arch:SSE2)
+
+# warning level 4
 IF(MSVC)
   if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
     string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@@ -135,9 +135,9 @@ ENDFUNCTION()
 FUNCTION(FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
   string( TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME )
   
-  LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*${COMPILER}.*${BUILD_BITNESS}")
-  LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER}.*${BUILD_BITNESS}")
-  LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${BUILD_BITNESS}")
+  LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*${COMPILER}.*${COMPILER_BITNESS}")
+  LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
+  LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER_BITNESS}")
   LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+")
   LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}")
   
@@ -356,7 +356,7 @@ ENDIF()
 IF (3RDPARTY_USE_TBB)
   ADD_DEFINITIONS(-DHAVE_TBB)
 
-  IF(${BUILD_BITNESS} STREQUAL 32)
+  IF(${COMPILER_BITNESS} STREQUAL 32)
     SET (TBB_ARCH_NAME ia32)
   ELSE()
     SET (TBB_ARCH_NAME intel64)