- check IF WIN32 AND NOT UNIX (for cygwin)
authorCampbell Barton <ideasman42@gmail.com>
Sun, 21 Nov 2010 13:41:43 +0000 (13:41 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 21 Nov 2010 13:41:43 +0000 (13:41 +0000)
- patch from Mike S to enable OpenMP and xcode

CMakeLists.txt
build_files/cmake/macros.cmake
intern/ghost/CMakeLists.txt
intern/guardedalloc/CMakeLists.txt
source/blender/blenfont/CMakeLists.txt
source/blender/makesdna/intern/CMakeLists.txt
source/blenderplayer/CMakeLists.txt
source/creator/CMakeLists.txt

index 0dc0a0b..b50d49d 100644 (file)
@@ -96,9 +96,9 @@ OPTION(WITH_IMAGE_HDR           "Enable HDR Image Support" ON)
 # Audio format support
 OPTION(WITH_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
 OPTION(WITH_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
-IF(APPLE OR WIN32)
+IF(APPLE OR (WIN32 AND NOT UNIX))
        OPTION(WITH_QUICKTIME     "Enable Quicktime Support" OFF)
-ENDIF(APPLE OR WIN32)
+ENDIF(APPLE OR (WIN32 AND NOT UNIX))
 
 # 3D format support
 # disable opencollada on non-apple unix because opencollada has no package for debian
@@ -352,10 +352,8 @@ IF(UNIX AND NOT APPLE)
 
                SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
        ENDIF(CMAKE_COMPILER_IS_GNUCC)
-ENDIF(UNIX AND NOT APPLE)
-
 
-IF(WIN32)
+ELSEIF(WIN32)
 
        # this file is included anyway when building under Windows with cl.exe
        #  INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
@@ -670,10 +668,8 @@ IF(WIN32)
        # used in many places so include globally, like OpenGL
        INCLUDE_DIRECTORIES(${PTHREADS_INC})
 
-ENDIF(WIN32)
+ELSEIF(APPLE)
 
-
-IF(APPLE)
        IF(WITH_LIBS10.5)
                SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
        ELSE(WITH_LIBS10.5)
@@ -861,7 +857,7 @@ IF(APPLE)
        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")
 
-ENDIF(APPLE)
+ENDIF(UNIX AND NOT APPLE)
 
 
 # buildinfo
@@ -935,6 +931,10 @@ IF(WITH_OPENMP)
        IF(OPENMP_FOUND)
                SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+
+               IF(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode")
+                       SET(CMAKE_XCODE_ATTRIBUTE_ENABLE_OPENMP_SUPPORT "YES")
+               ENDIF(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode")
        ELSE(OPENMP_FOUND)
                SET(WITH_OPENMP OFF)
        ENDIF(OPENMP_FOUND)
index 3392398..0da1d6c 100644 (file)
@@ -100,9 +100,9 @@ MACRO(SETUP_LIBDIRS)
                LINK_DIRECTORIES(${EXPAT_LIBPATH})
        ENDIF(WITH_OPENCOLLADA)
 
-       IF(WIN32)
+       IF(WIN32 AND NOT UNIX)
                LINK_DIRECTORIES(${PTHREADS_LIBPATH})
-       ENDIF(WIN32)
+       ENDIF(WIN32 AND NOT UNIX)
 ENDMACRO(SETUP_LIBDIRS)
 
 MACRO(SETUP_LIBLINKS
@@ -115,12 +115,12 @@ MACRO(SETUP_LIBLINKS
        IF(WITH_PYTHON)
                TARGET_LINK_LIBRARIES(${target} ${PYTHON_LINKFLAGS})
 
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
                        TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
-               ELSE(WIN32)
+               ELSE(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_PYTHON)
 
        TARGET_LINK_LIBRARIES(${target} ${OPENGL_glu_LIBRARY} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB})
@@ -129,9 +129,9 @@ MACRO(SETUP_LIBLINKS
        IF(WITH_INTERNATIONAL)
                TARGET_LINK_LIBRARIES(${target} ${GETTEXT_LIB})
 
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} ${ICONV_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_INTERNATIONAL)
 
        IF(WITH_OPENAL)
@@ -156,14 +156,14 @@ MACRO(SETUP_LIBLINKS
                TARGET_LINK_LIBRARIES(${target} ${TIFF_LIBRARY})
        ENDIF(WITH_IMAGE_TIFF)
        IF(WITH_IMAGE_OPENEXR)
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        FOREACH(loop_var ${OPENEXR_LIB})
                                TARGET_LINK_LIBRARIES(${target} debug ${loop_var}_d)
                                TARGET_LINK_LIBRARIES(${target} optimized ${loop_var})
                        ENDFOREACH(loop_var)
-               ELSE(WIN32)
+               ELSE(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} ${OPENEXR_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_IMAGE_OPENEXR)
        IF(WITH_LCMS)
                TARGET_LINK_LIBRARIES(${target} ${LCMS_LIBRARY})
@@ -172,7 +172,7 @@ MACRO(SETUP_LIBLINKS
                TARGET_LINK_LIBRARIES(${target} ${FFMPEG_LIB})
        ENDIF(WITH_FFMPEG)
        IF(WITH_OPENCOLLADA)
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        FOREACH(loop_var ${OPENCOLLADA_LIB})
                                TARGET_LINK_LIBRARIES(${target} debug ${loop_var}_d)
                                TARGET_LINK_LIBRARIES(${target} optimized ${loop_var})
@@ -183,21 +183,21 @@ MACRO(SETUP_LIBLINKS
                                TARGET_LINK_LIBRARIES(${target} debug ${EXPAT_LIB}_d)
                                TARGET_LINK_LIBRARIES(${target} optimized ${EXPAT_LIB})
                        ENDIF(EXPAT_LIB)
-               ELSE(WIN32)
+               ELSE(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} ${OPENCOLLADA_LIB})
                        TARGET_LINK_LIBRARIES(${target} ${PCRE_LIB})
                        TARGET_LINK_LIBRARIES(${target} ${EXPAT_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_OPENCOLLADA)
        IF(WITH_LCMS)
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} debug ${LCMS_LIB}_d)
                        TARGET_LINK_LIBRARIES(${target} optimized ${LCMS_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_LCMS)
-       IF(WIN32)
+       IF(WIN32 AND NOT UNIX)
                TARGET_LINK_LIBRARIES(${target} ${PTHREADS_LIB})
-       ENDIF(WIN32)
+       ENDIF(WIN32 AND NOT UNIX)
 ENDMACRO(SETUP_LIBLINKS)
 
 MACRO(TEST_SSE_SUPPORT)
index cd3bbd0..8319772 100644 (file)
@@ -68,16 +68,7 @@ IF(APPLE)
        IF(WITH_QUICKTIME)
                ADD_DEFINITIONS(-DWITH_QUICKTIME)
        ENDIF(WITH_QUICKTIME)
-ELSEIF(WIN32)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
-       LIST(APPEND INC ${WINTAB_INC})
 
-       LIST(APPEND SRC
-               ./intern/GHOST_DisplayManagerWin32.cpp
-               ./intern/GHOST_SystemWin32.cpp
-               ./intern/GHOST_WindowWin32.cpp
-               ./intern/GHOST_DropTargetWin32.cpp
-       )
 ELSEIF(UNIX)
        LIST(APPEND INC ${X11_X11_INCLUDE_PATH})
 
@@ -89,6 +80,18 @@ ELSEIF(UNIX)
 
        ADD_DEFINITIONS(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
 
+ELSEIF(WIN32)
+       IF(MSVC)
+               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
+               LIST(APPEND INC ${WINTAB_INC})
+       ENDIF(MSVC)
+
+       LIST(APPEND SRC
+               ./intern/GHOST_DisplayManagerWin32.cpp
+               ./intern/GHOST_SystemWin32.cpp
+               ./intern/GHOST_WindowWin32.cpp
+               ./intern/GHOST_DropTargetWin32.cpp
+       )
 ENDIF(APPLE)
 
 BLENDERLIB(bf_intern_ghost "${SRC}" "${INC}")
index 29e4f55..10c16e4 100644 (file)
@@ -30,9 +30,9 @@ SET(SRC
        ./intern/mallocn.c
 )
 
-IF(WIN32)
+IF(WIN32 AND NOT UNIX)
        LIST(APPEND SRC ./intern/mmap_win.c)
-ENDIF(WIN32)
+ENDIF(WIN32 AND NOT UNIX)
 
 BLENDERLIB(bf_intern_guardedalloc "${SRC}" "${INC}")
 
index f6afa31..131ff86 100644 (file)
@@ -47,9 +47,9 @@ IF(WITH_INTERNATIONAL)
        ADD_DEFINITIONS(-DINTERNATIONAL)
 ENDIF(WITH_INTERNATIONAL)
 
-IF(WIN32)
-       ADD_DEFINITIONS(-D_WIN32 -DUSE_GETTEXT_DLL)
-ENDIF(WIN32)
+IF(WIN32 AND NOT UNIX)
+       ADD_DEFINITIONS(-DUSE_GETTEXT_DLL)
+ENDIF(WIN32 AND NOT UNIX)
 
 BLENDERLIB(bf_blenfont "${SRC}" "${INC}")
 
index d42289e..61a6778 100644 (file)
@@ -33,9 +33,9 @@ SET(SRC
        ../../../../intern/guardedalloc/intern/mallocn.c
 )
 
-IF(WIN32)
+IF(WIN32 AND NOT UNIX)
        LIST(APPEND SRC ../../../../intern/guardedalloc/intern/mmap_win.c)
-ENDIF(WIN32)
+ENDIF(WIN32 AND NOT UNIX)
 
 ADD_EXECUTABLE(makesdna ${SRC} ${INC_FILES})
 
index ada6285..d1aee8c 100644 (file)
@@ -43,11 +43,11 @@ ADD_CUSTOM_COMMAND(
        DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
 )
 
-IF(WIN32)
+IF(WIN32 AND NOT UNIX)
        ADD_EXECUTABLE(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
-ELSE(WIN32)
+ELSE(WIN32 AND NOT UNIX)
        ADD_EXECUTABLE(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
-ENDIF(WIN32)
+ENDIF(WIN32 AND NOT UNIX)
 
 ADD_DEPENDENCIES(blenderplayer makesdna)
 
index 5e33976..bd86872 100644 (file)
@@ -42,10 +42,6 @@ INCLUDE_DIRECTORIES(
        ../blender/windowmanager
 )
 
-IF(WIN32)
-       INCLUDE_DIRECTORIES(${PTHREADS_INC})
-ENDIF(WIN32)
-
 IF(WITH_QUICKTIME)
        ADD_DEFINITIONS(-DWITH_QUICKTIME)
 ENDIF(WITH_QUICKTIME)
@@ -96,9 +92,9 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 # Setup the exe sources and buildinfo
 SET(EXESRC creator.c)
 
-IF(WIN32)
+IF(WIN32 AND NOT UNIX)
        LIST(APPEND EXESRC ../icons/winblender.rc)
-ENDIF(WIN32)
+ENDIF(WIN32 AND NOT UNIX)
 
 IF(WITH_BUILDINFO)
        STRING(REPLACE " " "\ " BUILDINFO_CFLAGS ${CMAKE_C_FLAGS})
@@ -254,53 +250,7 @@ IF(WITH_INSTALL)
                
                # end "make install"
        
-       ENDIF(UNIX AND NOT APPLE)
-
-       IF(APPLE)
-               SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
-               SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
-               SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
-
-               ADD_CUSTOM_COMMAND(
-                       TARGET blender POST_BUILD MAIN_DEPENDENCY blender
-                       COMMAND cp -Rf ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
-                       COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
-                       COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
-                       COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
-                       COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
-                       COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
-                       COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
-                       COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
-               )
-         
-               IF(WITH_INTERNATIONAL)
-                       ADD_CUSTOM_COMMAND(
-                               TARGET blender POST_BUILD MAIN_DEPENDENCY blender
-                               COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
-                               COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
-                       )
-               ENDIF(WITH_INTERNATIONAL)
-         
-               IF(WITH_PYTHON)
-                       SET(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
-                       ADD_CUSTOM_COMMAND(
-                               TARGET blender POST_BUILD MAIN_DEPENDENCY blender
-                               COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/
-                               COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
-                               COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
-                               COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;"
-                       )
-               ENDIF(WITH_PYTHON)        
-       
-               ADD_CUSTOM_COMMAND(
-                       TARGET blender POST_BUILD MAIN_DEPENDENCY blender       
-                       COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
-                       COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
-                                       COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
-               )
-       ENDIF(APPLE)
-
-       IF(WIN32)
+       ELSEIF(WIN32)
                # notice 'xcopy /Y /H' on .bfont.ttf, this is needed when building over samba
                ADD_CUSTOM_COMMAND(TARGET blender
                        POST_BUILD
@@ -451,7 +401,50 @@ IF(WITH_INSTALL)
                        ENDIF(NOT CMAKE_CL_64)
                ENDIF(WITH_SDL)
 
-       ENDIF(WIN32)
+       ELSEIF(APPLE)
+               SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
+               SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
+               SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
+
+               ADD_CUSTOM_COMMAND(
+                       TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+                       COMMAND cp -Rf ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
+                       COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
+                       COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
+                       COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
+                       COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
+                       COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
+                       COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
+                       COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
+               )
+         
+               IF(WITH_INTERNATIONAL)
+                       ADD_CUSTOM_COMMAND(
+                               TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+                               COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
+                               COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
+                       )
+               ENDIF(WITH_INTERNATIONAL)
+         
+               IF(WITH_PYTHON)
+                       SET(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
+                       ADD_CUSTOM_COMMAND(
+                               TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+                               COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/
+                               COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
+                               COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
+                               COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;"
+                       )
+               ENDIF(WITH_PYTHON)        
+       
+               ADD_CUSTOM_COMMAND(
+                       TARGET blender POST_BUILD MAIN_DEPENDENCY blender       
+                       COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
+                       COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
+                                       COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
+               )
+       ENDIF(UNIX AND NOT APPLE)
+
 ENDIF(WITH_INSTALL)
 
 ADD_DEPENDENCIES(blender makesdna)