patch from Dan Eicher to support intel C++ compiler for CMake on *nix.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 15 Nov 2010 05:32:49 +0000 (05:32 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 15 Nov 2010 05:32:49 +0000 (05:32 +0000)
CMakeLists.txt
source/blender/nodes/intern/CMP_nodes/CMP_defocus.c

index ce1e9d9a03f2d6761bdb0c4ddb8a9e6d8bddce50..85989ee661729b673b0a5e050ff1b2cb4673d75b 100644 (file)
@@ -311,24 +311,58 @@ IF(UNIX AND NOT APPLE)
                SET(BINRELOC_INC ${BINRELOC}/include)
        ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
-       IF(WITH_OPENMP)
-               LIST(APPEND LLIBS -lgomp)
-               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
-               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
-       ENDIF(WITH_OPENMP)
-
        SET(PLATFORM_LINKFLAGS "-pthread")
 
        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE")
        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE")
 
+       # GNU Compiler
        IF(CMAKE_COMPILER_IS_GNUCC)
+               IF(WITH_OPENMP)
+                       LIST(APPEND LLIBS -lgomp)
+                       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
+                       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
+               ENDIF(WITH_OPENMP)
+
                SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
        
                # Better warnings
                # note: -Wunused-parameter is added below for all GCC compilers
                SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
                SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
+
+       # Intel C++ Compiler
+       ELSEIF(CMAKE_C_COMPILER_ID MATCHES "Intel")
+               IF(WITH_OPENMP)
+                       LIST(APPEND LLIBS -lgomp)
+                       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -openmp")
+                       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -openmp")
+               ENDIF(WITH_OPENMP)
+
+               # think these next two are broken
+               FIND_PROGRAM(XIAR xiar) 
+               IF(XIAR) 
+                       SET(CMAKE_AR "${XIAR}")
+               ENDIF(XIAR) 
+               MARK_AS_ADVANCED(XIAR)
+
+               FIND_PROGRAM(XILD xild) 
+               IF(XILD) 
+                       SET(CMAKE_LINKER "${XILD}")
+               ENDIF(XILD) 
+               MARK_AS_ADVANCED(XILD)
+
+               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -prec_div -parallel")
+               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -prec_div -parallel")
+
+               SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
+
+               # SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -diag-enable sc3")
+
+               SET(C_WARNINGS "-Wall -Wpointer-arith -Wno-unknown-pragmas")
+               SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
+
+               SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
        ENDIF(CMAKE_COMPILER_IS_GNUCC)
 ENDIF(UNIX AND NOT APPLE)
 
index 5c25bffa5d98e80ba2f3622fd89a97a9680a2cc8..a18ae13b438943becbf53d878bb65214d5a3d7e4 100644 (file)
@@ -378,7 +378,11 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
 
        //------------------------------------------------------------------
        // main loop
+#ifdef __INTEL_COMPILER /* icc doesn't like the compound statement -- internal error: 0_1506 */
+       #pragma omp parallel for private(y) if(!nqd->preview) schedule(guided)
+#else
        #pragma omp parallel for private(y) if(!nqd->preview && img->y*img->x > 16384) schedule(guided)
+#endif
        for (y=0; y<img->y; y++) {
                unsigned int p, p4, zp, cp, cp4;
                float *ctcol, u, v, ct_crad, cR2=0;